Version 1.17.0-dev.6.0
Merge commit 'e3f5760f6647bdb54d11819c5087087a823a4f8a' into dev
diff --git a/pkg/analysis_server/lib/src/status/get_handler.dart b/pkg/analysis_server/lib/src/status/get_handler.dart
index 5b3f6de..fccb189 100644
--- a/pkg/analysis_server/lib/src/status/get_handler.dart
+++ b/pkg/analysis_server/lib/src/status/get_handler.dart
@@ -760,6 +760,20 @@
"right"
]);
buffer.write('</table>');
+
+ Map<ResultDescriptor, int> recomputedCounts =
+ CacheEntry.recomputedCounts;
+ List<ResultDescriptor> descriptors = recomputedCounts.keys.toList();
+ descriptors.sort(ResultDescriptor.SORT_BY_NAME);
+ buffer.write('<p><b>Results computed after being flushed</b></p>');
+ buffer.write(
+ '<table style="border-collapse: separate; border-spacing: 10px 5px;">');
+ _writeRow(buffer, ['Result', 'Count'], header: true);
+ for (ResultDescriptor descriptor in descriptors) {
+ _writeRow(buffer, [descriptor.name, recomputedCounts[descriptor]],
+ classes: [null, "right"]);
+ }
+ buffer.write('</table>');
}, (StringBuffer buffer) {
//
// Write task model timing information.
@@ -986,8 +1000,7 @@
SOURCE_QUERY_PARAM: sourceUri
};
List<ResultDescriptor> results = _getExpectedResults(entry);
- results.sort((ResultDescriptor first, ResultDescriptor second) =>
- first.toString().compareTo(second.toString()));
+ results.sort(ResultDescriptor.SORT_BY_NAME);
buffer.write('<h3>');
buffer.write(HTML_ESCAPE.convert(entry.target.toString()));
diff --git a/pkg/analyzer/lib/src/context/cache.dart b/pkg/analyzer/lib/src/context/cache.dart
index 36df855..ae79615 100644
--- a/pkg/analyzer/lib/src/context/cache.dart
+++ b/pkg/analyzer/lib/src/context/cache.dart
@@ -286,6 +286,13 @@
static int nextInvalidateId = 0;
/**
+ * A table containing the number of times the value of a result descriptor was
+ * recomputed after having been flushed.
+ */
+ static final Map<ResultDescriptor, int> recomputedCounts =
+ new HashMap<ResultDescriptor, int>();
+
+ /**
* The target this entry is about.
*/
final AnalysisTarget target;
@@ -530,6 +537,10 @@
}
ResultData data = getResultData(descriptor);
_setDependedOnResults(data, thisResult, dependedOn);
+ if (data.state == CacheState.FLUSHED) {
+ int count = recomputedCounts[descriptor] ?? 0;
+ recomputedCounts[descriptor] = count + 1;
+ }
data.state = CacheState.VALID;
data.value = value ?? descriptor.defaultValue;
}
diff --git a/pkg/analyzer/lib/src/dart/element/builder.dart b/pkg/analyzer/lib/src/dart/element/builder.dart
index 08de907..fb59f7b 100644
--- a/pkg/analyzer/lib/src/dart/element/builder.dart
+++ b/pkg/analyzer/lib/src/dart/element/builder.dart
@@ -1303,7 +1303,7 @@
int count = fields.length;
for (int i = 0; i < count; i++) {
FieldElement field = fields[i];
- _fieldMap[field.name] = field;
+ _fieldMap[field.name] ??= field;
}
}
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 78d0f5f..5e72951 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -1682,6 +1682,9 @@
ElementKind get kind => ElementKind.CONSTRUCTOR;
@override
+ DartType get returnType => enclosingElement.type;
+
+ @override
accept(ElementVisitor visitor) => visitor.visitConstructorElement(this);
@override
@@ -1798,6 +1801,32 @@
*/
DefaultFieldFormalParameterElementImpl.forNode(Identifier name)
: super.forNode(name);
+
+ /**
+ * Initialize using the given serialized information.
+ */
+ DefaultFieldFormalParameterElementImpl.forSerialized(
+ UnlinkedParam unlinkedParam, ElementImpl enclosingElement)
+ : super.forSerialized(unlinkedParam, enclosingElement);
+
+ @override
+ Expression get constantInitializer {
+ if (_unlinkedParam != null) {
+ UnlinkedConst defaultValue = _unlinkedParam.initializer?.bodyExpr;
+ if (defaultValue == null) {
+ return null;
+ }
+ return super.constantInitializer ??= enclosingUnit.resynthesizerContext
+ .buildExpression(this, defaultValue);
+ }
+ return super.constantInitializer;
+ }
+
+ @override
+ void set constantInitializer(Expression initializer) {
+ assert(_unlinkedParam == null);
+ super.constantInitializer = initializer;
+ }
}
/**
@@ -1827,7 +1856,7 @@
@override
Expression get constantInitializer {
if (_unlinkedParam != null) {
- UnlinkedConst defaultValue = _unlinkedParam.defaultValue;
+ UnlinkedConst defaultValue = _unlinkedParam.initializer?.bodyExpr;
if (defaultValue == null) {
return null;
}
@@ -2780,7 +2809,7 @@
/**
* The return type defined by this executable element.
*/
- DartType returnType;
+ DartType _returnType;
/**
* The type of function defined by this executable element.
@@ -3014,6 +3043,26 @@
}
@override
+ DartType get returnType {
+ if (serializedExecutable != null && _returnType == null) {
+ bool isSetter =
+ serializedExecutable.kind == UnlinkedExecutableKind.setter;
+ _returnType = enclosingUnit.resynthesizerContext.resolveLinkedType(
+ serializedExecutable.inferredReturnTypeSlot,
+ typeParameterContext) ??
+ enclosingUnit.resynthesizerContext.resolveTypeRef(
+ serializedExecutable.returnType, typeParameterContext,
+ defaultVoid: isSetter && context.analysisOptions.strongMode);
+ }
+ return _returnType;
+ }
+
+ void set returnType(DartType returnType) {
+ assert(serializedExecutable == null);
+ _returnType = returnType;
+ }
+
+ @override
TypeParameterizedElementMixin get typeParameterContext => this;
@override
@@ -3338,7 +3387,7 @@
/**
* The field associated with this field formal parameter.
*/
- FieldElement field;
+ FieldElement _field;
/**
* Initialize a newly created parameter element to have the given [name] and
@@ -3353,10 +3402,47 @@
FieldFormalParameterElementImpl.forNode(Identifier name)
: super.forNode(name);
+ /**
+ * Initialize using the given serialized information.
+ */
+ FieldFormalParameterElementImpl.forSerialized(
+ UnlinkedParam unlinkedParam, ElementImpl enclosingElement)
+ : super.forSerialized(unlinkedParam, enclosingElement);
+
+ @override
+ FieldElement get field {
+ if (_unlinkedParam != null && _field == null) {
+ Element enclosingClass = enclosingElement?.enclosingElement;
+ if (enclosingClass is ClassElement) {
+ _field = enclosingClass.getField(_unlinkedParam.name);
+ }
+ }
+ return _field;
+ }
+
+ void set field(FieldElement field) {
+ assert(_unlinkedParam == null);
+ _field = field;
+ }
+
@override
bool get isInitializingFormal => true;
@override
+ DartType get type {
+ if (_unlinkedParam != null && _unlinkedParam.type == null) {
+ _type ??= field?.type ?? DynamicTypeImpl.instance;
+ }
+ return super.type;
+ }
+
+ @override
+ void set type(DartType type) {
+ assert(_unlinkedParam == null);
+ _type = type;
+ }
+
+ @override
accept(ElementVisitor visitor) =>
visitor.visitFieldFormalParameterElement(this);
}
@@ -3506,6 +3592,50 @@
}
/**
+ * Implementation of [FunctionElementImpl] for a function typed parameter.
+ */
+class FunctionElementImpl_forFunctionTypedParameter
+ extends FunctionElementImpl {
+ @override
+ final CompilationUnitElementImpl enclosingUnit;
+
+ /**
+ * The enclosing function typed [ParameterElementImpl].
+ */
+ final ParameterElementImpl _parameter;
+
+ FunctionElementImpl_forFunctionTypedParameter(
+ this.enclosingUnit, this._parameter)
+ : super('', -1);
+
+ @override
+ TypeParameterizedElementMixin get enclosingTypeParameterContext =>
+ _parameter.typeParameterContext;
+
+ @override
+ bool get isSynthetic => true;
+}
+
+/**
+ * Implementation of [FunctionElementImpl] for a synthetic function element
+ * that was synthesized by a LUB computation.
+ */
+class FunctionElementImpl_forLUB extends FunctionElementImpl {
+ @override
+ final CompilationUnitElementImpl enclosingUnit;
+
+ @override
+ final TypeParameterizedElementMixin enclosingTypeParameterContext;
+
+ FunctionElementImpl_forLUB(
+ this.enclosingUnit, this.enclosingTypeParameterContext)
+ : super('', -1);
+
+ @override
+ bool get isSynthetic => true;
+}
+
+/**
* A concrete implementation of a [FunctionTypeAliasElement].
*/
class FunctionTypeAliasElementImpl extends ElementImpl
@@ -3524,7 +3654,7 @@
/**
* The return type defined by this type alias.
*/
- DartType returnType;
+ DartType _returnType;
/**
* The type of function defined by this type alias.
@@ -3655,6 +3785,20 @@
}
@override
+ DartType get returnType {
+ if (_unlinkedTypedef != null && _returnType == null) {
+ _returnType = enclosingUnit.resynthesizerContext
+ .resolveTypeRef(_unlinkedTypedef.returnType, this);
+ }
+ return _returnType;
+ }
+
+ void set returnType(DartType returnType) {
+ assert(_unlinkedTypedef == null);
+ _returnType = returnType;
+ }
+
+ @override
TypeParameterizedElementMixin get typeParameterContext => this;
@override
@@ -5671,7 +5815,7 @@
/**
* The kind of this parameter.
*/
- ParameterKind parameterKind;
+ ParameterKind _parameterKind;
/**
* The Dart code of the default value.
@@ -5748,7 +5892,7 @@
@override
String get defaultValueCode {
if (_unlinkedParam != null) {
- if (_unlinkedParam.defaultValue == null) {
+ if (_unlinkedParam.initializer?.bodyExpr == null) {
return null;
}
return _unlinkedParam.defaultValueCode;
@@ -5841,6 +5985,29 @@
}
@override
+ ParameterKind get parameterKind {
+ if (_unlinkedParam != null && _parameterKind == null) {
+ switch (_unlinkedParam.kind) {
+ case UnlinkedParamKind.named:
+ _parameterKind = ParameterKind.NAMED;
+ break;
+ case UnlinkedParamKind.positional:
+ _parameterKind = ParameterKind.POSITIONAL;
+ break;
+ case UnlinkedParamKind.required:
+ _parameterKind = ParameterKind.REQUIRED;
+ break;
+ }
+ }
+ return _parameterKind;
+ }
+
+ void set parameterKind(ParameterKind parameterKind) {
+ assert(_unlinkedParam == null);
+ _parameterKind = parameterKind;
+ }
+
+ @override
List<ParameterElement> get parameters => _parameters;
/**
@@ -5855,6 +6022,17 @@
}
@override
+ DartType get type {
+ if (_unlinkedParam != null && _type == null) {
+ _type = enclosingUnit.resynthesizerContext.resolveLinkedType(
+ _unlinkedParam.inferredTypeSlot, typeParameterContext) ??
+ enclosingUnit.resynthesizerContext
+ .resolveTypeRef(_unlinkedParam.type, typeParameterContext);
+ }
+ return super.type;
+ }
+
+ @override
List<TypeParameterElement> get typeParameters => _typeParameters;
/**
@@ -6294,6 +6472,13 @@
UnitExplicitTopLevelVariables buildTopLevelVariables();
/**
+ * Build the appropriate [DartType] object corresponding to a slot id in the
+ * [LinkedUnit.types] table.
+ */
+ DartType resolveLinkedType(
+ int slot, TypeParameterizedElementMixin typeParameterContext);
+
+ /**
* Resolve an [EntityRef] into a type. If the reference is
* unresolved, return [DynamicTypeImpl.instance].
*
@@ -6777,7 +6962,7 @@
/**
* The declared type of this variable.
*/
- DartType type;
+ DartType _type;
/**
* A synthetic function representing this variable's initializer, or `null` if
@@ -6896,6 +7081,13 @@
bool get isStatic => hasModifier(Modifier.STATIC);
@override
+ DartType get type => _type;
+
+ void set type(DartType type) {
+ _type = type;
+ }
+
+ @override
void appendTo(StringBuffer buffer) {
buffer.write(type);
buffer.write(" ");
diff --git a/pkg/analyzer/lib/src/summary/format.dart b/pkg/analyzer/lib/src/summary/format.dart
index 7a60450..701b10e 100644
--- a/pkg/analyzer/lib/src/summary/format.dart
+++ b/pkg/analyzer/lib/src/summary/format.dart
@@ -5925,7 +5925,6 @@
List<UnlinkedConstBuilder> _annotations;
CodeRangeBuilder _codeRange;
- UnlinkedConstBuilder _defaultValue;
String _defaultValueCode;
int _inferredTypeSlot;
UnlinkedExecutableBuilder _initializer;
@@ -5962,19 +5961,6 @@
}
@override
- UnlinkedConstBuilder get defaultValue => _defaultValue;
-
- /**
- * If the parameter has a default value, the constant expression in the
- * default value. Note that the presence of this expression does not mean
- * that it is a valid, check [UnlinkedConst.isInvalid].
- */
- void set defaultValue(UnlinkedConstBuilder _value) {
- assert(!_finished);
- _defaultValue = _value;
- }
-
- @override
String get defaultValueCode => _defaultValueCode ??= '';
/**
@@ -6123,10 +6109,9 @@
_visibleOffset = _value;
}
- UnlinkedParamBuilder({List<UnlinkedConstBuilder> annotations, CodeRangeBuilder codeRange, UnlinkedConstBuilder defaultValue, String defaultValueCode, int inferredTypeSlot, UnlinkedExecutableBuilder initializer, bool isFunctionTyped, bool isInitializingFormal, idl.UnlinkedParamKind kind, String name, int nameOffset, List<UnlinkedParamBuilder> parameters, EntityRefBuilder type, int visibleLength, int visibleOffset})
+ UnlinkedParamBuilder({List<UnlinkedConstBuilder> annotations, CodeRangeBuilder codeRange, String defaultValueCode, int inferredTypeSlot, UnlinkedExecutableBuilder initializer, bool isFunctionTyped, bool isInitializingFormal, idl.UnlinkedParamKind kind, String name, int nameOffset, List<UnlinkedParamBuilder> parameters, EntityRefBuilder type, int visibleLength, int visibleOffset})
: _annotations = annotations,
_codeRange = codeRange,
- _defaultValue = defaultValue,
_defaultValueCode = defaultValueCode,
_inferredTypeSlot = inferredTypeSlot,
_initializer = initializer,
@@ -6146,7 +6131,6 @@
void flushInformative() {
_annotations?.forEach((b) => b.flushInformative());
_codeRange = null;
- _defaultValue?.flushInformative();
_defaultValueCode = null;
_initializer?.flushInformative();
_nameOffset = null;
@@ -6159,7 +6143,6 @@
_finished = true;
fb.Offset offset_annotations;
fb.Offset offset_codeRange;
- fb.Offset offset_defaultValue;
fb.Offset offset_defaultValueCode;
fb.Offset offset_initializer;
fb.Offset offset_name;
@@ -6171,9 +6154,6 @@
if (_codeRange != null) {
offset_codeRange = _codeRange.finish(fbBuilder);
}
- if (_defaultValue != null) {
- offset_defaultValue = _defaultValue.finish(fbBuilder);
- }
if (_defaultValueCode != null) {
offset_defaultValueCode = fbBuilder.writeString(_defaultValueCode);
}
@@ -6194,10 +6174,7 @@
fbBuilder.addOffset(9, offset_annotations);
}
if (offset_codeRange != null) {
- fbBuilder.addOffset(14, offset_codeRange);
- }
- if (offset_defaultValue != null) {
- fbBuilder.addOffset(7, offset_defaultValue);
+ fbBuilder.addOffset(7, offset_codeRange);
}
if (offset_defaultValueCode != null) {
fbBuilder.addOffset(13, offset_defaultValueCode);
@@ -6254,7 +6231,6 @@
List<idl.UnlinkedConst> _annotations;
idl.CodeRange _codeRange;
- idl.UnlinkedConst _defaultValue;
String _defaultValueCode;
int _inferredTypeSlot;
idl.UnlinkedExecutable _initializer;
@@ -6276,17 +6252,11 @@
@override
idl.CodeRange get codeRange {
- _codeRange ??= const _CodeRangeReader().vTableGet(_bc, _bcOffset, 14, null);
+ _codeRange ??= const _CodeRangeReader().vTableGet(_bc, _bcOffset, 7, null);
return _codeRange;
}
@override
- idl.UnlinkedConst get defaultValue {
- _defaultValue ??= const _UnlinkedConstReader().vTableGet(_bc, _bcOffset, 7, null);
- return _defaultValue;
- }
-
- @override
String get defaultValueCode {
_defaultValueCode ??= const fb.StringReader().vTableGet(_bc, _bcOffset, 13, '');
return _defaultValueCode;
@@ -6365,7 +6335,6 @@
Map<String, Object> _result = <String, Object>{};
if (annotations.isNotEmpty) _result["annotations"] = annotations.map((_value) => _value.toJson()).toList();
if (codeRange != null) _result["codeRange"] = codeRange.toJson();
- if (defaultValue != null) _result["defaultValue"] = defaultValue.toJson();
if (defaultValueCode != '') _result["defaultValueCode"] = defaultValueCode;
if (inferredTypeSlot != 0) _result["inferredTypeSlot"] = inferredTypeSlot;
if (initializer != null) _result["initializer"] = initializer.toJson();
@@ -6385,7 +6354,6 @@
Map<String, Object> toMap() => {
"annotations": annotations,
"codeRange": codeRange,
- "defaultValue": defaultValue,
"defaultValueCode": defaultValueCode,
"inferredTypeSlot": inferredTypeSlot,
"initializer": initializer,
diff --git a/pkg/analyzer/lib/src/summary/format.fbs b/pkg/analyzer/lib/src/summary/format.fbs
index 92accd5..26c6256 100644
--- a/pkg/analyzer/lib/src/summary/format.fbs
+++ b/pkg/analyzer/lib/src/summary/format.fbs
@@ -284,10 +284,10 @@
pushNull,
/**
- * Push the value of the constant constructor parameter with
- * the name obtained from [UnlinkedConst.strings].
+ * Push the value of the function parameter with the name obtained from
+ * [UnlinkedConst.strings].
*/
- pushConstructorParameter,
+ pushParameter,
/**
* Evaluate a (potentially qualified) identifier expression and push the
@@ -1921,14 +1921,7 @@
/**
* Code range of the parameter.
*/
- codeRange:CodeRange (id: 14);
-
- /**
- * If the parameter has a default value, the constant expression in the
- * default value. Note that the presence of this expression does not mean
- * that it is a valid, check [UnlinkedConst.isInvalid].
- */
- defaultValue:UnlinkedConst (id: 7);
+ codeRange:CodeRange (id: 7);
/**
* If the parameter has a default value, the source text of the constant
diff --git a/pkg/analyzer/lib/src/summary/idl.dart b/pkg/analyzer/lib/src/summary/idl.dart
index de2ef57..7f2fe39 100644
--- a/pkg/analyzer/lib/src/summary/idl.dart
+++ b/pkg/analyzer/lib/src/summary/idl.dart
@@ -1124,10 +1124,10 @@
pushNull,
/**
- * Push the value of the constant constructor parameter with
- * the name obtained from [UnlinkedConst.strings].
+ * Push the value of the function parameter with the name obtained from
+ * [UnlinkedConst.strings].
*/
- pushConstructorParameter,
+ pushParameter,
/**
* Evaluate a (potentially qualified) identifier expression and push the
@@ -2149,16 +2149,8 @@
* Code range of the parameter.
*/
@informative
- @Id(14)
- CodeRange get codeRange;
-
- /**
- * If the parameter has a default value, the constant expression in the
- * default value. Note that the presence of this expression does not mean
- * that it is a valid, check [UnlinkedConst.isInvalid].
- */
@Id(7)
- UnlinkedConst get defaultValue;
+ CodeRange get codeRange;
/**
* If the parameter has a default value, the source text of the constant
diff --git a/pkg/analyzer/lib/src/summary/link.dart b/pkg/analyzer/lib/src/summary/link.dart
index ef54267..77c86f2 100644
--- a/pkg/analyzer/lib/src/summary/link.dart
+++ b/pkg/analyzer/lib/src/summary/link.dart
@@ -1541,7 +1541,7 @@
List<ConstNode> dependencies = <ConstNode>[];
collectDependencies(
dependencies,
- parameterElement._unlinkedParam.defaultValue,
+ parameterElement._unlinkedParam.initializer?.bodyExpr,
parameterElement.compilationUnit);
return dependencies;
}
@@ -3688,7 +3688,7 @@
ParameterElementForLink(this.enclosingElement, this._unlinkedParam,
this._typeParameterContext, this.compilationUnit, this._parameterIndex) {
- if (_unlinkedParam.defaultValue != null) {
+ if (_unlinkedParam.initializer?.bodyExpr != null) {
_constNode = new ConstParameterNode(this);
}
}
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index d0d4819..298c20d 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -468,7 +468,7 @@
case UnlinkedConstOperation.invokeConstructor:
_pushInstanceCreation();
break;
- case UnlinkedConstOperation.pushConstructorParameter:
+ case UnlinkedConstOperation.pushParameter:
String name = uc.strings[stringPtr++];
SimpleIdentifier identifier = AstFactory.identifier3(name);
identifier.staticElement = resynthesizer.currentConstructor.parameters
@@ -1546,6 +1546,12 @@
}
@override
+ DartType resolveLinkedType(
+ int slot, TypeParameterizedElementMixin typeParameterContext) {
+ return _unitResynthesizer.buildLinkedType(slot, typeParameterContext);
+ }
+
+ @override
DartType resolveTypeRef(
EntityRef type, TypeParameterizedElementMixin typeParameterContext,
{bool defaultVoid: false, bool instantiateToBoundsAllowed: true}) {
@@ -1873,7 +1879,6 @@
currentConstructor.periodOffset = serializedExecutable.periodOffset;
}
constructors[serializedExecutable.name] = currentConstructor;
- currentConstructor.returnType = classElement.type;
buildExecutableCommonParts(currentConstructor, serializedExecutable);
currentConstructor.constantInitializers = serializedExecutable
.constantInitializers
@@ -2101,19 +2106,6 @@
executableElement.parameters = parameters;
}
}
- if (serializedExecutable.kind == UnlinkedExecutableKind.constructor) {
- // Caller handles setting the return type.
- assert(serializedExecutable.returnType == null);
- } else {
- bool isSetter =
- serializedExecutable.kind == UnlinkedExecutableKind.setter;
- executableElement.returnType = buildLinkedType(
- serializedExecutable.inferredReturnTypeSlot,
- _currentTypeParameterizedElement) ??
- buildType(
- serializedExecutable.returnType, _currentTypeParameterizedElement,
- defaultVoid: isSetter && summaryResynthesizer.strongMode);
- }
executableElement.type = new FunctionTypeImpl.elementWithNameAndArgs(
executableElement, null, getCurrentTypeArguments(skipLevels: 1), false);
{
@@ -2320,49 +2312,32 @@
UnlinkedParam serializedParameter, ElementImpl enclosingElement,
{bool synthetic: false}) {
ParameterElementImpl parameterElement;
- bool isLazilyResynthesized = false;
- int nameOffset = synthetic ? -1 : serializedParameter.nameOffset;
if (serializedParameter.isInitializingFormal) {
- FieldFormalParameterElementImpl initializingParameter;
if (serializedParameter.kind == UnlinkedParamKind.required) {
- initializingParameter = new FieldFormalParameterElementImpl(
- serializedParameter.name, nameOffset);
+ parameterElement = new FieldFormalParameterElementImpl.forSerialized(
+ serializedParameter, enclosingElement);
} else {
- DefaultFieldFormalParameterElementImpl defaultParameter =
- new DefaultFieldFormalParameterElementImpl(
- serializedParameter.name, nameOffset);
- initializingParameter = defaultParameter;
- if (serializedParameter.defaultValue != null) {
- defaultParameter.constantInitializer = _buildConstExpression(
- enclosingElement, serializedParameter.defaultValue);
- defaultParameter.defaultValueCode =
- serializedParameter.defaultValueCode;
- }
+ parameterElement =
+ new DefaultFieldFormalParameterElementImpl.forSerialized(
+ serializedParameter, enclosingElement);
}
- parameterElement = initializingParameter;
- initializingParameter.field = fields[serializedParameter.name];
} else {
if (serializedParameter.kind == UnlinkedParamKind.required) {
parameterElement = new ParameterElementImpl.forSerialized(
serializedParameter, enclosingElement);
- isLazilyResynthesized = true;
} else {
- DefaultParameterElementImpl defaultParameter =
- new DefaultParameterElementImpl.forSerialized(
- serializedParameter, enclosingElement);
- isLazilyResynthesized = true;
- parameterElement = defaultParameter;
+ parameterElement = new DefaultParameterElementImpl.forSerialized(
+ serializedParameter, enclosingElement);
}
}
parameterElement.synthetic = synthetic;
- if (!isLazilyResynthesized) {
- buildAnnotations(parameterElement, serializedParameter.annotations);
- buildCodeRange(parameterElement, serializedParameter.codeRange);
- }
if (serializedParameter.isFunctionTyped) {
FunctionElementImpl parameterTypeElement =
- new FunctionElementImpl('', -1);
- parameterTypeElement.synthetic = true;
+ new FunctionElementImpl_forFunctionTypedParameter(
+ unit, parameterElement);
+ if (!synthetic) {
+ parameterTypeElement.enclosingElement = parameterElement;
+ }
List<ParameterElement> subParameters = serializedParameter.parameters
.map((UnlinkedParam p) =>
buildParameter(p, parameterTypeElement, synthetic: synthetic))
@@ -2372,48 +2347,14 @@
} else {
parameterElement.parameters = subParameters;
parameterTypeElement.shareParameters(subParameters);
- parameterTypeElement.enclosingElement = parameterElement;
}
parameterTypeElement.returnType =
buildType(serializedParameter.type, _currentTypeParameterizedElement);
parameterElement.type = new FunctionTypeImpl.elementWithNameAndArgs(
parameterTypeElement, null, getCurrentTypeArguments(), false);
parameterTypeElement.type = parameterElement.type;
- } else {
- if (serializedParameter.isInitializingFormal &&
- serializedParameter.type == null) {
- // The type is inherited from the matching field.
- parameterElement.type =
- fields[serializedParameter.name]?.type ?? DynamicTypeImpl.instance;
- } else {
- parameterElement.type = buildLinkedType(
- serializedParameter.inferredTypeSlot,
- _currentTypeParameterizedElement) ??
- buildType(
- serializedParameter.type, _currentTypeParameterizedElement);
- }
- if (!isLazilyResynthesized) {
- parameterElement.hasImplicitType = serializedParameter.type == null;
- }
}
buildVariableInitializer(parameterElement, serializedParameter.initializer);
- switch (serializedParameter.kind) {
- case UnlinkedParamKind.named:
- parameterElement.parameterKind = ParameterKind.NAMED;
- break;
- case UnlinkedParamKind.positional:
- parameterElement.parameterKind = ParameterKind.POSITIONAL;
- break;
- case UnlinkedParamKind.required:
- parameterElement.parameterKind = ParameterKind.REQUIRED;
- break;
- }
- if (!isLazilyResynthesized) {
- if (serializedParameter.visibleOffset != 0) {
- parameterElement.setVisibleRange(serializedParameter.visibleOffset,
- serializedParameter.visibleLength);
- }
- }
return parameterElement;
}
@@ -2462,8 +2403,8 @@
if (type.paramReference != 0) {
return typeParameterContext.getTypeParameterType(type.paramReference);
} else if (type.syntheticReturnType != null) {
- FunctionElementImpl element = new FunctionElementImpl('', -1);
- element.synthetic = true;
+ FunctionElementImpl element =
+ new FunctionElementImpl_forLUB(unit, typeParameterContext);
element.parameters = type.syntheticParams
.map((UnlinkedParam param) =>
buildParameter(param, element, synthetic: true))
@@ -2503,8 +2444,6 @@
functionTypeAliasElement.parameters = serializedTypedef.parameters
.map((p) => buildParameter(p, functionTypeAliasElement))
.toList();
- functionTypeAliasElement.returnType =
- buildType(serializedTypedef.returnType, functionTypeAliasElement);
functionTypeAliasElement.type =
new FunctionTypeImpl.forTypedef(functionTypeAliasElement);
unitHolder.addTypeAlias(functionTypeAliasElement);
@@ -2676,8 +2615,8 @@
void buildVariableCommonParts(
VariableElementImpl element, UnlinkedVariable serializedVariable) {
element.type = buildLinkedType(serializedVariable.inferredTypeSlot,
- _currentTypeParameterizedElement) ??
- buildType(serializedVariable.type, _currentTypeParameterizedElement);
+ element.typeParameterContext) ??
+ buildType(serializedVariable.type, element.typeParameterContext);
buildVariableInitializer(element, serializedVariable.initializer);
}
diff --git a/pkg/analyzer/lib/src/summary/summarize_ast.dart b/pkg/analyzer/lib/src/summary/summarize_ast.dart
index 7c359c3..c2a625b 100644
--- a/pkg/analyzer/lib/src/summary/summarize_ast.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_ast.dart
@@ -37,17 +37,17 @@
final Map<int, int> localClosureIndexMap;
/**
- * If a constructor initializer expression is being serialized, the names of
- * the constructor parameters. Otherwise `null`.
+ * If the expression being serialized appears inside a function body, the names
+ * of parameters that are in scope. Otherwise `null`.
*/
- final Set<String> constructorParameterNames;
+ final Set<String> parameterNames;
_ConstExprSerializer(
- this.visitor, this.localClosureIndexMap, this.constructorParameterNames);
+ this.visitor, this.localClosureIndexMap, this.parameterNames);
@override
- bool isConstructorParameterName(String name) {
- return constructorParameterNames?.contains(name) ?? false;
+ bool isParameterName(String name) {
+ return parameterNames?.contains(name) ?? false;
}
@override
@@ -346,6 +346,19 @@
Map<int, int> _localClosureIndexMap;
/**
+ * Indicates whether closure function bodies should be serialized. This flag
+ * is set while visiting the bodies of initializer expressions that will be
+ * needed by type inference.
+ */
+ bool _serializeClosureBodyExprs = false;
+
+ /**
+ * If a closure function body is being serialized, the set of closure
+ * parameter names which are currently in scope. Otherwise `null`.
+ */
+ Set<String> _parameterNames;
+
+ /**
* Create a slot id for storing a propagated or inferred type or const cycle
* info.
*/
@@ -522,9 +535,9 @@
*/
UnlinkedConstBuilder serializeConstExpr(
Map<int, int> localClosureIndexMap, Expression expression,
- [Set<String> constructorParameterNames]) {
- _ConstExprSerializer serializer = new _ConstExprSerializer(
- this, localClosureIndexMap, constructorParameterNames);
+ [Set<String> parameterNames]) {
+ _ConstExprSerializer serializer =
+ new _ConstExprSerializer(this, localClosureIndexMap, parameterNames);
serializer.serialize(expression);
return serializer.toBuilder();
}
@@ -580,6 +593,9 @@
/**
* Serialize a [FunctionDeclaration] or [MethodDeclaration] into an
* [UnlinkedExecutable].
+ *
+ * If [serializeBodyExpr] is `true`, then the function definition is stored
+ * in [UnlinkedExecutableBuilder.bodyExpr].
*/
UnlinkedExecutableBuilder serializeExecutable(
AstNode node,
@@ -595,7 +611,8 @@
Comment documentationComment,
NodeList<Annotation> annotations,
TypeParameterList typeParameters,
- bool isExternal) {
+ bool isExternal,
+ bool serializeBodyExpr) {
int oldScopesLength = scopes.length;
_TypeParameterScope typeParameterScope = new _TypeParameterScope();
scopes.add(typeParameterScope);
@@ -643,7 +660,15 @@
}
b.visibleOffset = enclosingBlock?.offset;
b.visibleLength = enclosingBlock?.length;
- serializeFunctionBody(b, null, body);
+ Set<String> oldParameterNames = _parameterNames;
+ if (formalParameters != null && formalParameters.parameters.isNotEmpty) {
+ _parameterNames =
+ _parameterNames == null ? new Set<String>() : _parameterNames.toSet();
+ _parameterNames.addAll(formalParameters.parameters
+ .map((FormalParameter p) => p.identifier.name));
+ }
+ serializeFunctionBody(b, null, body, serializeBodyExpr);
+ _parameterNames = oldParameterNames;
scopes.removeLast();
assert(scopes.length == oldScopesLength);
return b;
@@ -656,9 +681,20 @@
*
* If [initializers] is non-`null`, closures occurring inside the initializers
* are serialized first.
+ *
+ * If [serializeBodyExpr] is `true`, then the function definition is stored
+ * in [UnlinkedExecutableBuilder.bodyExpr], and closures occurring inside
+ * [initializers] and [body] have their function bodies serialized as well.
+ *
+ * The return value is a map whose keys are the offsets of local function
+ * nodes representing closures inside [initializers] and [body], and whose
+ * values are the indices of those local functions relative to their siblings.
*/
- void serializeFunctionBody(UnlinkedExecutableBuilder b,
- List<ConstructorInitializer> initializers, AstNode body) {
+ Map<int, int> serializeFunctionBody(
+ UnlinkedExecutableBuilder b,
+ List<ConstructorInitializer> initializers,
+ AstNode body,
+ bool serializeBodyExpr) {
if (body is BlockFunctionBody || body is ExpressionFunctionBody) {
for (UnlinkedParamBuilder parameter in b.parameters) {
parameter.visibleOffset = body.offset;
@@ -668,21 +704,40 @@
List<UnlinkedExecutableBuilder> oldExecutables = executables;
List<UnlinkedLabelBuilder> oldLabels = labels;
List<UnlinkedVariableBuilder> oldVariables = variables;
+ Map<int, int> oldLocalClosureIndexMap = _localClosureIndexMap;
+ bool oldSerializeClosureBodyExprs = _serializeClosureBodyExprs;
executables = <UnlinkedExecutableBuilder>[];
labels = <UnlinkedLabelBuilder>[];
variables = <UnlinkedVariableBuilder>[];
+ _localClosureIndexMap = <int, int>{};
+ _serializeClosureBodyExprs = serializeBodyExpr;
if (initializers != null) {
for (ConstructorInitializer initializer in initializers) {
initializer.accept(this);
}
}
body.accept(this);
+ if (serializeBodyExpr) {
+ if (body is Expression) {
+ b.bodyExpr =
+ serializeConstExpr(_localClosureIndexMap, body, _parameterNames);
+ } else if (body is ExpressionFunctionBody) {
+ b.bodyExpr = serializeConstExpr(
+ _localClosureIndexMap, body.expression, _parameterNames);
+ } else {
+ // TODO(paulberry): serialize other types of function bodies.
+ }
+ }
b.localFunctions = executables;
b.localLabels = labels;
b.localVariables = variables;
+ Map<int, int> localClosureIndexMap = _localClosureIndexMap;
executables = oldExecutables;
labels = oldLabels;
variables = oldVariables;
+ _localClosureIndexMap = oldLocalClosureIndexMap;
+ _serializeClosureBodyExprs = oldSerializeClosureBodyExprs;
+ return localClosureIndexMap;
}
/**
@@ -703,15 +758,18 @@
/**
* If the given [expression] is not `null`, serialize it as an
* [UnlinkedExecutableBuilder], otherwise return `null`.
+ *
+ * If [serializeBodyExpr] is `true`, then the initializer expression is stored
+ * in [UnlinkedExecutableBuilder.bodyExpr].
*/
UnlinkedExecutableBuilder serializeInitializerFunction(
- Expression expression) {
+ Expression expression, bool serializeBodyExpr) {
if (expression == null) {
return null;
}
UnlinkedExecutableBuilder initializer =
new UnlinkedExecutableBuilder(nameOffset: expression.offset);
- serializeFunctionBody(initializer, null, expression);
+ serializeFunctionBody(initializer, null, expression, serializeBodyExpr);
initializer.inferredReturnTypeSlot = assignSlot();
return initializer;
}
@@ -893,18 +951,11 @@
b.documentationComment = serializeDocumentation(documentationComment);
b.annotations = serializeAnnotations(annotations);
b.codeRange = serializeCodeRange(variables.parent);
- Map<int, int> localClosureIndexMap = _withLocalClosureIndexMap(() {
- b.initializer = serializeInitializerFunction(variable.initializer);
- });
- if (variable.isConst ||
+ bool serializeBodyExpr = variable.isConst ||
variable.isFinal && isField && !isDeclaredStatic ||
- variables.type == null) {
- Expression initializer = variable.initializer;
- if (initializer != null) {
- b.initializer.bodyExpr =
- serializeConstExpr(localClosureIndexMap, initializer);
- }
- }
+ variables.type == null;
+ b.initializer =
+ serializeInitializerFunction(variable.initializer, serializeBodyExpr);
if (variable.initializer != null &&
(variables.isFinal || variables.isConst)) {
b.propagatedTypeSlot = assignSlot();
@@ -1023,9 +1074,8 @@
b.documentationComment = serializeDocumentation(node.documentationComment);
b.annotations = serializeAnnotations(node.metadata);
b.codeRange = serializeCodeRange(node);
- Map<int, int> localClosureIndexMap = _withLocalClosureIndexMap(() {
- serializeFunctionBody(b, node.initializers, node.body);
- });
+ Map<int, int> localClosureIndexMap = serializeFunctionBody(
+ b, node.initializers, node.body, node.constKeyword != null);
if (node.constKeyword != null) {
Set<String> constructorParameterNames =
node.parameters.parameters.map((p) => p.identifier.name).toSet();
@@ -1044,15 +1094,10 @@
UnlinkedParamBuilder visitDefaultFormalParameter(
DefaultFormalParameter node) {
UnlinkedParamBuilder b = node.parameter.accept(this);
+ b.initializer = serializeInitializerFunction(node.defaultValue, true);
if (node.defaultValue != null) {
- // Closures can't appear inside default values, so we don't need a
- // localClosureIndexMap.
- Map<int, int> localClosureIndexMap = null;
- b.defaultValue =
- serializeConstExpr(localClosureIndexMap, node.defaultValue);
b.defaultValueCode = node.defaultValue.toSource();
}
- b.initializer = serializeInitializerFunction(node.defaultValue);
b.codeRange = serializeCodeRange(node);
return b;
}
@@ -1146,7 +1191,8 @@
node.documentationComment,
node.metadata,
node.functionExpression.typeParameters,
- node.externalKeyword != null));
+ node.externalKeyword != null,
+ false));
}
@override
@@ -1169,7 +1215,8 @@
null,
null,
node.typeParameters,
- false));
+ false,
+ _serializeClosureBodyExprs));
}
}
@@ -1268,7 +1315,8 @@
node.documentationComment,
node.metadata,
node.typeParameters,
- node.externalKeyword != null));
+ node.externalKeyword != null,
+ false));
}
@override
@@ -1317,21 +1365,6 @@
}
/**
- * Execute [callback], gathering any local closures in
- * [_localClosureIndexMap], and return the resulting map.
- *
- * Properly handles cases where one closure is nested within another.
- */
- Map<int, int> _withLocalClosureIndexMap(void callback()) {
- Map<int, int> prevLocalClosureIndexMap = _localClosureIndexMap;
- _localClosureIndexMap = <int, int>{};
- callback();
- Map<int, int> localClosureIndexMap = _localClosureIndexMap;
- _localClosureIndexMap = prevLocalClosureIndexMap;
- return localClosureIndexMap;
- }
-
- /**
* Helper method to determine if a given [typeName] refers to `dynamic`.
*/
static bool isDynamic(TypeName typeName) {
diff --git a/pkg/analyzer/lib/src/summary/summarize_const_expr.dart b/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
index f8f6aab..8be5f21 100644
--- a/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
@@ -102,10 +102,9 @@
final List<EntityRefBuilder> references = <EntityRefBuilder>[];
/**
- * Return `true` if a constructor initializer expression is being serialized
- * and the given [name] is a constructor parameter reference.
+ * Return `true` if the given [name] is a parameter reference.
*/
- bool isConstructorParameterName(String name);
+ bool isParameterName(String name);
/**
* Serialize the given [expr] expression into this serializer state.
@@ -267,9 +266,9 @@
} else if (expr is NullLiteral) {
operations.add(UnlinkedConstOperation.pushNull);
} else if (expr is Identifier) {
- if (expr is SimpleIdentifier && isConstructorParameterName(expr.name)) {
+ if (expr is SimpleIdentifier && isParameterName(expr.name)) {
strings.add(expr.name);
- operations.add(UnlinkedConstOperation.pushConstructorParameter);
+ operations.add(UnlinkedConstOperation.pushParameter);
} else {
references.add(serializeIdentifier(expr));
operations.add(UnlinkedConstOperation.pushReference);
diff --git a/pkg/analyzer/lib/src/summary/summarize_elements.dart b/pkg/analyzer/lib/src/summary/summarize_elements.dart
index 432d414..98e3de4 100644
--- a/pkg/analyzer/lib/src/summary/summarize_elements.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_elements.dart
@@ -919,21 +919,21 @@
b.type = serializeTypeRef(type, context);
}
}
+ // TODO(scheglov) VariableMember.initializer is not implemented
+ if (parameter is! VariableMember && parameter.initializer != null) {
+ b.initializer = serializeExecutable(parameter.initializer);
+ }
if (parameter is ConstVariableElement) {
ConstVariableElement constParameter = parameter as ConstVariableElement;
Expression initializer = constParameter.constantInitializer;
if (initializer != null) {
- b.defaultValue = serializeConstExpr(
+ b.initializer?.bodyExpr = serializeConstExpr(
parameter,
parameter.getAncestor((Element e) => e is ExecutableElement),
initializer);
b.defaultValueCode = parameter.defaultValueCode;
}
}
- // TODO(scheglov) VariableMember.initializer is not implemented
- if (parameter is! VariableMember && parameter.initializer != null) {
- b.initializer = serializeExecutable(parameter.initializer);
- }
{
SourceRange visibleRange = parameter.visibleRange;
if (visibleRange != null) {
@@ -1310,7 +1310,7 @@
this.constructorParameterNames);
@override
- bool isConstructorParameterName(String name) {
+ bool isParameterName(String name) {
return constructorParameterNames?.contains(name) ?? false;
}
diff --git a/pkg/analyzer/lib/task/model.dart b/pkg/analyzer/lib/task/model.dart
index 557a763..dd1062f 100644
--- a/pkg/analyzer/lib/task/model.dart
+++ b/pkg/analyzer/lib/task/model.dart
@@ -457,6 +457,13 @@
*/
abstract class ResultDescriptor<V> {
/**
+ * A comparator that can be used to sort result descriptors by their name.
+ */
+ static final Comparator<ResultDescriptor> SORT_BY_NAME =
+ (ResultDescriptor first, ResultDescriptor second) =>
+ first.name.compareTo(second.name);
+
+ /**
* Initialize a newly created analysis result to have the given [name] and
* [defaultValue].
*
diff --git a/pkg/analyzer/test/src/summary/resynthesize_test.dart b/pkg/analyzer/test/src/summary/resynthesize_test.dart
index b104092..100dbcb 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_test.dart
@@ -676,7 +676,13 @@
// any evaluation result.
expect(rImpl.evaluationResult, isNull);
} else {
- expect(rImpl.runtimeType, oImpl.runtimeType);
+ Type rRuntimeType;
+ if (rImpl is FunctionElementImpl) {
+ rRuntimeType = FunctionElementImpl;
+ } else {
+ rRuntimeType = rImpl.runtimeType;
+ }
+ expect(rRuntimeType, oImpl.runtimeType);
}
expect(resynthesized.kind, original.kind);
expect(resynthesized.location, original.location, reason: desc);
@@ -910,7 +916,7 @@
compareVariableElements(resynthesized, original, desc);
compareParameterElementLists(
resynthesized.parameters, original.parameters, desc);
- expect(resynthesized.parameterKind, original.parameterKind);
+ expect(resynthesized.parameterKind, original.parameterKind, reason: desc);
expect(resynthesized.isInitializingFormal, original.isInitializingFormal,
reason: desc);
expect(resynthesized is FieldFormalParameterElementImpl,
@@ -3416,14 +3422,6 @@
checkLibrary('import "a.dart"; import "b.dart"; C c; D d;');
}
- void test_inferedType_usesSyntheticFunctionType_functionTypedParam() {
- checkLibrary('''
-int f(int x(String y)) => null;
-String g(int x(String y)) => null;
-var v = [f, g];
-''');
- }
-
test_inferred_function_type_for_variable_in_generic_function() {
// In the code below, `x` has an inferred type of `() => int`, with 2
// (unused) type parameters from the enclosing top level function.
@@ -3574,6 +3572,14 @@
' abstract class D { void set f(int g(String s)); }');
}
+ void test_inferredType_usesSyntheticFunctionType_functionTypedParam() {
+ checkLibrary('''
+int f(int x(String y)) => null;
+String g(int x(String y)) => null;
+var v = [f, g];
+''');
+ }
+
test_initializer_executable_with_return_type_from_closure() {
checkLibrary('var v = () => 0;');
}
diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart
index 27bebab..d50f60d 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -1756,8 +1756,7 @@
}
''');
_assertUnlinkedConst(cls.executables[0].constantInitializers[0].expression,
- operators: [UnlinkedConstOperation.pushConstructorParameter],
- strings: ['a']);
+ operators: [UnlinkedConstOperation.pushParameter], strings: ['a']);
}
test_constExpr_constructorParam_shadows_typeParam() {
@@ -1768,8 +1767,7 @@
}
''');
_assertUnlinkedConst(cls.executables[0].constantInitializers[0].expression,
- operators: [UnlinkedConstOperation.pushConstructorParameter],
- strings: ['T']);
+ operators: [UnlinkedConstOperation.pushParameter], strings: ['T']);
}
test_constExpr_functionExpression_asArgument() {
@@ -3462,8 +3460,7 @@
expect(initializer.kind, UnlinkedConstructorInitializerKind.field);
expect(initializer.name, 'x');
_assertUnlinkedConst(initializer.expression,
- operators: [UnlinkedConstOperation.pushConstructorParameter],
- strings: ['p']);
+ operators: [UnlinkedConstOperation.pushParameter], strings: ['p']);
expect(initializer.arguments, isEmpty);
}
@@ -3702,7 +3699,7 @@
expect(param.isFunctionTyped, isTrue);
expect(param.kind, UnlinkedParamKind.positional);
expect(param.defaultValueCode, 'foo');
- _assertUnlinkedConst(param.defaultValue, operators: [
+ _assertUnlinkedConst(param.initializer.bodyExpr, operators: [
UnlinkedConstOperation.pushReference
], referenceValidators: [
(EntityRef r) => checkTypeRef(r, null, null, 'foo',
@@ -3734,7 +3731,7 @@
.executables);
UnlinkedParam parameter = executable.parameters[0];
expect(parameter.kind, UnlinkedParamKind.named);
- expect(parameter.defaultValue, isNull);
+ expect(parameter.initializer, isNull);
expect(parameter.defaultValueCode, isEmpty);
}
@@ -3747,7 +3744,7 @@
expect(parameter.initializer, isNotNull);
expect(parameter.defaultValueCode, '42');
_assertCodeRange(parameter.codeRange, 13, 10);
- _assertUnlinkedConst(parameter.defaultValue,
+ _assertUnlinkedConst(parameter.initializer.bodyExpr,
operators: [UnlinkedConstOperation.pushInt], ints: [42]);
}
@@ -3765,7 +3762,7 @@
.executables);
UnlinkedParam parameter = executable.parameters[0];
expect(parameter.kind, UnlinkedParamKind.positional);
- expect(parameter.defaultValue, isNull);
+ expect(parameter.initializer, isNull);
expect(parameter.defaultValueCode, isEmpty);
}
@@ -3779,7 +3776,7 @@
expect(parameter.initializer, isNotNull);
expect(parameter.defaultValueCode, '42');
_assertCodeRange(parameter.codeRange, 13, 11);
- _assertUnlinkedConst(parameter.defaultValue,
+ _assertUnlinkedConst(parameter.initializer.bodyExpr,
operators: [UnlinkedConstOperation.pushInt], ints: [42]);
}
@@ -3811,7 +3808,7 @@
UnlinkedParam param = executable.parameters[0];
expect(param.kind, UnlinkedParamKind.positional);
expect(param.defaultValueCode, '42');
- _assertUnlinkedConst(param.defaultValue,
+ _assertUnlinkedConst(param.initializer.bodyExpr,
operators: [UnlinkedConstOperation.pushInt], ints: [42]);
}
@@ -5806,7 +5803,7 @@
expect(param.kind, UnlinkedParamKind.positional);
expect(param.initializer, isNotNull);
expect(param.defaultValueCode, 'foo');
- _assertUnlinkedConst(param.defaultValue, operators: [
+ _assertUnlinkedConst(param.initializer.bodyExpr, operators: [
UnlinkedConstOperation.pushReference
], referenceValidators: [
(EntityRef r) => checkTypeRef(r, null, null, 'foo',
@@ -5819,7 +5816,6 @@
UnlinkedParam param = executable.parameters[0];
expect(param.kind, UnlinkedParamKind.named);
expect(param.initializer, isNull);
- expect(param.defaultValue, isNull);
expect(param.defaultValueCode, isEmpty);
}
@@ -5830,7 +5826,7 @@
expect(param.initializer, isNotNull);
expect(param.defaultValueCode, '42');
_assertCodeRange(param.codeRange, 3, 5);
- _assertUnlinkedConst(param.defaultValue,
+ _assertUnlinkedConst(param.initializer.bodyExpr,
operators: [UnlinkedConstOperation.pushInt], ints: [42]);
}
@@ -5839,7 +5835,6 @@
UnlinkedParam param = executable.parameters[0];
expect(param.kind, UnlinkedParamKind.positional);
expect(param.initializer, isNull);
- expect(param.defaultValue, isNull);
expect(param.defaultValueCode, isEmpty);
}
@@ -5850,7 +5845,7 @@
expect(param.initializer, isNotNull);
expect(param.defaultValueCode, '42');
_assertCodeRange(param.codeRange, 3, 6);
- _assertUnlinkedConst(param.defaultValue,
+ _assertUnlinkedConst(param.initializer.bodyExpr,
operators: [UnlinkedConstOperation.pushInt], ints: [42]);
}
@@ -5859,7 +5854,6 @@
UnlinkedParam param = executable.parameters[0];
expect(param.kind, UnlinkedParamKind.required);
expect(param.initializer, isNull);
- expect(param.defaultValue, isNull);
expect(param.defaultValueCode, isEmpty);
}
@@ -7070,6 +7064,70 @@
isValidConst: false, operators: [UnlinkedConstOperation.pushNull]);
}
+ test_expr_inClosure() {
+ if (skipNonConstInitializers) {
+ return;
+ }
+ UnlinkedVariable variable = serializeVariableText('var v = () => 1;');
+ _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
+ operators: [UnlinkedConstOperation.pushInt], ints: [1]);
+ }
+
+ test_expr_inClosure_noTypeInferenceNeeded() {
+ // We don't serialize closure body expressions for closures that don't need
+ // to participate in type inference.
+ UnlinkedVariable variable = serializeVariableText('Object v = () => 1;');
+ expect(variable.initializer.localFunctions[0].bodyExpr, isNull);
+ }
+
+ test_expr_inClosure_refersToOuterParam() {
+ if (skipNonConstInitializers) {
+ return;
+ }
+ UnlinkedVariable variable =
+ serializeVariableText('var v = (x) => (y) => x;');
+ _assertUnlinkedConst(
+ variable.initializer.localFunctions[0].localFunctions[0].bodyExpr,
+ operators: [UnlinkedConstOperation.pushParameter],
+ strings: ['x']);
+ }
+
+ test_expr_inClosure_refersToParam() {
+ if (skipNonConstInitializers) {
+ return;
+ }
+ UnlinkedVariable variable = serializeVariableText('var v = (x) => x;');
+ _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
+ operators: [UnlinkedConstOperation.pushParameter], strings: ['x']);
+ }
+
+ test_expr_inClosure_refersToParam_outOfScope() {
+ if (skipNonConstInitializers) {
+ return;
+ }
+ UnlinkedVariable variable =
+ serializeVariableText('var x; var v = (b) => (b ? (x) => x : x);');
+ _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
+ isValidConst: false,
+ operators: [
+ UnlinkedConstOperation.pushParameter,
+ UnlinkedConstOperation.pushLocalFunctionReference,
+ UnlinkedConstOperation.pushReference,
+ UnlinkedConstOperation.conditional,
+ ],
+ strings: [
+ 'b'
+ ],
+ ints: [
+ 0,
+ 0
+ ],
+ referenceValidators: [
+ (EntityRef r) => checkTypeRef(r, null, null, 'x',
+ expectedKind: ReferenceKind.topLevelPropertyAccessor)
+ ]);
+ }
+
test_expr_invokeMethod_instance() {
if (skipNonConstInitializers) {
return;
diff --git a/pkg/compiler/lib/src/serialization/modelz.dart b/pkg/compiler/lib/src/serialization/modelz.dart
index 0c06ea4..36ec45c 100644
--- a/pkg/compiler/lib/src/serialization/modelz.dart
+++ b/pkg/compiler/lib/src/serialization/modelz.dart
@@ -495,6 +495,7 @@
class ScriptZ implements Script {
final Uri resourceUri;
SourceFile _file;
+ bool _isSynthesized = false;
ScriptZ(this.resourceUri);
@@ -518,7 +519,11 @@
// TODO(johnniwinther): Decide if it is meaningful to serialize erroneous
// elements.
@override
- bool get isSynthesized => false;
+ bool get isSynthesized => _isSynthesized;
+
+ void set isSynthesized(bool value) {
+ _isSynthesized = value;
+ }
@override
String get name {
diff --git a/pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart b/pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart
index 9b4e0d3..ff8eef4 100644
--- a/pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart
+++ b/pkg/compiler/lib/src/serialization/resolved_ast_serialization.dart
@@ -379,6 +379,8 @@
int charOffset = objectDecoder.getInt(Key.OFFSET);
Token beginToken = getBeginToken(uri, charOffset);
if (beginToken == null) {
+ // TODO(johnniwinther): Handle unfound tokens by adding an erronous
+ // resolved ast kind.
reporter.internalError(
element, "No token found for $element in $uri @ $charOffset");
}
diff --git a/pkg/compiler/lib/src/serialization/system.dart b/pkg/compiler/lib/src/serialization/system.dart
index 02a716b..8b54e98d 100644
--- a/pkg/compiler/lib/src/serialization/system.dart
+++ b/pkg/compiler/lib/src/serialization/system.dart
@@ -71,8 +71,8 @@
.readScript(script.readableUri)
.then((Script newScript) {
script.file = newScript.file;
- _resolvedAstDeserializer.sourceFiles[script.resourceUri] =
- newScript.file;
+ script.isSynthesized = newScript.isSynthesized;
+ _resolvedAstDeserializer.scripts[script.resourceUri] = script;
});
}).then((_) => library);
}
@@ -200,7 +200,7 @@
class ResolvedAstDeserializerPlugin extends DeserializerPlugin {
final ParsingContext parsingContext;
final DeserializerPlugin nativeDataDeserializer;
- final Map<Uri, SourceFile> sourceFiles = <Uri, SourceFile>{};
+ final Map<Uri, Script> scripts = <Uri, Script>{};
Map<MemberElement, ObjectDecoder> _decoderMap =
<MemberElement, ObjectDecoder>{};
@@ -232,13 +232,15 @@
Token findToken(Uri uri, int offset) {
Token beginToken = beginTokenMap.putIfAbsent(uri, () {
- SourceFile sourceFile = sourceFiles[uri];
- if (sourceFile == null) {
- throw 'No source file found for $uri in:\n '
- '${sourceFiles.keys.join('\n ')}';
+ Script script = scripts[uri];
+ if (script == null) {
+ parsingContext.reporter.internalError(NO_LOCATION_SPANNABLE,
+ 'No source file found for $uri in:\n ${scripts.keys.join('\n ')}');
}
- return new Scanner(sourceFile).tokenize();
+ if (script.isSynthesized) return null;
+ return new Scanner(script.file).tokenize();
});
+ if (beginToken == null) return null;
return ResolvedAstDeserializer.findTokenInStream(beginToken, offset);
}
diff --git a/pkg/pkg.status b/pkg/pkg.status
index a78a08d6c..9fa4651 100644
--- a/pkg/pkg.status
+++ b/pkg/pkg.status
@@ -267,7 +267,7 @@
analyzer/test/src/task/strong_mode_test: Crash # Issue 24485
analyzer/test/src/task/yaml_test: Crash # Issue 24485
-[ $noopt || $runtime == dart_precompiled || $runtime == dart_product ]
+[ $noopt || $runtime == dart_precompiled || $runtime == dart_app ]
*: SkipByDesign # The pkg test framework imports dart:mirrors.
[ $compiler == dart2js && $cps_ir && $checked ]
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index 5ab2826..8823eda 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -1232,7 +1232,7 @@
intptr_t instructions_blob_size = 0;
uint8_t* rodata_blob_buffer = NULL;
intptr_t rodata_blob_size = 0;
- Dart_Handle result = Dart_CreatePrecompiledJITSnapshotBlob(
+ Dart_Handle result = Dart_CreateAppJITSnapshot(
&vm_isolate_buffer,
&vm_isolate_size,
&isolate_buffer,
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h
index bc8c474..d019d4f 100755
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -2960,7 +2960,6 @@
/**
* Creates a precompiled snapshot.
- * - The VM must not have been started from a snapshot.
* - A root library must have been loaded.
* - Dart_Precompile must have been called.
*
@@ -2972,6 +2971,11 @@
* The vm isolate snapshot, kInstructionsSnapshot and kDataSnapshot should be
* passed as arguments to Dart_Initialize. The isolate snapshot should be
* passed to Dart_CreateIsolate.
+ *
+ * The buffers are scope allocated and are only valid until the next call to
+ * Dart_ExitScope.
+ *
+ * \return A valid handle if no error occurs during the operation.
*/
DART_EXPORT Dart_Handle Dart_CreatePrecompiledSnapshotAssembly(
uint8_t** vm_isolate_snapshot_buffer,
@@ -3002,7 +3006,30 @@
DART_EXPORT Dart_Handle Dart_PrecompileJIT();
-DART_EXPORT Dart_Handle Dart_CreatePrecompiledJITSnapshotBlob(
+/**
+ * Creates a snapshot that caches unoptimized code and type feedback for faster
+ * startup and quicker warmup in a subsequent process.
+ *
+ * Outputs a snapshot in four pieces. The vm isolate snapshot,
+ * instructions_blob and rodata_blob should be passed as arguments to
+ * Dart_Initialize. The isolate snapshot should be passed to
+ * Dart_CreateIsolate. The instructions piece must be loaded with execute
+ * permissions; the other pieces may loaded as read-only.
+ *
+ * - Requires the VM to have been started with --load-deferred-eagerly.
+ * - Requires the VM to have not been started with --precompilation.
+ * - Not supported when targeting IA32.
+ * - The VM writing the snapshot and the VM reading the snapshot must be the
+ * same version, must be built in the same DEBUG/RELEASE/PRODUCT mode, must
+ * be targeting the same architecture, and must both be in checked mode or
+ * both in unchecked mode.
+ *
+ * The buffers are scope allocated and are only valid until the next call to
+ * Dart_ExitScope.
+ *
+ * \return A valid handle if no error occurs during the operation.
+ */
+DART_EXPORT Dart_Handle Dart_CreateAppJITSnapshot(
uint8_t** vm_isolate_snapshot_buffer,
intptr_t* vm_isolate_snapshot_size,
uint8_t** isolate_snapshot_buffer,
diff --git a/runtime/observatory/tests/service/service.status b/runtime/observatory/tests/service/service.status
index 3ec12e9..31ffa21 100644
--- a/runtime/observatory/tests/service/service.status
+++ b/runtime/observatory/tests/service/service.status
@@ -44,7 +44,7 @@
*: SkipByDesign
# Service protocol is not supported when running a full application snapshot.
-[ $runtime == dart_product ]
+[ $runtime == dart_app ]
*: SkipByDesign
[ $compiler == dart2analyzer ]
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index 8c08954..e34859d 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -103,7 +103,7 @@
dart/inline_stack_frame_test: Pass, RuntimeError
dart/optimized_stacktrace_test: Pass, RuntimeError
-[ $runtime == dart_product || $runtime == dart_precompiled ]
+[ $runtime == dart_app || $runtime == dart_precompiled ]
dart/data_uri_spawn_test: SkipByDesign # Isolate.spawnUri
dart/optimized_stacktrace_test: SkipByDesign # Requires line numbers
diff --git a/runtime/vm/dart_api_impl.cc b/runtime/vm/dart_api_impl.cc
index eed7789..95ae648 100644
--- a/runtime/vm/dart_api_impl.cc
+++ b/runtime/vm/dart_api_impl.cc
@@ -1463,7 +1463,7 @@
API_TIMELINE_DURATION;
Isolate* I = T->isolate();
if (!FLAG_load_deferred_eagerly) {
- return Dart_NewApiError(
+ return Api::NewError(
"Creating full snapshots requires --load_deferred_eagerly");
}
if (vm_isolate_snapshot_buffer != NULL &&
@@ -6131,10 +6131,13 @@
DART_EXPORT Dart_Handle Dart_Precompile(
Dart_QualifiedFunctionName entry_points[],
bool reset_fields) {
+#if defined(TARGET_ARCH_IA32)
+ return Api::NewError("Precompilation is not supported on IA32.");
+#else
API_TIMELINE_BEGIN_END;
DARTSCOPE(Thread::Current());
if (!FLAG_precompiled_mode) {
- return Dart_NewApiError("Flag --precompilation was not specified.");
+ return Api::NewError("Flag --precompilation was not specified.");
}
Dart_Handle result = Api::CheckAndFinalizePendingClasses(T);
if (::Dart_IsError(result)) {
@@ -6147,6 +6150,7 @@
return Api::NewHandle(T, error.raw());
}
return Api::Success();
+#endif
}
@@ -6157,12 +6161,15 @@
intptr_t* isolate_snapshot_size,
uint8_t** assembly_buffer,
intptr_t* assembly_size) {
+#if defined(TARGET_ARCH_IA32)
+ return Api::NewError("Snapshots with code are not supported on IA32.");
+#else
API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
Isolate* I = T->isolate();
if (I->compilation_allowed()) {
- return Dart_NewApiError("Isolate is not precompiled. "
- "Did you forget to call Dart_Precompile?");
+ return Api::NewError("Isolate is not precompiled. "
+ "Did you forget to call Dart_Precompile?");
}
ASSERT(FLAG_load_deferred_eagerly);
if (vm_isolate_snapshot_buffer == NULL) {
@@ -6201,6 +6208,7 @@
*assembly_size = instructions_writer.AssemblySize();
return Api::Success();
+#endif
}
@@ -6213,12 +6221,15 @@
intptr_t* instructions_blob_size,
uint8_t** rodata_blob_buffer,
intptr_t* rodata_blob_size) {
+#if defined(TARGET_ARCH_IA32)
+ return Api::NewError("Snapshots with code are not supported on IA32.");
+#else
API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
Isolate* I = T->isolate();
if (I->compilation_allowed()) {
- return Dart_NewApiError("Isolate is not precompiled. "
- "Did you forget to call Dart_Precompile?");
+ return Api::NewError("Isolate is not precompiled. "
+ "Did you forget to call Dart_Precompile?");
}
ASSERT(FLAG_load_deferred_eagerly);
if (vm_isolate_snapshot_buffer == NULL) {
@@ -6265,6 +6276,7 @@
*rodata_blob_size = instructions_writer.RodataBlobSize();
return Api::Success();
+#endif
}
#endif // DART_PRECOMPILER
@@ -6301,7 +6313,7 @@
}
-DART_EXPORT Dart_Handle Dart_CreatePrecompiledJITSnapshotBlob(
+DART_EXPORT Dart_Handle Dart_CreateAppJITSnapshot(
uint8_t** vm_isolate_snapshot_buffer,
intptr_t* vm_isolate_snapshot_size,
uint8_t** isolate_snapshot_buffer,
@@ -6310,11 +6322,14 @@
intptr_t* instructions_blob_size,
uint8_t** rodata_blob_buffer,
intptr_t* rodata_blob_size) {
+#if defined(TARGET_ARCH_IA32)
+ return Api::NewError("Snapshots with code are not supported on IA32.");
+#else
API_TIMELINE_DURATION;
DARTSCOPE(Thread::Current());
Isolate* I = T->isolate();
if (!FLAG_load_deferred_eagerly) {
- return Dart_NewApiError(
+ return Api::NewError(
"Creating full snapshots requires --load_deferred_eagerly");
}
if (vm_isolate_snapshot_buffer == NULL) {
@@ -6366,6 +6381,7 @@
*rodata_blob_size = instructions_writer.RodataBlobSize();
return Api::Success();
+#endif
}
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index b184f6c..8ed0873 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -2016,7 +2016,7 @@
void Isolate::AddDeoptimizingBoxedField(const Field& field) {
ASSERT(Compiler::IsBackgroundCompilation());
- ASSERT(field.IsOriginal());
+ ASSERT(!field.IsOriginal());
// The enclosed code allocates objects and can potentially trigger a GC,
// ensure that we account for safepoints when grabbing the lock.
SafepointMutexLocker ml(field_list_mutex_);
@@ -2025,7 +2025,7 @@
}
const GrowableObjectArray& array =
GrowableObjectArray::Handle(boxed_field_list_);
- array.Add(field, Heap::kOld);
+ array.Add(Field::Handle(field.Original()), Heap::kOld);
}
diff --git a/runtime/vm/jit_optimizer.cc b/runtime/vm/jit_optimizer.cc
index f05813d..e9085b6 100644
--- a/runtime/vm/jit_optimizer.cc
+++ b/runtime/vm/jit_optimizer.cc
@@ -2919,8 +2919,7 @@
// executed.
const Field& field = instr->field();
const String& field_name = String::Handle(Z, field.name());
- const Class& owner =
- Class::Handle(Z, Field::Handle(Z, field.Original()).Owner());
+ const Class& owner = Class::Handle(Z, field.Owner());
const Function& getter =
Function::Handle(Z, owner.LookupGetterFunction(field_name));
const Function& setter =
diff --git a/runtime/vm/megamorphic_cache_table.cc b/runtime/vm/megamorphic_cache_table.cc
index 9b80f80..4705b21 100644
--- a/runtime/vm/megamorphic_cache_table.cc
+++ b/runtime/vm/megamorphic_cache_table.cc
@@ -148,7 +148,7 @@
static_cast<double>(cumulative_entries) /
static_cast<double>(entry_count));
}
- delete probe_counts;
+ delete[] probe_counts;
}
} // namespace dart
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 2230804..0d5ca5f 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -7709,7 +7709,8 @@
return (raw_ptr()->guarded_cid_ == other.raw_ptr()->guarded_cid_) &&
(raw_ptr()->is_nullable_ == other.raw_ptr()->is_nullable_) &&
(raw_ptr()->guarded_list_length_ ==
- other.raw_ptr()->guarded_list_length_);
+ other.raw_ptr()->guarded_list_length_) &&
+ (is_unboxing_candidate() == other.is_unboxing_candidate());
}
@@ -10244,8 +10245,8 @@
void Library::DropDependencies() const {
- StorePointer(&raw_ptr()->imports_, Array::null());
- StorePointer(&raw_ptr()->exports_, Array::null());
+ StorePointer(&raw_ptr()->imports_, Object::empty_array().raw());
+ StorePointer(&raw_ptr()->exports_, Object::empty_array().raw());
}
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index f81f02d..74cf176 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -1040,7 +1040,6 @@
RawObject** from() { return reinterpret_cast<RawObject**>(&ptr()->name_); }
RawString* name_;
RawString* url_;
- RawScript* script_;
RawString* private_key_;
RawArray* dictionary_; // Top-level names in this library.
RawGrowableObjectArray* metadata_; // Metadata on classes, methods etc.
diff --git a/runtime/vm/raw_object_snapshot.cc b/runtime/vm/raw_object_snapshot.cc
index 1543db6..b245a94 100644
--- a/runtime/vm/raw_object_snapshot.cc
+++ b/runtime/vm/raw_object_snapshot.cc
@@ -1300,7 +1300,7 @@
kAsReference);
if (kind == Snapshot::kAppNoJIT) {
prefix.StorePointer(&prefix.raw_ptr()->imports_,
- Array::null());
+ Object::empty_array().raw());
}
prefix.StorePointer(&prefix.raw_ptr()->dependent_code_,
Array::null());
diff --git a/samples/samples.status b/samples/samples.status
index 1073481..1fa1d28 100644
--- a/samples/samples.status
+++ b/samples/samples.status
@@ -28,5 +28,5 @@
[ $arch == simarm64 ]
*: Skip
-[ $noopt || $runtime == dart_precompiled || $runtime == dart_product ]
+[ $noopt || $runtime == dart_precompiled || $runtime == dart_app ]
sample_extension: Skip # Platform.executable
diff --git a/site/try/poi/poi.dart b/site/try/poi/poi.dart
index f73e4e7..f40705a 100644
--- a/site/try/poi/poi.dart
+++ b/site/try/poi/poi.dart
@@ -455,7 +455,7 @@
int position) {
bool isFullCompile = cachedCompiler != newCompiler;
cachedCompiler = newCompiler;
- if (poiTask == null || poiTask.compiler != cachedCompiler) {
+ if (poiTask == null) {
poiTask = new PoiTask(cachedCompiler);
cachedCompiler.tasks.add(poiTask);
}
diff --git a/tests/benchmark_smoke/benchmark_smoke.status b/tests/benchmark_smoke/benchmark_smoke.status
index 7aa0af0..056911f 100644
--- a/tests/benchmark_smoke/benchmark_smoke.status
+++ b/tests/benchmark_smoke/benchmark_smoke.status
@@ -2,7 +2,7 @@
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
*: Skip
[ $compiler == dart2js && $runtime == none ]
diff --git a/tests/co19/co19-runtime.status b/tests/co19/co19-runtime.status
index fb4c02e..1ce9410 100644
--- a/tests/co19/co19-runtime.status
+++ b/tests/co19/co19-runtime.status
@@ -3,7 +3,7 @@
# BSD-style license that can be found in the LICENSE file.
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
# Failures ok in tests below. VM moves super initializer to end of list.
Language/Classes/Constructors/Generative_Constructors/execution_t03: Fail, OK
@@ -43,7 +43,7 @@
LibTest/core/Symbol/Symbol_A01_t03: RuntimeError # Issue 13596
LibTest/core/Symbol/Symbol_A01_t05: RuntimeError # Issue 13596
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
LibTest/typed_data/Float32x4/reciprocalSqrt_A01_t01: Pass, Fail # co19 issue 599
LibTest/typed_data/Float32x4/reciprocal_A01_t01: Pass, Fail # co19 issue 599
Language/Expressions/Instance_Creation/Const/abstract_class_t01: MissingCompileTimeError # Issue 22007
@@ -53,10 +53,10 @@
Language/Libraries_and_Scripts/Exports/invalid_uri_t02: Fail
Language/Libraries_and_Scripts/Parts/syntax_t06: Fail
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) && $mode == debug ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $mode == debug ]
LibTest/core/List/List_class_A01_t02: Pass, Slow
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) && ($arch != x64 && $arch != simarm64 && $arch != arm64) ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && ($arch != x64 && $arch != simarm64 && $arch != arm64) ]
LibTest/core/int/operator_left_shift_A01_t02: Fail # co19 issue 129
[ ($compiler == none || $compiler == precompiler) && ($runtime == vm || $runtime == dart_precompiled) && ($arch == mips || $arch == arm64) ]
@@ -66,7 +66,7 @@
LibTest/collection/ListMixin/ListMixin_class_A01_t02: Skip # co19 issue 673
LibTest/collection/ListBase/ListBase_class_A01_t02: Skip # co19 issue 673
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) && ($arch == simarm || $arch == simarmv6 || $arch == simarmv5te || $arch == simmips || $arch == simarm64) ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && ($arch == simarm || $arch == simarmv6 || $arch == simarmv5te || $arch == simmips || $arch == simarm64) ]
LibTest/core/Uri/Uri_A06_t03: Skip # Timeout
LibTest/collection/ListMixin/ListMixin_class_A01_t01: Skip # Timeout
LibTest/collection/ListBase/ListBase_class_A01_t01: Skip # Timeout
@@ -77,19 +77,19 @@
LibTest/collection/ListMixin/ListMixin_class_A01_t02: Pass, Slow
LibTest/collection/ListBase/ListBase_class_A01_t02: Pass, Slow
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
LibTest/isolate/Isolate/spawn_A02_t01: Skip # co19 issue 667
LibTest/html/*: SkipByDesign # dart:html not supported on VM.
LayoutTests/fast/*: SkipByDesign # DOM not supported on VM.
WebPlatformTest/*: SkipByDesign # dart:html not supported on VM.
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) && $mode == debug && $builder_tag == asan ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $mode == debug && $builder_tag == asan ]
Language/Types/Interface_Types/subtype_t27: Skip # Issue 21174.
-[ ($runtime == vm || $runtime == dart_product) && $arch == arm ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $arch == arm ]
LibTest/typed_data/Float32x4/operator_multiplication_A01_t01: Fail # Dart issue 24416
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
# co19 update Sep 29, 2015 (3ed795ea02e022ef19c77cf1b6095b7c8f5584d0)
Language/Classes/Getters/type_object_t01: RuntimeError # Issue 23721
Language/Classes/Getters/type_object_t02: RuntimeError # Issue 23721
@@ -127,7 +127,7 @@
Language/Mixins/not_object_superclass_t01: MissingCompileTimeError # co19 issue 43 and 44
Language/Mixins/reference_to_super_t01: MissingCompileTimeError # co19 issue 43 and 44
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) && $checked ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $checked ]
Language/Errors_and_Warnings/static_warning_t01: RuntimeError # co19 issue 45
Language/Errors_and_Warnings/static_warning_t02: RuntimeError # co19 issue 45
Language/Errors_and_Warnings/static_warning_t03: RuntimeError # co19 issue 45
@@ -138,7 +138,7 @@
[ $noopt || $compiler == precompiler || $mode == product ]
Language/Metadata/*: SkipByDesign # Uses dart:mirrors
-[ $runtime == dart_precompiled || $runtime == dart_product ]
+[ $runtime == dart_precompiled || $runtime == dart_app ]
LibTest/isolate/Isolate/spawnUri*: Skip # Isolate.spawnUri
[ $noopt || $compiler == precompiler ]
@@ -146,6 +146,8 @@
LibTest/collection/ListMixin/ListMixin_class_A01_t02: Pass, Timeout
LibTest/core/Map/Map_class_A01_t04: Pass, Timeout
LibTest/core/Uri/encodeQueryComponent_A01_t02: Pass, Timeout
+
+[ $noopt || $compiler == precompiler || $compiler == dart2appjit ]
Language/Mixins/Mixin_Application/error_t01: Pass
Language/Mixins/Mixin_Application/error_t02: Pass
Language/Mixins/declaring_constructor_t01: Pass
diff --git a/tests/compiler/dart2js/serialization/analysis_test.dart b/tests/compiler/dart2js/serialization/analysis_test.dart
index 42c1f5f..152972b 100644
--- a/tests/compiler/dart2js/serialization/analysis_test.dart
+++ b/tests/compiler/dart2js/serialization/analysis_test.dart
@@ -21,29 +21,32 @@
await serializeDartCore(arguments: arguments);
if (arguments.filename != null) {
Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename));
- await analyze(serializedData, entryPoint, null);
+ await analyze(entryPoint,
+ resolutionInputs: serializedData.toUris(),
+ sourceFiles: serializedData.toMemorySourceFiles());
} else {
- Uri entryPoint = Uri.parse('memory:main.dart');
- await arguments.forEachTest(TESTS, (int index, Test test) async {
- await analyze(serializedData, entryPoint, test);
- });
+ await arguments.forEachTest(serializedData, TESTS, analyze);
}
});
}
-Future analyze(SerializedData serializedData, Uri entryPoint, Test test,
- {int index}) async {
- String testDescription =
- test != null ? test.sourceFiles[entryPoint.path] : '${entryPoint}';
+Future analyze(
+ Uri entryPoint,
+ {Map<String, String> sourceFiles: const <String, String>{},
+ List<Uri> resolutionInputs,
+ int index,
+ Test test,
+ bool verbose: false}) async {
+ String testDescription = test != null ? test.name : '${entryPoint}';
+ String id = index != null ? '$index: ' : '';
print('------------------------------------------------------------------');
- print('analyze ${index != null ? '$index:' :''}${testDescription}');
+ print('analyze ${id}${testDescription}');
print('------------------------------------------------------------------');
DiagnosticCollector diagnosticCollector = new DiagnosticCollector();
await runCompiler(
entryPoint: entryPoint,
- resolutionInputs: serializedData.toUris(),
- memorySourceFiles: serializedData.toMemorySourceFiles(
- test != null ? test.sourceFiles : null),
+ resolutionInputs: resolutionInputs,
+ memorySourceFiles: sourceFiles,
options: [Flags.analyzeOnly],
diagnosticHandler: diagnosticCollector);
if (test != null) {
diff --git a/tests/compiler/dart2js/serialization/compilation_test.dart b/tests/compiler/dart2js/serialization/compilation_test.dart
index 595803a..9889bf4 100644
--- a/tests/compiler/dart2js/serialization/compilation_test.dart
+++ b/tests/compiler/dart2js/serialization/compilation_test.dart
@@ -20,31 +20,34 @@
await serializeDartCore(arguments: arguments);
if (arguments.filename != null) {
Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename));
- await compile(serializedData, entryPoint, null);
+ await compile(
+ entryPoint,
+ resolutionInputs: serializedData.toUris(),
+ sourceFiles: serializedData.toMemorySourceFiles());
} else {
Uri entryPoint = Uri.parse('memory:main.dart');
- await arguments.forEachTest(TESTS, (int index, Test test) async {
- await compile(serializedData, entryPoint, test,
- index: index,
- verbose: arguments.verbose);
- });
+ await arguments.forEachTest(serializedData, TESTS, compile);
}
});
}
-Future compile(SerializedData serializedData, Uri entryPoint, Test test,
- {int index, bool verbose: false}) async {
- String testDescription =
- test != null ? test.sourceFiles[entryPoint.path] : '${entryPoint}';
+Future compile(
+ Uri entryPoint,
+ {Map<String, String> sourceFiles: const <String, String>{},
+ List<Uri> resolutionInputs,
+ int index,
+ Test test,
+ bool verbose: false}) async {
+ String testDescription = test != null ? test.name : '${entryPoint}';
+ String id = index != null ? '$index: ' : '';
print('------------------------------------------------------------------');
- print('compile ${index != null ? '$index:' :''}${testDescription}');
+ print('compile ${id}${testDescription}');
print('------------------------------------------------------------------');
OutputCollector outputCollector = new OutputCollector();
await runCompiler(
entryPoint: entryPoint,
- resolutionInputs: serializedData.toUris(),
- memorySourceFiles: serializedData.toMemorySourceFiles(
- test != null ? test.sourceFiles : null),
+ memorySourceFiles: sourceFiles,
+ resolutionInputs: resolutionInputs,
options: [],
outputProvider: outputCollector);
if (verbose) {
diff --git a/tests/compiler/dart2js/serialization/helper.dart b/tests/compiler/dart2js/serialization/helper.dart
index 0471658..a7d185c 100644
--- a/tests/compiler/dart2js/serialization/helper.dart
+++ b/tests/compiler/dart2js/serialization/helper.dart
@@ -10,6 +10,7 @@
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/common/names.dart';
import 'package:compiler/src/compiler.dart';
+import 'package:compiler/src/elements/elements.dart';
import '../memory_compiler.dart';
import 'test_data.dart';
@@ -70,16 +71,45 @@
saveSerializedData: saveSerializedData);
}
- Future forEachTest(List<Test> tests, Future f(int index, Test test)) async {
+ Future forEachTest(
+ SerializedData serializedData,
+ List<Test> tests,
+ TestFunction testFunction) async {
+ Uri entryPoint = Uri.parse('memory:main.dart');
int first = start ?? 0;
int last = end ?? tests.length - 1;
+
for (int index = first; index <= last; index++) {
Test test = TESTS[index];
- await f(index, test);
+ List<SerializedData> dataList =
+ await preserializeData(serializedData, test);
+ Map<String, String> sourceFiles = <String, String>{};
+ sourceFiles.addAll(test.sourceFiles);
+ if (test.preserializedSourceFiles != null) {
+ sourceFiles.addAll(test.preserializedSourceFiles);
+ }
+ List<Uri> resolutionInputs = <Uri>[];
+ for (SerializedData data in dataList) {
+ data.expandMemorySourceFiles(sourceFiles);
+ data.expandUris(resolutionInputs);
+ }
+ await testFunction(entryPoint,
+ sourceFiles: sourceFiles,
+ resolutionInputs: resolutionInputs,
+ index: index,
+ test: test,
+ verbose: verbose);
}
}
}
+typedef Future TestFunction(
+ Uri entryPoint,
+ {Map<String, String> sourceFiles,
+ List<Uri> resolutionInputs,
+ int index,
+ Test test,
+ bool verbose});
Future<SerializedData> serializeDartCore(
{Arguments arguments: const Arguments()}) async {
@@ -146,4 +176,40 @@
void expandUris(List<Uri> uris) {
uris.add(uri);
}
-}
\ No newline at end of file
+}
+
+String extractSerializedData(
+ Compiler compiler, Iterable<LibraryElement> libraries) {
+ BufferedEventSink sink = new BufferedEventSink();
+ compiler.serialization.serializeToSink(sink, libraries);
+ return sink.text;
+}
+
+Future<List<SerializedData>> preserializeData(
+ SerializedData serializedData, Test test) async {
+ if (test == null ||
+ test.preserializedSourceFiles == null ||
+ test.preserializedSourceFiles.isEmpty) {
+ return <SerializedData>[serializedData];
+ }
+ List<Uri> uriList = <Uri>[];
+ for (String key in test.preserializedSourceFiles.keys) {
+ uriList.add(Uri.parse('memory:$key'));
+ }
+ Compiler compiler = compilerFor(
+ memorySourceFiles:
+ serializedData.toMemorySourceFiles(test.preserializedSourceFiles),
+ resolutionInputs: serializedData.toUris(),
+ options: [Flags.analyzeOnly, Flags.analyzeMain]);
+ compiler.librariesToAnalyzeWhenRun = uriList;
+ compiler.serialization.supportSerialization = true;
+ await compiler.run(null);
+ List<LibraryElement> libraries = <LibraryElement>[];
+ for (Uri uri in uriList) {
+ libraries.add(compiler.libraryLoader.lookupLibrary(uri));
+ }
+ SerializedData additionalSerializedData =
+ new SerializedData(Uri.parse('memory:additional.data'),
+ extractSerializedData(compiler, libraries));
+ return <SerializedData>[serializedData, additionalSerializedData];
+}
diff --git a/tests/compiler/dart2js/serialization/model_test.dart b/tests/compiler/dart2js/serialization/model_test.dart
index 2ab28e9..dd86acd 100644
--- a/tests/compiler/dart2js/serialization/model_test.dart
+++ b/tests/compiler/dart2js/serialization/model_test.dart
@@ -28,33 +28,31 @@
await serializeDartCore(arguments: arguments);
if (arguments.filename != null) {
Uri entryPoint = Uri.base.resolve(nativeToUriPath(arguments.filename));
- await checkModels(serializedData, entryPoint);
+ await checkModels(entryPoint,
+ sourceFiles: serializedData.toMemorySourceFiles(),
+ resolutionInputs: serializedData.toUris());
} else {
Uri entryPoint = Uri.parse('memory:main.dart');
- arguments.forEachTest(TESTS, (int index, Test test) async {
- print('==============================================================');
- print(test.sourceFiles);
- await checkModels(
- serializedData,
- entryPoint,
- memorySourceFiles: test.sourceFiles,
- verbose: arguments.verbose);
- });
+ arguments.forEachTest(serializedData, TESTS, checkModels);
}
});
}
Future checkModels(
- SerializedData serializedData,
Uri entryPoint,
- {Map<String, String> memorySourceFiles: const <String, String>{},
- bool verbose: false}) async {
+ {Map<String, String> sourceFiles: const <String, String>{},
+ List<Uri> resolutionInputs,
+ int index,
+ Test test,
+ bool verbose: false}) async {
+ String testDescription = test != null ? test.name : '${entryPoint}';
+ String id = index != null ? '$index: ' : '';
print('------------------------------------------------------------------');
- print('compile normal');
+ print('compile normal ${id}${testDescription}');
print('------------------------------------------------------------------');
Compiler compilerNormal = compilerFor(
- memorySourceFiles: memorySourceFiles,
+ memorySourceFiles: sourceFiles,
options: [Flags.analyzeOnly]);
compilerNormal.resolution.retainCachesForTesting = true;
await compilerNormal.run(entryPoint);
@@ -63,11 +61,11 @@
compilerNormal.backend.onResolutionComplete();
print('------------------------------------------------------------------');
- print('compile deserialized');
+ print('compile deserialized ${id}${testDescription}');
print('------------------------------------------------------------------');
Compiler compilerDeserialized = compilerFor(
- memorySourceFiles: serializedData.toMemorySourceFiles(memorySourceFiles),
- resolutionInputs: serializedData.toUris(),
+ memorySourceFiles: sourceFiles,
+ resolutionInputs: resolutionInputs,
options: [Flags.analyzeOnly]);
compilerDeserialized.resolution.retainCachesForTesting = true;
await compilerDeserialized.run(entryPoint);
diff --git a/tests/compiler/dart2js/serialization/resolved_ast_test.dart b/tests/compiler/dart2js/serialization/resolved_ast_test.dart
index 9cba5af..4610076 100644
--- a/tests/compiler/dart2js/serialization/resolved_ast_test.dart
+++ b/tests/compiler/dart2js/serialization/resolved_ast_test.dart
@@ -29,7 +29,7 @@
Uri entryPoint = Uri.parse('memory:main.dart');
// TODO(johnniwinther): Change to test all serialized resolved ast instead
// only those used in the test.
- Test test = TESTS.last;
+ Test test = TESTS.first;
await check(serializedData, entryPoint, test.sourceFiles);
}
});
diff --git a/tests/compiler/dart2js/serialization/test_data.dart b/tests/compiler/dart2js/serialization/test_data.dart
index 62126fd..49f3f44 100644
--- a/tests/compiler/dart2js/serialization/test_data.dart
+++ b/tests/compiler/dart2js/serialization/test_data.dart
@@ -5,21 +5,21 @@
library dart2js.serialization_test_data;
const List<Test> TESTS = const <Test>[
- const Test(const {
+ const Test('Empty program', const {
'main.dart': 'main() {}'
}),
- const Test(const {
+ const Test('Hello World', const {
'main.dart': 'main() => print("Hello World");'
}),
- const Test(const {
+ const Test('Too many arguments to print', const {
'main.dart': 'main() => print("Hello World", 0);'
},
expectedWarningCount: 1,
expectedInfoCount: 1),
- const Test(const {
+ const Test('Hello World with string interpolation', const {
'main.dart': r'''
main() {
String text = "Hello World";
@@ -27,7 +27,7 @@
}'''
}),
- const Test(const {
+ const Test('Too many arguments to print with string interpolation', const {
'main.dart': r'''
main() {
String text = "Hello World";
@@ -37,14 +37,14 @@
expectedWarningCount: 1,
expectedInfoCount: 1),
- const Test(const {
+ const Test('Print main arguments', const {
'main.dart': r'''
main(List<String> arguments) {
print(arguments);
}'''
}),
- const Test(const {
+ const Test('For loop on main arguments', const {
'main.dart': r'''
main(List<String> arguments) {
for (int i = 0; i < arguments.length; i++) {
@@ -53,7 +53,7 @@
}'''
}),
- const Test(const {
+ const Test('For-in loop on main arguments', const {
'main.dart': r'''
main(List<String> arguments) {
for (String argument in arguments) {
@@ -62,7 +62,7 @@
}'''
}),
- const Test(const {
+ const Test('Simple class', const {
'main.dart': r'''
class Class {}
main() {
@@ -70,7 +70,7 @@
}'''
}),
- const Test(const {
+ const Test('Simple class implements Function without call method', const {
'main.dart': r'''
class Class implements Function {}
main() {
@@ -79,7 +79,7 @@
},
expectedWarningCount: 1),
- const Test(const {
+ const Test('Simple class implements Function with call method', const {
'main.dart': r'''
class Class implements Function {
call() {}
@@ -89,7 +89,7 @@
}'''
}),
- const Test(const {
+ const Test('Implement Comparable', const {
'main.dart': r'''
class Class implements Comparable<Class> {
int compareTo(Class other) => 0;
@@ -99,7 +99,7 @@
}'''
}),
- const Test(const {
+ const Test('Implement Comparable with two many type arguments', const {
'main.dart': r'''
class Class implements Comparable<Class, Class> {
int compareTo(other) => 0;
@@ -110,7 +110,7 @@
},
expectedWarningCount: 1),
- const Test(const {
+ const Test('Impliment Comparable with incompatible parameter types', const {
'main.dart': r'''
class Class implements Comparable<Class> {
int compareTo(String other) => 0;
@@ -122,7 +122,7 @@
expectedWarningCount: 1,
expectedInfoCount: 1),
- const Test(const {
+ const Test('Impliment Comparable with incompatible parameter count', const {
'main.dart': r'''
class Class implements Comparable {
bool compareTo(a, b) => true;
@@ -134,7 +134,7 @@
expectedWarningCount: 1,
expectedInfoCount: 1),
- const Test(const {
+ const Test('Implement Random and call nextInt directly', const {
'main.dart': r'''
import 'dart:math';
@@ -152,7 +152,7 @@
expectedWarningCount: 1,
expectedInfoCount: 0),
- const Test(const {
+ const Test('Implement Random and do not call nextInt', const {
'main.dart': r'''
import 'dart:math';
@@ -168,7 +168,7 @@
}'''
}),
- const Test(const {
+ const Test('Implement Random and call nextInt through native code', const {
'main.dart': r'''
import 'dart:math';
@@ -189,7 +189,7 @@
expectedWarningCount: 1,
expectedInfoCount: 0),
- const Test(const {
+ const Test('Handle break and continue', const {
'main.dart': '''
main() {
loop: for (var a in []) {
@@ -201,7 +201,7 @@
}'''
}),
- const Test(const {
+ const Test('Explicit default constructor', const {
'main.dart': '''
class A {
A();
@@ -210,7 +210,20 @@
''',
}),
- const Test(const {
+ const Test('Explicit default constructor, preserialized', const {
+ 'main.dart': '''
+import 'lib.dart';
+main() => new A();
+ ''',
+ }, preserializedSourceFiles: const {
+ 'lib.dart': '''
+class A {
+ A();
+}
+''',
+ }),
+
+ const Test('Const constructor', const {
'main.dart': '''
class C {
const C();
@@ -218,7 +231,7 @@
main() => const C();'''
}),
- const Test(const {
+ const Test('Redirecting factory', const {
'main.dart': '''
class C {
factory C() = Object;
@@ -226,7 +239,7 @@
main() => new C();'''
}),
- const Test(const {
+ const Test('Redirecting factory with optional arguments', const {
'main.dart': '''
abstract class C implements List {
factory C([_]) = List;
@@ -234,27 +247,28 @@
main() => new C();'''
}),
- const Test(const {
+ const Test('Constructed constant using its default values.', const {
'main.dart': '''
main() => const Duration();
''',
}),
- const Test(const {
- 'main.dart': '''
+ const Test('Call forwarding constructor on named mixin application',
+ const {
+ 'main.dart': '''
import 'dart:collection';
main() => new UnmodifiableListView(null);
''',
}),
- const Test(const {
+ const Test('Function reference constant', const {
'main.dart': '''
var myIdentical = identical;
main() => myIdentical;
''',
}),
- const Test(const {
+ const Test('Super method call', const {
'main.dart': '''
class Foo {
String toString() => super.toString();
@@ -264,18 +278,53 @@
}
''',
}),
+
+ const Test('Call forwarding constructor on named mixin application, no args.',
+ const {
+ 'main.dart': '''
+import 'lib.dart';
+main() => new C();
+''',
+ }, preserializedSourceFiles: const {
+ 'lib.dart': '''
+class M {}
+class S {}
+class C = S with M;
+''',
+ }),
+
+ const Test('Call forwarding constructor on named mixin application, one arg.',
+ const {
+ 'main.dart': '''
+import 'lib.dart';
+main() => new C(0);
+''',
+ }, preserializedSourceFiles: const {
+ 'lib.dart': '''
+class M {}
+class S {
+ S(a);
+}
+class C = S with M;
+''',
+ }),
];
class Test {
+ final String name;
final Map sourceFiles;
+ final Map preserializedSourceFiles;
final int expectedErrorCount;
final int expectedWarningCount;
final int expectedHintCount;
final int expectedInfoCount;
- const Test(this.sourceFiles, {
- this.expectedErrorCount: 0,
- this.expectedWarningCount: 0,
- this.expectedHintCount: 0,
- this.expectedInfoCount: 0});
+ const Test(
+ this.name,
+ this.sourceFiles,
+ {this.preserializedSourceFiles,
+ this.expectedErrorCount: 0,
+ this.expectedWarningCount: 0,
+ this.expectedHintCount: 0,
+ this.expectedInfoCount: 0});
}
diff --git a/tests/corelib/corelib.status b/tests/corelib/corelib.status
index 9757816..60be0ba 100644
--- a/tests/corelib/corelib.status
+++ b/tests/corelib/corelib.status
@@ -14,7 +14,7 @@
string_from_environment3_test: Skip
string_from_environment_test: Skip
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app) ]
+[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) ]
unicode_test: Fail # Bug 6706
compare_to2_test: Fail # Bug 4018
@@ -30,7 +30,7 @@
string_case_test/01: Fail # Bug 18061
# #void should be a valid symbol.
-[ $compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2js ]
+[ $compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit || $compiler == dart2js ]
symbol_reserved_word_test/02: CompileTimeError # bug 20191
symbol_reserved_word_test/05: CompileTimeError # bug 20191
@@ -57,7 +57,7 @@
int_modulo_arith_test/bignum: RuntimeError # No bigints.
int_modulo_arith_test/modPow: RuntimeError # No bigints.
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app) && $runtime != dartium && $runtime != drt ]
+[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && $runtime != dartium && $runtime != drt ]
symbol_test/02: MissingCompileTimeError # bug 11669
symbol_test/03: MissingCompileTimeError # bug 11669
@@ -154,10 +154,10 @@
# The regexp tests are not verified to work on non d8/vm platforms yet.
regexp/*: Skip
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
regexp/global_test: Skip # Timeout. Issue 21709 and 21708
-[ $runtime != vm && $runtime != dart_precompiled && $runtime != dart_product && $compiler != dart2analyzer]
+[ $runtime != vm && $runtime != dart_precompiled && $runtime != dart_app && $compiler != dart2analyzer]
data_resource_test: RuntimeError # Issue 23825 (not implemented yet).
file_resource_test: Skip, OK # VM specific test, uses dart:io.
http_resource_test: Skip, OK # VM specific test, uses dart:io.
@@ -168,7 +168,7 @@
[ $mode == debug ]
regexp/pcre_test: Pass, Slow # Timeout. Issue 22008
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) && $arch == simarmv5te ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $arch == simarmv5te ]
int_parse_radix_test/*: Pass, Slow
big_integer_parsed_mul_div_vm_test: Pass, Slow
@@ -201,7 +201,7 @@
big_integer_parsed_mul_div_vm_test: Pass, Timeout # --no_intrinsify
int_parse_radix_test: Pass, Timeout # --no_intrinsify
-[ $compiler == precompiler || $runtime == dart_product ]
+[ $compiler == precompiler || $runtime == dart_app ]
data_resource_test: Skip # Resolve URI not supported yet in product mode.
package_resource_test: Skip # Resolve URI not supported yet in product mode.
file_resource_test: Skip # Resolve URI not supported yet in product mode.
diff --git a/tests/html/html.status b/tests/html/html.status
index dfd1a25..d39e5b9 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -364,7 +364,7 @@
# 'html' tests import the HTML library, so they only make sense in
# a browser environment.
-[ $runtime == vm || $runtime == dart_precompiled || $runtime == dart_product ]
+[ $runtime == vm || $runtime == dart_precompiled || $runtime == dart_app ]
*: Skip
[ $compiler == dart2js && ($runtime == drt || $runtime == ff) ]
diff --git a/tests/isolate/isolate.status b/tests/isolate/isolate.status
index 59748da..d9976d3 100644
--- a/tests/isolate/isolate.status
+++ b/tests/isolate/isolate.status
@@ -2,17 +2,17 @@
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
browser/*: SkipByDesign # Browser specific tests
isolate_stress_test: Skip # Issue 12588: Uses dart:html. This should be able to pass when we have wrapper-less tests.
[ $runtime != vm || $mode == product ]
checked_test: Skip # Unsupported.
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) && $arch == mips && $mode == debug ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $arch == mips && $mode == debug ]
mandel_isolate_test: Skip # Uses 600 MB Ram on our 1 GB test device.
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app) ]
+[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) ]
compile_time_error_test/01: Skip # Issue 12587
ping_test: Skip # Resolve test issues
ping_pause_test: Skip # Resolve test issues
@@ -157,27 +157,44 @@
spawn_function_custom_class_test: SkipByDesign
spawn_function_test: SkipByDesign
stacktrace_message_test: SkipByDesign
-stacktrace_message_test: SkipByDesign
static_function_test: SkipByDesign
unresolved_ports_test: SkipByDesign
-[ $runtime == dart_precompiled || $runtime == dart_product ]
-deferred_in_isolate_test: Skip # Isolate.spawnUri
+[ $runtime == dart_precompiled || $runtime == dart_app ]
+count_test: Skip # Isolate.spawnUri
+cross_isolate_message_test: Skip # Isolate.spawnUri
deferred_in_isolate2_test: Skip # Isolate.spawnUri
-exit_at_spawnuri_test: Skip # Isolate.spawnUri
-error_exit_at_spawnuri_test: Skip # Isolate.spawnUri
-issue_24243_parent_isolate_test: Skip # Isolate.spawnUri
-issue_21398_parent_isolate1_test: Skip # Isolate.spawnUri
-spawn_uri_exported_main_test: Skip # Isolate.spawnUri
-spawn_uri_test: Skip # Isolate.spawnUri
-spawn_uri_nested_vm_test: Skip # Isolate.spawnUri
deferred_in_isolate_test: Skip # Isolate.spawnUri
-spawn_uri_multi_test: Skip # Isolate.spawnUri
-spawn_uri_vm_test: Skip # Isolate.spawnUri
-issue_21398_parent_isolate_test: Skip # Isolate.spawnUri
+deferred_in_isolate_test: Skip # Isolate.spawnUri
error_at_spawnuri_test: Skip # Isolate.spawnUri
+error_exit_at_spawnuri_test: Skip # Isolate.spawnUri
+exit_at_spawnuri_test: Skip # Isolate.spawnUri
+illegal_msg_function_test: Skip # Isolate.spawnUri
+illegal_msg_mirror_test: Skip # Isolate.spawnUri
+isolate_complex_messages_test: Skip # Isolate.spawnUri
+issue_21398_parent_isolate1_test: Skip # Isolate.spawnUri
+issue_21398_parent_isolate_test: Skip # Isolate.spawnUri
+issue_24243_parent_isolate_test: Skip # Isolate.spawnUri
+mandel_isolate_test: Skip # Isolate.spawnUri
+message2_test: Skip # Isolate.spawnUri
+message_test: Skip # Isolate.spawnUri
+mint_maker_test: Skip # Isolate.spawnUri
+nested_spawn2_test: Skip # Isolate.spawnUri
+nested_spawn_test: Skip # Isolate.spawnUri
+raw_port_test: Skip # Isolate.spawnUri
+request_reply_test: Skip # Isolate.spawnUri
+spawn_function_custom_class_test: Skip # Isolate.spawnUri
+spawn_function_test: Skip # Isolate.spawnUri
+spawn_uri_exported_main_test: Skip # Isolate.spawnUri
spawn_uri_missing_from_isolate_test: Skip # Isolate.spawnUri
spawn_uri_missing_test: Skip # Isolate.spawnUri
+spawn_uri_multi_test: Skip # Isolate.spawnUri
+spawn_uri_nested_vm_test: Skip # Isolate.spawnUri
+spawn_uri_test: Skip # Isolate.spawnUri
+spawn_uri_vm_test: Skip # Isolate.spawnUri
+stacktrace_message_test: Skip # Isolate.spawnUri
+static_function_test: Skip # Isolate.spawnUri
+unresolved_ports_test: Skip # Isolate.spawnUri
[ $mode == product ]
issue_24243_parent_isolate_test: Skip # Requires checked mode
diff --git a/tests/language/language.status b/tests/language/language.status
index b64df81..d744e27 100644
--- a/tests/language/language.status
+++ b/tests/language/language.status
@@ -5,7 +5,7 @@
# This directory contains tests that are intended to show the
# current state of the language.
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app) ]
+[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) ]
tearoff_constructor_basic_test: Skip # Crashes in checked mode -- hausner investigating
# These tests are skipped in the VM because it has "--supermixin"
@@ -53,17 +53,17 @@
generic_methods_function_type_test: CompiletimeError # Issue 25869
generic_methods_type_expression_test: CompiletimeError # Issue 25869
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app) && ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) ]
+[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
class_keyword_test/02: MissingCompileTimeError # Issue 13627
unicode_bom_test: Fail # Issue 16067
vm/debug_break_enabled_vm_test/01: Crash, OK # Expected to hit breakpoint.
try_catch_optimized1_test: Skip # Srdjan investigating
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app) && $checked ]
+[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && $checked ]
type_variable_bounds4_test/01: Fail # Issue 14006
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app) && (($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) || $runtime == drt || $runtime == dartium) ]
+[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && (($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) || $runtime == drt || $runtime == dartium) ]
dynamic_prefix_core_test/none: Fail # Issue 12478
export_ambiguous_main_negative_test: Fail # Issue 14763
@@ -111,22 +111,22 @@
[ $compiler == none && $runtime == drt ]
disassemble_test: Pass, Fail # Issue 18122
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) && $arch == mips && $mode == debug ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $arch == mips && $mode == debug ]
large_class_declaration_test: SkipSlow # Times out. Issue 20352
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) && $arch == arm64 ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $arch == arm64 ]
large_class_declaration_test: SkipSlow # Uses too much memory.
[ $compiler == none && ($runtime == dartium || $runtime == drt) && $mode == debug ]
large_class_declaration_test: SkipSlow # Times out. Issue 20352
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) && ( $arch == simarm || $arch == arm || $arch == simarmv6 || $arch == armv6 || $arch == simarmv5te || $arch == armv5te || $arch == simarm64 || $arch == arm64 || $arch == simmips || $arch == mips) ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && ( $arch == simarm || $arch == arm || $arch == simarmv6 || $arch == armv6 || $arch == simarmv5te || $arch == armv5te || $arch == simarm64 || $arch == arm64 || $arch == simmips || $arch == mips) ]
vm/load_to_load_unaligned_forwarding_vm_test: Pass, Crash # Unaligned offset. Issue 22151
[ $compiler == none && ($runtime == dartium || $runtime == drt) ]
issue23244_test: Fail # Issue 23244
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app) && (($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) || $runtime == drt || $runtime == dartium) && $arch == ia32 ]
+[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && (($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) || $runtime == drt || $runtime == dartium) && $arch == ia32 ]
vm/regress_24517_test: Pass, Fail # Issue 24517.
[ $noopt || $compiler == precompiler ]
@@ -162,7 +162,7 @@
super_getter_setter_test: SkipByDesign
vm/reflect_core_vm_test: SkipByDesign
-[ $noopt || $compiler == precompiler || $compiler == dart2app || $mode == product ]
+[ $noopt || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit || $mode == product ]
# Deferred loading happens eagerly
regress_23408_test: Skip
deferred_inheritance_constraints_test: Skip
@@ -173,7 +173,7 @@
deferred_constraints_type_annotation_test/new_before_load: Skip
regress_22443_test: Skip
-[ $compiler == precompiler || $compiler == dart2app ]
+[ $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit ]
ct_const2_test: Skip # Incompatible flag: --compile_all
hello_dart_test: Skip # Incompatible flag: --compile_all
@@ -181,7 +181,7 @@
implicit_closure_test: Skip # Incompatible flag: --use_slow_path
deopt_inlined_function_lazy_test: Skip # Incompatible flag: --deoptimize-alot
-[ $noopt || $compiler == precompiler || $compiler == dart2app ]
+[ $noopt || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit ]
vm/type_vm_test: RuntimeError # Expects line and column numbers
vm/type_cast_vm_test: RuntimeError # Expects line and column numbers
@@ -201,17 +201,17 @@
vm/type_vm_test: Fail,OK # Expects exact type name.
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app) && $browser ]
+[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && $browser ]
# The following tests are supposed to fail.
library_env_test/has_io_support: RuntimeError, OK
library_env_test/has_no_html_support: RuntimeError, OK
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app) && $browser != true ]
+[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && $browser != true ]
# The following tests are supposed to fail.
library_env_test/has_html_support: RuntimeError, OK
library_env_test/has_no_io_support: RuntimeError, OK
-[ ($compiler == none || $compiler == dart2app) && $noopt == false && $mode != product ]
+[ ($compiler == none || $compiler == dart2app || $compiler == dart2appjit) && $noopt == false && $mode != product ]
# The following tests are supposed to fail.
library_env_test/has_no_mirror_support: RuntimeError, OK
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index d6abe8f..07ac39b 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -186,12 +186,12 @@
# 'js' tests import the dart:js library, so they only make sense in
# a browser environment.
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
js/*: Skip
# 'js' tests import the dart:js library, so they only make sense in
# a browser environment.
-[ $runtime == dart_product ]
+[ $runtime == dart_app ]
js/*: SkipByDesign
mirrors/*: SkipByDesign
@@ -229,12 +229,12 @@
# TODO(efortuna): Investigate.
async/timer_test: Fail, Pass
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
async/timer_not_available_test: Fail, OK
mirrors/native_class_test: Fail, OK # This test is meant to run in a browser.
mirrors/deferred_type_test: CompileTimeError, OK # Don't have a multitest marker for dynamic compile time errors.
-[ $compiler == none || $compiler == precompiler || $compiler == dart2app ]
+[ $compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit ]
async/timer_not_available_test: SkipByDesign # only meant to test when there is no way to implement timer (currently only in d8)
mirrors/symbol_validation_test: RuntimeError # Issue 13596
@@ -300,7 +300,7 @@
[ $compiler == dart2js && $mode == debug ]
mirrors/native_class_test: Pass, Slow
-[ ($compiler == none || $compiler == precompiler || $compiler == dart2app) && $arch == mips ]
+[ ($compiler == none || $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit) && $arch == mips ]
async/timer_regress22626_test: Pass, RuntimeError # Issue 22626
[ $arch == simarm || $arch == simarmv6 || $arch == simarmv5te ]
@@ -323,13 +323,13 @@
[ $mode == debug && $arch == ia32 && $system == windows ]
convert/streamed_conversion_json_utf8_decode_test: Skip # Verification OOM.
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) && $mode == debug && $arch == x64 && $system == windows ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $mode == debug && $arch == x64 && $system == windows ]
convert/streamed_conversion_json_utf8_decode_test: Pass, Slow
[ $mode == debug && $arch != ia32 && $arch != x64 && $arch != simarm && $arch != simarmv6 && $arch != simarmv5te ]
convert/streamed_conversion_json_utf8_decode_test: Skip # Verification not yet implemented.
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) && $mode == debug && $builder_tag == asan ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $mode == debug && $builder_tag == asan ]
mirrors/immutable_collections_test: SkipSlow # Timeout.
convert/streamed_conversion_json_utf8_decode_test: Skip # Timeout.
diff --git a/tests/standalone/io/socket_bind_test.dart b/tests/standalone/io/socket_bind_test.dart
index 9c4e1ed..084280d 100644
--- a/tests/standalone/io/socket_bind_test.dart
+++ b/tests/standalone/io/socket_bind_test.dart
@@ -63,15 +63,17 @@
Future testBindDifferentAddresses(InternetAddress addr1,
InternetAddress addr2,
bool addr1V6Only,
- bool addr2V6Only) {
+ bool addr2V6Only) async {
+ int freePort = await freeIPv4AndIPv6Port();
+
asyncStart();
return ServerSocket.bind(
- addr1, 0, v6Only: addr1V6Only, shared: false).then((socket) {
+ addr1, freePort, v6Only: addr1V6Only, shared: false).then((socket) {
Expect.isTrue(socket.port > 0);
asyncStart();
return ServerSocket.bind(
- addr2, socket.port, v6Only: addr2V6Only, shared: false).then((socket2) {
+ addr2, freePort, v6Only: addr2V6Only, shared: false).then((socket2) {
Expect.equals(socket.port, socket2.port);
return Future.wait([
@@ -110,7 +112,25 @@
asyncEnd();
}
-void main() {
+Future<int> freeIPv4AndIPv6Port() async {
+ var socket =
+ await ServerSocket.bind(InternetAddress.ANY_IP_V6, 0, v6Only: false);
+ int port = socket.port;
+ await socket.close();
+ return port;
+}
+
+main() async {
+ asyncStart();
+ await testBindDifferentAddresses(InternetAddress.ANY_IP_V6,
+ InternetAddress.ANY_IP_V4,
+ true,
+ false);
+ await testBindDifferentAddresses(InternetAddress.ANY_IP_V4,
+ InternetAddress.ANY_IP_V6,
+ false,
+ true);
+
for (var host in ['127.0.0.1', '::1']) {
testBindShared(host, false);
testBindShared(host, true);
@@ -123,16 +143,5 @@
testListenCloseListenClose(host);
}
-
- asyncStart();
- testBindDifferentAddresses(InternetAddress.ANY_IP_V6,
- InternetAddress.ANY_IP_V4,
- true,
- false).then((_) {
- testBindDifferentAddresses(InternetAddress.ANY_IP_V4,
- InternetAddress.ANY_IP_V6,
- false,
- true);
- asyncEnd();
- });
+ asyncEnd();
}
diff --git a/tests/standalone/standalone.status b/tests/standalone/standalone.status
index 975dad7..4ab080c 100644
--- a/tests/standalone/standalone.status
+++ b/tests/standalone/standalone.status
@@ -18,15 +18,15 @@
issue14236_test: Pass # Do not remove this line. It serves as a marker for Issue 14516 comment #4.
-[ ($runtime != vm && $runtime != dart_precompiled && $runtime != dart_product) && ($runtime != drt || $compiler != none)) ]
+[ ($runtime != vm && $runtime != dart_precompiled && $runtime != dart_app) && ($runtime != drt || $compiler != none)) ]
no_assert_test: Fail, OK # This is testing a vm flag.
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
package/package_isolate_test: Fail # Issue 12474
io/observatory_test: Fail
package/scenarios/invalid/same_package_twice_test: Pass # Issue 24119
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) && $checked ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $checked ]
# These tests have type errors on purpose.
io/process_invalid_arguments_test: Fail, OK
io/directory_invalid_arguments_test: Fail, OK
@@ -39,7 +39,7 @@
io/file_fuzz_test: Skip
io/directory_fuzz_test: Skip
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) && $system == macos ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $system == macos ]
# This test fails with "Too many open files" on the Mac OS buildbot.
# This is expected as MacOS by default runs with a very low number
# of allowed open files ('ulimit -n' says something like 256).
@@ -112,7 +112,7 @@
[ $compiler == dart2js && $cps_ir && $checked ]
*: Skip # `assert` not implemented
-[ ($runtime == vm || $runtime == dart_product) && ($arch == arm || $arch == arm64) ]
+[ ($runtime == vm || $runtime == dart_app) && ($arch == arm || $arch == arm64) ]
io/file_stream_test: Skip # Issue 26109
io/file_typed_data_test: Skip # Issue 26109
io/file_input_stream_test: Skip # Issue 26109
@@ -186,13 +186,13 @@
[ $arch != ia32 && $arch != x64 && $arch != simarm && $arch != simarmv5te && $mode == debug ]
verified_mem_test: Skip # Not yet implemented.
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) && $mode == debug && $builder_tag == asan ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) && $mode == debug && $builder_tag == asan ]
full_coverage_test: Skip # Timeout.
io/file_lock_test: Skip # Timeout.
io/test_runner_test: Skip # Timeout.
io/http_client_stays_alive_test: Skip # Timeout.
-[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_product) ]
+[ ($runtime == vm || $runtime == dart_precompiled || $runtime == dart_app) ]
# Failures in secure networking while NSS is replaced with BoringSSL
io/https_client_certificate_test: RuntimeError # Issue 24070
io/secure_socket_renegotiate_test: RuntimeError
@@ -209,6 +209,8 @@
[ $noopt || $compiler == precompiler ]
map_insert_remove_oom_test: Skip # Heap limit too low. Increasing iteration count to make a higher limit a meaningful test makes it too slow for simarm[64] bots.
io/web_socket_test: Pass, RuntimeError # Issue 24674
+
+[ $noopt || $compiler == precompiler || $compiler == dart2appjit ]
io/test_extension_test: Skip # Platform.executable
io/test_extension_fail_test: Skip # Platform.executable
io/platform_test: Skip # Platform.executable
@@ -216,13 +218,13 @@
full_coverage_test: Skip # Platform.executable
regress_26031_test: Skip # Platform.resolvedExecutable
-[ $compiler == precompiler || $compiler == dart2app ]
+[ $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit ]
io/compile_all_test: Skip # Incompatible flag --compile_all
-[ $runtime == dart_product ]
+[ $runtime == dart_app ]
io/stdout_bad_argument_test: Skip # Test exits and so can't generate snapshot.
-[ $runtime == dart_precompiled || $runtime == dart_product ]
+[ $runtime == dart_precompiled || $runtime == dart_app ]
full_coverage_test: Skip # Platform.executable
http_launch_test: Skip # Platform.executable
io/addlatexhash_test: Skip # Platform.executable
@@ -258,7 +260,7 @@
io/regress_7679_test: Skip # Platform.executable
io/process_*: Skip # Most use Platform.executable
-[ $runtime == dart_precompiled || $runtime == dart_product || $mode == product ]
+[ $runtime == dart_precompiled || $runtime == dart_app || $mode == product ]
debugger/*: Skip
assert_test: SkipByDesign # Requires checked mode.
no_assert_test: SkipByDesign # Requires checked mode.
@@ -278,8 +280,8 @@
no_support_service_test: SkipByDesign
no_support_timeline_test: SkipByDesign
-# Following tests are skipped on dart_product as package mapping is not supported.
-[ $runtime == dart_precompiled || $runtime == dart_product ]
+# Following tests are skipped on dart_app as package mapping is not supported.
+[ $runtime == dart_precompiled || $runtime == dart_app ]
package/scenarios/packages_file_strange_formatting/mixed_line_ends_test: Skip
package/scenarios/packages_file_strange_formatting/empty_lines_test: Skip
package/scenarios/invalid/invalid_utf8_test: Skip
diff --git a/tools/VERSION b/tools/VERSION
index 7b28ec1..56c1ccb 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 1
MINOR 17
PATCH 0
-PRERELEASE 5
+PRERELEASE 6
PRERELEASE_PATCH 0
diff --git a/tools/precompilation/test_linux.sh b/tools/precompilation/test_linux.sh
deleted file mode 100755
index 056fde0..0000000
--- a/tools/precompilation/test_linux.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-
-set -ex
-
-# Usage:
-# cd sdk
-# ./tools/precompilation/test_linux.sh <dart-script-file>
-
-./tools/build.py -mdebug -ax64 runtime
-
-./out/DebugX64/dart_bootstrap --gen-precompiled-snapshot --package-root=out/DebugX64/packages/ "$1"
-
-gcc -nostartfiles -m64 -shared -Wl,-soname,libprecompiled.so -o libprecompiled.so precompiled.S
-
-gdb -ex run --args ./out/DebugX64/dart_precompiled_runtime --run-precompiled-snapshot=$PWD not_used.dart
diff --git a/tools/precompilation/test_linux_simarm.sh b/tools/precompilation/test_linux_simarm.sh
deleted file mode 100755
index 13d09eb..0000000
--- a/tools/precompilation/test_linux_simarm.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-
-set -ex
-
-# Usage:
-# cd sdk
-# ./tools/precompilation/test_linux.sh <dart-script-file>
-
-./tools/build.py -mdebug -asimarm runtime
-
-./out/DebugSIMARM/dart_bootstrap --gen-precompiled-snapshot --package-root=out/DebugX64/packages/ "$1"
-
-gcc -nostartfiles -m32 -shared -Wl,-soname,libprecompiled.so -o libprecompiled.so precompiled.S
-
-gdb -ex run --args ./out/DebugSIMARM/dart_precompiled_runtime --run-precompiled-snapshot=$PWD not_used.dart
diff --git a/tools/precompilation/test_macos.sh b/tools/precompilation/test_macos.sh
deleted file mode 100755
index 1b97e36..0000000
--- a/tools/precompilation/test_macos.sh
+++ /dev/null
@@ -1,15 +0,0 @@
-#!/usr/bin/env bash
-
-set -ex
-
-# Usage:
-# cd sdk
-# ./tools/precompilation/test_macos.sh <dart-script-file>
-
-./tools/build.py -mdebug -ax64 runtime
-
-./xcodebuild/DebugX64/dart_bootstrap --gen-precompiled-snapshot --package-root=xcodebuild/DebugX64/packages/ "$1"
-
-clang -nostartfiles -m64 -dynamiclib -o libprecompiled.dylib precompiled.S
-
-lldb -- ./xcodebuild/DebugX64/dart_precompiled_runtime --run-precompiled-snapshot=$PWD not_used.dart
diff --git a/tools/testing/dart/compiler_configuration.dart b/tools/testing/dart/compiler_configuration.dart
index 5781e83..398986a 100644
--- a/tools/testing/dart/compiler_configuration.dart
+++ b/tools/testing/dart/compiler_configuration.dart
@@ -74,6 +74,9 @@
case 'dart2app':
return new Dart2AppSnapshotCompilerConfiguration(
isDebug: isDebug, isChecked: isChecked);
+ case 'dart2appjit':
+ return new Dart2AppJitSnapshotCompilerConfiguration(
+ isDebug: isDebug, isChecked: isChecked, useBlobs: useBlobs);
case 'precompiler':
return new PrecompilerCompilerConfiguration(
isDebug: isDebug,
@@ -552,6 +555,37 @@
}
}
+class Dart2AppJitSnapshotCompilerConfiguration extends Dart2AppSnapshotCompilerConfiguration {
+ final bool useBlobs;
+ Dart2AppJitSnapshotCompilerConfiguration({bool isDebug, bool isChecked, bool useBlobs})
+ : super(isDebug: isDebug, isChecked: isChecked), this.useBlobs = useBlobs;
+
+ CompilationCommand computeCompilationCommand(
+ String tempDir,
+ String buildDir,
+ CommandBuilder commandBuilder,
+ List arguments,
+ Map<String, String> environmentOverrides) {
+ var exec = "$buildDir/dart";
+ var args = new List();
+ args.add("--snapshot=$tempDir");
+ args.add("--snapshot-kind=app-jit-after-run");
+ if (useBlobs) {
+ args.add("--use-blobs");
+ }
+ args.addAll(arguments);
+
+ return commandBuilder.getCompilationCommand(
+ 'dart2snapshot',
+ tempDir,
+ !useSdk,
+ bootstrapDependencies(buildDir),
+ exec,
+ args,
+ environmentOverrides);
+ }
+}
+
class AnalyzerCompilerConfiguration extends CompilerConfiguration {
AnalyzerCompilerConfiguration(
{bool isDebug, bool isChecked, bool isHostChecked, bool useSdk})
diff --git a/tools/testing/dart/runtime_configuration.dart b/tools/testing/dart/runtime_configuration.dart
index 822700f..8c10e10 100644
--- a/tools/testing/dart/runtime_configuration.dart
+++ b/tools/testing/dart/runtime_configuration.dart
@@ -50,8 +50,8 @@
case 'vm':
return new StandaloneDartRuntimeConfiguration();
- case 'dart_product':
- return new DartProductRuntimeConfiguration();
+ case 'dart_app':
+ return new DartAppRuntimeConfiguration(useBlobs: useBlobs);
case 'dart_precompiled':
if (configuration['system'] == 'android') {
@@ -224,7 +224,10 @@
}
}
-class DartProductRuntimeConfiguration extends DartVmRuntimeConfiguration {
+class DartAppRuntimeConfiguration extends DartVmRuntimeConfiguration {
+ final bool useBlobs;
+ DartAppRuntimeConfiguration({bool useBlobs}) : useBlobs = useBlobs;
+
List<Command> computeRuntimeCommands(
TestSuite suite,
CommandBuilder commandBuilder,
@@ -234,11 +237,14 @@
String script = artifact.filename;
String type = artifact.mimeType;
if (script != null && type != 'application/dart-snapshot') {
- throw "dart_product cannot run files of type '$type'.";
+ throw "dart_app cannot run files of type '$type'.";
}
var augmentedArgs = new List();
augmentedArgs.add("--run-app-snapshot=${artifact.filename}");
+ if (useBlobs) {
+ augmentedArgs.add("--use-blobs");
+ }
augmentedArgs.addAll(arguments);
return <Command>[
diff --git a/tools/testing/dart/test_options.dart b/tools/testing/dart/test_options.dart
index dfca779..c5c6e34 100644
--- a/tools/testing/dart/test_options.dart
+++ b/tools/testing/dart/test_options.dart
@@ -73,9 +73,9 @@
(only valid with the following runtimes: none)
dart2app: Compile the Dart code into an app snapshot before running the test
- (only valid with the following runtimes: dart_product)''',
+ (only valid with the following runtimes: dart_app)''',
['-c', '--compiler'],
- ['none', 'precompiler', 'dart2js', 'dart2analyzer', 'dart2app'],
+ ['none', 'precompiler', 'dart2js', 'dart2analyzer', 'dart2app', 'dart2appjit'],
'none'),
// TODO(antonm): fix the option drt.
new _TestOptionSpecification(
@@ -86,7 +86,7 @@
dart_precompiled: Run a precompiled snapshot on a variant of the standalone
dart vm lacking a JIT.
- dart_product: Run a full app snapshot in product mode.
+ dart_app: Run a full app snapshot, with or without cached unoptimized code.
d8: Run JavaScript from the command line using v8.
@@ -111,7 +111,7 @@
[
'vm',
'dart_precompiled',
- 'dart_product',
+ 'dart_app',
'd8',
'jsshell',
'drt',
@@ -645,7 +645,10 @@
validRuntimes = const ['none'];
break;
case 'dart2app':
- validRuntimes = const ['dart_product'];
+ validRuntimes = const ['dart_app'];
+ break;
+ case 'dart2appjit':
+ validRuntimes = const ['dart_app'];
break;
case 'precompiler':
validRuntimes = const ['dart_precompiled'];
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index ca8b8c8..8bc8e9a 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -1763,11 +1763,11 @@
}
List<List<String>> getVmOptions(Map optionsFromFile) {
- var COMPILERS = const ['none', 'precompiler', 'dart2app'];
+ var COMPILERS = const ['none', 'precompiler', 'dart2app', 'dart2appjit'];
var RUNTIMES = const [
'none',
'dart_precompiled',
- 'dart_product',
+ 'dart_app',
'vm',
'drt',
'dartium',
@@ -2183,7 +2183,9 @@
}
static deleteTempSnapshotDirectory(Map configuration) {
- if (configuration['compiler'] == 'dart2app') {
+ if (configuration['compiler'] == 'dart2app' ||
+ configuration['compiler'] == 'dart2appjit' ||
+ configuration['compiler'] == 'precompiler') {
var checked = configuration['checked'] ? '-checked' : '';
var minified = configuration['minified'] ? '-minified' : '';
var csp = configuration['csp'] ? '-csp' : '';