Version 1.21.0-dev.11.0
Merge commit '0f9a78ff53f60101a954f2d9b20028083e6faf80' into dev
diff --git a/DEPS b/DEPS
index 685fbc7..44e124f 100644
--- a/DEPS
+++ b/DEPS
@@ -57,8 +57,8 @@
"csslib_tag" : "@0.13.2",
"dart2js_info_tag" : "@0.5.0",
"dart_services_rev" : "@7aea2574e6f3924bf409a80afb8ad52aa2be4f97",
- "dart_style_rev": "@a2b84e46a9e4044e61e3cc130087c18da40b9665",
- "dartdoc_tag" : "@v0.9.7+6",
+ "dart_style_tag": "@0.2.13",
+ "dartdoc_tag" : "@v0.9.8",
"fixnum_tag": "@0.10.5",
"func_tag": "@0.1.0",
"glob_tag": "@1.1.3",
@@ -203,7 +203,7 @@
(Var("github_mirror") % "dart-services") +
Var("dart_services_rev"),
Var("dart_root") + "/third_party/pkg_tested/dart_style":
- (Var("github_mirror") % "dart_style") + Var("dart_style_rev"),
+ (Var("github_mirror") % "dart_style") + Var("dart_style_tag"),
Var("dart_root") + "/third_party/pkg/dart2js_info":
(Var("github_mirror") % "dart2js_info") + Var("dart2js_info_tag"),
Var("dart_root") + "/third_party/pkg/dartdoc":
diff --git a/README.md b/README.md
index a95407c..e2a2f1e 100644
--- a/README.md
+++ b/README.md
@@ -14,7 +14,7 @@
## Building Dart
-Learn how to [get the source](https://github.com/dart-lang/sdk/wiki/Getting-The-Source)
+Learn how to [get the source](https://github.com/dart-lang/sdk/wiki/Building#getting-the-source)
and [prepare your machine to build the SDK](https://github.com/dart-lang/sdk/wiki/Preparing-your-machine-to-build-the-Dart-SDK).
There are more documents on our [wiki](https://github.com/dart-lang/sdk/wiki).
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index 076e01c..e179dda 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -801,6 +801,10 @@
* Dart file or cannot be resolved.
*/
Future<CompilationUnit> getResolvedCompilationUnit(String path) async {
+ if (options.enableNewAnalysisDriver) {
+ nd.AnalysisResult result = await getAnalysisResult(path);
+ return result?.unit;
+ }
ContextSourcePair contextSource = getContextSourcePair(path);
AnalysisContext context = contextSource.context;
if (context == null) {
diff --git a/pkg/analysis_server/lib/src/context_manager.dart b/pkg/analysis_server/lib/src/context_manager.dart
index 47293f7..19737b8 100644
--- a/pkg/analysis_server/lib/src/context_manager.dart
+++ b/pkg/analysis_server/lib/src/context_manager.dart
@@ -676,6 +676,65 @@
}
/**
+ * Process [options] for the given context [info].
+ */
+ void processOptionsForDriver(ContextInfo info, Map<String, Object> options,
+ {bool optionsRemoved: false}) {
+ if (options == null && !optionsRemoved) {
+ return;
+ }
+ AnalysisOptions analysisOptions = info.analysisDriver.analysisOptions;
+
+ // In case options files are removed, revert to defaults.
+ if (optionsRemoved) {
+ // Start with defaults.
+ analysisOptions.resetToDefaults();
+
+ // Apply inherited options.
+ options = _toStringMap(_getEmbeddedOptions(info));
+ if (options != null) {
+ applyToAnalysisOptions(analysisOptions, options);
+ }
+ } else {
+ // Check for embedded options.
+ Map embeddedOptions = _getEmbeddedOptions(info);
+ if (embeddedOptions != null) {
+ options = _toStringMap(new Merger().merge(embeddedOptions, options));
+ }
+ }
+
+ // TODO(brianwilkerson) Figure out what to do here.
+// // Notify options processors.
+// AnalysisEngine.instance.optionsPlugin.optionsProcessors
+// .forEach((OptionsProcessor p) {
+// try {
+// p.optionsProcessed(info.context, options);
+// } catch (e, stacktrace) {
+// AnalysisEngine.instance.logger.logError(
+// 'Error processing analysis options',
+// new CaughtException(e, stacktrace));
+// }
+// });
+
+ applyToAnalysisOptions(analysisOptions, options);
+
+ // Nothing more to do.
+ if (options == null) {
+ return;
+ }
+
+ var analyzer = options[AnalyzerOptions.analyzer];
+ if (analyzer is Map) {
+ // Set ignore patterns.
+ YamlList exclude = analyzer[AnalyzerOptions.exclude];
+ List<String> excludeList = toStringList(exclude);
+ if (excludeList != null) {
+ setIgnorePatternsForContext(info, excludeList);
+ }
+ }
+ }
+
+ /**
* Return the options from the analysis options file in the given [folder]
* if exists, or in one of the parent folders, or `null` if no analysis
* options file is found or if the contents of the file are not valid YAML.
@@ -1105,7 +1164,7 @@
}
if (enableNewAnalysisDriver) {
- // TODO(scheglov) implement for the new analysis driver
+ processOptionsForDriver(info, optionMap);
} else {
processOptionsForContext(info, optionMap);
}
diff --git a/pkg/analysis_server/lib/src/edit/edit_domain.dart b/pkg/analysis_server/lib/src/edit/edit_domain.dart
index 441a9f4..58137c6 100644
--- a/pkg/analysis_server/lib/src/edit/edit_domain.dart
+++ b/pkg/analysis_server/lib/src/edit/edit_domain.dart
@@ -205,21 +205,23 @@
engine.AnalysisErrorInfo errorInfo = server.getErrors(file);
if (errorInfo != null) {
LineInfo lineInfo = errorInfo.lineInfo;
- int requestLine = lineInfo.getLocation(offset).lineNumber;
- for (engine.AnalysisError error in errorInfo.errors) {
- int errorLine = lineInfo.getLocation(error.offset).lineNumber;
- if (errorLine == requestLine) {
- List<Fix> fixes = await computeFixes(server.serverPlugin,
- server.resourceProvider, unit.element.context, error);
- if (fixes.isNotEmpty) {
- AnalysisError serverError =
- newAnalysisError_fromEngine(lineInfo, error);
- AnalysisErrorFixes errorFixes =
- new AnalysisErrorFixes(serverError);
- errorFixesList.add(errorFixes);
- fixes.forEach((fix) {
- errorFixes.fixes.add(fix.change);
- });
+ if (lineInfo != null) {
+ int requestLine = lineInfo.getLocation(offset).lineNumber;
+ for (engine.AnalysisError error in errorInfo.errors) {
+ int errorLine = lineInfo.getLocation(error.offset).lineNumber;
+ if (errorLine == requestLine) {
+ List<Fix> fixes = await computeFixes(server.serverPlugin,
+ server.resourceProvider, unit.element.context, error);
+ if (fixes.isNotEmpty) {
+ AnalysisError serverError =
+ newAnalysisError_fromEngine(lineInfo, error);
+ AnalysisErrorFixes errorFixes =
+ new AnalysisErrorFixes(serverError);
+ errorFixesList.add(errorFixes);
+ fixes.forEach((fix) {
+ errorFixes.fixes.add(fix.change);
+ });
+ }
}
}
}
@@ -634,6 +636,9 @@
* [kind] in the given [file].
*/
Future<Null> _analyzeForRefactoring(String file, RefactoringKind kind) async {
+ if (server.options.enableNewAnalysisDriver) {
+ return;
+ }
// "Extract Local" and "Inline Local" refactorings need only local analysis.
if (kind == RefactoringKind.EXTRACT_LOCAL_VARIABLE ||
kind == RefactoringKind.INLINE_LOCAL_VARIABLE) {
@@ -755,7 +760,11 @@
CompilationUnit unit = await server.getResolvedCompilationUnit(file);
if (unit != null) {
_resetOnAnalysisStarted();
- refactoring = new InlineMethodRefactoring(searchEngine, unit, offset);
+ refactoring =
+ new InlineMethodRefactoring(searchEngine, (Element element) async {
+ String elementPath = element.source.fullName;
+ return await server.getResolvedCompilationUnit(elementPath);
+ }, unit, offset);
}
}
if (kind == RefactoringKind.MOVE_FILE) {
@@ -863,6 +872,9 @@
* But when any other file is changed or analyzed, we can continue.
*/
void _resetOnFileResolutionChanged(String file) {
+ if (server.options.enableNewAnalysisDriver) {
+ return;
+ }
subscriptionToReset?.cancel();
subscriptionToReset = server
.getAnalysisContext(file)
diff --git a/pkg/analysis_server/lib/src/provisional/completion/completion_core.dart b/pkg/analysis_server/lib/src/provisional/completion/completion_core.dart
index 06eb530..b3582c9 100644
--- a/pkg/analysis_server/lib/src/provisional/completion/completion_core.dart
+++ b/pkg/analysis_server/lib/src/provisional/completion/completion_core.dart
@@ -88,6 +88,12 @@
Source get source;
/**
+ * Return the content of the [source] in which the completion is being
+ * requested, or `null` if the content could not be accessed.
+ */
+ String get sourceContents;
+
+ /**
* Throw [AbortCompletion] if the completion request has been aborted.
*/
void checkAborted();
diff --git a/pkg/analysis_server/lib/src/services/completion/completion_core.dart b/pkg/analysis_server/lib/src/services/completion/completion_core.dart
index c43a144..0a8b431 100644
--- a/pkg/analysis_server/lib/src/services/completion/completion_core.dart
+++ b/pkg/analysis_server/lib/src/services/completion/completion_core.dart
@@ -87,12 +87,12 @@
* that can be used to filter the suggestions on the server side.
*/
String get filterText {
- return context
- .getContents(source)
- .data
- .substring(replacementOffset, offset);
+ return sourceContents.substring(replacementOffset, offset);
}
+ @override
+ String get sourceContents => context.getContents(source)?.data;
+
/**
* Abort the current completion request.
*/
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
index ea320be..e00ec2a 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/completion_manager.dart
@@ -226,6 +226,9 @@
}
@override
+ String get sourceContents => context.getContents(source)?.data;
+
+ @override
SourceFactory get sourceFactory {
return context?.sourceFactory ?? result.sourceFactory;
}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
index 5f78297..70b2b44 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart
@@ -211,7 +211,7 @@
// then do not suppress the relevance of private members
var data = request.result != null
? request.result.content
- : request.context.getContents(request.source)?.data;
+ : request.sourceContents;
int offset = request.offset;
if (data != null && 0 < offset && offset <= data.length) {
bool isIdentifierChar(int index) {
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/uri_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/uri_contributor.dart
index 802beae..b2b624d 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/uri_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/uri_contributor.dart
@@ -66,7 +66,7 @@
// Quoted empty string
visitSimpleStringLiteral(uri);
} else {
- String data = request.source.contents.data;
+ String data = request.sourceContents;
if (end == data.length) {
String ch = data[end - 1];
if (ch != '"' && ch != "'") {
@@ -78,7 +78,7 @@
}
}
} else if (offset == start && offset == end) {
- String data = request.source.contents.data;
+ String data = request.sourceContents;
if (end == data.length) {
String ch = data[end - 1];
if (ch == '"' || ch == "'") {
diff --git a/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart b/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
index 486f724..8a0322c 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/inline_method.dart
@@ -191,11 +191,18 @@
}
/**
+ * Completes with the resolved [CompilationUnit] that contains the [element].
+ */
+typedef Future<CompilationUnit> GetResolvedUnitContainingElement(
+ Element element);
+
+/**
* [InlineMethodRefactoring] implementation.
*/
class InlineMethodRefactoringImpl extends RefactoringImpl
implements InlineMethodRefactoring {
final SearchEngine searchEngine;
+ final GetResolvedUnitContainingElement getResolvedUnit;
final CompilationUnit unit;
final int offset;
CorrectionUtils utils;
@@ -218,7 +225,8 @@
List<_ReferenceProcessor> _referenceProcessors = [];
Set<FunctionBody> _alreadyMadeAsync = new Set<FunctionBody>();
- InlineMethodRefactoringImpl(this.searchEngine, this.unit, this.offset) {
+ InlineMethodRefactoringImpl(
+ this.searchEngine, this.getResolvedUnit, this.unit, this.offset) {
utils = new CorrectionUtils(unit);
}
@@ -279,7 +287,7 @@
Future<RefactoringStatus> checkInitialConditions() async {
RefactoringStatus result = new RefactoringStatus();
// prepare method information
- result.addStatus(_prepareMethod());
+ result.addStatus(await _prepareMethod());
if (result.hasFatalError) {
return new Future<RefactoringStatus>.value(result);
}
@@ -301,6 +309,7 @@
_referenceProcessors.clear();
for (SearchMatch reference in references) {
_ReferenceProcessor processor = new _ReferenceProcessor(this, reference);
+ await processor.init();
_referenceProcessors.add(processor);
}
return result;
@@ -327,7 +336,7 @@
/**
* Initializes [_methodElement] and related fields.
*/
- RefactoringStatus _prepareMethod() {
+ Future<RefactoringStatus> _prepareMethod() async {
_methodElement = null;
_methodParameters = null;
_methodBody = null;
@@ -352,7 +361,7 @@
}
_methodElement = element as ExecutableElement;
_isAccessor = element is PropertyAccessorElement;
- _methodUnit = element.unit;
+ _methodUnit = await getResolvedUnit(element);
_methodUtils = new CorrectionUtils(_methodUnit);
// class member
bool isClassMember = element.enclosingElement is ClassElement;
@@ -435,6 +444,7 @@
*/
class _ReferenceProcessor {
final InlineMethodRefactoringImpl ref;
+ final SearchMatch reference;
Element refElement;
CorrectionUtils _refUtils;
@@ -442,10 +452,12 @@
SourceRange _refLineRange;
String _refPrefix;
- _ReferenceProcessor(this.ref, SearchMatch reference) {
+ _ReferenceProcessor(this.ref, this.reference);
+
+ Future<Null> init() async {
refElement = reference.element;
// prepare CorrectionUtils
- CompilationUnit refUnit = refElement.unit;
+ CompilationUnit refUnit = await ref.getResolvedUnit(refElement);
_refUtils = new CorrectionUtils(refUnit);
// prepare node and environment
_node = _refUtils.findNode(reference.sourceRange.offset);
diff --git a/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart b/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
index b4abf87..5cf982f 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/refactoring.dart
@@ -249,8 +249,12 @@
* Returns a new [InlineMethodRefactoring] instance.
*/
factory InlineMethodRefactoring(
- SearchEngine searchEngine, CompilationUnit unit, int offset) {
- return new InlineMethodRefactoringImpl(searchEngine, unit, offset);
+ SearchEngine searchEngine,
+ GetResolvedUnitContainingElement getResolvedUnit,
+ CompilationUnit unit,
+ int offset) {
+ return new InlineMethodRefactoringImpl(
+ searchEngine, getResolvedUnit, unit, offset);
}
/**
diff --git a/pkg/analysis_server/test/services/refactoring/inline_method_test.dart b/pkg/analysis_server/test/services/refactoring/inline_method_test.dart
index bc1d29c..c629f93 100644
--- a/pkg/analysis_server/test/services/refactoring/inline_method_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/inline_method_test.dart
@@ -1712,6 +1712,7 @@
void _createRefactoring(String search) {
int offset = findOffset(search);
- refactoring = new InlineMethodRefactoring(searchEngine, testUnit, offset);
+ refactoring = new InlineMethodRefactoring(
+ searchEngine, (element) async => element.unit, testUnit, offset);
}
}
diff --git a/pkg/analyzer/lib/dart/ast/ast.dart b/pkg/analyzer/lib/dart/ast/ast.dart
index 851890c..c36925f 100644
--- a/pkg/analyzer/lib/dart/ast/ast.dart
+++ b/pkg/analyzer/lib/dart/ast/ast.dart
@@ -461,7 +461,8 @@
*
* Clients may not extend, implement or mix-in this class.
*/
-abstract class AssignmentExpression extends Expression {
+abstract class AssignmentExpression extends Expression
+ implements MethodReferenceExpression {
/**
* Initialize a newly created assignment expression.
*/
@@ -470,15 +471,6 @@
new AssignmentExpressionImpl(leftHandSide, operator, rightHandSide);
/**
- * Return the best element available for this operator. If resolution was able
- * to find a better element based on type propagation, that element will be
- * returned. Otherwise, the element found using the result of static analysis
- * will be returned. If resolution has not been performed, then `null` will be
- * returned.
- */
- MethodElement get bestElement;
-
- /**
* Return the expression used to compute the left hand side.
*/
Expression get leftHandSide;
@@ -499,20 +491,6 @@
void set operator(Token token);
/**
- * Return the element associated with the operator based on the propagated
- * type of the left-hand-side, or `null` if the AST structure has not been
- * resolved, if the operator is not a compound operator, or if the operator
- * could not be resolved.
- */
- MethodElement get propagatedElement;
-
- /**
- * Set the element associated with the operator based on the propagated
- * type of the left-hand-side to the given [element].
- */
- void set propagatedElement(MethodElement element);
-
- /**
* Return the expression used to compute the right hand side.
*/
Expression get rightHandSide;
@@ -522,20 +500,6 @@
* [expression].
*/
void set rightHandSide(Expression expression);
-
- /**
- * Return the element associated with the operator based on the static type of
- * the left-hand-side, or `null` if the AST structure has not been resolved,
- * if the operator is not a compound operator, or if the operator could not be
- * resolved.
- */
- MethodElement get staticElement;
-
- /**
- * Set the element associated with the operator based on the static type of
- * the left-hand-side to the given [element].
- */
- void set staticElement(MethodElement element);
}
/**
@@ -926,7 +890,8 @@
*
* Clients may not extend, implement or mix-in this class.
*/
-abstract class BinaryExpression extends Expression {
+abstract class BinaryExpression extends Expression
+ implements MethodReferenceExpression {
/**
* Initialize a newly created binary expression.
*/
@@ -935,15 +900,6 @@
new BinaryExpressionImpl(leftOperand, operator, rightOperand);
/**
- * Return the best element available for this operator. If resolution was able
- * to find a better element based on type propagation, that element will be
- * returned. Otherwise, the element found using the result of static analysis
- * will be returned. If resolution has not been performed, then `null` will be
- * returned.
- */
- MethodElement get bestElement;
-
- /**
* Return the expression used to compute the left operand.
*/
Expression get leftOperand;
@@ -965,20 +921,6 @@
void set operator(Token token);
/**
- * Return the element associated with the operator based on the propagated
- * type of the left operand, or `null` if the AST structure has not been
- * resolved, if the operator is not user definable, or if the operator could
- * not be resolved.
- */
- MethodElement get propagatedElement;
-
- /**
- * Set the element associated with the operator based on the propagated
- * type of the left operand to the given [element].
- */
- void set propagatedElement(MethodElement element);
-
- /**
* Return the expression used to compute the right operand.
*/
Expression get rightOperand;
@@ -988,20 +930,6 @@
* [expression].
*/
void set rightOperand(Expression expression);
-
- /**
- * Return the element associated with the operator based on the static type of
- * the left operand, or `null` if the AST structure has not been resolved, if
- * the operator is not user definable, or if the operator could not be
- * resolved.
- */
- MethodElement get staticElement;
-
- /**
- * Set the element associated with the operator based on the static type of
- * the left operand to the given [element].
- */
- void set staticElement(MethodElement element);
}
/**
@@ -2429,7 +2357,8 @@
*
* Clients may not extend, implement or mix-in this class.
*/
-abstract class ConstructorName extends AstNode {
+abstract class ConstructorName extends AstNode
+ implements ConstructorReferenceNode {
/**
* Initialize a newly created constructor name. The [period] and [name] can be
* `null` if the constructor being named is the unnamed constructor.
@@ -2461,19 +2390,6 @@
void set period(Token token);
/**
- * Return the element associated with this constructor name based on static
- * type information, or `null` if the AST structure has not been resolved or
- * if this constructor name could not be resolved.
- */
- ConstructorElement get staticElement;
-
- /**
- * Set the element associated with this constructor name based on static type
- * information to the given [element].
- */
- void set staticElement(ConstructorElement element);
-
- /**
* Return the name of the type defining the constructor.
*/
TypeName get type;
@@ -2485,6 +2401,26 @@
}
/**
+ * An AST node that makes reference to a constructor.
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class ConstructorReferenceNode {
+ /**
+ * Return the element associated with the referenced constructor based on
+ * static type information, or `null` if the AST structure has not been
+ * resolved or if the constructor could not be resolved.
+ */
+ ConstructorElement get staticElement;
+
+ /**
+ * Set the element associated with the referenced constructor based on static
+ * type information to the given [element].
+ */
+ void set staticElement(ConstructorElement element);
+}
+
+/**
* A continue statement.
*
* continueStatement ::=
@@ -4192,25 +4128,6 @@
void set propagatedElement(ExecutableElement element);
/**
- * Return the function type of the method invocation based on the propagated
- * type information, or `null` if the AST structure has not been resolved, or
- * if the invoke could not be resolved.
- *
- * This will usually be a [FunctionType], but it can also be an
- * [InterfaceType] with a `call` method, `dynamic`, `Function`, or a `@proxy`
- * interface type that implements `Function`.
- */
- @override
- DartType get propagatedInvokeType;
-
- /**
- * Set the function type of the method invocation based on the propagated type
- * information to the given [type].
- */
- @override
- void set propagatedInvokeType(DartType type);
-
- /**
* Return the element associated with the function being invoked based on
* static type information, or `null` if the AST structure has not been
* resolved or the function could not be resolved.
@@ -4224,25 +4141,6 @@
void set staticElement(ExecutableElement element);
/**
- * Return the function type of the method invocation based on the static type
- * information, or `null` if the AST structure has not been resolved, or if
- * the invoke could not be resolved.
- *
- * This will usually be a [FunctionType], but it can also be an
- * [InterfaceType] with a `call` method, `dynamic`, `Function`, or a `@proxy`
- * interface type that implements `Function`.
- */
- @override
- DartType get staticInvokeType;
-
- /**
- * Set the function type of the method invocation based on the static type
- * information to the given [type].
- */
- @override
- void set staticInvokeType(DartType type);
-
- /**
* Set the type arguments to be applied to the method being invoked to the
* given [typeArguments].
*/
@@ -4781,7 +4679,8 @@
*
* Clients may not extend, implement or mix-in this class.
*/
-abstract class IndexExpression extends Expression {
+abstract class IndexExpression extends Expression
+ implements MethodReferenceExpression {
/**
* Initialize a newly created index expression.
*/
@@ -4815,15 +4714,6 @@
void set auxiliaryElements(AuxiliaryElements elements);
/**
- * Return the best element available for this operator. If resolution was able
- * to find a better element based on type propagation, that element will be
- * returned. Otherwise, the element found using the result of static analysis
- * will be returned. If resolution has not been performed, then `null` will be
- * returned.
- */
- MethodElement get bestElement;
-
- /**
* Return the expression used to compute the index.
*/
Expression get index;
@@ -4863,19 +4753,6 @@
void set period(Token token);
/**
- * Return the element associated with the operator based on the propagated
- * type of the target, or `null` if the AST structure has not been resolved or
- * if the operator could not be resolved.
- */
- MethodElement get propagatedElement;
-
- /**
- * Set the element associated with the operator based on the propagated
- * type of the target to the given [element].
- */
- void set propagatedElement(MethodElement element);
-
- /**
* Return the expression used to compute the object being indexed. If this
* index expression is not part of a cascade expression, then this is the same
* as [target]. If this index expression is part of a cascade expression, then
@@ -4889,19 +4766,6 @@
Token get rightBracket;
/**
- * Return the element associated with the operator based on the static type of
- * the target, or `null` if the AST structure has not been resolved or if the
- * operator could not be resolved.
- */
- MethodElement get staticElement;
-
- /**
- * Set the element associated with the operator based on the static type of
- * the target to the given [element].
- */
- void set staticElement(MethodElement element);
-
- /**
* Return the expression used to compute the object being indexed, or `null`
* if this index expression is part of a cascade expression.
*
@@ -4949,7 +4813,8 @@
*
* Clients may not extend, implement or mix-in this class.
*/
-abstract class InstanceCreationExpression extends Expression {
+abstract class InstanceCreationExpression extends Expression
+ implements ConstructorReferenceNode {
/**
* Initialize a newly created instance creation expression.
*/
@@ -4995,19 +4860,6 @@
* created to the given [token].
*/
void set keyword(Token token);
-
- /**
- * Return the element associated with the constructor based on static type
- * information, or `null` if the AST structure has not been resolved or if the
- * constructor could not be resolved.
- */
- ConstructorElement get staticElement;
-
- /**
- * Set the element associated with the constructor based on static type
- * information to the given [element].
- */
- void set staticElement(ConstructorElement element);
}
/**
@@ -5838,25 +5690,6 @@
void set operator(Token token);
/**
- * Return the function type of the method invocation based on the propagated
- * type information, or `null` if the AST structure has not been resolved, or
- * if the invoke could not be resolved.
- *
- * This will usually be a [FunctionType], but it can also be an
- * [InterfaceType] with a `call` method, `dynamic`, `Function`, or a `@proxy`
- * interface type that implements `Function`.
- */
- @override
- DartType get propagatedInvokeType;
-
- /**
- * Set the function type of the method invocation based on the propagated type
- * information to the given [type].
- */
- @override
- void set propagatedInvokeType(DartType type);
-
- /**
* Return the expression used to compute the receiver of the invocation. If
* this invocation is not part of a cascade expression, then this is the same
* as [target]. If this invocation is part of a cascade expression, then the
@@ -5865,25 +5698,6 @@
Expression get realTarget;
/**
- * Return the function type of the method invocation based on the static type
- * information, or `null` if the AST structure has not been resolved, or if
- * the invoke could not be resolved.
- *
- * This will usually be a [FunctionType], but it can also be an
- * [InterfaceType] with a `call` method, `dynamic`, `Function`, or a `@proxy`
- * interface type that implements `Function`.
- */
- @override
- DartType get staticInvokeType;
-
- /**
- * Set the function type of the method invocation based on the static type
- * information to the given [type].
- */
- @override
- void set staticInvokeType(DartType type);
-
- /**
* Return the expression producing the object on which the method is defined,
* or `null` if there is no target (that is, the target is implicitly `this`)
* or if this method invocation is part of a cascade expression.
@@ -5907,6 +5721,52 @@
}
/**
+ * An expression that implicity makes reference to a method.
+ *
+ * Clients may not extend, implement or mix-in this class.
+ */
+abstract class MethodReferenceExpression {
+ /**
+ * Return the best element available for this expression. If resolution was
+ * able to find a better element based on type propagation, that element will
+ * be returned. Otherwise, the element found using the result of static
+ * analysis will be returned. If resolution has not been performed, then
+ * `null` will be returned.
+ */
+ MethodElement get bestElement;
+
+ /**
+ * Return the element associated with the expression based on propagated
+ * types, or `null` if the AST structure has not been resolved, or there is
+ * no meaningful propagated element to return (e.g. because this is a
+ * non-compound assignment expression, or because the method referred to could
+ * not be resolved).
+ */
+ MethodElement get propagatedElement;
+
+ /**
+ * Set the element associated with the expression based on propagated types to
+ * the given [element].
+ */
+ void set propagatedElement(MethodElement element);
+
+ /**
+ * Return the element associated with the expression based on the static
+ * types, or `null` if the AST structure has not been resolved, or there is no
+ * meaningful static element to return (e.g. because this is a non-compound
+ * assignment expression, or because the method referred to could not be
+ * resolved).
+ */
+ MethodElement get staticElement;
+
+ /**
+ * Set the element associated with the expression based on static types to the
+ * given [element].
+ */
+ void set staticElement(MethodElement element);
+}
+
+/**
* A node that declares a single name within the scope of a compilation unit.
*
* Clients may not extend, implement or mix-in this class.
@@ -6417,7 +6277,8 @@
*
* Clients may not extend, implement or mix-in this class.
*/
-abstract class PostfixExpression extends Expression {
+abstract class PostfixExpression extends Expression
+ implements MethodReferenceExpression {
/**
* Initialize a newly created postfix expression.
*/
@@ -6425,15 +6286,6 @@
new PostfixExpressionImpl(operand, operator);
/**
- * Return the best element available for this operator. If resolution was able
- * to find a better element based on type propagation, that element will be
- * returned. Otherwise, the element found using the result of static analysis
- * will be returned. If resolution has not been performed, then `null` will be
- * returned.
- */
- MethodElement get bestElement;
-
- /**
* Return the expression computing the operand for the operator.
*/
Expression get operand;
@@ -6453,33 +6305,6 @@
* Set the postfix operator being applied to the operand to the given [token].
*/
void set operator(Token token);
-
- /**
- * Return the element associated with this the operator based on the
- * propagated type of the operand, or `null` if the AST structure has not been
- * resolved, if the operator is not user definable, or if the operator could
- * not be resolved.
- */
- MethodElement get propagatedElement;
-
- /**
- * Set the element associated with this the operator based on the propagated
- * type of the operand to the given [element].
- */
- void set propagatedElement(MethodElement element);
-
- /**
- * Return the element associated with the operator based on the static type of
- * the operand, or `null` if the AST structure has not been resolved, if the
- * operator is not user definable, or if the operator could not be resolved.
- */
- MethodElement get staticElement;
-
- /**
- * Set the element associated with the operator based on the static type of
- * the operand to the given [element].
- */
- void set staticElement(MethodElement element);
}
/**
@@ -6550,7 +6375,8 @@
*
* Clients may not extend, implement or mix-in this class.
*/
-abstract class PrefixExpression extends Expression {
+abstract class PrefixExpression extends Expression
+ implements MethodReferenceExpression {
/**
* Initialize a newly created prefix expression.
*/
@@ -6558,15 +6384,6 @@
new PrefixExpressionImpl(operator, operand);
/**
- * Return the best element available for this operator. If resolution was able
- * to find a better element based on type propagation, that element will be
- * returned. Otherwise, the element found using the result of static analysis
- * will be returned. If resolution has not been performed, then `null` will be
- * returned.
- */
- MethodElement get bestElement;
-
- /**
* Return the expression computing the operand for the operator.
*/
Expression get operand;
@@ -6586,33 +6403,6 @@
* Set the prefix operator being applied to the operand to the given [token].
*/
void set operator(Token token);
-
- /**
- * Return the element associated with the operator based on the propagated
- * type of the operand, or `null` if the AST structure has not been resolved,
- * if the operator is not user definable, or if the operator could not be
- * resolved.
- */
- MethodElement get propagatedElement;
-
- /**
- * Set the element associated with the operator based on the propagated type
- * of the operand to the given [element].
- */
- void set propagatedElement(MethodElement element);
-
- /**
- * Return the element associated with the operator based on the static type of
- * the operand, or `null` if the AST structure has not been resolved, if the
- * operator is not user definable, or if the operator could not be resolved.
- */
- MethodElement get staticElement;
-
- /**
- * Set the element associated with the operator based on the static type of
- * the operand to the given [element].
- */
- void set staticElement(MethodElement element);
}
/**
@@ -6695,7 +6485,8 @@
*
* Clients may not extend, implement or mix-in this class.
*/
-abstract class RedirectingConstructorInvocation extends ConstructorInitializer {
+abstract class RedirectingConstructorInvocation extends ConstructorInitializer
+ implements ConstructorReferenceNode {
/**
* Initialize a newly created redirecting invocation to invoke the constructor
* with the given name with the given arguments. The [constructorName] can be
@@ -6741,19 +6532,6 @@
void set period(Token token);
/**
- * Return the element associated with the constructor based on static type
- * information, or `null` if the AST structure has not been resolved or if the
- * constructor could not be resolved.
- */
- ConstructorElement get staticElement;
-
- /**
- * Set the element associated with the constructor based on static type
- * information to the given [element].
- */
- void set staticElement(ConstructorElement element);
-
- /**
* Return the token for the 'this' keyword.
*/
Token get thisKeyword;
@@ -7193,7 +6971,8 @@
*
* Clients may not extend, implement or mix-in this class.
*/
-abstract class SuperConstructorInvocation extends ConstructorInitializer {
+abstract class SuperConstructorInvocation extends ConstructorInitializer
+ implements ConstructorReferenceNode {
/**
* Initialize a newly created super invocation to invoke the inherited
* constructor with the given name with the given arguments. The [period] and
@@ -7240,19 +7019,6 @@
void set period(Token token);
/**
- * Return the element associated with the constructor based on static type
- * information, or `null` if the AST structure has not been resolved or if the
- * constructor could not be resolved.
- */
- ConstructorElement get staticElement;
-
- /**
- * Set the element associated with the constructor based on static type
- * information to the given [element].
- */
- void set staticElement(ConstructorElement element);
-
- /**
* Return the token for the 'super' keyword.
*/
Token get superKeyword;
diff --git a/pkg/analyzer/lib/src/command_line/arguments.dart b/pkg/analyzer/lib/src/command_line/arguments.dart
index 147ade7..939623d 100644
--- a/pkg/analyzer/lib/src/command_line/arguments.dart
+++ b/pkg/analyzer/lib/src/command_line/arguments.dart
@@ -46,8 +46,6 @@
// Analysis options.
//
AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl();
- defaultOptions.enableInitializingFormalAccess =
- args[enableInitializingFormalAccessFlag];
defaultOptions.enableStrictCallChecks = args[enableStrictCallChecksFlag];
defaultOptions.enableSuperMixins = args[enableSuperInMixinFlag];
defaultOptions.implicitCasts = !args[noImplicitCastsFlag];
diff --git a/pkg/analyzer/lib/src/context/context.dart b/pkg/analyzer/lib/src/context/context.dart
index 3068176..30d48e2 100644
--- a/pkg/analyzer/lib/src/context/context.dart
+++ b/pkg/analyzer/lib/src/context/context.dart
@@ -283,8 +283,6 @@
this._options.enableAssertInitializer !=
options.enableAssertInitializer ||
this._options.enableAssertMessage != options.enableAssertMessage ||
- this._options.enableInitializingFormalAccess !=
- options.enableInitializingFormalAccess ||
this._options.enableLazyAssignmentOperators !=
options.enableLazyAssignmentOperators ||
((options is AnalysisOptionsImpl)
@@ -311,8 +309,6 @@
this._options.enableAssertInitializer = options.enableAssertInitializer;
this._options.enableAssertMessage = options.enableAssertMessage;
this._options.enableStrictCallChecks = options.enableStrictCallChecks;
- this._options.enableInitializingFormalAccess =
- options.enableInitializingFormalAccess;
this._options.enableLazyAssignmentOperators =
options.enableLazyAssignmentOperators;
this._options.enableSuperMixins = options.enableSuperMixins;
diff --git a/pkg/analyzer/lib/src/dart/analysis/driver.dart b/pkg/analyzer/lib/src/dart/analysis/driver.dart
index 7d493d6..a903243 100644
--- a/pkg/analyzer/lib/src/dart/analysis/driver.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/driver.dart
@@ -71,7 +71,7 @@
/**
* The version of data format, should be incremented on every format change.
*/
- static const int DATA_VERSION = 8;
+ static const int DATA_VERSION = 9;
/**
* The name of the driver, e.g. the name of the folder.
@@ -592,9 +592,14 @@
AnalysisContext analysisContext = _createAnalysisContext(libraryContext);
// Resynthesize the CompilationUnitElement in the context.
- CompilationUnitElement unitElement = analysisContext.computeResult(
- new LibrarySpecificUnit(libraryFile.source, file.source),
- COMPILATION_UNIT_ELEMENT);
+ CompilationUnitElement unitElement;
+ try {
+ unitElement = analysisContext.computeResult(
+ new LibrarySpecificUnit(libraryFile.source, file.source),
+ COMPILATION_UNIT_ELEMENT);
+ } finally {
+ analysisContext.dispose();
+ }
// Return as IndexResult.
return new IndexResult(unitElement, analysisResult._index);
diff --git a/pkg/analyzer/lib/src/dart/analysis/index.dart b/pkg/analyzer/lib/src/dart/analysis/index.dart
index 6b5c09c..8c8c132 100644
--- a/pkg/analyzer/lib/src/dart/analysis/index.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/index.dart
@@ -440,6 +440,13 @@
false) {
return;
}
+ // Ignore named parameters of synthetic functions, e.g. created for LUB.
+ // These functions are not bound to a source, we cannot index them.
+ if (elementKind == ElementKind.PARAMETER &&
+ element is ParameterElement &&
+ element.enclosingElement.isSynthetic) {
+ return;
+ }
// Add the relation.
assembler.addElementRelation(element, kind, offset, length, isQualified);
}
diff --git a/pkg/analyzer/lib/src/dart/analysis/search.dart b/pkg/analyzer/lib/src/dart/analysis/search.dart
index 2c3448c..8ca2f31 100644
--- a/pkg/analyzer/lib/src/dart/analysis/search.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/search.dart
@@ -60,6 +60,8 @@
return _searchReferences_Local(element, (n) => n is Block);
} else if (kind == ElementKind.PARAMETER) {
return _searchReferences_Parameter(element);
+ } else if (kind == ElementKind.PREFIX) {
+ return _searchReferences_Prefix(element);
} else if (kind == ElementKind.TYPE_PARAMETER) {
return _searchReferences_Local(
element, (n) => n.parent is CompilationUnit);
@@ -69,7 +71,7 @@
}
Future<Null> _addResults(List<SearchResult> results, Element element,
- IndexRelationKind relationKind, SearchResultKind resultKind) async {
+ Map<IndexRelationKind, SearchResultKind> relationToResultKind) async {
String path = element.source.fullName;
// If the file with the element is not known, then the element is not used.
@@ -93,8 +95,8 @@
int elementId = request.findElementId(element);
if (elementId != -1) {
CompilationUnitElement unitElement = result.unitElement;
- List<SearchResult> fileResults = request.getRelations(
- elementId, relationKind, resultKind, unitElement);
+ List<SearchResult> fileResults =
+ request.getRelations(elementId, relationToResultKind, unitElement);
results.addAll(fileResults);
}
}
@@ -102,8 +104,8 @@
Future<List<SearchResult>> _searchReferences(Element element) async {
List<SearchResult> results = <SearchResult>[];
- await _addResults(results, element, IndexRelationKind.IS_REFERENCED_BY,
- SearchResultKind.REFERENCE);
+ await _addResults(results, element,
+ {IndexRelationKind.IS_REFERENCED_BY: SearchResultKind.REFERENCE});
return results;
}
@@ -113,20 +115,20 @@
PropertyAccessorElement getter = field.getter;
PropertyAccessorElement setter = field.setter;
if (!field.isSynthetic) {
- await _addResults(results, field, IndexRelationKind.IS_WRITTEN_BY,
- SearchResultKind.WRITE);
- await _addResults(results, field, IndexRelationKind.IS_REFERENCED_BY,
- SearchResultKind.REFERENCE);
+ await _addResults(results, field, {
+ IndexRelationKind.IS_WRITTEN_BY: SearchResultKind.WRITE,
+ IndexRelationKind.IS_REFERENCED_BY: SearchResultKind.REFERENCE
+ });
}
if (getter != null) {
- await _addResults(results, getter, IndexRelationKind.IS_REFERENCED_BY,
- SearchResultKind.READ);
- await _addResults(results, getter, IndexRelationKind.IS_INVOKED_BY,
- SearchResultKind.INVOCATION);
+ await _addResults(results, getter, {
+ IndexRelationKind.IS_REFERENCED_BY: SearchResultKind.READ,
+ IndexRelationKind.IS_INVOKED_BY: SearchResultKind.INVOCATION
+ });
}
if (setter != null) {
- await _addResults(results, setter, IndexRelationKind.IS_REFERENCED_BY,
- SearchResultKind.WRITE);
+ await _addResults(results, setter,
+ {IndexRelationKind.IS_REFERENCED_BY: SearchResultKind.WRITE});
}
return results;
}
@@ -136,20 +138,20 @@
element = (element as Member).baseElement;
}
List<SearchResult> results = <SearchResult>[];
- await _addResults(results, element, IndexRelationKind.IS_REFERENCED_BY,
- SearchResultKind.REFERENCE);
- await _addResults(results, element, IndexRelationKind.IS_INVOKED_BY,
- SearchResultKind.INVOCATION);
+ await _addResults(results, element, {
+ IndexRelationKind.IS_REFERENCED_BY: SearchResultKind.REFERENCE,
+ IndexRelationKind.IS_INVOKED_BY: SearchResultKind.INVOCATION
+ });
return results;
}
Future<List<SearchResult>> _searchReferences_Getter(
PropertyAccessorElement getter) async {
List<SearchResult> results = <SearchResult>[];
- await _addResults(results, getter, IndexRelationKind.IS_REFERENCED_BY,
- SearchResultKind.REFERENCE);
- await _addResults(results, getter, IndexRelationKind.IS_INVOKED_BY,
- SearchResultKind.INVOCATION);
+ await _addResults(results, getter, {
+ IndexRelationKind.IS_REFERENCED_BY: SearchResultKind.REFERENCE,
+ IndexRelationKind.IS_INVOKED_BY: SearchResultKind.INVOCATION
+ });
return results;
}
@@ -196,6 +198,27 @@
}));
return results;
}
+
+ Future<List<SearchResult>> _searchReferences_Prefix(
+ PrefixElement element) async {
+ // Search only in drivers to which the library with the prefix was added.
+ String path = element.source.fullName;
+ if (!_driver.addedFiles.contains(path)) {
+ return const <SearchResult>[];
+ }
+
+ List<SearchResult> results = <SearchResult>[];
+ LibraryElement libraryElement = element.library;
+ for (CompilationUnitElement unitElement in libraryElement.units) {
+ String unitPath = unitElement.source.fullName;
+ AnalysisResult unitAnalysisResult = await _driver.getResult(unitPath);
+ _LocalReferencesVisitor visitor =
+ new _LocalReferencesVisitor(element, unitElement);
+ unitAnalysisResult.unit.accept(visitor);
+ results.addAll(visitor.results);
+ }
+ return results;
+ }
}
/**
@@ -377,12 +400,11 @@
/**
* Return a list of results where an element with the given [elementId] has
- * relation of the given [indexKind].
+ * a relation with the kind from [relationToResultKind].
*/
List<SearchResult> getRelations(
int elementId,
- IndexRelationKind indexKind,
- SearchResultKind searchKind,
+ Map<IndexRelationKind, SearchResultKind> relationToResultKind,
CompilationUnitElement enclosingUnitElement) {
// Find the first usage of the element.
int i = _findFirstOccurrence(index.usedElements, elementId);
@@ -394,14 +416,16 @@
for (;
i < index.usedElements.length && index.usedElements[i] == elementId;
i++) {
- if (index.usedElementKinds[i] == indexKind) {
+ IndexRelationKind relationKind = index.usedElementKinds[i];
+ SearchResultKind resultKind = relationToResultKind[relationKind];
+ if (resultKind != null) {
int offset = index.usedElementOffsets[i];
Element enclosingElement =
_getEnclosingElement(enclosingUnitElement, offset);
results.add(new SearchResult._(
null,
enclosingElement,
- searchKind,
+ resultKind,
offset,
index.usedElementLengths[i],
true,
diff --git a/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart b/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
index 57c4169..69d3948 100644
--- a/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/inheritance_manager.dart
@@ -54,12 +54,22 @@
new HashMap<ClassElement, Set<AnalysisError>>();
/**
+ * Indicates whether errors should be ignored.
+ *
+ * When this bool is `true`, we skip the logic that figures out which error
+ * to report; this avoids a crash when the inheritance manager is used in the
+ * context of summary linking (where there is not enough information available
+ * to determine error locations).
+ */
+ final bool ignoreErrors;
+
+ /**
* Initialize a newly created inheritance manager.
*
* @param library the library element context that the inheritance mappings are being generated
*/
InheritanceManager(LibraryElement library,
- {bool includeAbstractFromSuperclasses: false}) {
+ {bool includeAbstractFromSuperclasses: false, this.ignoreErrors: false}) {
this._library = library;
_includeAbstractFromSuperclasses = includeAbstractFromSuperclasses;
_classLookup = new HashMap<ClassElement, Map<String, ExecutableElement>>();
@@ -654,15 +664,15 @@
* @param errorCode the error code to be associated with this error
* @param arguments the arguments used to build the error message
*/
- void _reportError(ClassElement classElt, int offset, int length,
- ErrorCode errorCode, List<Object> arguments) {
- HashSet<AnalysisError> errorSet = _errorsInClassElement[classElt];
- if (errorSet == null) {
- errorSet = new HashSet<AnalysisError>();
- _errorsInClassElement[classElt] = errorSet;
+ void _reportError(
+ ClassElement classElt, ErrorCode errorCode, List<Object> arguments) {
+ if (ignoreErrors) {
+ return;
}
- errorSet.add(new AnalysisError(
- classElt.source, offset, length, errorCode, arguments));
+ HashSet<AnalysisError> errorSet = _errorsInClassElement.putIfAbsent(
+ classElt, () => new HashSet<AnalysisError>());
+ errorSet.add(new AnalysisError(classElt.source, classElt.nameOffset,
+ classElt.nameLength, errorCode, arguments));
}
/**
@@ -793,8 +803,6 @@
"${executableElementTypes[0]}, ${executableElementTypes[1]}";
_reportError(
classElt,
- classElt.nameOffset,
- classElt.nameLength,
StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE,
[key, firstTwoFuntionTypesStr]);
}
@@ -823,8 +831,6 @@
} else {
_reportError(
classElt,
- classElt.nameOffset,
- classElt.nameLength,
StaticWarningCode
.INCONSISTENT_METHOD_INHERITANCE_GETTER_AND_METHOD,
[key]);
diff --git a/pkg/analyzer/lib/src/generated/engine.dart b/pkg/analyzer/lib/src/generated/engine.dart
index 0301ed0..3860533 100644
--- a/pkg/analyzer/lib/src/generated/engine.dart
+++ b/pkg/analyzer/lib/src/generated/engine.dart
@@ -1129,6 +1129,7 @@
* Return `true` if access to field formal parameters should be allowed in a
* constructor's initializer list.
*/
+ @deprecated
bool get enableInitializingFormalAccess;
/**
@@ -1259,6 +1260,11 @@
List<int> encodeCrossContextOptions();
/**
+ * Reset the state of this set of analysis options to its original state.
+ */
+ void resetToDefaults();
+
+ /**
* Set the values of the cross-context options to match those in the given set
* of [options].
*/
@@ -1330,9 +1336,6 @@
bool enableAssertMessage = false;
@override
- bool enableInitializingFormalAccess = false;
-
- @override
bool enableLazyAssignmentOperators = false;
@override
@@ -1453,7 +1456,6 @@
enableAssertInitializer = options.enableAssertInitializer;
enableAssertMessage = options.enableAssertMessage;
enableStrictCallChecks = options.enableStrictCallChecks;
- enableInitializingFormalAccess = options.enableInitializingFormalAccess;
enableLazyAssignmentOperators = options.enableLazyAssignmentOperators;
enableSuperMixins = options.enableSuperMixins;
enableTiming = options.enableTiming;
@@ -1533,6 +1535,13 @@
@deprecated
void set enableGenericMethods(bool enable) {}
+ @deprecated
+ @override
+ bool get enableInitializingFormalAccess => true;
+
+ @deprecated
+ void set enableInitializingFormalAccess(bool enable) {}
+
@override
List<ErrorProcessor> get errorProcessors =>
_errorProcessors ??= const <ErrorProcessor>[];
@@ -1579,6 +1588,38 @@
}
@override
+ void resetToDefaults() {
+ dart2jsHint = false;
+ disableCacheFlushing = false;
+ enableAssertInitializer = false;
+ enableAssertMessage = false;
+ enableLazyAssignmentOperators = false;
+ enableStrictCallChecks = false;
+ enableSuperMixins = false;
+ enableTiming = false;
+ enableUriInPartOf = false;
+ _errorProcessors = null;
+ _excludePatterns = null;
+ finerGrainedInvalidation = false;
+ generateImplicitErrors = true;
+ generateSdkErrors = false;
+ hint = true;
+ implicitCasts = true;
+ implicitDynamic = true;
+ incremental = false;
+ incrementalApi = false;
+ incrementalValidation = false;
+ lint = false;
+ _lintRules = null;
+ nonnullableTypes = NONNULLABLE_TYPES;
+ patchPlatform = 0;
+ preserveComments = true;
+ strongMode = false;
+ strongModeHints = false;
+ trackCacheDependencies = true;
+ }
+
+ @override
void setCrossContextOptionsFrom(AnalysisOptions options) {
enableAssertMessage = options.enableAssertMessage;
enableLazyAssignmentOperators = options.enableLazyAssignmentOperators;
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index b345876..df3ad03 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -7169,12 +7169,6 @@
LabelScope labelScope;
/**
- * A flag indicating whether to enable support for allowing access to field
- * formal parameters in a constructor's initializer list.
- */
- bool enableInitializingFormalAccess = false;
-
- /**
* The class containing the AST nodes being visited,
* or `null` if we are not in the scope of a class.
*/
@@ -7205,8 +7199,6 @@
} else {
this.nameScope = nameScope;
}
- enableInitializingFormalAccess =
- definingLibrary.context.analysisOptions.enableInitializingFormalAccess;
}
/**
@@ -7368,7 +7360,7 @@
node.parameters?.accept(this);
Scope functionScope = nameScope;
try {
- if (constructorElement != null && enableInitializingFormalAccess) {
+ if (constructorElement != null) {
nameScope =
new ConstructorInitializerScope(nameScope, constructorElement);
}
diff --git a/pkg/analyzer/lib/src/summary/format.fbs b/pkg/analyzer/lib/src/summary/format.fbs
index d3df9c0..de75fea 100644
--- a/pkg/analyzer/lib/src/summary/format.fbs
+++ b/pkg/analyzer/lib/src/summary/format.fbs
@@ -765,7 +765,13 @@
* keep it and discard the second. Otherwise, keep the second and discard the
* first.
*/
- ifNull
+ ifNull,
+
+ /**
+ * Pop the top value from the stack. Treat it as a Future and await its
+ * completion. Then push the awaited value onto the stack.
+ */
+ await
}
/**
diff --git a/pkg/analyzer/lib/src/summary/idl.dart b/pkg/analyzer/lib/src/summary/idl.dart
index 53102b1..9c07aff 100644
--- a/pkg/analyzer/lib/src/summary/idl.dart
+++ b/pkg/analyzer/lib/src/summary/idl.dart
@@ -2341,6 +2341,12 @@
* first.
*/
ifNull,
+
+ /**
+ * Pop the top value from the stack. Treat it as a Future and await its
+ * completion. Then push the awaited value onto the stack.
+ */
+ await,
}
/**
diff --git a/pkg/analyzer/lib/src/summary/link.dart b/pkg/analyzer/lib/src/summary/link.dart
index 7bfbed1..ec0806e 100644
--- a/pkg/analyzer/lib/src/summary/link.dart
+++ b/pkg/analyzer/lib/src/summary/link.dart
@@ -2228,6 +2228,9 @@
case UnlinkedExprOperation.assignToIndex:
_doAssignToIndex();
break;
+ case UnlinkedExprOperation.await:
+ _doAwait();
+ break;
case UnlinkedExprOperation.extractIndex:
_doExtractIndex();
break;
@@ -2363,6 +2366,13 @@
}
}
+ void _doAwait() {
+ DartType type = stack.removeLast();
+ DartType typeArgument = type?.flattenFutures(linker.typeSystem);
+ typeArgument = _dynamicIfNull(typeArgument);
+ stack.add(typeArgument);
+ }
+
void _doConditional() {
DartType elseType = stack.removeLast();
DartType thenType = stack.removeLast();
@@ -3413,10 +3423,10 @@
_linkedLibrary.importDependencies.map(_getDependency).toList();
@override
- bool get isDartAsync => _absoluteUri == 'dart:async';
+ bool get isDartAsync => _absoluteUri.toString() == 'dart:async';
@override
- bool get isDartCore => _absoluteUri == 'dart:core';
+ bool get isDartCore => _absoluteUri.toString() == 'dart:core';
/**
* If this library is part of the build unit being linked, return the library
@@ -3529,7 +3539,7 @@
* Get the inheritance manager for this library (creating it if necessary).
*/
InheritanceManager get inheritanceManager =>
- _inheritanceManager ??= new InheritanceManager(this);
+ _inheritanceManager ??= new InheritanceManager(this, ignoreErrors: true);
@override
LibraryCycleForLink get libraryCycleForLink {
@@ -3551,9 +3561,15 @@
}
}
int result = _linkedLibrary.dependencies.length;
+ Uri libraryUri = library._absoluteUri;
+ List<String> partsRelativeToDependency =
+ library.definingUnlinkedUnit.publicNamespace.parts;
+ List<String> partsRelativeToLibraryBeingLinked = partsRelativeToDependency
+ .map((partUri) =>
+ resolveRelativeUri(libraryUri, Uri.parse(partUri)).toString())
+ .toList();
_linkedLibrary.dependencies.add(new LinkedDependencyBuilder(
- parts: library.definingUnlinkedUnit.publicNamespace.parts,
- uri: library._absoluteUri.toString()));
+ parts: partsRelativeToLibraryBeingLinked, uri: libraryUri.toString()));
_dependencies.add(library);
return result;
}
diff --git a/pkg/analyzer/lib/src/summary/resynthesize.dart b/pkg/analyzer/lib/src/summary/resynthesize.dart
index f8f2060..bee1e9e 100644
--- a/pkg/analyzer/lib/src/summary/resynthesize.dart
+++ b/pkg/analyzer/lib/src/summary/resynthesize.dart
@@ -500,6 +500,10 @@
case UnlinkedExprOperation.ifNull:
_pushBinary(TokenType.QUESTION_QUESTION);
break;
+ case UnlinkedExprOperation.await:
+ Expression expression = _pop();
+ _push(AstTestFactory.awaitExpression(expression));
+ break;
case UnlinkedExprOperation.assignToRef:
case UnlinkedExprOperation.assignToProperty:
case UnlinkedExprOperation.assignToIndex:
diff --git a/pkg/analyzer/lib/src/summary/summarize_const_expr.dart b/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
index f7e6911..5a8702a 100644
--- a/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
+++ b/pkg/analyzer/lib/src/summary/summarize_const_expr.dart
@@ -66,7 +66,7 @@
bool isValidConst = true;
/**
- * See [UnlinkedExprBuilder.nmae].
+ * See [UnlinkedExprBuilder.name].
*/
String name = null;
@@ -380,6 +380,10 @@
isValidConst = false;
_serialize(expr.expression);
operations.add(UnlinkedExprOperation.throwException);
+ } else if (expr is AwaitExpression) {
+ isValidConst = false;
+ _serialize(expr.expression);
+ operations.add(UnlinkedExprOperation.await);
} else {
throw new StateError('Unknown expression type: $expr');
}
diff --git a/pkg/analyzer/lib/src/task/options.dart b/pkg/analyzer/lib/src/task/options.dart
index 5dfe1dc..4cf2afe 100644
--- a/pkg/analyzer/lib/src/task/options.dart
+++ b/pkg/analyzer/lib/src/task/options.dart
@@ -635,8 +635,6 @@
if (boolValue != null) {
if (feature == AnalyzerOptions.enableAssertInitializer) {
options.enableAssertInitializer = boolValue;
- } else if (feature == AnalyzerOptions.enableInitializingFormalAccess) {
- options.enableInitializingFormalAccess = boolValue;
} else if (feature == AnalyzerOptions.enableSuperMixins) {
options.enableSuperMixins = boolValue;
}
diff --git a/pkg/analyzer/test/generated/engine_test.dart b/pkg/analyzer/test/generated/engine_test.dart
index 8bcd6bc..93b3108 100644
--- a/pkg/analyzer/test/generated/engine_test.dart
+++ b/pkg/analyzer/test/generated/engine_test.dart
@@ -28,10 +28,80 @@
main() {
defineReflectiveSuite(() {
+ defineReflectiveTests(AnalysisOptionsImplTest);
defineReflectiveTests(SourcesChangedEventTest);
});
}
+@reflectiveTest
+class AnalysisOptionsImplTest {
+ test_resetToDefaults() {
+ // Note that this only tests options visible from the interface.
+ AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl();
+ AnalysisOptionsImpl modifiedOptions = new AnalysisOptionsImpl();
+ modifiedOptions.dart2jsHint = true;
+ modifiedOptions.disableCacheFlushing = true;
+ modifiedOptions.enableAssertInitializer = true;
+ modifiedOptions.enableAssertMessage = true;
+ modifiedOptions.enableLazyAssignmentOperators = true;
+ modifiedOptions.enableStrictCallChecks = true;
+ modifiedOptions.enableSuperMixins = true;
+ modifiedOptions.enableTiming = true;
+ modifiedOptions.enableUriInPartOf = true;
+ modifiedOptions.errorProcessors = [null];
+ modifiedOptions.excludePatterns = ['a'];
+ modifiedOptions.finerGrainedInvalidation = true;
+ modifiedOptions.generateImplicitErrors = false;
+ modifiedOptions.generateSdkErrors = true;
+ modifiedOptions.hint = false;
+ modifiedOptions.incremental = true;
+ modifiedOptions.incrementalApi = true;
+ modifiedOptions.incrementalValidation = true;
+ modifiedOptions.lint = true;
+ modifiedOptions.lintRules = [null];
+ modifiedOptions.patchPlatform = 3;
+ modifiedOptions.preserveComments = false;
+ modifiedOptions.strongMode = true;
+ modifiedOptions.trackCacheDependencies = false;
+
+ modifiedOptions.resetToDefaults();
+
+ expect(modifiedOptions.dart2jsHint, defaultOptions.dart2jsHint);
+ expect(modifiedOptions.disableCacheFlushing,
+ defaultOptions.disableCacheFlushing);
+ expect(modifiedOptions.enableAssertInitializer,
+ defaultOptions.enableAssertInitializer);
+ expect(modifiedOptions.enableAssertMessage,
+ defaultOptions.enableAssertMessage);
+ expect(modifiedOptions.enableLazyAssignmentOperators,
+ defaultOptions.enableLazyAssignmentOperators);
+ expect(modifiedOptions.enableStrictCallChecks,
+ defaultOptions.enableStrictCallChecks);
+ expect(modifiedOptions.enableSuperMixins, defaultOptions.enableSuperMixins);
+ expect(modifiedOptions.enableTiming, defaultOptions.enableTiming);
+ expect(modifiedOptions.enableUriInPartOf, defaultOptions.enableUriInPartOf);
+ expect(modifiedOptions.errorProcessors, defaultOptions.errorProcessors);
+ expect(modifiedOptions.excludePatterns, defaultOptions.excludePatterns);
+ expect(modifiedOptions.finerGrainedInvalidation,
+ defaultOptions.finerGrainedInvalidation);
+ expect(modifiedOptions.generateImplicitErrors,
+ defaultOptions.generateImplicitErrors);
+ expect(modifiedOptions.generateSdkErrors, defaultOptions.generateSdkErrors);
+ expect(modifiedOptions.hint, defaultOptions.hint);
+ expect(modifiedOptions.incremental, defaultOptions.incremental);
+ expect(modifiedOptions.incrementalApi, defaultOptions.incrementalApi);
+ expect(modifiedOptions.incrementalValidation,
+ defaultOptions.incrementalValidation);
+ expect(modifiedOptions.lint, defaultOptions.lint);
+ expect(modifiedOptions.lintRules, defaultOptions.lintRules);
+ expect(modifiedOptions.patchPlatform, defaultOptions.patchPlatform);
+ expect(modifiedOptions.preserveComments, defaultOptions.preserveComments);
+ expect(modifiedOptions.strongMode, defaultOptions.strongMode);
+ expect(modifiedOptions.trackCacheDependencies,
+ defaultOptions.trackCacheDependencies);
+ }
+}
+
/**
* A listener used to gather the [ImplicitAnalysisEvent]s that are produced
* during analysis.
diff --git a/pkg/analyzer/test/generated/simple_resolver_test.dart b/pkg/analyzer/test/generated/simple_resolver_test.dart
index 8a3059b..4df27be 100644
--- a/pkg/analyzer/test/generated/simple_resolver_test.dart
+++ b/pkg/analyzer/test/generated/simple_resolver_test.dart
@@ -656,9 +656,6 @@
}
void test_fieldFormalParameter() {
- AnalysisOptionsImpl options = new AnalysisOptionsImpl();
- options.enableInitializingFormalAccess = true;
- resetWithOptions(options);
Source source = addSource(r'''
class A {
int x;
diff --git a/pkg/analyzer/test/src/command_line/arguments_test.dart b/pkg/analyzer/test/src/command_line/arguments_test.dart
index 3e1e940..eb6704c 100644
--- a/pkg/analyzer/test/src/command_line/arguments_test.dart
+++ b/pkg/analyzer/test/src/command_line/arguments_test.dart
@@ -35,7 +35,6 @@
'-Dfoo=1',
'-Dbar=2',
'--enable-strict-call-checks',
- '--initializing-formal-access',
'--no-implicit-casts',
'--no-implicit-dynamic',
'--options=$defaultAnalysisOptionsFilePath',
@@ -58,7 +57,6 @@
expect(options.defaultPackagesDirectoryPath, defaultPackagesDirectoryPath);
AnalysisOptionsImpl defaultOptions = options.defaultOptions;
expect(defaultOptions, isNotNull);
- expect(defaultOptions.enableInitializingFormalAccess, true);
expect(defaultOptions.enableStrictCallChecks, true);
expect(defaultOptions.strongMode, true);
expect(defaultOptions.implicitCasts, false);
@@ -81,7 +79,6 @@
expect(options.defaultPackagesDirectoryPath, isNull);
AnalysisOptionsImpl defaultOptions = options.defaultOptions;
expect(defaultOptions, isNotNull);
- expect(defaultOptions.enableInitializingFormalAccess, false);
expect(defaultOptions.enableStrictCallChecks, false);
expect(defaultOptions.strongMode, false);
expect(defaultOptions.implicitCasts, true);
diff --git a/pkg/analyzer/test/src/dart/analysis/index_test.dart b/pkg/analyzer/test/src/dart/analysis/index_test.dart
index d090dbb..51fb995 100644
--- a/pkg/analyzer/test/src/dart/analysis/index_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/index_test.dart
@@ -814,6 +814,18 @@
assertThat(element)..isReferencedAt('p: 1', true);
}
+ test_isReferencedBy_synthetic_leastUpperBound() async {
+ await _indexTestUnit('''
+int f1({int p}) => 1;
+int f2({int p}) => 2;
+main(bool b) {
+ var f = b ? f1 : f2;
+ f(p: 0);
+}''');
+ // We should not crash because of reference to "p" - a named parameter
+ // of a synthetic LUB FunctionElement created for "f".
+ }
+
test_isReferencedBy_TopLevelVariableElement() async {
provider.newFile(
_p('$testProject/lib.dart'),
diff --git a/pkg/analyzer/test/src/dart/analysis/search_test.dart b/pkg/analyzer/test/src/dart/analysis/search_test.dart
index 8872ebd..e473ffc 100644
--- a/pkg/analyzer/test/src/dart/analysis/search_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/search_test.dart
@@ -38,6 +38,7 @@
result.isResolved == this.isResolved &&
result.isQualified == this.isQualified &&
result.offset == this.offset &&
+ result.length == this.length &&
result.enclosingElement == this.enclosingElement;
}
@@ -510,6 +511,34 @@
await _verifyReferences(element, expected);
}
+ test_searchReferences_PrefixElement() async {
+ String partCode = r'''
+part of my_lib;
+ppp.Future c;
+''';
+ provider.newFile(_p('$testProject/my_part.dart'), partCode);
+ await _resolveTestUnit('''
+library my_lib;
+import 'dart:async' as ppp;
+part 'my_part.dart';
+main() {
+ ppp.Future a;
+ ppp.Stream b;
+}
+''');
+ PrefixElement element = _findElementAtString('ppp;');
+ Element a = _findElement('a');
+ Element b = _findElement('b');
+ Element c = findChildElement(testLibraryElement, 'c');
+ var expected = [
+ _expectId(a, SearchResultKind.REFERENCE, 'ppp.Future'),
+ _expectId(b, SearchResultKind.REFERENCE, 'ppp.Stream'),
+ new ExpectedResult(c, SearchResultKind.REFERENCE,
+ partCode.indexOf('ppp.Future c'), 'ppp'.length)
+ ];
+ await _verifyReferences(element, expected);
+ }
+
test_searchReferences_PropertyAccessorElement_getter() async {
await _resolveTestUnit('''
class A {
diff --git a/pkg/analyzer/test/src/summary/resynthesize_common.dart b/pkg/analyzer/test/src/summary/resynthesize_common.dart
index 48293c1..ddff695 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_common.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_common.dart
@@ -3617,6 +3617,32 @@
' abstract class D { void set f(int g(String s)); }');
}
+ void test_inferredType_definedInSdkLibraryPart() {
+ addSource(
+ '/a.dart',
+ r'''
+import 'dart:async';
+class A {
+ m(Stream p) {}
+}
+''');
+ LibraryElement library = checkLibrary(r'''
+import 'a.dart';
+class B extends A {
+ m(p) {}
+}
+ ''');
+ ClassElement b = library.definingCompilationUnit.types[0];
+ ParameterElement p = b.methods[0].parameters[0];
+ // This test should verify that we correctly record inferred types,
+ // when the type is defined in a part of an SDK library. So, test that
+ // the type is actually in a part.
+ Element streamElement = p.type.element;
+ if (streamElement is ClassElement) {
+ expect(streamElement.source, isNot(streamElement.library.source));
+ }
+ }
+
void test_inferredType_usesSyntheticFunctionType_functionTypedParam() {
checkLibrary('''
int f(int x(String y)) => null;
@@ -3625,10 +3651,53 @@
''');
}
+ test_inheritance_errors() {
+ checkLibrary('''
+abstract class A {
+ int m();
+}
+
+abstract class B {
+ String m();
+}
+
+abstract class C implements A, B {}
+
+abstract class D extends C {
+ var f;
+}
+''');
+ }
+
test_initializer_executable_with_return_type_from_closure() {
checkLibrary('var v = () => 0;');
}
+ test_initializer_executable_with_return_type_from_closure_await_dynamic() {
+ checkLibrary('var v = (f) async => await f;');
+ }
+
+ test_initializer_executable_with_return_type_from_closure_await_future3_int() {
+ checkLibrary(r'''
+import 'dart:async';
+var v = (Future<Future<Future<int>>> f) async => await f;
+''');
+ }
+
+ test_initializer_executable_with_return_type_from_closure_await_future_int() {
+ checkLibrary(r'''
+import 'dart:async';
+var v = (Future<int> f) async => await f;
+''');
+ }
+
+ test_initializer_executable_with_return_type_from_closure_await_future_noArg() {
+ checkLibrary(r'''
+import 'dart:async';
+var v = (Future f) async => await f;
+''');
+ }
+
test_initializer_executable_with_return_type_from_closure_field() {
checkLibrary('''
class C {
diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart
index 16f3f3c..fd93301 100644
--- a/pkg/analyzer/test/src/summary/summary_common.dart
+++ b/pkg/analyzer/test/src/summary/summary_common.dart
@@ -1843,6 +1843,26 @@
operators: [UnlinkedExprOperation.pushParameter], strings: ['T']);
}
+ test_constExpr_functionExpression() {
+ if (skipNonConstInitializers) {
+ return;
+ }
+ UnlinkedVariable variable = serializeVariableText('''
+import 'dart:async';
+const v = (f) async => await f;
+''');
+ _assertUnlinkedConst(variable.initializer.localFunctions[0].bodyExpr,
+ isValidConst: false,
+ operators: [
+ UnlinkedExprOperation.pushParameter,
+ UnlinkedExprOperation.await
+ ],
+ strings: [
+ 'f'
+ ],
+ ints: []);
+ }
+
test_constExpr_functionExpression_asArgument() {
// Even though function expressions are not allowed in constant
// declarations, they might occur due to erroneous code, so make sure they
diff --git a/pkg/analyzer_cli/lib/src/driver.dart b/pkg/analyzer_cli/lib/src/driver.dart
index 386a95d..16ec22d 100644
--- a/pkg/analyzer_cli/lib/src/driver.dart
+++ b/pkg/analyzer_cli/lib/src/driver.dart
@@ -280,10 +280,6 @@
if (options.disableHints != _previousOptions.disableHints) {
return false;
}
- if (options.enableInitializingFormalAccess !=
- _previousOptions.enableInitializingFormalAccess) {
- return false;
- }
if (options.enableStrictCallChecks !=
_previousOptions.enableStrictCallChecks) {
return false;
@@ -671,8 +667,6 @@
contextOptions.trackCacheDependencies = false;
contextOptions.disableCacheFlushing = options.disableCacheFlushing;
contextOptions.hint = !options.disableHints;
- contextOptions.enableInitializingFormalAccess =
- options.enableInitializingFormalAccess;
contextOptions.enableStrictCallChecks = options.enableStrictCallChecks;
contextOptions.enableSuperMixins = options.enableSuperMixins;
contextOptions.generateImplicitErrors = options.showPackageWarnings;
diff --git a/pkg/analyzer_cli/lib/src/options.dart b/pkg/analyzer_cli/lib/src/options.dart
index be7dbae..abb3623 100644
--- a/pkg/analyzer_cli/lib/src/options.dart
+++ b/pkg/analyzer_cli/lib/src/options.dart
@@ -85,10 +85,6 @@
/// Whether to display version information
final bool displayVersion;
- /// A flag indicating whether access to field formal parameters should be
- /// allowed in a constructor's initializer list.
- final bool enableInitializingFormalAccess;
-
/// Whether to enable null-aware operators (DEP 9).
final bool enableNullAwareOperators;
@@ -179,7 +175,6 @@
disableCacheFlushing = args['disable-cache-flushing'],
disableHints = args['no-hints'],
displayVersion = args['version'],
- enableInitializingFormalAccess = args['initializing-formal-access'],
enableNullAwareOperators = args['enable-null-aware-operators'],
enableStrictCallChecks = args['enable-strict-call-checks'],
enableSuperMixins = args['supermixin'],
diff --git a/pkg/compiler/lib/src/common/backend_api.dart b/pkg/compiler/lib/src/common/backend_api.dart
index 2bb7001..089058c 100644
--- a/pkg/compiler/lib/src/common/backend_api.dart
+++ b/pkg/compiler/lib/src/common/backend_api.dart
@@ -82,7 +82,8 @@
void initializeHelperClasses() {}
- void enqueueHelpers(ResolutionEnqueuer world);
+ /// Compute the [WorldImpact] for backend helper methods.
+ WorldImpact computeHelpersImpact();
/// Creates an [Enqueuer] for code generation specific to this backend.
Enqueuer createCodegenEnqueuer(CompilerTask task, Compiler compiler);
@@ -116,21 +117,27 @@
/// Enable deferred loading. Returns `true` if the backend supports deferred
/// loading.
- bool enableDeferredLoadingIfSupported(
- ResolutionEnqueuer enqueuer, Spannable node);
+ bool enableDeferredLoadingIfSupported(Spannable node);
+
+ /// Returns the [WorldImpact] of enabling deferred loading.
+ WorldImpact computeDeferredLoadingImpact() => const WorldImpact();
/// Called during codegen when [constant] has been used.
void computeImpactForCompileTimeConstant(ConstantValue constant,
WorldImpactBuilder impactBuilder, bool isForResolution) {}
- /// Called to notify to the backend that a class is being instantiated.
- // TODO(johnniwinther): Remove this. It's only called once for each [cls] and
- // only with [Compiler.globalDependencies] as [registry].
- void registerInstantiatedClass(ClassElement cls, Enqueuer enqueuer) {}
+ /// Called to notify to the backend that a class is being instantiated. Any
+ /// backend specific [WorldImpact] of this is returned.
+ WorldImpact registerInstantiatedClass(ClassElement cls,
+ {bool forResolution}) =>
+ const WorldImpact();
/// Called to notify to the backend that a class is implemented by an
- /// instantiated class.
- void registerImplementedClass(ClassElement cls, Enqueuer enqueuer) {}
+ /// instantiated class. Any backend specific [WorldImpact] of this is
+ /// returned.
+ WorldImpact registerImplementedClass(ClassElement cls,
+ {bool forResolution}) =>
+ const WorldImpact();
/// Called to instruct to the backend register [type] as instantiated on
/// [enqueuer].
@@ -141,40 +148,47 @@
void registerTypeVariableBoundsSubtypeCheck(
DartType typeArgument, DartType bound) {}
- /**
- * Call this to register that an instantiated generic class has a call
- * method.
- */
- void registerCallMethodWithFreeTypeVariables(
- Element callMethod, Enqueuer enqueuer) {}
+ /// Called to register that an instantiated generic class has a call method.
+ /// Any backend specific [WorldImpact] of this is returned.
+ ///
+ /// Note: The [callMethod] is registered even thought it doesn't reference
+ /// the type variables.
+ WorldImpact registerCallMethodWithFreeTypeVariables(Element callMethod,
+ {bool forResolution}) =>
+ const WorldImpact();
/// Called to instruct the backend to register that a closure exists for a
- /// function on an instantiated generic class.
- void registerClosureWithFreeTypeVariables(
- Element closure, Enqueuer enqueuer) {}
+ /// function on an instantiated generic class. Any backend specific
+ /// [WorldImpact] of this is returned.
+ WorldImpact registerClosureWithFreeTypeVariables(Element closure,
+ {bool forResolution}) =>
+ const WorldImpact();
- /// Call this to register that a member has been closurized.
- void registerBoundClosure(Enqueuer enqueuer) {}
+ /// Called to register that a member has been closurized. Any backend specific
+ /// [WorldImpact] of this is returned.
+ WorldImpact registerBoundClosure() => const WorldImpact();
- /// Call this to register that a static function has been closurized.
- void registerGetOfStaticFunction(Enqueuer enqueuer) {}
+ /// Called to register that a static function has been closurized. Any backend
+ /// specific [WorldImpact] of this is returned.
+ WorldImpact registerGetOfStaticFunction() => const WorldImpact();
- /**
- * Call this to register that the [:runtimeType:] property has been accessed.
- */
- void registerRuntimeType(Enqueuer enqueuer) {}
+ /// Called to register that the `runtimeType` property has been accessed. Any
+ /// backend specific [WorldImpact] of this is returned.
+ WorldImpact registerRuntimeType() => const WorldImpact();
- /// Call this to register a `noSuchMethod` implementation.
+ /// Called to register a `noSuchMethod` implementation.
void registerNoSuchMethod(FunctionElement noSuchMethodElement) {}
- /// Call this method to enable support for `noSuchMethod`.
- void enableNoSuchMethod(Enqueuer enqueuer) {}
+ /// Called to enable support for `noSuchMethod`. Any backend specific
+ /// [WorldImpact] of this is returned.
+ WorldImpact enableNoSuchMethod() => const WorldImpact();
/// Returns whether or not `noSuchMethod` support has been enabled.
bool get enabledNoSuchMethod => false;
- /// Call this method to enable support for isolates.
- void enableIsolateSupport(Enqueuer enqueuer) {}
+ /// Called to enable support for isolates. Any backend specific [WorldImpact]
+ /// of this is returned.
+ WorldImpact enableIsolateSupport({bool forResolution});
void registerConstSymbol(String name) {}
@@ -206,7 +220,10 @@
return false;
}
- void registerStaticUse(Enqueuer enqueuer, Element element) {}
+ /// Called to register that [element] is statically known to be used. Any
+ /// backend specific [WorldImpact] of this is returned.
+ WorldImpact registerStaticUse(Element element, {bool forResolution}) =>
+ const WorldImpact();
/// This method is called immediately after the [LibraryElement] [library] has
/// been created.
@@ -314,7 +331,9 @@
void forgetElement(Element element) {}
/// Computes the [WorldImpact] of calling [mainMethod] as the entry point.
- WorldImpact computeMainImpact(Enqueuer enqueuer, MethodElement mainMethod) {}
+ WorldImpact computeMainImpact(MethodElement mainMethod,
+ {bool forResolution}) =>
+ const WorldImpact();
/// Returns the location of the patch-file associated with [libraryName]
/// resolved from [plaformConfigUri].
diff --git a/pkg/compiler/lib/src/common/codegen.dart b/pkg/compiler/lib/src/common/codegen.dart
index 285e032..748f222 100644
--- a/pkg/compiler/lib/src/common/codegen.dart
+++ b/pkg/compiler/lib/src/common/codegen.dart
@@ -5,7 +5,7 @@
library dart2js.common.codegen;
import '../common.dart';
-import '../compiler.dart' show Compiler;
+import '../common/backend_api.dart' show Backend;
import '../constants/values.dart' show ConstantValue;
import '../dart_types.dart' show DartType, InterfaceType;
import '../elements/elements.dart'
@@ -146,19 +146,22 @@
// TODO(johnniwinther): Split this class into interface and implementation.
// TODO(johnniwinther): Move this implementation to the JS backend.
class CodegenRegistry {
- final Compiler compiler;
final Element currentElement;
final _CodegenImpact worldImpact;
- CodegenRegistry(Compiler compiler, AstElement currentElement)
- : this.compiler = compiler,
- this.currentElement = currentElement,
+ CodegenRegistry(AstElement currentElement)
+ : this.currentElement = currentElement,
this.worldImpact = new _CodegenImpact();
bool get isForResolution => false;
String toString() => 'CodegenRegistry for $currentElement';
+ /// Add the uses in [impact] to the impact of this registry.
+ void addImpact(WorldImpact impact) {
+ worldImpact.addImpact(impact);
+ }
+
@deprecated
void registerInstantiatedClass(ClassElement element) {
registerInstantiation(element.rawType);
@@ -218,8 +221,9 @@
class CodegenWorkItem extends WorkItem {
CodegenRegistry registry;
final ResolvedAst resolvedAst;
+ final Backend backend;
- factory CodegenWorkItem(Compiler compiler, AstElement element) {
+ factory CodegenWorkItem(Backend backend, AstElement element) {
// If this assertion fails, the resolution callbacks of the backend may be
// missing call of form registry.registerXXX. Alternatively, the code
// generation could spuriously be adding dependencies on things we know we
@@ -227,18 +231,16 @@
assert(invariant(element, element.hasResolvedAst,
message: "$element has no resolved ast."));
ResolvedAst resolvedAst = element.resolvedAst;
- return new CodegenWorkItem.internal(resolvedAst);
+ return new CodegenWorkItem.internal(resolvedAst, backend);
}
- CodegenWorkItem.internal(ResolvedAst resolvedAst)
+ CodegenWorkItem.internal(ResolvedAst resolvedAst, this.backend)
: this.resolvedAst = resolvedAst,
super(resolvedAst.element);
- WorldImpact run(Compiler compiler, Enqueuer world) {
- if (world.isProcessed(element)) return const WorldImpact();
-
- registry = new CodegenRegistry(compiler, element);
- return compiler.codegen(this, world);
+ WorldImpact run() {
+ registry = new CodegenRegistry(element);
+ return backend.codegen(this);
}
String toString() => 'CodegenWorkItem(${resolvedAst.element})';
diff --git a/pkg/compiler/lib/src/common/resolution.dart b/pkg/compiler/lib/src/common/resolution.dart
index 9012c82..2adfe26 100644
--- a/pkg/compiler/lib/src/common/resolution.dart
+++ b/pkg/compiler/lib/src/common/resolution.dart
@@ -41,18 +41,24 @@
import 'work.dart' show WorkItem;
/// [WorkItem] used exclusively by the [ResolutionEnqueuer].
-class ResolutionWorkItem extends WorkItem {
+abstract class ResolutionWorkItem implements WorkItem {
+ factory ResolutionWorkItem(Resolution resolution, AstElement element) =
+ _ResolutionWorkItem;
+}
+
+class _ResolutionWorkItem extends WorkItem implements ResolutionWorkItem {
bool _isAnalyzed = false;
+ final Resolution resolution;
- ResolutionWorkItem(AstElement element) : super(element);
+ _ResolutionWorkItem(this.resolution, AstElement element) : super(element);
- WorldImpact run(Compiler compiler, ResolutionEnqueuer world) {
- WorldImpact impact = compiler.analyze(this, world);
+ WorldImpact run() {
+ assert(invariant(element, !_isAnalyzed,
+ message: 'Element ${element} has already been analyzed'));
+ WorldImpact impact = resolution.computeWorldImpact(element);
_isAnalyzed = true;
return impact;
}
-
- bool get isAnalyzed => _isAnalyzed;
}
class ResolutionImpact extends WorldImpact {
@@ -210,11 +216,8 @@
/// A container of commonly used dependencies for tasks that involve parsing.
abstract class ParsingContext {
- factory ParsingContext(
- DiagnosticReporter reporter,
- ParserTask parser,
- PatchParserTask patchParser,
- Backend backend) = _ParsingContext;
+ factory ParsingContext(DiagnosticReporter reporter, ParserTask parser,
+ PatchParserTask patchParser, Backend backend) = _ParsingContext;
DiagnosticReporter get reporter;
ParserTask get parser;
@@ -238,8 +241,7 @@
final PatchParserTask patchParser;
final Backend backend;
- _ParsingContext(this.reporter, this.parser,
- this.patchParser, this.backend);
+ _ParsingContext(this.reporter, this.parser, this.patchParser, this.backend);
@override
measure(f()) => parser.measure(f);
diff --git a/pkg/compiler/lib/src/common/work.dart b/pkg/compiler/lib/src/common/work.dart
index c44c4251..c36a2a5 100644
--- a/pkg/compiler/lib/src/common/work.dart
+++ b/pkg/compiler/lib/src/common/work.dart
@@ -18,5 +18,5 @@
assert(invariant(element, element.isDeclaration));
}
- WorldImpact run(Compiler compiler, Enqueuer world);
+ WorldImpact run();
}
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index 7b4d9ce..db282a3 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -35,8 +35,7 @@
import 'dump_info.dart' show DumpInfoTask;
import 'elements/elements.dart';
import 'elements/modelx.dart' show ErroneousElementX;
-import 'enqueue.dart'
- show Enqueuer, EnqueueTask, ResolutionEnqueuer, QueueFilter;
+import 'enqueue.dart' show Enqueuer, EnqueueTask, ResolutionEnqueuer;
import 'environment.dart';
import 'id_generator.dart';
import 'io/source_information.dart' show SourceInformation;
@@ -56,9 +55,7 @@
import 'parser/diet_parser_task.dart' show DietParserTask;
import 'parser/parser_task.dart' show ParserTask;
import 'patch_parser.dart' show PatchParserTask;
-import 'resolution/registry.dart' show ResolutionRegistry;
import 'resolution/resolution.dart' show ResolverTask;
-import 'resolution/tree_elements.dart' show TreeElementMapping;
import 'resolved_uri_translator.dart';
import 'scanner/scanner_task.dart' show ScannerTask;
import 'script.dart' show Script;
@@ -70,11 +67,10 @@
import 'tree/tree.dart' show Node, TypeAnnotation;
import 'typechecker.dart' show TypeCheckerTask;
import 'types/types.dart' show GlobalTypeInferenceTask;
-import 'types/masks.dart' show CommonMasks;
import 'universe/selector.dart' show Selector;
import 'universe/world_builder.dart'
show ResolutionWorldBuilder, CodegenWorldBuilder;
-import 'universe/use.dart' show StaticUse;
+import 'universe/use.dart' show StaticUse, TypeUse;
import 'universe/world_impact.dart'
show
ImpactStrategy,
@@ -97,7 +93,7 @@
Types types;
_CompilerCoreTypes _coreTypes;
CompilerDiagnosticReporter _reporter;
- _CompilerResolution _resolution;
+ CompilerResolution _resolution;
ParsingContext _parsingContext;
final CacheStrategy cacheStrategy;
@@ -184,9 +180,6 @@
MirrorUsageAnalyzerTask mirrorUsageAnalyzerTask;
DumpInfoTask dumpInfoTask;
- /// A customizable filter that is applied to enqueued work items.
- QueueFilter enqueuerFilter = new QueueFilter();
-
bool get hasFunctionApplySupport => resolverWorld.hasFunctionApplySupport;
bool get hasIsolateSupport => resolverWorld.hasIsolateSupport;
@@ -222,7 +215,7 @@
} else {
_reporter = new CompilerDiagnosticReporter(this, options);
}
- _resolution = new _CompilerResolution(this);
+ _resolution = createResolution();
// TODO(johnniwinther): Initialize core types in [initializeCoreClasses] and
// make its field final.
_coreTypes = new _CompilerCoreTypes(_resolution, reporter);
@@ -240,13 +233,7 @@
if (makeBackend != null) {
backend = makeBackend(this);
} else {
- js_backend.JavaScriptBackend jsBackend = new js_backend.JavaScriptBackend(
- this,
- generateSourceMap: options.generateSourceMap,
- useStartupEmitter: options.useStartupEmitter,
- useNewSourceInfo: options.useNewSourceInfo,
- useKernel: options.useKernel);
- backend = jsBackend;
+ backend = createBackend();
}
enqueuer = backend.makeEnqueuer();
@@ -256,8 +243,7 @@
}
tasks = [
- dietParser =
- new DietParserTask(idGenerator, backend, reporter, measurer),
+ dietParser = new DietParserTask(idGenerator, backend, reporter, measurer),
scanner = createScannerTask(),
serialization = new SerializationTask(this),
libraryLoader = new LibraryLoaderTask(
@@ -310,6 +296,17 @@
return _world;
}
+ /// Creates the backend.
+ ///
+ /// Override this to mock the backend for testing.
+ Backend createBackend() {
+ return new js_backend.JavaScriptBackend(this,
+ generateSourceMap: options.generateSourceMap,
+ useStartupEmitter: options.useStartupEmitter,
+ useNewSourceInfo: options.useNewSourceInfo,
+ useKernel: options.useKernel);
+ }
+
/// Creates the scanner task.
///
/// Override this to mock the scanner for testing.
@@ -317,6 +314,11 @@
new ScannerTask(dietParser, reporter, measurer,
preserveComments: options.preserveComments, commentMap: commentMap);
+ /// Creates the resolution object.
+ ///
+ /// Override this to mock resolution for testing.
+ Resolution createResolution() => new CompilerResolution(this);
+
/// Creates the resolver task.
///
/// Override this to mock the resolver for testing.
@@ -553,9 +555,10 @@
});
}
- void computeMain() {
- if (mainApp == null) return;
+ WorldImpact computeMain() {
+ if (mainApp == null) return const WorldImpact();
+ WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
Element main = mainApp.findExported(Identifiers.main);
ErroneousElement errorElement = null;
if (main == null) {
@@ -596,7 +599,7 @@
parameter);
mainFunction = backend.helperForMainArity();
// Don't warn about main not being used:
- enqueuer.resolution.registerStaticUse(new StaticUse.foreignUse(main));
+ impactBuilder.registerStaticUse(new StaticUse.foreignUse(main));
});
}
}
@@ -613,6 +616,7 @@
reporter.reportWarningMessage(errorElement, errorElement.messageKind,
errorElement.messageArguments);
}
+ return impactBuilder;
}
/// Analyze all members of the library in [libraryUri].
@@ -630,8 +634,8 @@
.loadLibrary(libraryUri, skipFileWithPartOfTag: true)
.then((LibraryElement library) {
if (library == null) return null;
- fullyEnqueueLibrary(library, enqueuer.resolution);
- emptyQueue(enqueuer.resolution);
+ enqueuer.resolution.applyImpact(computeImpactForLibrary(library));
+ emptyQueue(enqueuer.resolution, onProgress: showResolutionProgress);
enqueuer.resolution.logSummary(reporter.log);
return library;
});
@@ -640,7 +644,7 @@
/// Performs the compilation when all libraries have been loaded.
void compileLoadedLibraries() =>
selfTask.measureSubtask("Compiler.compileLoadedLibraries", () {
- computeMain();
+ WorldImpact mainImpact = computeMain();
mirrorUsageAnalyzerTask.analyzeUsage(mainApp);
@@ -649,45 +653,51 @@
// something to the resolution queue. So we cannot wait with
// this until after the resolution queue is processed.
deferredLoadTask.beforeResolution(this);
- ImpactStrategy impactStrategy = backend.createImpactStrategy(
+ impactStrategy = backend.createImpactStrategy(
supportDeferredLoad: deferredLoadTask.isProgramSplit,
supportDumpInfo: options.dumpInfo,
supportSerialization: serialization.supportSerialization);
phase = PHASE_RESOLVING;
+ enqueuer.resolution.applyImpact(mainImpact);
if (options.resolveOnly) {
libraryLoader.libraries.where((LibraryElement library) {
return !serialization.isDeserialized(library);
}).forEach((LibraryElement library) {
reporter.log('Enqueuing ${library.canonicalUri}');
- fullyEnqueueLibrary(library, enqueuer.resolution);
+ enqueuer.resolution.applyImpact(computeImpactForLibrary(library));
});
} else if (analyzeAll) {
libraryLoader.libraries.forEach((LibraryElement library) {
reporter.log('Enqueuing ${library.canonicalUri}');
- fullyEnqueueLibrary(library, enqueuer.resolution);
+ enqueuer.resolution.applyImpact(computeImpactForLibrary(library));
});
} else if (options.analyzeMain) {
if (mainApp != null) {
- fullyEnqueueLibrary(mainApp, enqueuer.resolution);
+ enqueuer.resolution.applyImpact(computeImpactForLibrary(mainApp));
}
if (librariesToAnalyzeWhenRun != null) {
for (Uri libraryUri in librariesToAnalyzeWhenRun) {
- fullyEnqueueLibrary(
- libraryLoader.lookupLibrary(libraryUri), enqueuer.resolution);
+ enqueuer.resolution.applyImpact(computeImpactForLibrary(
+ libraryLoader.lookupLibrary(libraryUri)));
}
}
}
+ if (deferredLoadTask.isProgramSplit) {
+ enqueuer.resolution
+ .applyImpact(backend.computeDeferredLoadingImpact());
+ }
// Elements required by enqueueHelpers are global dependencies
// that are not pulled in by a particular element.
- backend.enqueueHelpers(enqueuer.resolution);
+ enqueuer.resolution.applyImpact(backend.computeHelpersImpact());
resolveLibraryMetadata();
reporter.log('Resolving...');
if (mainFunction != null && !mainFunction.isMalformed) {
mainFunction.computeType(resolution);
}
- processQueue(enqueuer.resolution, mainFunction);
+ processQueue(enqueuer.resolution, mainFunction,
+ onProgress: showResolutionProgress);
enqueuer.resolution.logSummary(reporter.log);
_reporter.reportSuppressedMessagesSummary();
@@ -733,16 +743,19 @@
reporter.log('Compiling...');
phase = PHASE_COMPILING;
+
backend.onCodegenStart();
if (hasIsolateSupport) {
- backend.enableIsolateSupport(enqueuer.codegen);
+ enqueuer.codegen
+ .applyImpact(backend.enableIsolateSupport(forResolution: false));
}
if (compileAll) {
libraryLoader.libraries.forEach((LibraryElement library) {
- fullyEnqueueLibrary(library, enqueuer.codegen);
+ enqueuer.codegen.applyImpact(computeImpactForLibrary(library));
});
}
- processQueue(enqueuer.codegen, mainFunction);
+ processQueue(enqueuer.codegen, mainFunction,
+ onProgress: showCodegenProgress);
enqueuer.codegen.logSummary(reporter.log);
int programSize = backend.assembleProgram();
@@ -773,19 +786,34 @@
closureToClassMapper.createClosureClasses();
}
- void fullyEnqueueLibrary(LibraryElement library, Enqueuer world) {
- void enqueueAll(Element element) {
- fullyEnqueueTopLevelElement(element, world);
+ /// Compute the [WorldImpact] for accessing all elements in [library].
+ WorldImpact computeImpactForLibrary(LibraryElement library) {
+ WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
+
+ void registerStaticUse(Element element) {
+ impactBuilder.registerStaticUse(new StaticUse.directUse(element));
}
- library.implementation.forEachLocalMember(enqueueAll);
+ void registerElement(Element element) {
+ if (element.isClass) {
+ ClassElement cls = element;
+ cls.ensureResolved(resolution);
+ cls.forEachLocalMember(registerStaticUse);
+ impactBuilder.registerTypeUse(new TypeUse.instantiation(cls.rawType));
+ } else {
+ registerStaticUse(element);
+ }
+ }
+
+ library.implementation.forEachLocalMember(registerElement);
+
library.imports.forEach((ImportElement import) {
if (import.isDeferred) {
// `import.prefix` and `loadLibrary` may be `null` when the deferred
// import has compile-time errors.
GetterElement loadLibrary = import.prefix?.loadLibrary;
if (loadLibrary != null) {
- world.addToWorkList(loadLibrary);
+ registerStaticUse(loadLibrary);
}
}
if (serialization.supportSerialization) {
@@ -806,17 +834,7 @@
}
});
}
- }
-
- void fullyEnqueueTopLevelElement(Element element, Enqueuer world) {
- if (element.isClass) {
- ClassElement cls = element;
- cls.ensureResolved(resolution);
- cls.forEachLocalMember(enqueuer.resolution.addToWorkList);
- world.registerInstantiatedType(cls.rawType);
- } else {
- world.addToWorkList(element);
- }
+ return impactBuilder;
}
// Resolves metadata on library elements. This is necessary in order to
@@ -835,37 +853,39 @@
/**
* Empty the [enqueuer] queue.
*/
- void emptyQueue(Enqueuer enqueuer) {
+ void emptyQueue(Enqueuer enqueuer, {void onProgress()}) {
selfTask.measureSubtask("Compiler.emptyQueue", () {
enqueuer.forEach((WorkItem work) {
+ if (onProgress != null) {
+ onProgress();
+ }
reporter.withCurrentElement(
work.element,
() => selfTask.measureSubtask("world.applyImpact", () {
enqueuer.applyImpact(
- impactStrategy,
- selfTask.measureSubtask(
- "work.run", () => work.run(this, enqueuer)),
+ selfTask.measureSubtask("work.run", () => work.run()),
impactSource: work.element);
}));
});
});
}
- void processQueue(Enqueuer enqueuer, MethodElement mainMethod) {
+ void processQueue(Enqueuer enqueuer, MethodElement mainMethod,
+ {void onProgress()}) {
selfTask.measureSubtask("Compiler.processQueue", () {
- enqueuer.applyImpact(
- impactStrategy,
- enqueuer.nativeEnqueuer
- .processNativeClasses(libraryLoader.libraries));
+ enqueuer.open(impactStrategy);
+ enqueuer.applyImpact(enqueuer.nativeEnqueuer
+ .processNativeClasses(libraryLoader.libraries));
if (mainMethod != null && !mainMethod.isMalformed) {
- enqueuer.applyImpact(
- impactStrategy, backend.computeMainImpact(enqueuer, mainMethod));
+ enqueuer.applyImpact(backend.computeMainImpact(mainMethod,
+ forResolution: enqueuer.isResolutionQueue));
}
if (options.verbose) {
progress.reset();
}
- emptyQueue(enqueuer);
+ emptyQueue(enqueuer, onProgress: onProgress);
enqueuer.queueIsClosed = true;
+ enqueuer.close();
// Notify the impact strategy impacts are no longer needed for this
// enqueuer.
impactStrategy.onImpactUsed(enqueuer.impactUse);
@@ -914,49 +934,18 @@
}
}
- WorldImpact analyzeElement(Element element) =>
- selfTask.measureSubtask("Compiler.analyzeElement", () {
- assert(invariant(
- element,
- element.impliesType ||
- element.isField ||
- element.isFunction ||
- element.isConstructor ||
- element.isGetter ||
- element.isSetter,
- message: 'Unexpected element kind: ${element.kind}'));
- assert(invariant(element, element is AnalyzableElement,
- message: 'Element $element is not analyzable.'));
- assert(invariant(element, element.isDeclaration));
- return resolution.computeWorldImpact(element);
- });
+ void showResolutionProgress() {
+ if (shouldPrintProgress) {
+ // TODO(ahe): Add structured diagnostics to the compiler API and
+ // use it to separate this from the --verbose option.
+ assert(phase == PHASE_RESOLVING);
+ reporter.log('Resolved ${enqueuer.resolution.processedElements.length} '
+ 'elements.');
+ progress.reset();
+ }
+ }
- WorldImpact analyze(ResolutionWorkItem work, ResolutionEnqueuer world) =>
- selfTask.measureSubtask("Compiler.analyze", () {
- assert(invariant(work.element, identical(world, enqueuer.resolution)));
- assert(invariant(work.element, !work.isAnalyzed,
- message: 'Element ${work.element} has already been analyzed'));
- if (shouldPrintProgress) {
- // TODO(ahe): Add structured diagnostics to the compiler API and
- // use it to separate this from the --verbose option.
- if (phase == PHASE_RESOLVING) {
- reporter
- .log('Resolved ${enqueuer.resolution.processedElements.length} '
- 'elements.');
- progress.reset();
- }
- }
- AstElement element = work.element;
- if (world.hasBeenProcessed(element)) {
- return const WorldImpact();
- }
- WorldImpact worldImpact = analyzeElement(element);
- world.registerProcessedElement(element);
- return worldImpact;
- });
-
- WorldImpact codegen(CodegenWorkItem work, Enqueuer world) {
- assert(invariant(work.element, identical(world, enqueuer.codegen)));
+ void showCodegenProgress() {
if (shouldPrintProgress) {
// TODO(ahe): Add structured diagnostics to the compiler API and
// use it to separate this from the --verbose option.
@@ -964,7 +953,6 @@
'Compiled ${enqueuer.codegen.processedEntities.length} methods.');
progress.reset();
}
- return backend.codegen(work);
}
void reportDiagnostic(DiagnosticMessage message,
@@ -1940,94 +1928,94 @@
}
// TODO(johnniwinther): Move [ResolverTask] here.
-class _CompilerResolution implements Resolution {
- final Compiler compiler;
+class CompilerResolution implements Resolution {
+ final Compiler _compiler;
final Map<Element, ResolutionImpact> _resolutionImpactCache =
<Element, ResolutionImpact>{};
final Map<Element, WorldImpact> _worldImpactCache = <Element, WorldImpact>{};
bool retainCachesForTesting = false;
- _CompilerResolution(this.compiler);
+ CompilerResolution(this._compiler);
@override
- DiagnosticReporter get reporter => compiler.reporter;
+ DiagnosticReporter get reporter => _compiler.reporter;
@override
- ParsingContext get parsingContext => compiler.parsingContext;
+ ParsingContext get parsingContext => _compiler.parsingContext;
@override
- CoreClasses get coreClasses => compiler.coreClasses;
+ CoreClasses get coreClasses => _compiler.coreClasses;
@override
- CoreTypes get coreTypes => compiler.coreTypes;
+ CoreTypes get coreTypes => _compiler.coreTypes;
@override
- CommonElements get commonElements => compiler.commonElements;
+ CommonElements get commonElements => _compiler.commonElements;
@override
- Types get types => compiler.types;
+ Types get types => _compiler.types;
@override
- Target get target => compiler.backend;
+ Target get target => _compiler.backend;
@override
- ResolverTask get resolver => compiler.resolver;
+ ResolverTask get resolver => _compiler.resolver;
@override
- ResolutionEnqueuer get enqueuer => compiler.enqueuer.resolution;
+ ResolutionEnqueuer get enqueuer => _compiler.enqueuer.resolution;
@override
- CompilerOptions get options => compiler.options;
+ CompilerOptions get options => _compiler.options;
@override
- IdGenerator get idGenerator => compiler.idGenerator;
+ IdGenerator get idGenerator => _compiler.idGenerator;
@override
- ConstantEnvironment get constants => compiler.constants;
+ ConstantEnvironment get constants => _compiler.constants;
@override
MirrorUsageAnalyzerTask get mirrorUsageAnalyzerTask =>
- compiler.mirrorUsageAnalyzerTask;
+ _compiler.mirrorUsageAnalyzerTask;
@override
- LibraryElement get coreLibrary => compiler._coreTypes.coreLibrary;
+ LibraryElement get coreLibrary => _compiler._coreTypes.coreLibrary;
@override
bool get wasProxyConstantComputedTestingOnly => _proxyConstant != null;
@override
void registerClass(ClassElement cls) {
- compiler.openWorld.registerClass(cls);
+ _compiler.openWorld.registerClass(cls);
}
@override
void resolveClass(ClassElement cls) {
- compiler.resolver.resolveClass(cls);
+ _compiler.resolver.resolveClass(cls);
}
@override
void resolveTypedef(TypedefElement typdef) {
- compiler.resolver.resolve(typdef);
+ _compiler.resolver.resolve(typdef);
}
@override
void resolveMetadataAnnotation(MetadataAnnotation metadataAnnotation) {
- compiler.resolver.resolveMetadataAnnotation(metadataAnnotation);
+ _compiler.resolver.resolveMetadataAnnotation(metadataAnnotation);
}
@override
FunctionSignature resolveSignature(FunctionElement function) {
- return compiler.resolver.resolveSignature(function);
+ return _compiler.resolver.resolveSignature(function);
}
@override
DartType resolveTypeAnnotation(Element element, TypeAnnotation node) {
- return compiler.resolver.resolveTypeAnnotation(element, node);
+ return _compiler.resolver.resolveTypeAnnotation(element, node);
}
@override
void ensureResolved(Element element) {
- if (compiler.serialization.isDeserialized(element)) {
+ if (_compiler.serialization.isDeserialized(element)) {
return;
}
computeWorldImpact(element);
@@ -2035,21 +2023,21 @@
@override
void ensureClassMembers(ClassElement element) {
- if (!compiler.serialization.isDeserialized(element)) {
- compiler.resolver.checkClass(element);
+ if (!_compiler.serialization.isDeserialized(element)) {
+ _compiler.resolver.checkClass(element);
}
}
@override
void registerCompileTimeError(Element element, DiagnosticMessage message) =>
- compiler.registerCompileTimeError(element, message);
+ _compiler.registerCompileTimeError(element, message);
@override
bool hasResolvedAst(ExecutableElement element) {
assert(invariant(element, element.isDeclaration,
message: "Element $element must be the declaration."));
- if (compiler.serialization.isDeserialized(element)) {
- return compiler.serialization.hasResolvedAst(element);
+ if (_compiler.serialization.isDeserialized(element)) {
+ return _compiler.serialization.hasResolvedAst(element);
}
return hasBeenResolved(element.memberContext.declaration) &&
element.hasResolvedAst;
@@ -2061,8 +2049,8 @@
message: "Element $element must be the declaration."));
assert(invariant(element, hasResolvedAst(element),
message: "ResolvedAst not available for $element."));
- if (compiler.serialization.isDeserialized(element)) {
- return compiler.serialization.getResolvedAst(element);
+ if (_compiler.serialization.isDeserialized(element)) {
+ return _compiler.serialization.getResolvedAst(element);
}
return element.resolvedAst;
}
@@ -2077,8 +2065,8 @@
bool hasResolutionImpact(Element element) {
assert(invariant(element, element.isDeclaration,
message: "Element $element must be the declaration."));
- if (compiler.serialization.isDeserialized(element)) {
- return compiler.serialization.hasResolutionImpact(element);
+ if (_compiler.serialization.isDeserialized(element)) {
+ return _compiler.serialization.hasResolutionImpact(element);
}
return _resolutionImpactCache.containsKey(element);
}
@@ -2088,8 +2076,8 @@
assert(invariant(element, element.isDeclaration,
message: "Element $element must be the declaration."));
ResolutionImpact resolutionImpact;
- if (compiler.serialization.isDeserialized(element)) {
- resolutionImpact = compiler.serialization.getResolutionImpact(element);
+ if (_compiler.serialization.isDeserialized(element)) {
+ resolutionImpact = _compiler.serialization.getResolutionImpact(element);
} else {
resolutionImpact = _resolutionImpactCache[element];
}
@@ -2110,39 +2098,53 @@
@override
WorldImpact computeWorldImpact(Element element) {
- assert(invariant(element, element.isDeclaration,
- message: "Element $element must be the declaration."));
- return _worldImpactCache.putIfAbsent(element, () {
- assert(compiler.parser != null);
- Node tree = compiler.parser.parse(element);
- assert(invariant(element, !element.isSynthesized || tree == null));
- ResolutionImpact resolutionImpact = compiler.resolver.resolve(element);
+ return _compiler.selfTask.measureSubtask("Resolution.computeWorldImpact",
+ () {
+ assert(invariant(
+ element,
+ element.impliesType ||
+ element.isField ||
+ element.isFunction ||
+ element.isConstructor ||
+ element.isGetter ||
+ element.isSetter,
+ message: 'Unexpected element kind: ${element.kind}'));
+ assert(invariant(element, element is AnalyzableElement,
+ message: 'Element $element is not analyzable.'));
+ assert(invariant(element, element.isDeclaration,
+ message: "Element $element must be the declaration."));
+ return _worldImpactCache.putIfAbsent(element, () {
+ assert(_compiler.parser != null);
+ Node tree = _compiler.parser.parse(element);
+ assert(invariant(element, !element.isSynthesized || tree == null));
+ ResolutionImpact resolutionImpact = _compiler.resolver.resolve(element);
- if (compiler.serialization.supportSerialization ||
- retainCachesForTesting) {
- // [ResolutionImpact] is currently only used by serialization. The
- // enqueuer uses the [WorldImpact] which is always cached.
- // TODO(johnniwinther): Align these use cases better; maybe only
- // cache [ResolutionImpact] and let the enqueuer transform it into
- // a [WorldImpact].
- _resolutionImpactCache[element] = resolutionImpact;
- }
- if (tree != null && !compiler.options.analyzeSignaturesOnly) {
- // TODO(het): don't do this if suppressWarnings is on, currently we have
- // to do it because the typechecker also sets types
- // Only analyze nodes with a corresponding [TreeElements].
- compiler.checker.check(element);
- }
- return transformResolutionImpact(element, resolutionImpact);
+ if (_compiler.serialization.supportSerialization ||
+ retainCachesForTesting) {
+ // [ResolutionImpact] is currently only used by serialization. The
+ // enqueuer uses the [WorldImpact] which is always cached.
+ // TODO(johnniwinther): Align these use cases better; maybe only
+ // cache [ResolutionImpact] and let the enqueuer transform it into
+ // a [WorldImpact].
+ _resolutionImpactCache[element] = resolutionImpact;
+ }
+ if (tree != null && !_compiler.options.analyzeSignaturesOnly) {
+ // TODO(het): don't do this if suppressWarnings is on, currently we
+ // have to do it because the typechecker also sets types
+ // Only analyze nodes with a corresponding [TreeElements].
+ _compiler.checker.check(element);
+ }
+ return transformResolutionImpact(element, resolutionImpact);
+ });
});
}
@override
WorldImpact transformResolutionImpact(
Element element, ResolutionImpact resolutionImpact) {
- WorldImpact worldImpact = compiler.backend.impactTransformer
+ WorldImpact worldImpact = _compiler.backend.impactTransformer
.transformResolutionImpact(
- compiler.enqueuer.resolution, resolutionImpact);
+ _compiler.enqueuer.resolution, resolutionImpact);
_worldImpactCache[element] = worldImpact;
return worldImpact;
}
@@ -2152,7 +2154,7 @@
assert(invariant(element, element.isDeclaration,
message: "Element $element must be the declaration."));
if (retainCachesForTesting) return;
- if (compiler.serialization.isDeserialized(element)) return;
+ if (_compiler.serialization.isDeserialized(element)) return;
assert(invariant(element, _worldImpactCache[element] != null,
message: "WorldImpact not computed for $element."));
_worldImpactCache[element] = const WorldImpact();
@@ -2175,10 +2177,10 @@
@override
ResolutionWorkItem createWorkItem(Element element) {
- if (compiler.serialization.isDeserialized(element)) {
- return compiler.serialization.createResolutionWorkItem(element);
+ if (_compiler.serialization.isDeserialized(element)) {
+ return _compiler.serialization.createResolutionWorkItem(element);
} else {
- return new ResolutionWorkItem(element);
+ return new ResolutionWorkItem(this, element);
}
}
diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart
index b29dae6..d2c8ddb 100644
--- a/pkg/compiler/lib/src/deferred_load.dart
+++ b/pkg/compiler/lib/src/deferred_load.dart
@@ -843,8 +843,8 @@
});
}
if (isProgramSplit) {
- isProgramSplit = compiler.backend.enableDeferredLoadingIfSupported(
- compiler.enqueuer.resolution, lastDeferred);
+ isProgramSplit =
+ compiler.backend.enableDeferredLoadingIfSupported(lastDeferred);
}
}
diff --git a/pkg/compiler/lib/src/enqueue.dart b/pkg/compiler/lib/src/enqueue.dart
index 6c7de3f..cdd46e9 100644
--- a/pkg/compiler/lib/src/enqueue.dart
+++ b/pkg/compiler/lib/src/enqueue.dart
@@ -54,9 +54,8 @@
this,
compiler.options,
compiler.resolution,
- compiler.enqueuerFilter,
compiler.options.analyzeOnly && compiler.options.analyzeMain
- ? const EnqueuerStrategy()
+ ? const DirectEnqueuerStrategy()
: const TreeShakingEnqueuerStrategy(),
compiler.globalDependencies,
compiler.backend,
@@ -75,16 +74,24 @@
}
abstract class Enqueuer {
- CompilerTask get task;
WorldBuilder get universe;
native.NativeEnqueuer get nativeEnqueuer;
void forgetElement(Element element, Compiler compiler);
- void processInstantiatedClassMembers(ClassElement cls);
- void processInstantiatedClassMember(ClassElement cls, Element member);
- void handleUnseenSelectorInternal(DynamicUse dynamicUse);
- void registerStaticUse(StaticUse staticUse);
- void registerStaticUseInternal(StaticUse staticUse);
- void registerDynamicUse(DynamicUse dynamicUse);
+
+ // TODO(johnniwinther): Initialize [_impactStrategy] to `null`.
+ ImpactStrategy _impactStrategy = const ImpactStrategy();
+
+ ImpactStrategy get impactStrategy => _impactStrategy;
+
+ void open(ImpactStrategy impactStrategy) {
+ _impactStrategy = impactStrategy;
+ }
+
+ void close() {
+ // TODO(johnniwinther): Set [_impactStrategy] to `null` and [queueIsClosed]
+ // to `true` here.
+ _impactStrategy = const ImpactStrategy();
+ }
/// Returns [:true:] if this enqueuer is the resolution enqueuer.
bool get isResolutionQueue;
@@ -95,23 +102,12 @@
ImpactUseCase get impactUse;
- /**
- * Documentation wanted -- johnniwinther
- *
- * Invariant: [element] must be a declaration element.
- */
- void addToWorkList(Element element);
-
- void enableIsolateSupport();
-
- void registerInstantiatedType(InterfaceType type);
void forEach(void f(WorkItem work));
- /// Apply the [worldImpact] to this enqueuer. If the [impactSource] is provided
- /// the impact strategy will remove it from the element impact cache, if it is
- /// no longer needed.
- void applyImpact(ImpactStrategy impactStrategy, WorldImpact worldImpact,
- {Element impactSource});
+ /// Apply the [worldImpact] to this enqueuer. If the [impactSource] is
+ /// provided the impact strategy will remove it from the element impact cache,
+ /// if it is no longer needed.
+ void applyImpact(WorldImpact worldImpact, {Element impactSource});
bool checkNoEnqueuedInvokedInstanceMethods();
void logSummary(log(message));
@@ -123,12 +119,23 @@
Iterable<ClassElement> get processedClasses;
}
+abstract class EnqueuerImpl extends Enqueuer {
+ CompilerTask get task;
+ void processInstantiatedClassMembers(ClassElement cls);
+ void processInstantiatedClassMember(ClassElement cls, Element member);
+ void registerStaticUse(StaticUse staticUse);
+ void registerStaticUseInternal(StaticUse staticUse);
+ void registerTypeUse(TypeUse typeUse);
+ void registerTypeUseInternal(TypeUse typeUse);
+ void registerDynamicUse(DynamicUse dynamicUse);
+ void handleUnseenSelectorInternal(DynamicUse dynamicUse);
+}
+
/// [Enqueuer] which is specific to resolution.
-class ResolutionEnqueuer extends Enqueuer {
+class ResolutionEnqueuer extends EnqueuerImpl {
final CompilerTask task;
final String name;
final Resolution resolution;
- final QueueFilter filter;
final CompilerOptions options;
final Backend backend;
final GlobalDependencyRegistry globalDependencies;
@@ -148,13 +155,10 @@
WorldImpactVisitor impactVisitor;
- ImpactStrategy impactStrategy;
-
ResolutionEnqueuer(
this.task,
this.options,
this.resolution,
- this.filter,
this.strategy,
this.globalDependencies,
Backend backend,
@@ -169,7 +173,7 @@
deferredQueue = new Queue<_DeferredAction>(),
_universe = new ResolutionWorldBuilderImpl(
backend, commonElements, cacheStrategy, const TypeMaskStrategy()) {
- impactVisitor = new _EnqueuerImpactVisitor(this);
+ impactVisitor = new EnqueuerImplImpactVisitor(this);
}
ResolutionWorldBuilder get universe => _universe;
@@ -194,8 +198,8 @@
internalAddToWorkList(element);
}
- void applyImpact(ImpactStrategy impactStrategy, WorldImpact worldImpact,
- {Element impactSource}) {
+ void applyImpact(WorldImpact worldImpact, {Element impactSource}) {
+ if (worldImpact.isEmpty) return;
impactStrategy.visitImpact(
impactSource, worldImpact, impactVisitor, impactUse);
}
@@ -219,7 +223,7 @@
isNative: isNative,
byMirrors: mirrorUsage,
isRedirection: isRedirection, onImplemented: (ClassElement cls) {
- backend.registerImplementedClass(cls, this);
+ applyImpact(backend.registerImplementedClass(cls, forResolution: true));
});
if (globalDependency && !mirrorUsage) {
globalDependencies.registerDependency(type.element);
@@ -236,7 +240,7 @@
}
bool checkNoEnqueuedInvokedInstanceMethods() {
- return filter.checkNoEnqueuedInvokedInstanceMethods(this);
+ return strategy.checkEnqueuerConsistency(this);
}
void processInstantiatedClassMembers(ClassElement cls) {
@@ -284,7 +288,7 @@
registerNoSuchMethod(function);
}
if (function.name == Identifiers.call && !cls.typeVariables.isEmpty) {
- registerCallMethodWithFreeTypeVariables(function);
+ _registerCallMethodWithFreeTypeVariables(function);
}
// If there is a property access with the same name as a method we
// need to emit the method.
@@ -349,7 +353,8 @@
// We only tell the backend once that [superclass] was instantiated, so
// any additional dependencies must be treated as global
// dependencies.
- backend.registerInstantiatedClass(superclass, this);
+ applyImpact(
+ backend.registerInstantiatedClass(superclass, forResolution: true));
}
ClassElement superclass = cls;
@@ -433,11 +438,11 @@
assert(invariant(element, element.isDeclaration,
message: "Element ${element} is not the declaration."));
_universe.registerStaticUse(staticUse);
- backend.registerStaticUse(this, element);
+ applyImpact(backend.registerStaticUse(element, forResolution: true));
bool addElement = true;
switch (staticUse.kind) {
case StaticUseKind.STATIC_TEAR_OFF:
- backend.registerGetOfStaticFunction(this);
+ applyImpact(backend.registerGetOfStaticFunction());
break;
case StaticUseKind.FIELD_GET:
case StaticUseKind.FIELD_SET:
@@ -455,6 +460,7 @@
case StaticUseKind.SUPER_FIELD_SET:
case StaticUseKind.SUPER_TEAR_OFF:
case StaticUseKind.GENERAL:
+ case StaticUseKind.DIRECT_USE:
break;
case StaticUseKind.CONSTRUCTOR_INVOKE:
case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
@@ -477,7 +483,11 @@
}
}
- void _registerTypeUse(TypeUse typeUse) {
+ void registerTypeUse(TypeUse typeUse) {
+ strategy.processTypeUse(this, typeUse);
+ }
+
+ void registerTypeUseInternal(TypeUse typeUse) {
DartType type = typeUse.type;
switch (typeUse.kind) {
case TypeUseKind.INSTANTIATION:
@@ -514,18 +524,20 @@
assert(!type.isTypeVariable || !type.element.enclosingElement.isTypedef);
}
- void registerCallMethodWithFreeTypeVariables(Element element) {
- backend.registerCallMethodWithFreeTypeVariables(element, this);
+ void _registerCallMethodWithFreeTypeVariables(Element element) {
+ applyImpact(backend.registerCallMethodWithFreeTypeVariables(element,
+ forResolution: true));
_universe.callMethodsWithFreeTypeVariables.add(element);
}
void registerClosurizedMember(TypedElement element) {
assert(element.isInstanceMember);
if (element.computeType(resolution).containsTypeVariables) {
- backend.registerClosureWithFreeTypeVariables(element, this);
+ applyImpact(backend.registerClosureWithFreeTypeVariables(element,
+ forResolution: true));
_universe.closuresWithFreeTypeVariables.add(element);
}
- backend.registerBoundClosure(this);
+ applyImpact(backend.registerBoundClosure());
_universe.closurizedMembers.add(element);
}
@@ -533,7 +545,11 @@
do {
while (queue.isNotEmpty) {
// TODO(johnniwinther): Find an optimal process order.
- filter.processWorkItem(f, queue.removeLast());
+ WorkItem work = queue.removeLast();
+ if (!isProcessed(work.element)) {
+ strategy.processWorkItem(f, work);
+ registerProcessedElement(work.element);
+ }
}
List recents = recentClasses.toList(growable: false);
recentClasses.clear();
@@ -625,7 +641,7 @@
// runtime type.
_universe.hasRuntimeTypeSupport = true;
// TODO(ahe): Record precise dependency here.
- backend.registerRuntimeType(this);
+ applyImpact(backend.registerRuntimeType());
} else if (commonElements.isFunctionApplyMethod(element)) {
_universe.hasFunctionApplySupport = true;
}
@@ -639,7 +655,7 @@
void enableIsolateSupport() {
_universe.hasIsolateSupport = true;
- backend.enableIsolateSupport(this);
+ applyImpact(backend.enableIsolateSupport(forResolution: true));
}
/**
@@ -690,11 +706,32 @@
}
}
-/// Parameterizes filtering of which work items are enqueued.
-class QueueFilter {
- bool checkNoEnqueuedInvokedInstanceMethods(Enqueuer enqueuer) {
+void removeFromSet(Map<String, Set<Element>> map, Element element) {
+ Set<Element> set = map[element.name];
+ if (set == null) return;
+ set.remove(element);
+}
+
+/// Strategy used by the enqueuer to populate the world.
+class EnqueuerStrategy {
+ const EnqueuerStrategy();
+
+ /// Process a class instantiated in live code.
+ void processInstantiatedClass(EnqueuerImpl enqueuer, ClassElement cls) {}
+
+ /// Process a static use of and element in live code.
+ void processStaticUse(EnqueuerImpl enqueuer, StaticUse staticUse) {}
+
+ /// Process a type use in live code.
+ void processTypeUse(EnqueuerImpl enqueuer, TypeUse typeUse) {}
+
+ /// Process a dynamic use for a call site in live code.
+ void processDynamicUse(EnqueuerImpl enqueuer, DynamicUse dynamicUse) {}
+
+ /// Check enqueuer consistency after the queue has been closed.
+ bool checkEnqueuerConsistency(EnqueuerImpl enqueuer) {
enqueuer.task.measure(() {
- // Run through the classes and see if we need to compile methods.
+ // Run through the classes and see if we need to enqueue more methods.
for (ClassElement classElement
in enqueuer.universe.directlyInstantiatedClasses) {
for (ClassElement currentClass = classElement;
@@ -707,55 +744,51 @@
return true;
}
+ /// Process [work] using [f].
void processWorkItem(void f(WorkItem work), WorkItem work) {
f(work);
}
}
-void removeFromSet(Map<String, Set<Element>> map, Element element) {
- Set<Element> set = map[element.name];
- if (set == null) return;
- set.remove(element);
+/// Strategy that only enqueues directly used elements.
+class DirectEnqueuerStrategy extends EnqueuerStrategy {
+ const DirectEnqueuerStrategy();
+ void processStaticUse(EnqueuerImpl enqueuer, StaticUse staticUse) {
+ if (staticUse.kind == StaticUseKind.DIRECT_USE) {
+ enqueuer.registerStaticUseInternal(staticUse);
+ }
+ }
}
-/// Strategy used by the enqueuer to populate the world.
-// TODO(johnniwinther): Merge this interface with [QueueFilter].
-class EnqueuerStrategy {
- const EnqueuerStrategy();
-
- /// Process a class instantiated in live code.
- void processInstantiatedClass(Enqueuer enqueuer, ClassElement cls) {}
-
- /// Process a static use of and element in live code.
- void processStaticUse(Enqueuer enqueuer, StaticUse staticUse) {}
-
- /// Process a dynamic use for a call site in live code.
- void processDynamicUse(Enqueuer enqueuer, DynamicUse dynamicUse) {}
-}
-
-class TreeShakingEnqueuerStrategy implements EnqueuerStrategy {
+/// Strategy used for tree-shaking.
+class TreeShakingEnqueuerStrategy extends EnqueuerStrategy {
const TreeShakingEnqueuerStrategy();
@override
- void processInstantiatedClass(Enqueuer enqueuer, ClassElement cls) {
+ void processInstantiatedClass(EnqueuerImpl enqueuer, ClassElement cls) {
cls.implementation.forEachMember(enqueuer.processInstantiatedClassMember);
}
@override
- void processStaticUse(Enqueuer enqueuer, StaticUse staticUse) {
+ void processStaticUse(EnqueuerImpl enqueuer, StaticUse staticUse) {
enqueuer.registerStaticUseInternal(staticUse);
}
@override
- void processDynamicUse(Enqueuer enqueuer, DynamicUse dynamicUse) {
+ void processTypeUse(EnqueuerImpl enqueuer, TypeUse typeUse) {
+ enqueuer.registerTypeUseInternal(typeUse);
+ }
+
+ @override
+ void processDynamicUse(EnqueuerImpl enqueuer, DynamicUse dynamicUse) {
enqueuer.handleUnseenSelectorInternal(dynamicUse);
}
}
-class _EnqueuerImpactVisitor implements WorldImpactVisitor {
- final ResolutionEnqueuer enqueuer;
+class EnqueuerImplImpactVisitor implements WorldImpactVisitor {
+ final EnqueuerImpl enqueuer;
- _EnqueuerImpactVisitor(this.enqueuer);
+ EnqueuerImplImpactVisitor(this.enqueuer);
@override
void visitDynamicUse(DynamicUse dynamicUse) {
@@ -769,7 +802,7 @@
@override
void visitTypeUse(TypeUse typeUse) {
- enqueuer._registerTypeUse(typeUse);
+ enqueuer.registerTypeUse(typeUse);
}
}
diff --git a/pkg/compiler/lib/src/inferrer/inferrer_visitor.dart b/pkg/compiler/lib/src/inferrer/inferrer_visitor.dart
index d011dc0..7b913b0 100644
--- a/pkg/compiler/lib/src/inferrer/inferrer_visitor.dart
+++ b/pkg/compiler/lib/src/inferrer/inferrer_visitor.dart
@@ -763,9 +763,22 @@
T visitAssert(Assert node) {
// Avoid pollution from assert statement unless enabled.
- if (compiler.options.enableUserAssertions) {
- super.visitAssert(node);
+ if (!compiler.options.enableUserAssertions) {
+ return null;
}
+ List<Send> tests = <Send>[];
+ bool simpleCondition = handleCondition(node.condition, tests);
+ LocalsHandler<T> saved = locals;
+ locals = new LocalsHandler<T>.from(locals, node);
+ updateIsChecks(tests, usePositive: true);
+
+ LocalsHandler<T> thenLocals = locals;
+ locals = new LocalsHandler<T>.from(saved, node);
+ if (simpleCondition) updateIsChecks(tests, usePositive: false);
+ visit(node.message);
+ locals.seenReturnOrThrow = true;
+ saved.mergeDiamondFlow(thenLocals, locals);
+ locals = saved;
return null;
}
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index 03e5839..c4d156b 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -335,7 +335,6 @@
static const String TRACE_METHOD = const String.fromEnvironment('traceCalls');
static const bool TRACE_CALLS =
TRACE_METHOD == 'post' || TRACE_METHOD == 'console';
- MethodElement traceHelper;
TypeMask get stringType => compiler.closedWorld.commonMasks.stringType;
TypeMask get doubleType => compiler.closedWorld.commonMasks.doubleType;
@@ -1036,9 +1035,9 @@
});
}
- void addInterceptorsForNativeClassMembers(
- ClassElement cls, Enqueuer enqueuer) {
- if (enqueuer.isResolutionQueue) {
+ void addInterceptorsForNativeClassMembers(ClassElement cls,
+ {bool forResolution}) {
+ if (forResolution) {
cls.ensureResolved(resolution);
cls.forEachMember((ClassElement classElement, Element member) {
if (member.name == Identifiers.call) {
@@ -1062,20 +1061,22 @@
}
}
- void addInterceptors(ClassElement cls, Enqueuer enqueuer) {
- if (enqueuer.isResolutionQueue) {
+ void addInterceptors(ClassElement cls, WorldImpactBuilder impactBuilder,
+ {bool forResolution}) {
+ if (forResolution) {
+ if (_interceptedClasses.add(cls)) {
+ cls.ensureResolved(resolution);
+ cls.forEachMember((ClassElement classElement, Element member) {
+ // All methods on [Object] are shadowed by [Interceptor].
+ if (classElement == coreClasses.objectClass) return;
+ Set<Element> set = interceptedElements.putIfAbsent(
+ member.name, () => new Set<Element>());
+ set.add(member);
+ }, includeSuperAndInjectedMembers: true);
+ }
_interceptedClasses.add(helpers.jsInterceptorClass);
- _interceptedClasses.add(cls);
- cls.ensureResolved(resolution);
- cls.forEachMember((ClassElement classElement, Element member) {
- // All methods on [Object] are shadowed by [Interceptor].
- if (classElement == coreClasses.objectClass) return;
- Set<Element> set = interceptedElements.putIfAbsent(
- member.name, () => new Set<Element>());
- set.add(member);
- }, includeSuperAndInjectedMembers: true);
}
- enqueueClass(enqueuer, cls);
+ impactTransformer.registerBackendInstantiation(impactBuilder, cls);
}
Set<ClassElement> get interceptedClasses {
@@ -1168,190 +1169,168 @@
}
}
- void registerInstantiatedClass(ClassElement cls, Enqueuer enqueuer) {
- _processClass(cls, enqueuer);
+ WorldImpact registerInstantiatedClass(ClassElement cls,
+ {bool forResolution}) {
+ return _processClass(cls, forResolution: forResolution);
}
- void registerImplementedClass(ClassElement cls, Enqueuer enqueuer) {
- _processClass(cls, enqueuer);
+ WorldImpact registerImplementedClass(ClassElement cls, {bool forResolution}) {
+ return _processClass(cls, forResolution: forResolution);
}
- void _processClass(ClassElement cls, Enqueuer enqueuer) {
+ WorldImpact _processClass(ClassElement cls, {bool forResolution}) {
+ WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
if (!cls.typeVariables.isEmpty) {
- typeVariableHandler.registerClassWithTypeVariables(cls, enqueuer);
+ typeVariableHandler.registerClassWithTypeVariables(cls,
+ forResolution: forResolution);
}
// Register any helper that will be needed by the backend.
- if (enqueuer.isResolutionQueue) {
+ if (forResolution) {
if (cls == coreClasses.intClass ||
cls == coreClasses.doubleClass ||
cls == coreClasses.numClass) {
- // The backend will try to optimize number operations and use the
- // `iae` helper directly.
- enqueue(enqueuer, helpers.throwIllegalArgumentException);
+ impactTransformer.registerBackendImpact(
+ impactBuilder, impacts.numClasses);
} else if (cls == coreClasses.listClass ||
cls == coreClasses.stringClass) {
- // The backend will try to optimize array and string access and use the
- // `ioore` and `iae` helpers directly.
- enqueue(enqueuer, helpers.throwIndexOutOfRangeException);
- enqueue(enqueuer, helpers.throwIllegalArgumentException);
+ impactTransformer.registerBackendImpact(
+ impactBuilder, impacts.listOrStringClasses);
} else if (cls == coreClasses.functionClass) {
- enqueueClass(enqueuer, helpers.closureClass);
+ impactTransformer.registerBackendImpact(
+ impactBuilder, impacts.functionClass);
} else if (cls == coreClasses.mapClass) {
- // The backend will use a literal list to initialize the entries
- // of the map.
- enqueueClass(enqueuer, coreClasses.listClass);
- enqueueClass(enqueuer, helpers.mapLiteralClass);
+ impactTransformer.registerBackendImpact(
+ impactBuilder, impacts.mapClass);
// For map literals, the dependency between the implementation class
// and [Map] is not visible, so we have to add it manually.
rti.registerRtiDependency(helpers.mapLiteralClass, cls);
} else if (cls == helpers.boundClosureClass) {
- // TODO(johnniwinther): Is this a noop?
- enqueueClass(enqueuer, helpers.boundClosureClass);
+ impactTransformer.registerBackendImpact(
+ impactBuilder, impacts.boundClosureClass);
} else if (isNativeOrExtendsNative(cls)) {
- enqueue(enqueuer, helpers.getNativeInterceptorMethod);
- enqueueClass(enqueuer, helpers.jsInterceptorClass);
- enqueueClass(enqueuer, helpers.jsJavaScriptObjectClass);
- enqueueClass(enqueuer, helpers.jsPlainJavaScriptObjectClass);
- enqueueClass(enqueuer, helpers.jsJavaScriptFunctionClass);
+ impactTransformer.registerBackendImpact(
+ impactBuilder, impacts.nativeOrExtendsClass);
} else if (cls == helpers.mapLiteralClass) {
- // For map literals, the dependency between the implementation class
- // and [Map] is not visible, so we have to add it manually.
- Element getFactory(String name, int arity) {
- // The constructor is on the patch class, but dart2js unit tests don't
- // have a patch class.
- ClassElement implementation = cls.implementation;
- ConstructorElement ctor = implementation.lookupConstructor(name);
- if (ctor == null ||
- (Name.isPrivateName(name) &&
- ctor.library != helpers.mapLiteralClass.library)) {
- reporter.internalError(
- helpers.mapLiteralClass,
- "Map literal class ${helpers.mapLiteralClass} missing "
- "'$name' constructor"
- " ${helpers.mapLiteralClass.constructors}");
- }
- return ctor;
- }
-
- Element getMember(String name) {
- // The constructor is on the patch class, but dart2js unit tests don't
- // have a patch class.
- ClassElement implementation = cls.implementation;
- Element element = implementation.lookupLocalMember(name);
- if (element == null || !element.isFunction || !element.isStatic) {
- reporter.internalError(
- helpers.mapLiteralClass,
- "Map literal class ${helpers.mapLiteralClass} missing "
- "'$name' static member function");
- }
- return element;
- }
-
- helpers.mapLiteralConstructor = getFactory('_literal', 1);
- helpers.mapLiteralConstructorEmpty = getFactory('_empty', 0);
- enqueue(enqueuer, helpers.mapLiteralConstructor);
- enqueue(enqueuer, helpers.mapLiteralConstructorEmpty);
-
- helpers.mapLiteralUntypedMaker = getMember('_makeLiteral');
- helpers.mapLiteralUntypedEmptyMaker = getMember('_makeEmpty');
- enqueue(enqueuer, helpers.mapLiteralUntypedMaker);
- enqueue(enqueuer, helpers.mapLiteralUntypedEmptyMaker);
+ impactTransformer.registerBackendImpact(
+ impactBuilder, impacts.mapLiteralClass);
}
}
if (cls == helpers.closureClass) {
- enqueue(enqueuer, helpers.closureFromTearOff);
+ impactTransformer.registerBackendImpact(
+ impactBuilder, impacts.closureClass);
}
if (cls == coreClasses.stringClass || cls == helpers.jsStringClass) {
- addInterceptors(helpers.jsStringClass, enqueuer);
+ addInterceptors(helpers.jsStringClass, impactBuilder,
+ forResolution: forResolution);
} else if (cls == coreClasses.listClass ||
cls == helpers.jsArrayClass ||
cls == helpers.jsFixedArrayClass ||
cls == helpers.jsExtendableArrayClass ||
cls == helpers.jsUnmodifiableArrayClass) {
- addInterceptors(helpers.jsArrayClass, enqueuer);
- addInterceptors(helpers.jsMutableArrayClass, enqueuer);
- addInterceptors(helpers.jsFixedArrayClass, enqueuer);
- addInterceptors(helpers.jsExtendableArrayClass, enqueuer);
- addInterceptors(helpers.jsUnmodifiableArrayClass, enqueuer);
- if (enqueuer.isResolutionQueue) {
- // Literal lists can be translated into calls to these functions:
- enqueue(enqueuer, helpers.jsArrayTypedConstructor);
- enqueue(enqueuer, helpers.setRuntimeTypeInfo);
- enqueue(enqueuer, helpers.getTypeArgumentByIndex);
+ addInterceptors(helpers.jsArrayClass, impactBuilder,
+ forResolution: forResolution);
+ addInterceptors(helpers.jsMutableArrayClass, impactBuilder,
+ forResolution: forResolution);
+ addInterceptors(helpers.jsFixedArrayClass, impactBuilder,
+ forResolution: forResolution);
+ addInterceptors(helpers.jsExtendableArrayClass, impactBuilder,
+ forResolution: forResolution);
+ addInterceptors(helpers.jsUnmodifiableArrayClass, impactBuilder,
+ forResolution: forResolution);
+ if (forResolution) {
+ impactTransformer.registerBackendImpact(
+ impactBuilder, impacts.listClasses);
}
} else if (cls == coreClasses.intClass || cls == helpers.jsIntClass) {
- addInterceptors(helpers.jsIntClass, enqueuer);
- addInterceptors(helpers.jsPositiveIntClass, enqueuer);
- addInterceptors(helpers.jsUInt32Class, enqueuer);
- addInterceptors(helpers.jsUInt31Class, enqueuer);
- addInterceptors(helpers.jsNumberClass, enqueuer);
+ addInterceptors(helpers.jsIntClass, impactBuilder,
+ forResolution: forResolution);
+ addInterceptors(helpers.jsPositiveIntClass, impactBuilder,
+ forResolution: forResolution);
+ addInterceptors(helpers.jsUInt32Class, impactBuilder,
+ forResolution: forResolution);
+ addInterceptors(helpers.jsUInt31Class, impactBuilder,
+ forResolution: forResolution);
+ addInterceptors(helpers.jsNumberClass, impactBuilder,
+ forResolution: forResolution);
} else if (cls == coreClasses.doubleClass || cls == helpers.jsDoubleClass) {
- addInterceptors(helpers.jsDoubleClass, enqueuer);
- addInterceptors(helpers.jsNumberClass, enqueuer);
+ addInterceptors(helpers.jsDoubleClass, impactBuilder,
+ forResolution: forResolution);
+ addInterceptors(helpers.jsNumberClass, impactBuilder,
+ forResolution: forResolution);
} else if (cls == coreClasses.boolClass || cls == helpers.jsBoolClass) {
- addInterceptors(helpers.jsBoolClass, enqueuer);
+ addInterceptors(helpers.jsBoolClass, impactBuilder,
+ forResolution: forResolution);
} else if (cls == coreClasses.nullClass || cls == helpers.jsNullClass) {
- addInterceptors(helpers.jsNullClass, enqueuer);
+ addInterceptors(helpers.jsNullClass, impactBuilder,
+ forResolution: forResolution);
} else if (cls == coreClasses.numClass || cls == helpers.jsNumberClass) {
- addInterceptors(helpers.jsIntClass, enqueuer);
- addInterceptors(helpers.jsPositiveIntClass, enqueuer);
- addInterceptors(helpers.jsUInt32Class, enqueuer);
- addInterceptors(helpers.jsUInt31Class, enqueuer);
- addInterceptors(helpers.jsDoubleClass, enqueuer);
- addInterceptors(helpers.jsNumberClass, enqueuer);
+ addInterceptors(helpers.jsIntClass, impactBuilder,
+ forResolution: forResolution);
+ addInterceptors(helpers.jsPositiveIntClass, impactBuilder,
+ forResolution: forResolution);
+ addInterceptors(helpers.jsUInt32Class, impactBuilder,
+ forResolution: forResolution);
+ addInterceptors(helpers.jsUInt31Class, impactBuilder,
+ forResolution: forResolution);
+ addInterceptors(helpers.jsDoubleClass, impactBuilder,
+ forResolution: forResolution);
+ addInterceptors(helpers.jsNumberClass, impactBuilder,
+ forResolution: forResolution);
} else if (cls == helpers.jsJavaScriptObjectClass) {
- addInterceptors(helpers.jsJavaScriptObjectClass, enqueuer);
+ addInterceptors(helpers.jsJavaScriptObjectClass, impactBuilder,
+ forResolution: forResolution);
} else if (cls == helpers.jsPlainJavaScriptObjectClass) {
- addInterceptors(helpers.jsPlainJavaScriptObjectClass, enqueuer);
+ addInterceptors(helpers.jsPlainJavaScriptObjectClass, impactBuilder,
+ forResolution: forResolution);
} else if (cls == helpers.jsUnknownJavaScriptObjectClass) {
- addInterceptors(helpers.jsUnknownJavaScriptObjectClass, enqueuer);
+ addInterceptors(helpers.jsUnknownJavaScriptObjectClass, impactBuilder,
+ forResolution: forResolution);
} else if (cls == helpers.jsJavaScriptFunctionClass) {
- addInterceptors(helpers.jsJavaScriptFunctionClass, enqueuer);
+ addInterceptors(helpers.jsJavaScriptFunctionClass, impactBuilder,
+ forResolution: forResolution);
} else if (isNativeOrExtendsNative(cls)) {
- addInterceptorsForNativeClassMembers(cls, enqueuer);
+ addInterceptorsForNativeClassMembers(cls, forResolution: forResolution);
} else if (cls == helpers.jsIndexingBehaviorInterface) {
- // These two helpers are used by the emitter and the codegen.
- // Because we cannot enqueue elements at the time of emission,
- // we make sure they are always generated.
- enqueue(enqueuer, helpers.isJsIndexable);
+ impactTransformer.registerBackendImpact(
+ impactBuilder, impacts.jsIndexingBehavior);
}
customElementsAnalysis.registerInstantiatedClass(cls,
- forResolution: enqueuer.isResolutionQueue);
- if (!enqueuer.isResolutionQueue) {
+ forResolution: forResolution);
+ if (!forResolution) {
lookupMapAnalysis.registerInstantiatedClass(cls);
}
+
+ return impactBuilder;
}
void registerInstantiatedType(InterfaceType type) {
lookupMapAnalysis.registerInstantiatedType(type);
}
- void enqueueHelpers(ResolutionEnqueuer enqueuer) {
+ @override
+ WorldImpact computeHelpersImpact() {
assert(helpers.interceptorsLibrary != null);
+ WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
// TODO(ngeoffray): Not enqueuing those two classes currently make
// the compiler potentially crash. However, any reasonable program
// will instantiate those two classes.
- addInterceptors(helpers.jsBoolClass, enqueuer);
- addInterceptors(helpers.jsNullClass, enqueuer);
+ addInterceptors(helpers.jsBoolClass, impactBuilder, forResolution: true);
+ addInterceptors(helpers.jsNullClass, impactBuilder, forResolution: true);
if (compiler.options.enableTypeAssertions) {
- // Unconditionally register the helper that checks if the
- // expression in an if/while/for is a boolean.
- // TODO(ngeoffray): Should we have the resolver register those instead?
- Element e = helpers.boolConversionCheck;
- if (e != null) enqueue(enqueuer, e);
+ impactTransformer.registerBackendImpact(
+ impactBuilder, impacts.enableTypeAssertions);
}
if (TRACE_CALLS) {
- traceHelper = TRACE_METHOD == 'console'
- ? helpers.consoleTraceHelper
- : helpers.postTraceHelper;
- assert(traceHelper != null);
- enqueue(enqueuer, traceHelper);
+ impactTransformer.registerBackendImpact(
+ impactBuilder, impacts.traceHelper);
}
- enqueue(enqueuer, helpers.assertUnreachableMethod);
- registerCheckedModeHelpers(enqueuer);
+ impactTransformer.registerBackendImpact(
+ impactBuilder, impacts.assertUnreachable);
+ _registerCheckedModeHelpers(impactBuilder);
+ return impactBuilder;
}
onResolutionComplete() {
@@ -1366,47 +1345,36 @@
noSuchMethodRegistry.onTypeInferenceComplete();
}
- void registerGetRuntimeTypeArgument() {
- enqueueImpact(compiler.enqueuer.resolution, impacts.getRuntimeTypeArgument);
- }
-
- void registerCallMethodWithFreeTypeVariables(
- Element callMethod, Enqueuer enqueuer) {
- if (enqueuer.isResolutionQueue || methodNeedsRti(callMethod)) {
- registerComputeSignature(enqueuer);
+ WorldImpact registerCallMethodWithFreeTypeVariables(Element callMethod,
+ {bool forResolution}) {
+ if (forResolution || methodNeedsRti(callMethod)) {
+ return _registerComputeSignature();
}
+ return const WorldImpact();
}
- void registerClosureWithFreeTypeVariables(
- Element closure, Enqueuer enqueuer) {
- if (enqueuer.isResolutionQueue || methodNeedsRti(closure)) {
- registerComputeSignature(enqueuer);
+ WorldImpact registerClosureWithFreeTypeVariables(Element closure,
+ {bool forResolution}) {
+ if (forResolution || methodNeedsRti(closure)) {
+ return _registerComputeSignature();
}
+ return const WorldImpact();
}
- void registerBoundClosure(Enqueuer enqueuer) {
- helpers.boundClosureClass.ensureResolved(resolution);
- enqueuer.registerInstantiatedType(helpers.boundClosureClass.rawType);
+ WorldImpact registerBoundClosure() {
+ return impactTransformer.createImpactFor(impacts.memberClosure);
}
- void registerGetOfStaticFunction(Enqueuer enqueuer) {
- helpers.closureClass.ensureResolved(resolution);
- enqueuer.registerInstantiatedType(helpers.closureClass.rawType);
+ WorldImpact registerGetOfStaticFunction() {
+ return impactTransformer.createImpactFor(impacts.staticClosure);
}
- void registerComputeSignature(Enqueuer enqueuer) {
- // Calls to [:computeSignature:] are generated by the emitter and we
- // therefore need to enqueue the used elements in the codegen enqueuer as
- // well as in the resolution enqueuer.
- enqueueImpact(enqueuer, impacts.computeSignature);
+ WorldImpact _registerComputeSignature() {
+ return impactTransformer.createImpactFor(impacts.computeSignature);
}
- void registerRuntimeType(ResolutionEnqueuer enqueuer) {
- registerComputeSignature(enqueuer);
- enqueue(enqueuer, helpers.setRuntimeTypeInfo);
- registerGetRuntimeTypeArgument();
- enqueue(enqueuer, helpers.getRuntimeTypeInfo);
- enqueueClass(enqueuer, coreClasses.listClass);
+ WorldImpact registerRuntimeType() {
+ return impactTransformer.createImpactFor(impacts.runtimeTypeSupport);
}
void registerTypeVariableBoundsSubtypeCheck(
@@ -1414,10 +1382,8 @@
rti.registerTypeVariableBoundsSubtypeCheck(typeArgument, bound);
}
- void registerCheckDeferredIsLoaded(ResolutionEnqueuer enqueuer) {
- enqueue(enqueuer, helpers.checkDeferredIsLoaded);
- // Also register the types of the arguments passed to this method.
- enqueueClass(enqueuer, coreClasses.stringClass);
+ WorldImpact computeDeferredLoadingImpact() {
+ return impactTransformer.createImpactFor(impacts.deferredLoading);
}
void registerNoSuchMethod(FunctionElement noSuchMethod) {
@@ -1458,12 +1424,12 @@
return null;
}
- void enableNoSuchMethod(Enqueuer world) {
- enqueue(world, helpers.createInvocationMirror);
- world.registerDynamicUse(new DynamicUse(Selectors.noSuchMethod_, null));
+ WorldImpact enableNoSuchMethod() {
+ return impactTransformer.createImpactFor(impacts.noSuchMethodSupport);
}
- void enableIsolateSupport(Enqueuer enqueuer) {
+ WorldImpact enableIsolateSupport({bool forResolution}) {
+ WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
// TODO(floitsch): We should also ensure that the class IsolateMessage is
// instantiated. Currently, just enabling isolate support works.
if (compiler.mainFunction != null) {
@@ -1474,22 +1440,16 @@
// The JavaScript backend of [Isolate.spawnUri] uses the same internal
// implementation as [Isolate.spawn], and fails if it cannot look main up
// by name.
- enqueuer.registerStaticUse(
+ impactBuilder.registerStaticUse(
new StaticUse.staticTearOff(compiler.mainFunction));
}
- if (enqueuer.isResolutionQueue) {
- void enqueue(Element element) {
- enqueuer.addToWorkList(element);
- compiler.globalDependencies.registerDependency(element);
- helpersUsed.add(element.declaration);
- }
-
- enqueue(helpers.startRootIsolate);
- enqueue(helpers.currentIsolate);
- enqueue(helpers.callInIsolate);
- } else {
- enqueuer.addToWorkList(helpers.startRootIsolate);
+ impactTransformer.registerBackendImpact(
+ impactBuilder, impacts.isolateSupport);
+ if (forResolution) {
+ impactTransformer.registerBackendImpact(
+ impactBuilder, impacts.isolateSupportForResolution);
}
+ return impactBuilder;
}
bool classNeedsRti(ClassElement cls) {
@@ -1519,60 +1479,6 @@
compiler.resolverWorld.hasRuntimeTypeSupport;
}
- /// Enqueue [e] in [enqueuer].
- ///
- /// This method calls [registerBackendUse].
- void enqueue(Enqueuer enqueuer, Element e) {
- if (e == null) return;
- registerBackendUse(e);
- enqueuer.addToWorkList(e);
- compiler.globalDependencies.registerDependency(e);
- }
-
- /// Register instantiation of [cls] in [enqueuer].
- ///
- /// This method calls [registerBackendUse].
- void enqueueClass(Enqueuer enqueuer, ClassElement cls) {
- if (cls == null) return;
- registerBackendUse(cls);
- helpersUsed.add(cls.declaration);
- if (cls.declaration != cls.implementation) {
- helpersUsed.add(cls.implementation);
- }
- cls.ensureResolved(resolution);
- enqueuer.registerInstantiatedType(cls.rawType);
- }
-
- /// Register instantiation of [type] in [enqueuer].
- ///
- /// This method calls [registerBackendUse].
- void enqueueType(Enqueuer enqueuer, InterfaceType type) {
- if (type == null) return;
- ClassElement cls = type.element;
- registerBackendUse(cls);
- helpersUsed.add(cls.declaration);
- if (cls.declaration != cls.implementation) {
- helpersUsed.add(cls.implementation);
- }
- cls.ensureResolved(resolution);
- enqueuer.registerInstantiatedType(type);
- }
-
- void enqueueImpact(Enqueuer enqueuer, BackendImpact impact) {
- for (Element staticUse in impact.staticUses) {
- enqueue(enqueuer, staticUse);
- }
- for (InterfaceType type in impact.instantiatedTypes) {
- enqueueType(enqueuer, type);
- }
- for (ClassElement cls in impact.instantiatedClasses) {
- enqueueClass(enqueuer, cls);
- }
- for (BackendImpact otherImpact in impact.otherImpacts) {
- enqueueImpact(enqueuer, otherImpact);
- }
- }
-
CodegenEnqueuer get codegenEnqueuer => compiler.enqueuer.codegen;
CodegenEnqueuer createCodegenEnqueuer(CompilerTask task, Compiler compiler) {
@@ -1634,7 +1540,7 @@
// go through the builder (below) to generate the lazy initializer for
// the static variable.
// We also need to register the use of the cyclic-error helper.
- compiler.enqueuer.codegen.registerStaticUse(new StaticUse.staticInvoke(
+ work.registry.worldImpact.registerStaticUse(new StaticUse.staticInvoke(
helpers.cyclicThrowHelper, CallStructure.ONE_ARG));
}
}
@@ -1856,12 +1762,15 @@
}
}
- void registerCheckedModeHelpers(ResolutionEnqueuer enqueuer) {
+ void _registerCheckedModeHelpers(WorldImpactBuilder impactBuilder) {
// We register all the helpers in the resolution queue.
// TODO(13155): Find a way to register fewer helpers.
+ List<Element> staticUses = <Element>[];
for (CheckedModeHelper helper in checkedModeHelpers) {
- enqueue(enqueuer, helper.getStaticUse(compiler).element);
+ staticUses.add(helper.getStaticUse(compiler).element);
}
+ impactTransformer.registerBackendImpact(
+ impactBuilder, new BackendImpact(globalUses: staticUses));
}
/**
@@ -1892,7 +1801,8 @@
return compiler.closedWorld.hasOnlySubclasses(classElement);
}
- void registerStaticUse(Enqueuer enqueuer, Element element) {
+ WorldImpact registerStaticUse(Element element, {bool forResolution}) {
+ WorldImpactBuilderImpl worldImpact = new WorldImpactBuilderImpl();
if (element == helpers.disableTreeShakingMarker) {
isTreeShakingDisabled = true;
} else if (element == helpers.preserveNamesMarker) {
@@ -1909,15 +1819,17 @@
// TODO(sigurdm): Create a function registerLoadLibraryAccess.
if (!isLoadLibraryFunctionResolved) {
isLoadLibraryFunctionResolved = true;
- if (enqueuer.isResolutionQueue) {
- enqueue(enqueuer, helpers.loadLibraryWrapper);
+ if (forResolution) {
+ impactTransformer.registerBackendImpact(
+ worldImpact, impacts.loadLibrary);
}
}
} else if (element == helpers.requiresPreambleMarker) {
requiresPreamble = true;
}
customElementsAnalysis.registerStaticUse(element,
- forResolution: enqueuer.isResolutionQueue);
+ forResolution: forResolution);
+ return worldImpact;
}
/// Called when [:const Symbol(name):] is seen.
@@ -2344,13 +2256,11 @@
//
// Return early if any elements are added to avoid counting the elements as
// due to mirrors.
+ enqueuer.applyImpact(customElementsAnalysis.flush(
+ forResolution: enqueuer.isResolutionQueue));
enqueuer.applyImpact(
- compiler.impactStrategy,
- customElementsAnalysis.flush(
- forResolution: enqueuer.isResolutionQueue));
- enqueuer.applyImpact(compiler.impactStrategy,
lookupMapAnalysis.flush(forResolution: enqueuer.isResolutionQueue));
- enqueuer.applyImpact(compiler.impactStrategy,
+ enqueuer.applyImpact(
typeVariableHandler.flush(forResolution: enqueuer.isResolutionQueue));
if (!enqueuer.queueIsEmpty) return false;
@@ -2359,7 +2269,7 @@
if (!enabledNoSuchMethod &&
(noSuchMethodRegistry.hasThrowingNoSuchMethod ||
noSuchMethodRegistry.hasComplexNoSuchMethod)) {
- enableNoSuchMethod(enqueuer);
+ enqueuer.applyImpact(enableNoSuchMethod());
enabledNoSuchMethod = true;
}
@@ -2369,10 +2279,10 @@
if (compiler.options.hasIncrementalSupport) {
// Always enable tear-off closures during incremental compilation.
- Element e = helpers.closureFromTearOff;
- if (e != null && !enqueuer.isProcessed(e)) {
- registerBackendUse(e);
- enqueuer.addToWorkList(e);
+ Element element = helpers.closureFromTearOff;
+ if (element != null && !enqueuer.isProcessed(element)) {
+ enqueuer.applyImpact(
+ impactTransformer.createImpactFor(impacts.closureClass));
}
}
@@ -2381,19 +2291,17 @@
}
if (isTreeShakingDisabled) {
- enqueuer.applyImpact(
- compiler.impactStrategy,
- mirrorsAnalysis.computeImpactForReflectiveElements(recentClasses,
- enqueuer.processedClasses, compiler.libraryLoader.libraries,
- forResolution: enqueuer.isResolutionQueue));
+ enqueuer.applyImpact(mirrorsAnalysis.computeImpactForReflectiveElements(
+ recentClasses,
+ enqueuer.processedClasses,
+ compiler.libraryLoader.libraries,
+ forResolution: enqueuer.isResolutionQueue));
} else if (!targetsUsed.isEmpty && enqueuer.isResolutionQueue) {
// Add all static elements (not classes) that have been requested for
// reflection. If there is no mirror-usage these are probably not
// necessary, but the backend relies on them being resolved.
- enqueuer.applyImpact(
- compiler.impactStrategy,
- mirrorsAnalysis.computeImpactForReflectiveStaticFields(
- _findStaticFieldTargets(),
+ enqueuer.applyImpact(mirrorsAnalysis
+ .computeImpactForReflectiveStaticFields(_findStaticFieldTargets(),
forResolution: enqueuer.isResolutionQueue));
}
@@ -2430,7 +2338,7 @@
}
metadataConstants.clear();
}
- enqueuer.applyImpact(compiler.impactStrategy, impactBuilder.flush());
+ enqueuer.applyImpact(impactBuilder.flush());
}
return true;
}
@@ -2579,7 +2487,8 @@
}
@override
- WorldImpact computeMainImpact(Enqueuer enqueuer, MethodElement mainMethod) {
+ WorldImpact computeMainImpact(MethodElement mainMethod,
+ {bool forResolution}) {
WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl();
if (mainMethod.parameters.isNotEmpty) {
impactTransformer.registerBackendImpact(
@@ -2590,7 +2499,7 @@
// target of Isolate.spawnUri. Strictly speaking, that can happen also if
// main takes no arguments, but in this case the spawned isolate can't
// communicate with the spawning isolate.
- enqueuer.enableIsolateSupport();
+ mainImpact.addImpact(enableIsolateSupport(forResolution: forResolution));
}
mainImpact.registerStaticUse(
new StaticUse.staticInvoke(mainMethod, CallStructure.NO_ARGS));
@@ -2612,11 +2521,7 @@
}
@override
- bool enableDeferredLoadingIfSupported(
- ResolutionEnqueuer enqueuer, Spannable node) {
- registerCheckDeferredIsLoaded(enqueuer);
- return true;
- }
+ bool enableDeferredLoadingIfSupported(Spannable node) => true;
@override
bool enableCodegenWithErrorsIfSupported(Spannable node) => true;
@@ -3011,14 +2916,44 @@
return transformed;
}
+ WorldImpact createImpactFor(BackendImpact impact) {
+ WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
+ registerBackendImpact(impactBuilder, impact);
+ return impactBuilder;
+ }
+
+ void registerBackendStaticUse(
+ WorldImpactBuilder worldImpact, MethodElement element,
+ {bool isGlobal: false}) {
+ backend.registerBackendUse(element);
+ worldImpact.registerStaticUse(
+ // TODO(johnniwinther): Store the correct use in impacts.
+ new StaticUse.foreignUse(element));
+ if (isGlobal) {
+ backend.compiler.globalDependencies.registerDependency(element);
+ }
+ }
+
+ void registerBackendInstantiation(
+ WorldImpactBuilder worldImpact, ClassElement cls,
+ {bool isGlobal: false}) {
+ cls.ensureResolved(backend.resolution);
+ backend.registerBackendUse(cls);
+ worldImpact.registerTypeUse(new TypeUse.instantiation(cls.rawType));
+ if (isGlobal) {
+ backend.compiler.globalDependencies.registerDependency(cls);
+ }
+ }
+
void registerBackendImpact(
WorldImpactBuilder worldImpact, BackendImpact backendImpact) {
for (Element staticUse in backendImpact.staticUses) {
assert(staticUse != null);
- backend.registerBackendUse(staticUse);
- worldImpact.registerStaticUse(
- // TODO(johnniwinther): Store the correct use in impacts.
- new StaticUse.foreignUse(staticUse));
+ registerBackendStaticUse(worldImpact, staticUse);
+ }
+ for (Element staticUse in backendImpact.globalUses) {
+ assert(staticUse != null);
+ registerBackendStaticUse(worldImpact, staticUse, isGlobal: true);
}
for (Selector selector in backendImpact.dynamicUses) {
assert(selector != null);
@@ -3029,9 +2964,10 @@
worldImpact.registerTypeUse(new TypeUse.instantiation(instantiatedType));
}
for (ClassElement cls in backendImpact.instantiatedClasses) {
- cls.ensureResolved(backend.resolution);
- backend.registerBackendUse(cls);
- worldImpact.registerTypeUse(new TypeUse.instantiation(cls.rawType));
+ registerBackendInstantiation(worldImpact, cls);
+ }
+ for (ClassElement cls in backendImpact.globalClasses) {
+ registerBackendInstantiation(worldImpact, cls, isGlobal: true);
}
for (BackendImpact otherImpact in backendImpact.otherImpacts) {
registerBackendImpact(worldImpact, otherImpact);
diff --git a/pkg/compiler/lib/src/js_backend/backend_helpers.dart b/pkg/compiler/lib/src/js_backend/backend_helpers.dart
index eb347c3..e50c744 100644
--- a/pkg/compiler/lib/src/js_backend/backend_helpers.dart
+++ b/pkg/compiler/lib/src/js_backend/backend_helpers.dart
@@ -21,6 +21,7 @@
LibraryElement,
MemberElement,
MethodElement,
+ Name,
PublicName;
import '../library_loader.dart' show LoadedLibraries;
import '../universe/call_structure.dart' show CallStructure;
@@ -120,10 +121,6 @@
ClassElement mapLiteralClass;
ClassElement constMapLiteralClass;
ClassElement typeVariableClass;
- ConstructorElement mapLiteralConstructor;
- ConstructorElement mapLiteralConstructorEmpty;
- Element mapLiteralUntypedMaker;
- Element mapLiteralUntypedEmptyMaker;
ClassElement noSideEffectsClass;
ClassElement noThrowsClass;
@@ -396,6 +393,73 @@
objectEquals = compiler.lookupElementIn(coreClasses.objectClass, '==');
}
+ ConstructorElement _mapLiteralConstructor;
+ ConstructorElement _mapLiteralConstructorEmpty;
+ Element _mapLiteralUntypedMaker;
+ Element _mapLiteralUntypedEmptyMaker;
+
+ ConstructorElement get mapLiteralConstructor {
+ _ensureMapLiteralHelpers();
+ return _mapLiteralConstructor;
+ }
+
+ ConstructorElement get mapLiteralConstructorEmpty {
+ _ensureMapLiteralHelpers();
+ return _mapLiteralConstructorEmpty;
+ }
+
+ Element get mapLiteralUntypedMaker {
+ _ensureMapLiteralHelpers();
+ return _mapLiteralUntypedMaker;
+ }
+
+ Element get mapLiteralUntypedEmptyMaker {
+ _ensureMapLiteralHelpers();
+ return _mapLiteralUntypedEmptyMaker;
+ }
+
+ void _ensureMapLiteralHelpers() {
+ if (_mapLiteralConstructor != null) return;
+
+ // For map literals, the dependency between the implementation class
+ // and [Map] is not visible, so we have to add it manually.
+ Element getFactory(String name, int arity) {
+ // The constructor is on the patch class, but dart2js unit tests don't
+ // have a patch class.
+ ClassElement implementation = mapLiteralClass.implementation;
+ ConstructorElement ctor = implementation.lookupConstructor(name);
+ if (ctor == null ||
+ (Name.isPrivateName(name) &&
+ ctor.library != mapLiteralClass.library)) {
+ reporter.internalError(
+ mapLiteralClass,
+ "Map literal class ${mapLiteralClass} missing "
+ "'$name' constructor"
+ " ${mapLiteralClass.constructors}");
+ }
+ return ctor;
+ }
+
+ Element getMember(String name) {
+ // The constructor is on the patch class, but dart2js unit tests don't
+ // have a patch class.
+ ClassElement implementation = mapLiteralClass.implementation;
+ Element element = implementation.lookupLocalMember(name);
+ if (element == null || !element.isFunction || !element.isStatic) {
+ reporter.internalError(
+ mapLiteralClass,
+ "Map literal class ${mapLiteralClass} missing "
+ "'$name' static member function");
+ }
+ return element;
+ }
+
+ _mapLiteralConstructor = getFactory('_literal', 1);
+ _mapLiteralConstructorEmpty = getFactory('_empty', 0);
+ _mapLiteralUntypedMaker = getMember('_makeLiteral');
+ _mapLiteralUntypedEmptyMaker = getMember('_makeEmpty');
+ }
+
Element get badMain {
return findHelper('badMain');
}
@@ -416,11 +480,19 @@
return findHelper('boolConversionCheck');
}
- Element get consoleTraceHelper {
+ MethodElement _traceHelper;
+
+ MethodElement get traceHelper {
+ return _traceHelper ??= JavaScriptBackend.TRACE_METHOD == 'console'
+ ? _consoleTraceHelper
+ : _postTraceHelper;
+ }
+
+ MethodElement get _consoleTraceHelper {
return findHelper('consoleTraceHelper');
}
- Element get postTraceHelper {
+ MethodElement get _postTraceHelper {
return findHelper('postTraceHelper');
}
diff --git a/pkg/compiler/lib/src/js_backend/backend_impact.dart b/pkg/compiler/lib/src/js_backend/backend_impact.dart
index afbd270..b5b9e72 100644
--- a/pkg/compiler/lib/src/js_backend/backend_impact.dart
+++ b/pkg/compiler/lib/src/js_backend/backend_impact.dart
@@ -24,17 +24,21 @@
/// A set of JavaScript backend dependencies.
class BackendImpact {
final List<Element> staticUses;
+ final List<Element> globalUses;
final List<Selector> dynamicUses;
final List<InterfaceType> instantiatedTypes;
final List<ClassElement> instantiatedClasses;
+ final List<ClassElement> globalClasses;
final List<BackendImpact> otherImpacts;
final EnumSet<BackendFeature> _features;
const BackendImpact(
{this.staticUses: const <Element>[],
+ this.globalUses: const <Element>[],
this.dynamicUses: const <Selector>[],
this.instantiatedTypes: const <InterfaceType>[],
this.instantiatedClasses: const <ClassElement>[],
+ this.globalClasses: const <ClassElement>[],
this.otherImpacts: const <BackendImpact>[],
EnumSet<BackendFeature> features: const EnumSet<BackendFeature>.fixed(0)})
: this._features = features;
@@ -58,172 +62,131 @@
BackendImpact _getRuntimeTypeArgument;
BackendImpact get getRuntimeTypeArgument {
- if (_getRuntimeTypeArgument == null) {
- _getRuntimeTypeArgument = new BackendImpact(staticUses: [
- helpers.getRuntimeTypeArgument,
- helpers.getTypeArgumentByIndex,
- ]);
- }
- return _getRuntimeTypeArgument;
+ return _getRuntimeTypeArgument ??= new BackendImpact(globalUses: [
+ helpers.getRuntimeTypeArgument,
+ helpers.getTypeArgumentByIndex,
+ ]);
}
BackendImpact _computeSignature;
BackendImpact get computeSignature {
- if (_computeSignature == null) {
- _computeSignature = new BackendImpact(staticUses: [
- helpers.setRuntimeTypeInfo,
- helpers.getRuntimeTypeInfo,
- helpers.computeSignature,
- helpers.getRuntimeTypeArguments
- ], otherImpacts: [
- listValues
- ]);
- }
- return _computeSignature;
+ return _computeSignature ??= new BackendImpact(globalUses: [
+ helpers.setRuntimeTypeInfo,
+ helpers.getRuntimeTypeInfo,
+ helpers.computeSignature,
+ helpers.getRuntimeTypeArguments
+ ], otherImpacts: [
+ listValues
+ ]);
}
BackendImpact _mainWithArguments;
BackendImpact get mainWithArguments {
- if (_mainWithArguments == null) {
- _mainWithArguments = new BackendImpact(
- instantiatedClasses: [
- helpers.jsArrayClass,
- helpers.jsStringClass]);
- }
- return _mainWithArguments;
+ return _mainWithArguments ??= new BackendImpact(
+ instantiatedClasses: [helpers.jsArrayClass, helpers.jsStringClass]);
}
BackendImpact _asyncBody;
BackendImpact get asyncBody {
- if (_asyncBody == null) {
- _asyncBody = new BackendImpact(staticUses: [
- helpers.asyncHelper,
- helpers.syncCompleterConstructor,
- helpers.streamIteratorConstructor,
- helpers.wrapBody
- ]);
- }
- return _asyncBody;
+ return _asyncBody ??= new BackendImpact(staticUses: [
+ helpers.asyncHelper,
+ helpers.syncCompleterConstructor,
+ helpers.streamIteratorConstructor,
+ helpers.wrapBody
+ ]);
}
BackendImpact _syncStarBody;
BackendImpact get syncStarBody {
- if (_syncStarBody == null) {
- _syncStarBody = new BackendImpact(staticUses: [
- helpers.syncStarIterableConstructor,
- helpers.endOfIteration,
- helpers.yieldStar,
- helpers.syncStarUncaughtError
- ], instantiatedClasses: [
- helpers.syncStarIterable
- ]);
- }
- return _syncStarBody;
+ return _syncStarBody ??= new BackendImpact(staticUses: [
+ helpers.syncStarIterableConstructor,
+ helpers.endOfIteration,
+ helpers.yieldStar,
+ helpers.syncStarUncaughtError
+ ], instantiatedClasses: [
+ helpers.syncStarIterable
+ ]);
}
BackendImpact _asyncStarBody;
BackendImpact get asyncStarBody {
- if (_asyncStarBody == null) {
- _asyncStarBody = new BackendImpact(staticUses: [
- helpers.asyncStarHelper,
- helpers.streamOfController,
- helpers.yieldSingle,
- helpers.yieldStar,
- helpers.asyncStarControllerConstructor,
- helpers.streamIteratorConstructor,
- helpers.wrapBody
- ], instantiatedClasses: [
- helpers.asyncStarController
- ]);
- }
- return _asyncStarBody;
+ return _asyncStarBody ??= new BackendImpact(staticUses: [
+ helpers.asyncStarHelper,
+ helpers.streamOfController,
+ helpers.yieldSingle,
+ helpers.yieldStar,
+ helpers.asyncStarControllerConstructor,
+ helpers.streamIteratorConstructor,
+ helpers.wrapBody
+ ], instantiatedClasses: [
+ helpers.asyncStarController
+ ]);
}
BackendImpact _typeVariableBoundCheck;
BackendImpact get typeVariableBoundCheck {
- if (_typeVariableBoundCheck == null) {
- _typeVariableBoundCheck = new BackendImpact(
- staticUses: [helpers.throwTypeError, helpers.assertIsSubtype]);
- }
- return _typeVariableBoundCheck;
+ return _typeVariableBoundCheck ??= new BackendImpact(
+ staticUses: [helpers.throwTypeError, helpers.assertIsSubtype]);
}
BackendImpact _abstractClassInstantiation;
BackendImpact get abstractClassInstantiation {
- if (_abstractClassInstantiation == null) {
- _abstractClassInstantiation = new BackendImpact(
- staticUses: [helpers.throwAbstractClassInstantiationError],
- otherImpacts: [_needsString('Needed to encode the message.')]);
- }
- return _abstractClassInstantiation;
+ return _abstractClassInstantiation ??= new BackendImpact(
+ staticUses: [helpers.throwAbstractClassInstantiationError],
+ otherImpacts: [_needsString('Needed to encode the message.')]);
}
BackendImpact _fallThroughError;
BackendImpact get fallThroughError {
- if (_fallThroughError == null) {
- _fallThroughError =
- new BackendImpact(staticUses: [helpers.fallThroughError]);
- }
- return _fallThroughError;
+ return _fallThroughError ??=
+ new BackendImpact(staticUses: [helpers.fallThroughError]);
}
BackendImpact _asCheck;
BackendImpact get asCheck {
- if (_asCheck == null) {
- _asCheck = new BackendImpact(staticUses: [helpers.throwRuntimeError]);
- }
- return _asCheck;
+ return _asCheck ??=
+ new BackendImpact(staticUses: [helpers.throwRuntimeError]);
}
BackendImpact _throwNoSuchMethod;
BackendImpact get throwNoSuchMethod {
- if (_throwNoSuchMethod == null) {
- _throwNoSuchMethod = new BackendImpact(staticUses: [
- helpers.throwNoSuchMethod
- ], otherImpacts: [
- // Also register the types of the arguments passed to this method.
- _needsList(
- 'Needed to encode the arguments for throw NoSuchMethodError.'),
- _needsString('Needed to encode the name for throw NoSuchMethodError.')
- ]);
- }
- return _throwNoSuchMethod;
+ return _throwNoSuchMethod ??= new BackendImpact(staticUses: [
+ helpers.throwNoSuchMethod
+ ], otherImpacts: [
+ // Also register the types of the arguments passed to this method.
+ _needsList('Needed to encode the arguments for throw NoSuchMethodError.'),
+ _needsString('Needed to encode the name for throw NoSuchMethodError.')
+ ]);
}
BackendImpact _stringValues;
BackendImpact get stringValues {
- if (_stringValues == null) {
- _stringValues =
- new BackendImpact(instantiatedClasses: [helpers.jsStringClass]);
- }
- return _stringValues;
+ return _stringValues ??=
+ new BackendImpact(instantiatedClasses: [helpers.jsStringClass]);
}
BackendImpact _numValues;
BackendImpact get numValues {
- if (_numValues == null) {
- _numValues = new BackendImpact(instantiatedClasses: [
- helpers.jsIntClass,
- helpers.jsPositiveIntClass,
- helpers.jsUInt32Class,
- helpers.jsUInt31Class,
- helpers.jsNumberClass,
- helpers.jsDoubleClass
- ]);
- }
- return _numValues;
+ return _numValues ??= new BackendImpact(instantiatedClasses: [
+ helpers.jsIntClass,
+ helpers.jsPositiveIntClass,
+ helpers.jsUInt32Class,
+ helpers.jsUInt31Class,
+ helpers.jsNumberClass,
+ helpers.jsDoubleClass
+ ]);
}
BackendImpact get intValues => numValues;
@@ -233,67 +196,51 @@
BackendImpact _boolValues;
BackendImpact get boolValues {
- if (_boolValues == null) {
- _boolValues =
- new BackendImpact(instantiatedClasses: [helpers.jsBoolClass]);
- }
- return _boolValues;
+ return _boolValues ??=
+ new BackendImpact(instantiatedClasses: [helpers.jsBoolClass]);
}
BackendImpact _nullValue;
BackendImpact get nullValue {
- if (_nullValue == null) {
- _nullValue =
- new BackendImpact(instantiatedClasses: [helpers.jsNullClass]);
- }
- return _nullValue;
+ return _nullValue ??=
+ new BackendImpact(instantiatedClasses: [helpers.jsNullClass]);
}
BackendImpact _listValues;
BackendImpact get listValues {
- if (_listValues == null) {
- _listValues = new BackendImpact(instantiatedClasses: [
- helpers.jsArrayClass,
- helpers.jsMutableArrayClass,
- helpers.jsFixedArrayClass,
- helpers.jsExtendableArrayClass,
- helpers.jsUnmodifiableArrayClass
- ]);
- }
- return _listValues;
+ return _listValues ??= new BackendImpact(globalClasses: [
+ helpers.jsArrayClass,
+ helpers.jsMutableArrayClass,
+ helpers.jsFixedArrayClass,
+ helpers.jsExtendableArrayClass,
+ helpers.jsUnmodifiableArrayClass
+ ]);
}
BackendImpact _throwRuntimeError;
BackendImpact get throwRuntimeError {
- if (_throwRuntimeError == null) {
- _throwRuntimeError = new BackendImpact(staticUses: [
- helpers.throwRuntimeError
- ], otherImpacts: [
- // Also register the types of the arguments passed to this method.
- stringValues
- ]);
- }
- return _throwRuntimeError;
+ return _throwRuntimeError ??= new BackendImpact(staticUses: [
+ helpers.throwRuntimeError
+ ], otherImpacts: [
+ // Also register the types of the arguments passed to this method.
+ stringValues
+ ]);
}
BackendImpact _superNoSuchMethod;
BackendImpact get superNoSuchMethod {
- if (_superNoSuchMethod == null) {
- _superNoSuchMethod = new BackendImpact(staticUses: [
- helpers.createInvocationMirror,
- helpers.objectNoSuchMethod
- ], otherImpacts: [
- _needsInt(
- 'Needed to encode the invocation kind of super.noSuchMethod.'),
- _needsList('Needed to encode the arguments of super.noSuchMethod.'),
- _needsString('Needed to encode the name of super.noSuchMethod.')
- ]);
- }
- return _superNoSuchMethod;
+ return _superNoSuchMethod ??= new BackendImpact(staticUses: [
+ helpers.createInvocationMirror,
+ helpers.objectNoSuchMethod
+ ], otherImpacts: [
+ _needsInt('Needed to encode the invocation kind of super.noSuchMethod.'),
+ _needsList('Needed to encode the arguments of super.noSuchMethod.'),
+ _needsString('Needed to encode the name of super.noSuchMethod.')
+ ]);
}
BackendImpact _constantMapLiteral;
@@ -317,22 +264,16 @@
BackendImpact _symbolConstructor;
BackendImpact get symbolConstructor {
- if (_symbolConstructor == null) {
- _symbolConstructor =
- new BackendImpact(staticUses: [helpers.symbolValidatedConstructor]);
- }
- return _symbolConstructor;
+ return _symbolConstructor ??=
+ new BackendImpact(staticUses: [helpers.symbolValidatedConstructor]);
}
BackendImpact _constSymbol;
BackendImpact get constSymbol {
- if (_constSymbol == null) {
- _constSymbol = new BackendImpact(
- instantiatedClasses: [commonElements.symbolClass],
- staticUses: [commonElements.symbolConstructor.declaration]);
- }
- return _constSymbol;
+ return _constSymbol ??= new BackendImpact(
+ instantiatedClasses: [commonElements.symbolClass],
+ staticUses: [commonElements.symbolConstructor.declaration]);
}
/// Helper for registering that `int` is needed.
@@ -356,52 +297,37 @@
BackendImpact _assertWithoutMessage;
BackendImpact get assertWithoutMessage {
- if (_assertWithoutMessage == null) {
- _assertWithoutMessage =
- new BackendImpact(staticUses: [helpers.assertHelper]);
- }
- return _assertWithoutMessage;
+ return _assertWithoutMessage ??=
+ new BackendImpact(staticUses: [helpers.assertHelper]);
}
BackendImpact _assertWithMessage;
BackendImpact get assertWithMessage {
- if (_assertWithMessage == null) {
- _assertWithMessage = new BackendImpact(
- staticUses: [helpers.assertTest, helpers.assertThrow]);
- }
- return _assertWithMessage;
+ return _assertWithMessage ??= new BackendImpact(
+ staticUses: [helpers.assertTest, helpers.assertThrow]);
}
BackendImpact _asyncForIn;
BackendImpact get asyncForIn {
- if (_asyncForIn == null) {
- _asyncForIn =
- new BackendImpact(staticUses: [helpers.streamIteratorConstructor]);
- }
- return _asyncForIn;
+ return _asyncForIn ??=
+ new BackendImpact(staticUses: [helpers.streamIteratorConstructor]);
}
BackendImpact _stringInterpolation;
BackendImpact get stringInterpolation {
- if (_stringInterpolation == null) {
- _stringInterpolation = new BackendImpact(
- dynamicUses: [Selectors.toString_],
- staticUses: [helpers.stringInterpolationHelper],
- otherImpacts: [_needsString('Strings are created.')]);
- }
- return _stringInterpolation;
+ return _stringInterpolation ??= new BackendImpact(
+ dynamicUses: [Selectors.toString_],
+ staticUses: [helpers.stringInterpolationHelper],
+ otherImpacts: [_needsString('Strings are created.')]);
}
BackendImpact _stringJuxtaposition;
BackendImpact get stringJuxtaposition {
- if (_stringJuxtaposition == null) {
- _stringJuxtaposition = _needsString('String.concat is used.');
- }
- return _stringJuxtaposition;
+ return _stringJuxtaposition ??= _needsString('String.concat is used.');
}
BackendImpact get nullLiteral => nullValue;
@@ -417,231 +343,368 @@
BackendImpact _catchStatement;
BackendImpact get catchStatement {
- if (_catchStatement == null) {
- _catchStatement = new BackendImpact(staticUses: [
- helpers.exceptionUnwrapper
- ], instantiatedClasses: [
- helpers.jsPlainJavaScriptObjectClass,
- helpers.jsUnknownJavaScriptObjectClass
- ]);
- }
- return _catchStatement;
+ return _catchStatement ??= new BackendImpact(staticUses: [
+ helpers.exceptionUnwrapper
+ ], instantiatedClasses: [
+ helpers.jsPlainJavaScriptObjectClass,
+ helpers.jsUnknownJavaScriptObjectClass
+ ]);
}
BackendImpact _throwExpression;
BackendImpact get throwExpression {
- if (_throwExpression == null) {
- _throwExpression = new BackendImpact(
- // We don't know ahead of time whether we will need the throw in a
- // statement context or an expression context, so we register both
- // here, even though we may not need the throwExpression helper.
- staticUses: [
- helpers.wrapExceptionHelper,
- helpers.throwExpressionHelper
- ]);
- }
- return _throwExpression;
+ return _throwExpression ??= new BackendImpact(
+ // We don't know ahead of time whether we will need the throw in a
+ // statement context or an expression context, so we register both
+ // here, even though we may not need the throwExpression helper.
+ staticUses: [
+ helpers.wrapExceptionHelper,
+ helpers.throwExpressionHelper
+ ]);
}
BackendImpact _lazyField;
BackendImpact get lazyField {
- if (_lazyField == null) {
- _lazyField = new BackendImpact(staticUses: [helpers.cyclicThrowHelper]);
- }
- return _lazyField;
+ return _lazyField ??=
+ new BackendImpact(staticUses: [helpers.cyclicThrowHelper]);
}
BackendImpact _typeLiteral;
BackendImpact get typeLiteral {
- if (_typeLiteral == null) {
- _typeLiteral = new BackendImpact(
- instantiatedClasses: [backend.backendClasses.typeImplementation],
- staticUses: [helpers.createRuntimeType]);
- }
- return _typeLiteral;
+ return _typeLiteral ??= new BackendImpact(
+ instantiatedClasses: [backend.backendClasses.typeImplementation],
+ staticUses: [helpers.createRuntimeType]);
}
BackendImpact _stackTraceInCatch;
BackendImpact get stackTraceInCatch {
- if (_stackTraceInCatch == null) {
- _stackTraceInCatch = new BackendImpact(
- instantiatedClasses: [helpers.stackTraceClass],
- staticUses: [helpers.traceFromException]);
- }
- return _stackTraceInCatch;
+ return _stackTraceInCatch ??= new BackendImpact(
+ instantiatedClasses: [helpers.stackTraceClass],
+ staticUses: [helpers.traceFromException]);
}
BackendImpact _syncForIn;
BackendImpact get syncForIn {
- if (_syncForIn == null) {
- _syncForIn = new BackendImpact(
- // The SSA builder recognizes certain for-in loops and can generate
- // calls to throwConcurrentModificationError.
- staticUses: [helpers.checkConcurrentModificationError]);
- }
- return _syncForIn;
+ return _syncForIn ??= new BackendImpact(
+ // The SSA builder recognizes certain for-in loops and can generate
+ // calls to throwConcurrentModificationError.
+ staticUses: [helpers.checkConcurrentModificationError]);
}
BackendImpact _typeVariableExpression;
BackendImpact get typeVariableExpression {
- if (_typeVariableExpression == null) {
- _typeVariableExpression = new BackendImpact(staticUses: [
- helpers.setRuntimeTypeInfo,
- helpers.getRuntimeTypeInfo,
- helpers.runtimeTypeToString,
- helpers.createRuntimeType
- ], otherImpacts: [
- listValues,
- getRuntimeTypeArgument,
- _needsInt('Needed for accessing a type variable literal on this.')
- ]);
- }
- return _typeVariableExpression;
+ return _typeVariableExpression ??= new BackendImpact(staticUses: [
+ helpers.setRuntimeTypeInfo,
+ helpers.getRuntimeTypeInfo,
+ helpers.runtimeTypeToString,
+ helpers.createRuntimeType
+ ], otherImpacts: [
+ listValues,
+ getRuntimeTypeArgument,
+ _needsInt('Needed for accessing a type variable literal on this.')
+ ]);
}
BackendImpact _typeCheck;
BackendImpact get typeCheck {
- if (_typeCheck == null) {
- _typeCheck = new BackendImpact(otherImpacts: [boolValues]);
- }
- return _typeCheck;
+ return _typeCheck ??= new BackendImpact(otherImpacts: [boolValues]);
}
BackendImpact _checkedModeTypeCheck;
BackendImpact get checkedModeTypeCheck {
- if (_checkedModeTypeCheck == null) {
- _checkedModeTypeCheck =
- new BackendImpact(staticUses: [helpers.throwRuntimeError]);
- }
- return _checkedModeTypeCheck;
+ return _checkedModeTypeCheck ??=
+ new BackendImpact(staticUses: [helpers.throwRuntimeError]);
}
BackendImpact _malformedTypeCheck;
BackendImpact get malformedTypeCheck {
- if (_malformedTypeCheck == null) {
- _malformedTypeCheck =
- new BackendImpact(staticUses: [helpers.throwTypeError]);
- }
- return _malformedTypeCheck;
+ return _malformedTypeCheck ??=
+ new BackendImpact(staticUses: [helpers.throwTypeError]);
}
BackendImpact _genericTypeCheck;
BackendImpact get genericTypeCheck {
- if (_genericTypeCheck == null) {
- _genericTypeCheck = new BackendImpact(staticUses: [
- helpers.checkSubtype,
- // TODO(johnniwinther): Investigate why this is needed.
- helpers.setRuntimeTypeInfo,
- helpers.getRuntimeTypeInfo
- ], otherImpacts: [
- listValues,
- getRuntimeTypeArgument
- ]);
- }
- return _genericTypeCheck;
+ return _genericTypeCheck ??= new BackendImpact(staticUses: [
+ helpers.checkSubtype,
+ // TODO(johnniwinther): Investigate why this is needed.
+ helpers.setRuntimeTypeInfo,
+ helpers.getRuntimeTypeInfo
+ ], otherImpacts: [
+ listValues,
+ getRuntimeTypeArgument
+ ]);
}
BackendImpact _genericIsCheck;
BackendImpact get genericIsCheck {
- if (_genericIsCheck == null) {
- _genericIsCheck = new BackendImpact(otherImpacts: [intValues]);
- }
- return _genericIsCheck;
+ return _genericIsCheck ??= new BackendImpact(otherImpacts: [intValues]);
}
BackendImpact _genericCheckedModeTypeCheck;
BackendImpact get genericCheckedModeTypeCheck {
- if (_genericCheckedModeTypeCheck == null) {
- _genericCheckedModeTypeCheck =
- new BackendImpact(staticUses: [helpers.assertSubtype]);
- }
- return _genericCheckedModeTypeCheck;
+ return _genericCheckedModeTypeCheck ??=
+ new BackendImpact(staticUses: [helpers.assertSubtype]);
}
BackendImpact _typeVariableTypeCheck;
BackendImpact get typeVariableTypeCheck {
- if (_typeVariableTypeCheck == null) {
- _typeVariableTypeCheck =
- new BackendImpact(staticUses: [helpers.checkSubtypeOfRuntimeType]);
- }
- return _typeVariableTypeCheck;
+ return _typeVariableTypeCheck ??=
+ new BackendImpact(staticUses: [helpers.checkSubtypeOfRuntimeType]);
}
BackendImpact _typeVariableCheckedModeTypeCheck;
BackendImpact get typeVariableCheckedModeTypeCheck {
- if (_typeVariableCheckedModeTypeCheck == null) {
- _typeVariableCheckedModeTypeCheck =
- new BackendImpact(staticUses: [helpers.assertSubtypeOfRuntimeType]);
- }
- return _typeVariableCheckedModeTypeCheck;
+ return _typeVariableCheckedModeTypeCheck ??=
+ new BackendImpact(staticUses: [helpers.assertSubtypeOfRuntimeType]);
}
BackendImpact _functionTypeCheck;
BackendImpact get functionTypeCheck {
- if (_functionTypeCheck == null) {
- _functionTypeCheck =
- new BackendImpact(staticUses: [helpers.functionTypeTestMetaHelper]);
- }
- return _functionTypeCheck;
+ return _functionTypeCheck ??=
+ new BackendImpact(staticUses: [helpers.functionTypeTestMetaHelper]);
}
BackendImpact _nativeTypeCheck;
BackendImpact get nativeTypeCheck {
- if (_nativeTypeCheck == null) {
- _nativeTypeCheck = new BackendImpact(staticUses: [
- // We will neeed to add the "$is" and "$as" properties on the
- // JavaScript object prototype, so we make sure
- // [:defineProperty:] is compiled.
- helpers.defineProperty
- ]);
- }
- return _nativeTypeCheck;
+ return _nativeTypeCheck ??= new BackendImpact(staticUses: [
+ // We will neeed to add the "$is" and "$as" properties on the
+ // JavaScript object prototype, so we make sure
+ // [:defineProperty:] is compiled.
+ helpers.defineProperty
+ ]);
}
BackendImpact _closure;
BackendImpact get closure {
- if (_closure == null) {
- _closure = new BackendImpact(
- instantiatedClasses: [commonElements.functionClass]);
- }
- return _closure;
+ return _closure ??=
+ new BackendImpact(instantiatedClasses: [commonElements.functionClass]);
}
BackendImpact _interceptorUse;
BackendImpact get interceptorUse {
- if (_interceptorUse == null) {
- _interceptorUse = new BackendImpact(
- staticUses: [
- helpers.getNativeInterceptorMethod
- ],
- instantiatedClasses: [
- helpers.jsJavaScriptObjectClass,
- helpers.jsPlainJavaScriptObjectClass,
- helpers.jsJavaScriptFunctionClass
- ],
- features: new EnumSet<BackendFeature>.fromValues([
- BackendFeature.needToInitializeDispatchProperty,
- BackendFeature.needToInitializeIsolateAffinityTag
- ], fixed: true));
- }
- return _interceptorUse;
+ return _interceptorUse ??= new BackendImpact(
+ staticUses: [
+ helpers.getNativeInterceptorMethod
+ ],
+ instantiatedClasses: [
+ helpers.jsJavaScriptObjectClass,
+ helpers.jsPlainJavaScriptObjectClass,
+ helpers.jsJavaScriptFunctionClass
+ ],
+ features: new EnumSet<BackendFeature>.fromValues([
+ BackendFeature.needToInitializeDispatchProperty,
+ BackendFeature.needToInitializeIsolateAffinityTag
+ ], fixed: true));
+ }
+
+ BackendImpact _numClasses;
+
+ BackendImpact get numClasses {
+ return _numClasses ??= new BackendImpact(
+ // The backend will try to optimize number operations and use the
+ // `iae` helper directly.
+ globalUses: [helpers.throwIllegalArgumentException]);
+ }
+
+ BackendImpact _listOrStringClasses;
+
+ BackendImpact get listOrStringClasses {
+ return _listOrStringClasses ??= new BackendImpact(
+ // The backend will try to optimize array and string access and use the
+ // `ioore` and `iae` helpers directly.
+ globalUses: [
+ helpers.throwIndexOutOfRangeException,
+ helpers.throwIllegalArgumentException
+ ]);
+ }
+
+ BackendImpact _functionClass;
+
+ BackendImpact get functionClass {
+ return _functionClass ??=
+ new BackendImpact(globalClasses: [helpers.closureClass]);
+ }
+
+ BackendImpact _mapClass;
+
+ BackendImpact get mapClass {
+ return _mapClass ??= new BackendImpact(
+ // The backend will use a literal list to initialize the entries
+ // of the map.
+ globalClasses: [
+ helpers.coreClasses.listClass,
+ helpers.mapLiteralClass
+ ]);
+ }
+
+ BackendImpact _boundClosureClass;
+
+ BackendImpact get boundClosureClass {
+ return _boundClosureClass ??=
+ new BackendImpact(globalClasses: [helpers.boundClosureClass]);
+ }
+
+ BackendImpact _nativeOrExtendsClass;
+
+ BackendImpact get nativeOrExtendsClass {
+ return _nativeOrExtendsClass ??= new BackendImpact(globalUses: [
+ helpers.getNativeInterceptorMethod
+ ], globalClasses: [
+ helpers.jsInterceptorClass,
+ helpers.jsJavaScriptObjectClass,
+ helpers.jsPlainJavaScriptObjectClass,
+ helpers.jsJavaScriptFunctionClass
+ ]);
+ }
+
+ BackendImpact _mapLiteralClass;
+
+ BackendImpact get mapLiteralClass {
+ return _mapLiteralClass ??= new BackendImpact(globalUses: [
+ helpers.mapLiteralConstructor,
+ helpers.mapLiteralConstructorEmpty,
+ helpers.mapLiteralUntypedMaker,
+ helpers.mapLiteralUntypedEmptyMaker
+ ]);
+ }
+
+ BackendImpact _closureClass;
+
+ BackendImpact get closureClass {
+ return _closureClass ??=
+ new BackendImpact(globalUses: [helpers.closureFromTearOff]);
+ }
+
+ BackendImpact _listClasses;
+
+ BackendImpact get listClasses {
+ return _listClasses ??= new BackendImpact(
+ // Literal lists can be translated into calls to these functions:
+ globalUses: [
+ helpers.jsArrayTypedConstructor,
+ helpers.setRuntimeTypeInfo,
+ helpers.getTypeArgumentByIndex
+ ]);
+ }
+
+ BackendImpact _jsIndexingBehavior;
+
+ BackendImpact get jsIndexingBehavior {
+ return _jsIndexingBehavior ??= new BackendImpact(
+ // These two helpers are used by the emitter and the codegen.
+ // Because we cannot enqueue elements at the time of emission,
+ // we make sure they are always generated.
+ globalUses: [helpers.isJsIndexable]);
+ }
+
+ BackendImpact _enableTypeAssertions;
+
+ BackendImpact get enableTypeAssertions {
+ return _enableTypeAssertions ??= new BackendImpact(
+ // Register the helper that checks if the expression in an if/while/for
+ // is a boolean.
+ // TODO(johnniwinther): Should this be registered through a [Feature]
+ // instead?
+ globalUses: [helpers.boolConversionCheck]);
+ }
+
+ BackendImpact _traceHelper;
+
+ BackendImpact get traceHelper {
+ return _traceHelper ??=
+ new BackendImpact(globalUses: [helpers.traceHelper]);
+ }
+
+ BackendImpact _assertUnreachable;
+
+ BackendImpact get assertUnreachable {
+ return _assertUnreachable ??=
+ new BackendImpact(globalUses: [helpers.assertUnreachableMethod]);
+ }
+
+ BackendImpact _runtimeTypeSupport;
+
+ BackendImpact get runtimeTypeSupport {
+ return _runtimeTypeSupport ??= new BackendImpact(
+ globalClasses: [helpers.coreClasses.listClass],
+ globalUses: [helpers.setRuntimeTypeInfo, helpers.getRuntimeTypeInfo],
+ otherImpacts: [getRuntimeTypeArgument, computeSignature]);
+ }
+
+ BackendImpact _deferredLoading;
+
+ BackendImpact get deferredLoading {
+ return _deferredLoading ??=
+ new BackendImpact(globalUses: [helpers.checkDeferredIsLoaded],
+ // Also register the types of the arguments passed to this method.
+ globalClasses: [helpers.coreClasses.stringClass]);
+ }
+
+ BackendImpact _noSuchMethodSupport;
+
+ BackendImpact get noSuchMethodSupport {
+ return _noSuchMethodSupport ??= new BackendImpact(
+ staticUses: [helpers.createInvocationMirror],
+ dynamicUses: [Selectors.noSuchMethod_]);
+ }
+
+ BackendImpact _isolateSupport;
+
+ /// Backend impact for isolate support.
+ BackendImpact get isolateSupport {
+ return _isolateSupport ??=
+ new BackendImpact(globalUses: [helpers.startRootIsolate]);
+ }
+
+ BackendImpact _isolateSupportForResolution;
+
+ /// Additional backend impact for isolate support in resolution.
+ BackendImpact get isolateSupportForResolution {
+ return _isolateSupportForResolution ??= new BackendImpact(
+ globalUses: [helpers.currentIsolate, helpers.callInIsolate]);
+ }
+
+ BackendImpact _loadLibrary;
+
+ /// Backend impact for accessing a `loadLibrary` function on a deferred
+ /// prefix.
+ BackendImpact get loadLibrary {
+ return _loadLibrary ??=
+ new BackendImpact(globalUses: [helpers.loadLibraryWrapper]);
+ }
+
+ BackendImpact _memberClosure;
+
+ /// Backend impact for performing member closurization.
+ BackendImpact get memberClosure {
+ return _memberClosure ??=
+ new BackendImpact(globalClasses: [helpers.boundClosureClass]);
+ }
+
+ BackendImpact _staticClosure;
+
+ /// Backend impact for performing closurization of a top-level or static
+ /// function.
+ BackendImpact get staticClosure {
+ return _staticClosure ??=
+ new BackendImpact(globalClasses: [helpers.closureClass]);
}
}
diff --git a/pkg/compiler/lib/src/js_backend/enqueuer.dart b/pkg/compiler/lib/src/js_backend/enqueuer.dart
index 07c1f06..c0b028c 100644
--- a/pkg/compiler/lib/src/js_backend/enqueuer.dart
+++ b/pkg/compiler/lib/src/js_backend/enqueuer.dart
@@ -43,7 +43,7 @@
import '../world.dart';
/// [Enqueuer] which is specific to code generation.
-class CodegenEnqueuer implements Enqueuer {
+class CodegenEnqueuer extends EnqueuerImpl {
final String name;
@deprecated
final Compiler _compiler; // TODO(ahe): Remove this dependency.
@@ -70,7 +70,7 @@
nativeEnqueuer = compiler.backend.nativeCodegenEnqueuer(),
this.name = 'codegen enqueuer',
this._compiler = compiler {
- impactVisitor = new _EnqueuerImpactVisitor(this);
+ impactVisitor = new EnqueuerImplImpactVisitor(this);
}
CodegenWorldBuilder get universe => _universe;
@@ -86,8 +86,6 @@
/// Returns [:true:] if this enqueuer is the resolution enqueuer.
bool get isResolutionQueue => false;
- QueueFilter get filter => _compiler.enqueuerFilter;
-
DiagnosticReporter get reporter => _compiler.reporter;
/**
@@ -116,15 +114,15 @@
throw new SpannableAssertionFailure(
element, "Codegen work list is closed. Trying to add $element");
}
- queue.add(new CodegenWorkItem(_compiler, element));
+ queue.add(new CodegenWorkItem(backend, element));
// TODO(sigmund): add other missing dependencies (internals, selectors
// enqueued after allocations).
_compiler.dumpInfoTask
.registerDependency(_compiler.currentElement, element);
}
- void applyImpact(ImpactStrategy impactStrategy, WorldImpact worldImpact,
- {Element impactSource}) {
+ void applyImpact(WorldImpact worldImpact, {Element impactSource}) {
+ if (worldImpact.isEmpty) return;
impactStrategy.visitImpact(
impactSource, worldImpact, impactVisitor, impactUse);
}
@@ -141,7 +139,8 @@
_universe.registerTypeInstantiation(type,
isNative: isNative,
byMirrors: mirrorUsage, onImplemented: (ClassElement cls) {
- backend.registerImplementedClass(cls, this);
+ applyImpact(
+ backend.registerImplementedClass(cls, forResolution: false));
});
if (nativeUsage) {
nativeEnqueuer.onInstantiatedType(type);
@@ -155,7 +154,7 @@
}
bool checkNoEnqueuedInvokedInstanceMethods() {
- return filter.checkNoEnqueuedInvokedInstanceMethods(this);
+ return strategy.checkEnqueuerConsistency(this);
}
void processInstantiatedClassMembers(ClassElement cls) {
@@ -272,7 +271,8 @@
// We only tell the backend once that [superclass] was instantiated, so
// any additional dependencies must be treated as global
// dependencies.
- backend.registerInstantiatedClass(superclass, this);
+ applyImpact(backend.registerInstantiatedClass(superclass,
+ forResolution: false));
}
ClassElement superclass = cls;
@@ -356,11 +356,11 @@
assert(invariant(element, element.isDeclaration,
message: "Element ${element} is not the declaration."));
_universe.registerStaticUse(staticUse);
- backend.registerStaticUse(this, element);
+ applyImpact(backend.registerStaticUse(element, forResolution: false));
bool addElement = true;
switch (staticUse.kind) {
case StaticUseKind.STATIC_TEAR_OFF:
- backend.registerGetOfStaticFunction(this);
+ applyImpact(backend.registerGetOfStaticFunction());
break;
case StaticUseKind.FIELD_GET:
case StaticUseKind.FIELD_SET:
@@ -374,11 +374,12 @@
case StaticUseKind.SUPER_FIELD_SET:
case StaticUseKind.SUPER_TEAR_OFF:
case StaticUseKind.GENERAL:
+ case StaticUseKind.DIRECT_USE:
break;
case StaticUseKind.CONSTRUCTOR_INVOKE:
case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
case StaticUseKind.REDIRECTION:
- registerTypeUse(new TypeUse.instantiation(staticUse.type));
+ registerTypeUseInternal(new TypeUse.instantiation(staticUse.type));
break;
case StaticUseKind.DIRECT_INVOKE:
_registerInstanceMethod(staticUse.element);
@@ -390,6 +391,10 @@
}
void registerTypeUse(TypeUse typeUse) {
+ strategy.processTypeUse(this, typeUse);
+ }
+
+ void registerTypeUseInternal(TypeUse typeUse) {
DartType type = typeUse.type;
switch (typeUse.kind) {
case TypeUseKind.INSTANTIATION:
@@ -425,22 +430,29 @@
}
void registerCallMethodWithFreeTypeVariables(Element element) {
- backend.registerCallMethodWithFreeTypeVariables(element, this);
+ applyImpact(backend.registerCallMethodWithFreeTypeVariables(element,
+ forResolution: false));
}
void registerClosurizedMember(TypedElement element) {
assert(element.isInstanceMember);
if (element.type.containsTypeVariables) {
- backend.registerClosureWithFreeTypeVariables(element, this);
+ applyImpact(backend.registerClosureWithFreeTypeVariables(element,
+ forResolution: false));
}
- backend.registerBoundClosure(this);
+ applyImpact(backend.registerBoundClosure());
}
void forEach(void f(WorkItem work)) {
do {
while (queue.isNotEmpty) {
// TODO(johnniwinther): Find an optimal process order.
- filter.processWorkItem(f, queue.removeLast());
+ WorkItem work = queue.removeLast();
+ if (!isProcessed(work.element)) {
+ strategy.processWorkItem(f, work);
+ // TODO(johnniwinther): Register the processed element here. This
+ // is currently a side-effect of calling `work.run`.
+ }
}
List recents = recentClasses.toList(growable: false);
recentClasses.clear();
@@ -491,7 +503,7 @@
void registerNoSuchMethod(Element element) {
if (!enabledNoSuchMethod && backend.enabledNoSuchMethod) {
- backend.enableNoSuchMethod(this);
+ applyImpact(backend.enableNoSuchMethod());
enabledNoSuchMethod = true;
}
}
@@ -531,24 +543,3 @@
if (set == null) return;
set.remove(element);
}
-
-class _EnqueuerImpactVisitor implements WorldImpactVisitor {
- final CodegenEnqueuer enqueuer;
-
- _EnqueuerImpactVisitor(this.enqueuer);
-
- @override
- void visitDynamicUse(DynamicUse dynamicUse) {
- enqueuer.registerDynamicUse(dynamicUse);
- }
-
- @override
- void visitStaticUse(StaticUse staticUse) {
- enqueuer.registerStaticUse(staticUse);
- }
-
- @override
- void visitTypeUse(TypeUse typeUse) {
- enqueuer.registerTypeUse(typeUse);
- }
-}
diff --git a/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart b/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart
index fec60e3..4a51239 100644
--- a/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart
+++ b/pkg/compiler/lib/src/js_backend/lookup_map_analysis.dart
@@ -21,7 +21,7 @@
import '../dart_types.dart' show InterfaceType;
import '../elements/elements.dart'
show ClassElement, FieldElement, LibraryElement, VariableElement;
-import '../enqueue.dart';
+import '../universe/use.dart' show StaticUse;
import '../universe/world_impact.dart'
show WorldImpact, StagedWorldImpactBuilder;
import 'js_backend.dart' show JavaScriptBackend;
@@ -120,7 +120,10 @@
/// entry with that key.
final _pending = <ConstantValue, List<_LookupMapInfo>>{};
- final StagedWorldImpactBuilder impactBuilder = new StagedWorldImpactBuilder();
+ final StagedWorldImpactBuilder impactBuilderForResolution =
+ new StagedWorldImpactBuilder();
+ final StagedWorldImpactBuilder impactBuilderForCodegen =
+ new StagedWorldImpactBuilder();
/// Whether the backend is currently processing the codegen queue.
bool _inCodegen = false;
@@ -129,8 +132,11 @@
/// Compute the [WorldImpact] for the constants registered since last flush.
WorldImpact flush({bool forResolution}) {
- if (forResolution) return const WorldImpact();
- return impactBuilder.flush();
+ if (forResolution) {
+ return impactBuilderForResolution.flush();
+ } else {
+ return impactBuilderForCodegen.flush();
+ }
}
/// Whether this analysis and optimization is enabled.
@@ -151,8 +157,8 @@
reporter.reportInfo(
library, MessageKind.UNRECOGNIZED_VERSION_OF_LOOKUP_MAP);
} else {
- backend.compiler.enqueuer.resolution
- .addToWorkList(lookupMapVersionVariable);
+ impactBuilderForResolution.registerStaticUse(
+ new StaticUse.foreignUse(lookupMapVersionVariable));
}
}
@@ -277,7 +283,8 @@
// type_lookup_map/generic_type_test
// TODO(sigmund): can we get rid of this?
backend.computeImpactForInstantiatedConstantType(
- backend.backendClasses.typeImplementation.rawType, impactBuilder);
+ backend.backendClasses.typeImplementation.rawType,
+ impactBuilderForCodegen);
_addGenerics(arg);
}
}
@@ -418,7 +425,7 @@
ConstantValue constant = unusedEntries.remove(key);
usedEntries[key] = constant;
analysis.backend.computeImpactForCompileTimeConstant(
- constant, analysis.impactBuilder, false);
+ constant, analysis.impactBuilderForCodegen, false);
}
/// Restores [original] to contain all of the entries marked as possibly used.
diff --git a/pkg/compiler/lib/src/js_backend/type_variable_handler.dart b/pkg/compiler/lib/src/js_backend/type_variable_handler.dart
index ff8822d..a32a3b5 100644
--- a/pkg/compiler/lib/src/js_backend/type_variable_handler.dart
+++ b/pkg/compiler/lib/src/js_backend/type_variable_handler.dart
@@ -44,9 +44,13 @@
Map<TypeVariableElement, jsAst.Expression> _typeVariableConstants =
new Map<TypeVariableElement, jsAst.Expression>();
+ /// Impact builder used for the resolution world computation.
+ final StagedWorldImpactBuilder impactBuilderForResolution =
+ new StagedWorldImpactBuilder();
+
/// Impact builder used for the codegen world computation.
- // TODO(johnniwinther): Add impact builder for resolution.
- final StagedWorldImpactBuilder impactBuilder = new StagedWorldImpactBuilder();
+ final StagedWorldImpactBuilder impactBuilderForCodegen =
+ new StagedWorldImpactBuilder();
TypeVariableHandler(this._compiler);
@@ -59,16 +63,18 @@
/// Compute the [WorldImpact] for the type variables registered since last
/// flush.
WorldImpact flush({bool forResolution}) {
- if (forResolution) return const WorldImpact();
- return impactBuilder.flush();
+ if (forResolution) {
+ return impactBuilderForResolution.flush();
+ } else {
+ return impactBuilderForCodegen.flush();
+ }
}
- void registerClassWithTypeVariables(ClassElement cls, Enqueuer enqueuer) {
- if (enqueuer.isResolutionQueue) {
+ void registerClassWithTypeVariables(ClassElement cls, {bool forResolution}) {
+ if (forResolution) {
// On first encounter, we have to ensure that the support classes get
// resolved.
if (!_seenClassesWithTypeVariables) {
- _backend.enqueueClass(enqueuer, _typeVariableClass);
_typeVariableClass.ensureResolved(_compiler.resolution);
Link constructors = _typeVariableClass.constructors;
if (constructors.isEmpty && constructors.tail.isEmpty) {
@@ -76,11 +82,12 @@
"Class '$_typeVariableClass' should only have one constructor");
}
_typeVariableConstructor = _typeVariableClass.constructors.head;
- _backend.enqueue(enqueuer, _typeVariableConstructor);
- enqueuer.registerInstantiatedType(_typeVariableClass.rawType);
- enqueuer.registerStaticUse(new StaticUse.staticInvoke(
- _backend.registerBackendUse(_backend.helpers.createRuntimeType),
- CallStructure.ONE_ARG));
+ _backend.impactTransformer.registerBackendStaticUse(
+ impactBuilderForResolution, _typeVariableConstructor);
+ _backend.impactTransformer.registerBackendInstantiation(
+ impactBuilderForResolution, _typeVariableClass);
+ _backend.impactTransformer.registerBackendStaticUse(
+ impactBuilderForResolution, _backend.helpers.createRuntimeType);
_seenClassesWithTypeVariables = true;
}
} else {
@@ -117,7 +124,8 @@
_backend.constants.evaluate(constant);
ConstantValue value = _backend.constants.getConstantValue(constant);
- _backend.computeImpactForCompileTimeConstant(value, impactBuilder, false);
+ _backend.computeImpactForCompileTimeConstant(
+ value, impactBuilderForCodegen, false);
_backend.addCompileTimeConstantForEmission(value);
constants
.add(_reifyTypeVariableConstant(value, currentTypeVariable.element));
diff --git a/pkg/compiler/lib/src/kernel/kernel.dart b/pkg/compiler/lib/src/kernel/kernel.dart
index 3bcad71..1210501 100644
--- a/pkg/compiler/lib/src/kernel/kernel.dart
+++ b/pkg/compiler/lib/src/kernel/kernel.dart
@@ -409,7 +409,7 @@
}
function = function.declaration;
return functions.putIfAbsent(function, () {
- compiler.analyzeElement(function);
+ compiler.resolution.ensureResolved(function);
compiler.enqueuer.resolution.emptyDeferredQueueForTesting();
function = function.implementation;
ir.Member member;
@@ -507,7 +507,7 @@
}
field = field.declaration;
return fields.putIfAbsent(field, () {
- compiler.analyzeElement(field);
+ compiler.resolution.ensureResolved(field);
compiler.enqueuer.resolution.emptyDeferredQueueForTesting();
field = field.implementation;
ir.DartType type =
diff --git a/pkg/compiler/lib/src/resolution/registry.dart b/pkg/compiler/lib/src/resolution/registry.dart
index ce40fd0..3784bd9 100644
--- a/pkg/compiler/lib/src/resolution/registry.dart
+++ b/pkg/compiler/lib/src/resolution/registry.dart
@@ -36,6 +36,9 @@
ResolutionWorldImpactBuilder(this.name);
+ @override
+ bool get isEmpty => false;
+
void registerMapLiteral(MapLiteralUse mapLiteralUse) {
assert(mapLiteralUse != null);
if (_mapLiterals == null) {
diff --git a/pkg/compiler/lib/src/serialization/impact_serialization.dart b/pkg/compiler/lib/src/serialization/impact_serialization.dart
index c6ce258..90c1570 100644
--- a/pkg/compiler/lib/src/serialization/impact_serialization.dart
+++ b/pkg/compiler/lib/src/serialization/impact_serialization.dart
@@ -116,6 +116,9 @@
this.nativeData: const <dynamic>[]})
: this._features = features;
+ @override
+ bool get isEmpty => false;
+
Iterable<Feature> get features {
return _features != null
? _features.iterable(Feature.values)
diff --git a/pkg/compiler/lib/src/serialization/task.dart b/pkg/compiler/lib/src/serialization/task.dart
index 5bfae8b..acad224 100644
--- a/pkg/compiler/lib/src/serialization/task.dart
+++ b/pkg/compiler/lib/src/serialization/task.dart
@@ -138,17 +138,11 @@
class DeserializedResolutionWorkItem implements ResolutionWorkItem {
final Element element;
final WorldImpact worldImpact;
- bool _isAnalyzed = false;
DeserializedResolutionWorkItem(this.element, this.worldImpact);
@override
- bool get isAnalyzed => _isAnalyzed;
-
- @override
- WorldImpact run(Compiler compiler, ResolutionEnqueuer world) {
- _isAnalyzed = true;
- world.registerProcessedElement(element);
+ WorldImpact run() {
return worldImpact;
}
}
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
index 8bb5e0b..2fee721 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -407,10 +407,8 @@
bool tryInlineMethod(Element element, Selector selector, TypeMask mask,
List<HInstruction> providedArguments, ast.Node currentNode,
{InterfaceType instanceType}) {
- // TODO(johnniwinther): Register this on the [registry]. Currently the
- // [CodegenRegistry] calls the enqueuer, but [element] should _not_ be
- // enqueued.
- backend.registerStaticUse(compiler.enqueuer.codegen, element);
+ registry
+ .addImpact(backend.registerStaticUse(element, forResolution: false));
if (backend.isJsInterop(element) && !element.isFactoryConstructor) {
// We only inline factory JavaScript interop constructors.
@@ -1497,23 +1495,23 @@
insertTraceCall(Element element) {
if (JavaScriptBackend.TRACE_METHOD == 'console') {
- if (element == backend.traceHelper) return;
+ if (element == backend.helpers.traceHelper) return;
n(e) => e == null ? '' : e.name;
String name = "${n(element.library)}:${n(element.enclosingClass)}."
"${n(element)}";
HConstant nameConstant = addConstantString(name);
- add(new HInvokeStatic(backend.traceHelper, <HInstruction>[nameConstant],
- backend.dynamicType));
+ add(new HInvokeStatic(backend.helpers.traceHelper,
+ <HInstruction>[nameConstant], backend.dynamicType));
}
}
insertCoverageCall(Element element) {
if (JavaScriptBackend.TRACE_METHOD == 'post') {
- if (element == backend.traceHelper) return;
+ if (element == backend.helpers.traceHelper) return;
// TODO(sigmund): create a better uuid for elements.
HConstant idConstant = graph.addConstantInt(element.hashCode, compiler);
HConstant nameConstant = addConstantString(element.name);
- add(new HInvokeStatic(backend.traceHelper,
+ add(new HInvokeStatic(backend.helpers.traceHelper,
<HInstruction>[idConstant, nameConstant], backend.dynamicType));
}
}
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 3addf4b..c05772e 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -28,7 +28,7 @@
import '../types/masks.dart';
import '../universe/call_structure.dart' show CallStructure;
import '../universe/selector.dart';
-import '../universe/use.dart' show TypeUse;
+import '../universe/use.dart' show StaticUse, TypeUse;
import '../universe/side_effects.dart' show SideEffects;
import 'graph_builder.dart';
import 'kernel_ast_adapter.dart';
@@ -671,6 +671,41 @@
}
@override
+ void visitAsExpression(ir.AsExpression asExpression) {
+ asExpression.operand.accept(this);
+ HInstruction expressionInstruction = pop();
+ DartType type = astAdapter.getDartType(asExpression.type);
+ if (type.isMalformed) {
+ if (type is MalformedType) {
+ ErroneousElement element = type.element;
+ generateTypeError(asExpression, element.message);
+ } else {
+ assert(type is MethodTypeVariableType);
+ stack.add(expressionInstruction);
+ }
+ } else {
+ HInstruction converted = typeBuilder.buildTypeConversion(
+ expressionInstruction,
+ localsHandler.substInContext(type),
+ HTypeConversion.CAST_TYPE_CHECK);
+ if (converted != expressionInstruction) {
+ add(converted);
+ }
+ stack.add(converted);
+ }
+ }
+
+ void generateError(ir.Node node, String message, TypeMask typeMask) {
+ HInstruction errorMessage =
+ graph.addConstantString(new DartString.literal(message), compiler);
+ _pushStaticInvocation(node, [errorMessage], typeMask);
+ }
+
+ void generateTypeError(ir.Node node, String message) {
+ generateError(node, message, astAdapter.throwTypeErrorType);
+ }
+
+ @override
void visitAssertStatement(ir.AssertStatement assertStatement) {
if (!compiler.options.enableUserAssertions) return;
if (assertStatement.message == null) {
@@ -1191,31 +1226,6 @@
}
_pushStaticInvocation(target, <HInstruction>[], backend.dynamicType);
}
-
- /*
- if (!node.arguments.isEmpty) {
- reporter.internalError(
- node, 'Too many arguments to JS_CURRENT_ISOLATE_CONTEXT.');
- }
-
- if (!compiler.hasIsolateSupport) {
- // If the isolate library is not used, we just generate code
- // to fetch the static state.
- String name = backend.namer.staticStateHolder;
- push(new HForeignCode(
- js.js.parseForeignJS(name), backend.dynamicType, <HInstruction>[],
- nativeBehavior: native.NativeBehavior.DEPENDS_OTHER));
- } else {
- // Call a helper method from the isolate library. The isolate
- // library uses its own isolate structure, that encapsulates
- // Leg's isolate.
- Element element = helpers.currentIsolate;
- if (element == null) {
- reporter.internalError(node, 'Isolate library and compiler mismatch.');
- }
- pushInvokeStatic(null, element, [], typeMask: backend.dynamicType);
- }
- */
}
void handleForeignJsCallInIsolate(ir.StaticInvocation invocation) {
@@ -1224,12 +1234,48 @@
void handleForeignDartClosureToJs(
ir.StaticInvocation invocation, String name) {
- unhandledForeign(invocation);
+ // TODO(sra): Do we need to wrap the closure in something that saves the
+ // current isolate?
+ handleForeignRawFunctionRef(invocation, name);
}
void handleForeignRawFunctionRef(
ir.StaticInvocation invocation, String name) {
- unhandledForeign(invocation);
+ if (_unexpectedForeignArguments(invocation, 1, 1)) {
+ stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+ return;
+ }
+
+ ir.Expression closure = invocation.arguments.positional.single;
+ String problem = 'requires a static method or top-level method';
+ if (closure is ir.StaticGet) {
+ ir.Member staticTarget = closure.target;
+ if (staticTarget is ir.Procedure) {
+ if (staticTarget.kind == ir.ProcedureKind.Method) {
+ ir.FunctionNode function = staticTarget.function;
+ if (function != null &&
+ function.requiredParameterCount ==
+ function.positionalParameters.length &&
+ function.namedParameters.isEmpty) {
+ registry?.registerStaticUse(
+ new StaticUse.foreignUse(astAdapter.getMember(staticTarget)));
+ push(new HForeignCode(
+ js.js.expressionTemplateYielding(backend.emitter
+ .staticFunctionAccess(astAdapter.getMember(staticTarget))),
+ backend.dynamicType,
+ <HInstruction>[],
+ nativeBehavior: native.NativeBehavior.PURE));
+ return;
+ }
+ problem = 'does not handle a closure with optional parameters';
+ }
+ }
+ }
+
+ compiler.reporter.reportErrorMessage(astAdapter.getNode(invocation),
+ MessageKind.GENERIC, {'text': "'$name' $problem."});
+ stack.add(graph.addConstantNull(compiler)); // Result expected on stack.
+ return;
}
void handleForeignJsSetStaticState(ir.StaticInvocation invocation) {
@@ -1487,6 +1533,9 @@
// TODO(het): Decide when to inline
@override
void visitMethodInvocation(ir.MethodInvocation invocation) {
+ // Handle `x == null` specially. When these come from null-aware operators,
+ // there is no mapping in the astAdapter.
+ if (_handleEqualsNull(invocation)) return;
invocation.receiver.accept(this);
HInstruction receiver = pop();
@@ -1497,6 +1546,27 @@
..addAll(_visitArguments(invocation.arguments)));
}
+ bool _handleEqualsNull(ir.MethodInvocation invocation) {
+ if (invocation.name.name == '==') {
+ ir.Arguments arguments = invocation.arguments;
+ if (arguments.types.isEmpty &&
+ arguments.positional.length == 1 &&
+ arguments.named.isEmpty) {
+ bool finish(ir.Expression comparand) {
+ comparand.accept(this);
+ pushCheckNull(pop());
+ return true;
+ }
+
+ ir.Expression receiver = invocation.receiver;
+ ir.Expression argument = arguments.positional.first;
+ if (argument is ir.NullLiteral) return finish(receiver);
+ if (receiver is ir.NullLiteral) return finish(argument);
+ }
+ }
+ return false;
+ }
+
HInterceptor _interceptorFor(HInstruction intercepted) {
HInterceptor interceptor =
new HInterceptor(intercepted, backend.nonNullType);
diff --git a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
index 6d8943d..07c515c 100644
--- a/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart
@@ -318,6 +318,9 @@
ir.Procedure get assertHelper =>
kernel.functions[_backend.helpers.assertHelper];
+ TypeMask get throwTypeErrorType => TypeMaskFactory
+ .inferredReturnTypeForElement(_backend.helpers.throwTypeError, _compiler);
+
TypeMask get assertHelperReturnType => TypeMaskFactory
.inferredReturnTypeForElement(_backend.helpers.assertHelper, _compiler);
diff --git a/pkg/compiler/lib/src/universe/use.dart b/pkg/compiler/lib/src/universe/use.dart
index ce9a2c4..f399509 100644
--- a/pkg/compiler/lib/src/universe/use.dart
+++ b/pkg/compiler/lib/src/universe/use.dart
@@ -75,6 +75,7 @@
CONST_CONSTRUCTOR_INVOKE,
REDIRECTION,
DIRECT_INVOKE,
+ DIRECT_USE,
}
/// Statically known use of an [Element].
@@ -311,6 +312,11 @@
return new StaticUse.internal(element, StaticUseKind.GENERAL);
}
+ /// Direct use of [element] as done with `--analyze-all` and `--analyze-main`.
+ factory StaticUse.directUse(Element element) {
+ return new StaticUse.internal(element, StaticUseKind.DIRECT_USE);
+ }
+
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! StaticUse) return false;
diff --git a/pkg/compiler/lib/src/universe/world_builder.dart b/pkg/compiler/lib/src/universe/world_builder.dart
index afcd031..49deb8e 100644
--- a/pkg/compiler/lib/src/universe/world_builder.dart
+++ b/pkg/compiler/lib/src/universe/world_builder.dart
@@ -636,6 +636,7 @@
methodsNeedingSuperGetter.add(element);
break;
case StaticUseKind.GENERAL:
+ case StaticUseKind.DIRECT_USE:
case StaticUseKind.STATIC_TEAR_OFF:
case StaticUseKind.FIELD_GET:
case StaticUseKind.CONSTRUCTOR_INVOKE:
@@ -911,6 +912,7 @@
case StaticUseKind.SUPER_FIELD_SET:
case StaticUseKind.FIELD_SET:
case StaticUseKind.GENERAL:
+ case StaticUseKind.DIRECT_USE:
case StaticUseKind.CLOSURE:
case StaticUseKind.FIELD_GET:
case StaticUseKind.CONSTRUCTOR_INVOKE:
diff --git a/pkg/compiler/lib/src/universe/world_impact.dart b/pkg/compiler/lib/src/universe/world_impact.dart
index 9012057..2a1afb8 100644
--- a/pkg/compiler/lib/src/universe/world_impact.dart
+++ b/pkg/compiler/lib/src/universe/world_impact.dart
@@ -33,6 +33,8 @@
Iterable<TypeUse> get typeUses => const <TypeUse>[];
+ bool get isEmpty => true;
+
void apply(WorldImpactVisitor visitor) {
staticUses.forEach(visitor.visitStaticUse);
dynamicUses.forEach(visitor.visitDynamicUse);
@@ -74,6 +76,18 @@
Set<StaticUse> _staticUses;
Set<TypeUse> _typeUses;
+ @override
+ bool get isEmpty =>
+ _dynamicUses == null && _staticUses == null && _typeUses == null;
+
+ /// Copy uses in [impact] to this impact builder.
+ void addImpact(WorldImpact impact) {
+ if (impact.isEmpty) return;
+ impact.dynamicUses.forEach(registerDynamicUse);
+ impact.staticUses.forEach(registerStaticUse);
+ impact.typeUses.forEach(registerTypeUse);
+ }
+
void registerDynamicUse(DynamicUse dynamicUse) {
assert(dynamicUse != null);
if (_dynamicUses == null) {
@@ -174,6 +188,14 @@
TransformedWorldImpact(this.worldImpact);
@override
+ bool get isEmpty {
+ return worldImpact.isEmpty &&
+ _staticUses == null &&
+ _typeUses == null &&
+ _dynamicUses == null;
+ }
+
+ @override
Iterable<DynamicUse> get dynamicUses {
return _dynamicUses != null ? _dynamicUses : worldImpact.dynamicUses;
}
diff --git a/pkg/compiler/tool/perf.dart b/pkg/compiler/tool/perf.dart
index 7705061..4725014 100644
--- a/pkg/compiler/tool/perf.dart
+++ b/pkg/compiler/tool/perf.dart
@@ -11,7 +11,6 @@
import 'package:compiler/compiler_new.dart';
import 'package:compiler/src/apiimpl.dart';
import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/kernel/task.dart';
import 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/common.dart';
import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
@@ -28,6 +27,7 @@
import 'package:compiler/src/scanner/scanner.dart';
import 'package:compiler/src/source_file_provider.dart';
import 'package:compiler/src/tokens/token.dart' show Token;
+import 'package:compiler/src/universe/world_impact.dart' show WorldImpact;
import 'package:package_config/discovery.dart' show findPackages;
import 'package:package_config/packages.dart' show Packages;
import 'package:package_config/src/util.dart' show checkValidPackageUri;
@@ -359,7 +359,7 @@
/// Performs the compilation when all libraries have been loaded.
void compileLoadedLibraries() =>
selfTask.measureSubtask("KernelCompiler.compileLoadedLibraries", () {
- computeMain();
+ WorldImpact mainImpact = computeMain();
mirrorUsageAnalyzerTask.analyzeUsage(mainApp);
deferredLoadTask.beforeResolution(this);
@@ -369,14 +369,18 @@
supportSerialization: serialization.supportSerialization);
phase = Compiler.PHASE_RESOLVING;
-
+ enqueuer.resolution.applyImpact(mainImpact);
// Note: we enqueue everything in the program so we measure generating
// kernel for the entire code, not just what's reachable from main.
libraryLoader.libraries.forEach((LibraryElement library) {
- fullyEnqueueLibrary(library, enqueuer.resolution);
+ enqueuer.resolution.applyImpact(computeImpactForLibrary(library));
});
- backend.enqueueHelpers(enqueuer.resolution);
+ if (deferredLoadTask.isProgramSplit) {
+ enqueuer.resolution.applyImpact(
+ backend.computeDeferredLoadingImpact());
+ }
+ enqueuer.resolution.applyImpact(backend.computeHelpersImpact());
resolveLibraryMetadata();
reporter.log('Resolving...');
processQueue(enqueuer.resolution, mainFunction);
diff --git a/pkg/dart2js_incremental/lib/caching_compiler.dart b/pkg/dart2js_incremental/lib/caching_compiler.dart
index 34f67c64..8bf1c64 100644
--- a/pkg/dart2js_incremental/lib/caching_compiler.dart
+++ b/pkg/dart2js_incremental/lib/caching_compiler.dart
@@ -85,7 +85,7 @@
// Likewise, always be prepared for runtimeType support.
// TODO(johnniwinther): Add global switch to force RTI.
compiler.resolverWorld.hasRuntimeTypeSupport = true;
- backend.registerRuntimeType(compiler.enqueuer.resolution);
+ compiler.enqueuer.resolution.applyImpact(backend.registerRuntimeType());
return compiler;
});
});
diff --git a/pkg/dev_compiler/lib/js/amd/dart_sdk.js b/pkg/dev_compiler/lib/js/amd/dart_sdk.js
index 7252d35..9935e21 100644
--- a/pkg/dev_compiler/lib/js/amd/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/amd/dart_sdk.js
@@ -17,6 +17,7 @@
const collection = Object.create(null);
const convert = Object.create(null);
const core = Object.create(null);
+ const developer = Object.create(null);
const isolate = Object.create(null);
const js = Object.create(null);
const js_util = Object.create(null);
@@ -376,6 +377,12 @@
let MapOfString$String = () => (MapOfString$String = dart.constFn(core.Map$(core.String, core.String)))();
let IterableOfString = () => (IterableOfString = dart.constFn(core.Iterable$(core.String)))();
let MapOfString$dynamic = () => (MapOfString$dynamic = dart.constFn(core.Map$(core.String, dart.dynamic)))();
+ let MapOfString$ServiceExtensionHandler = () => (MapOfString$ServiceExtensionHandler = dart.constFn(core.Map$(core.String, developer.ServiceExtensionHandler)))();
+ let MapOfString$Metric = () => (MapOfString$Metric = dart.constFn(core.Map$(core.String, developer.Metric)))();
+ let ListOf_SyncBlock = () => (ListOf_SyncBlock = dart.constFn(core.List$(developer._SyncBlock)))();
+ let JSArrayOf_AsyncBlock = () => (JSArrayOf_AsyncBlock = dart.constFn(_interceptors.JSArray$(developer._AsyncBlock)))();
+ let ListOf_AsyncBlock = () => (ListOf_AsyncBlock = dart.constFn(core.List$(developer._AsyncBlock)))();
+ let CompleterOfUri = () => (CompleterOfUri = dart.constFn(async.Completer$(core.Uri)))();
let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate.Isolate)))();
let JsArray = () => (JsArray = dart.constFn(js.JsArray$()))();
let ExpandoOfFunction = () => (ExpandoOfFunction = dart.constFn(core.Expando$(core.Function)))();
@@ -616,11 +623,12 @@
let TypeToTypeMirror = () => (TypeToTypeMirror = dart.constFn(dart.definiteFunctionType(mirrors.TypeMirror, [core.Type])))();
let dynamicAndListTodynamic = () => (dynamicAndListTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.List])))();
let dynamicAndStringAndListTodynamic = () => (dynamicAndStringAndListTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String, core.List])))();
- let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
+ let SymbolTodynamic = () => (SymbolTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Symbol])))();
+ let dynamicToSymbol = () => (dynamicToSymbol = dart.constFn(dart.definiteFunctionType(core.Symbol, [dart.dynamic])))();
+ let dynamicToMapOfSymbol$dynamic = () => (dynamicToMapOfSymbol$dynamic = dart.constFn(dart.definiteFunctionType(MapOfSymbol$dynamic(), [dart.dynamic])))();
let TypeAndInvocationTodynamic = () => (TypeAndInvocationTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, core.Invocation])))();
let SymbolAnddynamicTovoid = () => (SymbolAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Symbol, dart.dynamic])))();
let MapOfSymbol$dynamicTodynamic = () => (MapOfSymbol$dynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [MapOfSymbol$dynamic()])))();
- let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
let dynamicToTypeMirror = () => (dynamicToTypeMirror = dart.constFn(dart.definiteFunctionType(mirrors.TypeMirror, [dart.dynamic])))();
let dynamicAnddynamicAnddynamicTovoid = () => (dynamicAnddynamicAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic, dart.dynamic])))();
let ListToList = () => (ListToList = dart.constFn(dart.definiteFunctionType(core.List, [core.List])))();
@@ -678,9 +686,24 @@
let ObjectToint = () => (ObjectToint = dart.constFn(dart.definiteFunctionType(core.int, [core.Object])))();
let ObjectTovoid = () => (ObjectTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Object])))();
let StringAndStringTovoid$ = () => (StringAndStringTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.String])))();
+ let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
let intAndintAndintTovoid = () => (intAndintAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.int])))();
let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
+ let __Tobool = () => (__Tobool = dart.constFn(dart.definiteFunctionType(core.bool, [], {when: core.bool, message: core.String})))();
+ let String__Tovoid$ = () => (String__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], {time: core.DateTime, sequenceNumber: core.int, level: core.int, name: core.String, zone: async.Zone, error: core.Object, stackTrace: core.StackTrace})))();
+ let StringAndServiceExtensionHandlerTovoid = () => (StringAndServiceExtensionHandlerTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, developer.ServiceExtensionHandler])))();
+ let StringAndMapTovoid = () => (StringAndMapTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.Map])))();
+ let StringToServiceExtensionHandler = () => (StringToServiceExtensionHandler = dart.constFn(dart.definiteFunctionType(developer.ServiceExtensionHandler, [core.String])))();
+ let StringAndServiceExtensionHandlerTodynamic = () => (StringAndServiceExtensionHandlerTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, developer.ServiceExtensionHandler])))();
+ let VoidToUserTag = () => (VoidToUserTag = dart.constFn(dart.definiteFunctionType(developer.UserTag, [])))();
+ let MapToString = () => (MapToString = dart.constFn(dart.definiteFunctionType(core.String, [core.Map])))();
+ let intAndintAndString__Tovoid = () => (intAndintAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String, core.String])))();
+ let intAndintAndString__Tovoid$ = () => (intAndintAndString__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String])))();
+ let intAndStringAndString__Tovoid = () => (intAndStringAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.String, core.String, core.String])))();
+ let UriTovoid = () => (UriTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Uri])))();
+ let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort])))();
+ let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort, core.bool])))();
let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate.Isolate, [core.List])))();
let dynamicTo_DartObject = () => (dynamicTo_DartObject = dart.constFn(dart.definiteFunctionType(js._DartObject, [dart.dynamic])))();
let dynamicToJsObject = () => (dynamicToJsObject = dart.constFn(dart.definiteFunctionType(js.JsObject, [dart.dynamic])))();
@@ -749,6 +772,7 @@
let NodeAndNodeTovoid = () => (NodeAndNodeTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Node, html$.Node])))();
let dynamicToImageData = () => (dynamicToImageData = dart.constFn(dart.definiteFunctionType(html$.ImageData, [dart.dynamic])))();
let ImageDataTodynamic = () => (ImageDataTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [html$.ImageData])))();
+ let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
let Map__Todynamic = () => (Map__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Map], [dynamicTovoid()])))();
let ListOfStringToList = () => (ListOfStringToList = dart.constFn(dart.definiteFunctionType(core.List, [ListOfString()])))();
let dynamicToDateTime = () => (dynamicToDateTime = dart.constFn(dart.definiteFunctionType(core.DateTime, [dart.dynamic])))();
@@ -780,10 +804,10 @@
return Mixin;
};
dart.getMixins = function(clazz) {
- return clazz[dart._mixins];
+ return Object.hasOwnProperty.call(clazz, dart._mixins) ? clazz[dart._mixins] : null;
};
dart.getImplements = function(clazz) {
- return clazz[dart.implements];
+ return Object.hasOwnProperty.call(clazz, dart.implements) ? clazz[dart.implements] : null;
};
dart.flattenFutures = function(builder) {
function flatten(T) {
@@ -8657,18 +8681,26 @@
});
_internal.Sort._INSERTION_SORT_THRESHOLD = 32;
const _name = Symbol('_name');
+ const _nativeSymbol = Symbol('_nativeSymbol');
_internal.Symbol = class Symbol extends core.Object {
new(name) {
this[_name] = name;
+ this[_nativeSymbol] = null;
+ }
+ es6(name, nativeSymbol) {
+ this[_name] = name;
+ this[_nativeSymbol] = nativeSymbol;
}
unvalidated(name) {
this[_name] = name;
+ this[_nativeSymbol] = null;
}
validated(name) {
this[_name] = _internal.Symbol.validatePublicSymbol(name);
+ this[_nativeSymbol] = null;
}
['=='](other) {
- return _internal.Symbol.is(other) && this[_name] == other[_name];
+ return _internal.Symbol.is(other) && this[_name] == other[_name] && dart.equals(this[_nativeSymbol], other[_nativeSymbol]);
}
get hashCode() {
let hash = this._hashCode;
@@ -8684,6 +8716,9 @@
static getName(symbol) {
return symbol[_name];
}
+ static getNativeSymbol(symbol) {
+ return symbol[_nativeSymbol];
+ }
static validatePublicSymbol(name) {
if (dart.test(name[dartx.isEmpty]) || dart.test(_internal.Symbol.publicSymbolPattern.hasMatch(name))) return name;
if (dart.test(name[dartx.startsWith]('_'))) {
@@ -8695,16 +8730,21 @@
return dart.test(name[dartx.isEmpty]) || dart.test(_internal.Symbol.symbolPattern.hasMatch(name));
}
};
+ dart.defineNamedConstructor(_internal.Symbol, 'es6');
dart.defineNamedConstructor(_internal.Symbol, 'unvalidated');
dart.defineNamedConstructor(_internal.Symbol, 'validated');
_internal.Symbol[dart.implements] = () => [core.Symbol];
dart.setSignature(_internal.Symbol, {
constructors: () => ({
new: dart.definiteFunctionType(_internal.Symbol, [core.String]),
+ es6: dart.definiteFunctionType(_internal.Symbol, [core.String, dart.dynamic]),
unvalidated: dart.definiteFunctionType(_internal.Symbol, [core.String]),
validated: dart.definiteFunctionType(_internal.Symbol, [core.String])
}),
- fields: () => ({[_name]: core.String}),
+ fields: () => ({
+ [_name]: core.String,
+ [_nativeSymbol]: dart.dynamic
+ }),
methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])}),
sfields: () => ({
reservedWordRE: core.String,
@@ -8716,10 +8756,11 @@
}),
statics: () => ({
getName: dart.definiteFunctionType(core.String, [_internal.Symbol]),
+ getNativeSymbol: dart.definiteFunctionType(dart.dynamic, [_internal.Symbol]),
validatePublicSymbol: dart.definiteFunctionType(core.String, [core.String]),
isValidSymbol: dart.definiteFunctionType(core.bool, [core.String])
}),
- names: ['getName', 'validatePublicSymbol', 'isValidSymbol']
+ names: ['getName', 'getNativeSymbol', 'validatePublicSymbol', 'isValidSymbol']
});
_internal.Symbol.reservedWordRE = '(?:assert|break|c(?:a(?:se|tch)|lass|on(?:st|tinue))|d(?:efault|o)|' + 'e(?:lse|num|xtends)|f(?:alse|inal(?:ly)?|or)|i[fns]|n(?:ew|ull)|' + 'ret(?:hrow|urn)|s(?:uper|witch)|t(?:h(?:is|row)|r(?:ue|y))|' + 'v(?:ar|oid)|w(?:hile|ith))';
_internal.Symbol.operatorRE = '(?:[\\-+*/%&|^]|\\[\\]=?|==|~/?|<[<=]?|>[>=]?|unary-)';
@@ -13230,73 +13271,109 @@
return _js_mirrors._dart.definiteFunctionType(type, []);
};
dart.fn(_js_mirrors._defaultConstructorType, dynamicTodynamic$());
+ _js_mirrors._getMixins = function(type) {
+ return _js_mirrors._dart.getMixins(type, []);
+ };
+ dart.fn(_js_mirrors._getMixins, dynamicTodynamic$());
_js_mirrors._Lazy$ = dart.generic(T => {
const _Lazy = dart.typedef('_Lazy', () => dart.functionType(T, []));
return _Lazy;
});
_js_mirrors._Lazy = _Lazy();
+ _js_mirrors._getESSymbol = function(symbol) {
+ return _internal.Symbol.getNativeSymbol(_internal.Symbol.as(symbol));
+ };
+ dart.lazyFn(_js_mirrors._getESSymbol, () => SymbolTodynamic());
+ _js_mirrors._getMember = function(symbol) {
+ let privateSymbol = _js_mirrors._getESSymbol(symbol);
+ if (privateSymbol != null) {
+ return privateSymbol;
+ }
+ return _js_mirrors.getName(symbol);
+ };
+ dart.lazyFn(_js_mirrors._getMember, () => SymbolTodynamic());
_js_mirrors._getNameForESSymbol = function(member) {
+ dart.assert(typeof member == "symbol");
let str = dart.toString(member);
dart.assert(dart.test(str[dartx.startsWith]('Symbol(')) && dart.test(str[dartx.endsWith](')')));
return str[dartx.substring](7, dart.notNull(str[dartx.length]) - 1);
};
dart.lazyFn(_js_mirrors._getNameForESSymbol, () => dynamicToString());
+ _js_mirrors._getSymbolForESSymbol = function(member) {
+ let name = _js_mirrors._getNameForESSymbol(member);
+ return new _internal.Symbol.es6(name, member);
+ };
+ dart.lazyFn(_js_mirrors._getSymbolForESSymbol, () => dynamicToSymbol());
+ _js_mirrors._getSymbolForMember = function(member) {
+ if (typeof member == 'string') {
+ return core.Symbol.new(member);
+ } else {
+ let name = _js_mirrors._getNameForESSymbol(member);
+ return new _internal.Symbol.es6(name, member);
+ }
+ };
+ dart.lazyFn(_js_mirrors._getSymbolForMember, () => dynamicToSymbol());
_js_mirrors._toDartMap = function(data) {
- if (data == null) return dart.map();
- let map = _js_mirrors._dart.map(data);
+ if (data == null) return dart.map({}, core.Symbol, dart.dynamic);
+ let map = MapOfSymbol$dynamic().new();
+ let publicMembers = Object.getOwnPropertyNames(data);
+ for (let member of core.Iterable._check(publicMembers)) {
+ let symbol = core.Symbol.new(core.String._check(member));
+ map[dartx._set](symbol, data[member]);
+ }
let privateMembers = Object.getOwnPropertySymbols(data);
for (let member of core.Iterable._check(privateMembers)) {
- let name = _js_mirrors._getNameForESSymbol(member);
- map[dartx._set](name, data[member]);
+ let symbol = _js_mirrors._getSymbolForESSymbol(member);
+ map[dartx._set](symbol, data[member]);
}
return map;
};
- dart.lazyFn(_js_mirrors._toDartMap, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._toDartMap, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getConstructors = function(obj) {
let sig = _js_mirrors._dart.getConstructorSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getConstructors, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getConstructors, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getFields = function(obj) {
let sig = _js_mirrors._dart.getFieldSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getFields, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getFields, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getMethods = function(obj) {
let sig = _js_mirrors._dart.getMethodSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getMethods, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getMethods, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getGetters = function(obj) {
let sig = _js_mirrors._dart.getGetterSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getGetters, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getGetters, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getSetters = function(obj) {
let sig = _js_mirrors._dart.getSetterSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getSetters, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getSetters, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getStaticFields = function(obj) {
let sig = _js_mirrors._dart.getStaticFieldSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getStaticFields, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getStaticFields, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getStatics = function(obj) {
let sig = _js_mirrors._dart.getStaticSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getStatics, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getStatics, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getStaticGetters = function(obj) {
let sig = _js_mirrors._dart.getStaticGetterSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getStaticGetters, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getStaticGetters, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getStaticSetters = function(obj) {
let sig = _js_mirrors._dart.getStaticSetterSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getStaticSetters, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getStaticSetters, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._unwrap = function(obj) {
return _js_mirrors._dart.unwrapType(obj);
};
@@ -13435,15 +13512,7 @@
[_getAccessor](reflectee, symbol, args, namedArgs) {
if (args === void 0) args = null;
if (namedArgs === void 0) namedArgs = null;
- let name = _js_mirrors.getName(symbol);
- if (!dart.test(name[dartx.startsWith]('_'))) return name;
- let privateMembers = Object.getOwnPropertySymbols(reflectee);
- dart.dsend(privateMembers, 'addAll', Object.getOwnPropertySymbols(reflectee.__proto__));
- for (let member of core.Iterable._check(privateMembers)) {
- let privateName = _js_mirrors._getNameForESSymbol(member);
- if (name == privateName) return member;
- }
- return new core.NoSuchMethodError(reflectee, symbol, args, namedArgs);
+ return _js_mirrors._getMember(symbol);
}
getField(symbol) {
let name = this[_getAccessor](this.reflectee, symbol);
@@ -13520,6 +13589,7 @@
let const$0;
const _declarations = Symbol('_declarations');
const _raw = Symbol('_raw');
+ const _mixin = Symbol('_mixin');
const _typeArguments = Symbol('_typeArguments');
let const$1;
_js_mirrors.JsClassMirror = class JsClassMirror extends _js_mirrors.JsMirror {
@@ -13536,67 +13606,66 @@
this[_declarations] = MapOfSymbol$DeclarationMirror().new();
let unwrapped = _js_mirrors._unwrap(this[_cls]);
let constructors = _js_mirrors._getConstructors(unwrapped);
- constructors[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, name, ft));
- }, StringAnddynamicTovoid()));
+ constructors[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
if (dart.test(constructors[dartx.isEmpty])) {
let name = 'new';
let ft = _js_mirrors._defaultConstructorType(_js_mirrors._unwrap(this[_cls]));
let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, name, ft));
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, symbol, ft));
}
let fields = _js_mirrors._getFields(unwrapped);
- fields[dartx.forEach](dart.fn((name, t) => {
- let symbol = core.Symbol.new(name);
+ fields[dartx.forEach](dart.fn((symbol, t) => {
let metadata = [];
if (core.List.is(t)) {
metadata = core.List._check(dart.dsend(dart.dsend(t, 'skip', 1), 'toList'));
t = dart.dindex(t, 0);
}
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(name, core.Type._check(_js_mirrors._wrap(t)), metadata));
- }, StringAnddynamicTovoid()));
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(symbol, core.Type._check(_js_mirrors._wrap(t)), metadata));
+ }, SymbolAnddynamicTovoid()));
let methods = _js_mirrors._getMethods(unwrapped);
- methods[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ methods[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let getters = _js_mirrors._getGetters(unwrapped);
- getters[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ getters[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let setters = _js_mirrors._getSetters(unwrapped);
- setters[dartx.forEach](dart.fn((name, ft) => {
- name = dart.notNull(name) + '=';
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ setters[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = dart.notNull(_js_mirrors.getName(symbol)) + '=';
+ symbol = new _internal.Symbol.es6(name, _js_mirrors._getESSymbol(symbol));
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let staticFields = _js_mirrors._getStaticFields(unwrapped);
- staticFields[dartx.forEach](dart.fn((name, t) => {
- let symbol = core.Symbol.new(name);
+ staticFields[dartx.forEach](dart.fn((symbol, t) => {
+ let name = _js_mirrors.getName(symbol);
let metadata = [];
if (core.List.is(t)) {
metadata = core.List._check(dart.dsend(dart.dsend(t, 'skip', 1), 'toList'));
t = dart.dindex(t, 0);
}
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(name, core.Type._check(_js_mirrors._wrap(t)), metadata));
- }, StringAnddynamicTovoid()));
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(symbol, core.Type._check(_js_mirrors._wrap(t)), metadata));
+ }, SymbolAnddynamicTovoid()));
let statics = _js_mirrors._getStatics(unwrapped);
- statics[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ statics[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let staticGetters = _js_mirrors._getStaticGetters(unwrapped);
- staticGetters[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ staticGetters[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let staticSetters = _js_mirrors._getStaticSetters(unwrapped);
- staticSetters[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ staticSetters[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
this[_declarations] = MapOfSymbol$DeclarationMirror().unmodifiable(this[_declarations]);
}
return this[_declarations];
@@ -13605,7 +13674,7 @@
this[_cls] = cls;
this[_raw] = _js_mirrors._getGenericClass(_js_mirrors._unwrap(cls));
this.simpleName = core.Symbol.new(_js_mirrors._unwrap(cls).name);
- this.mixin = null;
+ this[_mixin] = null;
this[_typeArguments] = null;
this[_metadata$] = null;
this[_declarations] = null;
@@ -13676,6 +13745,21 @@
return mirrors.ClassMirror._check(_js_mirrors.reflectType(core.Type._check(_js_mirrors._wrap(_js_mirrors._unwrap(this[_cls]).__proto__))));
}
}
+ get mixin() {
+ if (this[_mixin] != null) {
+ return this[_mixin];
+ }
+ let mixins = _js_mirrors._getMixins(_js_mirrors._unwrap(this[_cls]));
+ if (mixins == null || dart.test(dart.dload(mixins, 'isEmpty'))) {
+ this[_mixin] = this;
+ return this[_mixin];
+ }
+ if (dart.test(dart.dsend(dart.dload(mixins, 'length'), '>', 1))) {
+ dart.throw(new core.UnsupportedError("ClassMirror.mixin not yet supported for " + dart.str`classes (${this[_cls]}) with multiple mixins`));
+ }
+ this[_mixin] = mirrors.ClassMirror._check(_js_mirrors.reflectType(core.Type._check(_js_mirrors._wrap(dart.dindex(mixins, 0)))));
+ return this[_mixin];
+ }
toString() {
return dart.str`ClassMirror on '${this[_cls]}'`;
}
@@ -13724,7 +13808,7 @@
[_cls]: core.Type,
simpleName: core.Symbol,
[_raw]: dart.dynamic,
- mixin: mirrors.ClassMirror,
+ [_mixin]: mirrors.ClassMirror,
[_typeArguments]: ListOfTypeMirror(),
[_metadata$]: ListOfInstanceMirror(),
[_declarations]: MapOfSymbol$DeclarationMirror()
@@ -13738,7 +13822,8 @@
isOriginalDeclaration: dart.definiteFunctionType(core.bool, []),
typeArguments: dart.definiteFunctionType(core.List$(mirrors.TypeMirror), []),
originalDeclaration: dart.definiteFunctionType(mirrors.TypeMirror, []),
- superclass: dart.definiteFunctionType(mirrors.ClassMirror, [])
+ superclass: dart.definiteFunctionType(mirrors.ClassMirror, []),
+ mixin: dart.definiteFunctionType(mirrors.ClassMirror, [])
}),
methods: () => ({
newInstance: dart.definiteFunctionType(mirrors.InstanceMirror, [core.Symbol, core.List], [MapOfSymbol$dynamic()]),
@@ -13747,13 +13832,15 @@
invoke: dart.definiteFunctionType(mirrors.InstanceMirror, [core.Symbol, core.List], [MapOfSymbol$dynamic()])
})
});
+ const _symbol = Symbol('_symbol');
const _name$ = Symbol('_name');
_js_mirrors.JsVariableMirror = class JsVariableMirror extends _js_mirrors.JsMirror {
get simpleName() {
- return core.Symbol.new(this[_name$]);
+ return this[_symbol];
}
- _(name, t, annotations) {
- this[_name$] = name;
+ _(symbol, t, annotations) {
+ this[_symbol] = symbol;
+ this[_name$] = _js_mirrors.getName(symbol);
this.type = _js_mirrors.reflectType(t);
this.metadata = ListOfInstanceMirror().unmodifiable(annotations[dartx.map](mirrors.InstanceMirror)(dart.fn(a => _js_mirrors.reflect(a), dynamicToInstanceMirror())));
this.isStatic = false;
@@ -13784,8 +13871,9 @@
dart.defineNamedConstructor(_js_mirrors.JsVariableMirror, '_');
_js_mirrors.JsVariableMirror[dart.implements] = () => [mirrors.VariableMirror];
dart.setSignature(_js_mirrors.JsVariableMirror, {
- constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsVariableMirror, [core.String, core.Type, core.List])}),
+ constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsVariableMirror, [core.Symbol, core.Type, core.List])}),
fields: () => ({
+ [_symbol]: core.Symbol,
[_name$]: core.String,
type: mirrors.TypeMirror,
metadata: ListOfInstanceMirror(),
@@ -13795,8 +13883,8 @@
getters: () => ({simpleName: dart.definiteFunctionType(core.Symbol, [])})
});
_js_mirrors.JsParameterMirror = class JsParameterMirror extends _js_mirrors.JsVariableMirror {
- _(name, t, annotations) {
- super._(name, t, annotations);
+ _(member, t, annotations) {
+ super._(member, t, annotations);
}
toString() {
return dart.str`ParameterMirror on '${this[_name$]}'`;
@@ -13835,7 +13923,7 @@
dart.defineNamedConstructor(_js_mirrors.JsParameterMirror, '_');
_js_mirrors.JsParameterMirror[dart.implements] = () => [mirrors.ParameterMirror];
dart.setSignature(_js_mirrors.JsParameterMirror, {
- constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsParameterMirror, [core.String, core.Type, core.List])})
+ constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsParameterMirror, [core.Symbol, core.Type, core.List])})
});
const _params = Symbol('_params');
const _createParameterMirrorList = Symbol('_createParameterMirrorList');
@@ -13850,10 +13938,11 @@
return this[_name$][dartx.startsWith]('_');
}
get simpleName() {
- return core.Symbol.new(this[_name$]);
+ return this[_symbol];
}
- _constructor(cls, name, ftype) {
- this[_name$] = name;
+ _constructor(cls, symbol, ftype) {
+ this[_symbol] = symbol;
+ this[_name$] = _js_mirrors.getName(symbol);
this.isConstructor = true;
this.isStatic = false;
this[_params] = null;
@@ -13861,8 +13950,9 @@
this.isFinal = false;
this[_createParameterMirrorList](ftype);
}
- _instanceMethod(cls, name, ftype) {
- this[_name$] = name;
+ _instanceMethod(cls, symbol, ftype) {
+ this[_symbol] = symbol;
+ this[_name$] = _js_mirrors.getName(symbol);
this.isConstructor = false;
this.isStatic = false;
this[_params] = null;
@@ -13870,8 +13960,9 @@
this.isFinal = false;
this[_createParameterMirrorList](ftype);
}
- _staticMethod(cls, name, ftype) {
- this[_name$] = name;
+ _staticMethod(cls, symbol, ftype) {
+ this[_symbol] = symbol;
+ this[_name$] = _js_mirrors.getName(symbol);
this.isConstructor = false;
this.isStatic = true;
this[_params] = null;
@@ -13880,7 +13971,7 @@
this[_createParameterMirrorList](ftype);
}
get constructorName() {
- return dart.test(this.isConstructor) ? core.Symbol.new(this[_name$]) : null;
+ return dart.test(this.isConstructor) ? this[_symbol] : null;
}
get parameters() {
return this[_params];
@@ -13909,13 +14000,13 @@
for (let i = 0; i < dart.notNull(args[dartx.length]); ++i) {
let type = args[dartx._get](i);
let metadata = dart.dindex(dart.dload(ftype, 'metadata'), i);
- let param = new _js_mirrors.JsParameterMirror._('', core.Type._check(_js_mirrors._wrap(type)), core.List._check(metadata));
+ let param = new _js_mirrors.JsParameterMirror._(core.Symbol.new(''), core.Type._check(_js_mirrors._wrap(type)), core.List._check(metadata));
params[dartx._set](i, param);
}
for (let i = 0; i < dart.notNull(opts[dartx.length]); ++i) {
let type = opts[dartx._get](i);
let metadata = dart.dindex(dart.dload(ftype, 'metadata'), dart.notNull(args[dartx.length]) + i);
- let param = new _js_mirrors.JsParameterMirror._('', core.Type._check(_js_mirrors._wrap(type)), core.List._check(metadata));
+ let param = new _js_mirrors.JsParameterMirror._(core.Symbol.new(''), core.Type._check(_js_mirrors._wrap(type)), core.List._check(metadata));
params[dartx._set](i + dart.notNull(args[dartx.length]), param);
}
this[_params] = ListOfParameterMirror().unmodifiable(params);
@@ -13975,11 +14066,12 @@
_js_mirrors.JsMethodMirror[dart.implements] = () => [mirrors.MethodMirror];
dart.setSignature(_js_mirrors.JsMethodMirror, {
constructors: () => ({
- _constructor: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.String, dart.dynamic]),
- _instanceMethod: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.String, dart.dynamic]),
- _staticMethod: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.String, dart.dynamic])
+ _constructor: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.Symbol, dart.dynamic]),
+ _instanceMethod: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.Symbol, dart.dynamic]),
+ _staticMethod: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.Symbol, dart.dynamic])
}),
fields: () => ({
+ [_symbol]: core.Symbol,
[_name$]: core.String,
[_params]: ListOfParameterMirror(),
[_metadata$]: ListOfInstanceMirror(),
@@ -36375,6 +36467,741 @@
core.UriData._noScheme = -1;
core.UriData._tokenCharTable = dart.constList([0, 0, 27858, 1023, 65534, 51199, 65535, 32767], core.int);
core.UriData._uricTable = core.Uri._queryCharTable;
+ developer.debugger = function(opts) {
+ let when = opts && 'when' in opts ? opts.when : true;
+ let message = opts && 'message' in opts ? opts.message : null;
+ if (dart.test(when)) {
+ debugger;
+ }
+ return when;
+ };
+ dart.fn(developer.debugger, __Tobool());
+ developer.inspect = function(object) {
+ return object;
+ };
+ dart.fn(developer.inspect, ObjectToObject());
+ developer.log = function(message, opts) {
+ let time = opts && 'time' in opts ? opts.time : null;
+ let sequenceNumber = opts && 'sequenceNumber' in opts ? opts.sequenceNumber : null;
+ let level = opts && 'level' in opts ? opts.level : 0;
+ let name = opts && 'name' in opts ? opts.name : '';
+ let zone = opts && 'zone' in opts ? opts.zone : null;
+ let error = opts && 'error' in opts ? opts.error : null;
+ let stackTrace = opts && 'stackTrace' in opts ? opts.stackTrace : null;
+ };
+ dart.fn(developer.log, String__Tovoid$());
+ dart.defineLazy(developer, {
+ get _extensions() {
+ return MapOfString$ServiceExtensionHandler().new();
+ }
+ });
+ developer._clockValue = 0;
+ const _result = Symbol('_result');
+ const _errorCode = Symbol('_errorCode');
+ const _errorDetail = Symbol('_errorDetail');
+ const _isError = Symbol('_isError');
+ const _toString = Symbol('_toString');
+ developer.ServiceExtensionResponse = class ServiceExtensionResponse extends core.Object {
+ result(result) {
+ this[_result] = result;
+ this[_errorCode] = null;
+ this[_errorDetail] = null;
+ if (!(typeof this[_result] == 'string')) {
+ dart.throw(new core.ArgumentError.value(this[_result], "result", "Must be a String"));
+ }
+ }
+ error(errorCode, errorDetail) {
+ this[_result] = null;
+ this[_errorCode] = errorCode;
+ this[_errorDetail] = errorDetail;
+ developer.ServiceExtensionResponse._validateErrorCode(this[_errorCode]);
+ if (!(typeof this[_errorDetail] == 'string')) {
+ dart.throw(new core.ArgumentError.value(this[_errorDetail], "errorDetail", "Must be a String"));
+ }
+ }
+ static _errorCodeMessage(errorCode) {
+ developer.ServiceExtensionResponse._validateErrorCode(errorCode);
+ if (errorCode == developer.ServiceExtensionResponse.kInvalidParams) {
+ return "Invalid params";
+ }
+ return "Server error";
+ }
+ static _validateErrorCode(errorCode) {
+ if (!(typeof errorCode == 'number')) {
+ dart.throw(new core.ArgumentError.value(errorCode, "errorCode", "Must be an int"));
+ }
+ if (errorCode == developer.ServiceExtensionResponse.invalidParams) {
+ return;
+ }
+ if (dart.notNull(errorCode) >= developer.ServiceExtensionResponse.extensionErrorMin && dart.notNull(errorCode) <= developer.ServiceExtensionResponse.extensionErrorMax) {
+ return;
+ }
+ dart.throw(new core.ArgumentError.value(errorCode, "errorCode", "Out of range"));
+ }
+ [_isError]() {
+ return this[_errorCode] != null && this[_errorDetail] != null;
+ }
+ [_toString]() {
+ if (this[_result] != null) {
+ return this[_result];
+ } else {
+ dart.assert(this[_errorCode] != null);
+ dart.assert(this[_errorDetail] != null);
+ return convert.JSON.encode(dart.map({code: this[_errorCode], message: developer.ServiceExtensionResponse._errorCodeMessage(this[_errorCode]), data: dart.map({details: this[_errorDetail]}, core.String, core.String)}, core.String, core.Object));
+ }
+ }
+ };
+ dart.defineNamedConstructor(developer.ServiceExtensionResponse, 'result');
+ dart.defineNamedConstructor(developer.ServiceExtensionResponse, 'error');
+ dart.setSignature(developer.ServiceExtensionResponse, {
+ constructors: () => ({
+ result: dart.definiteFunctionType(developer.ServiceExtensionResponse, [core.String]),
+ error: dart.definiteFunctionType(developer.ServiceExtensionResponse, [core.int, core.String])
+ }),
+ fields: () => ({
+ [_result]: core.String,
+ [_errorCode]: core.int,
+ [_errorDetail]: core.String
+ }),
+ methods: () => ({
+ [_isError]: dart.definiteFunctionType(core.bool, []),
+ [_toString]: dart.definiteFunctionType(core.String, [])
+ }),
+ sfields: () => ({
+ kInvalidParams: core.int,
+ kExtensionError: core.int,
+ kExtensionErrorMax: core.int,
+ kExtensionErrorMin: core.int,
+ invalidParams: core.int,
+ extensionError: core.int,
+ extensionErrorMax: core.int,
+ extensionErrorMin: core.int
+ }),
+ statics: () => ({
+ _errorCodeMessage: dart.definiteFunctionType(core.String, [core.int]),
+ _validateErrorCode: dart.definiteFunctionType(dart.dynamic, [core.int])
+ }),
+ names: ['_errorCodeMessage', '_validateErrorCode']
+ });
+ developer.ServiceExtensionResponse.invalidParams = -32602;
+ developer.ServiceExtensionResponse.extensionError = -32000;
+ developer.ServiceExtensionResponse.extensionErrorMax = -32000;
+ developer.ServiceExtensionResponse.extensionErrorMin = -32016;
+ dart.defineLazy(developer.ServiceExtensionResponse, {
+ get kInvalidParams() {
+ return developer.ServiceExtensionResponse.invalidParams;
+ },
+ get kExtensionError() {
+ return developer.ServiceExtensionResponse.extensionError;
+ },
+ get kExtensionErrorMax() {
+ return developer.ServiceExtensionResponse.extensionErrorMax;
+ },
+ get kExtensionErrorMin() {
+ return developer.ServiceExtensionResponse.extensionErrorMin;
+ }
+ });
+ developer.ServiceExtensionHandler = dart.typedef('ServiceExtensionHandler', () => dart.functionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]));
+ developer.registerExtension = function(method, handler) {
+ if (!(typeof method == 'string')) {
+ dart.throw(new core.ArgumentError.value(method, 'method', 'Must be a String'));
+ }
+ if (!dart.test(method[dartx.startsWith]('ext.'))) {
+ dart.throw(new core.ArgumentError.value(method, 'method', 'Must begin with ext.'));
+ }
+ if (developer._lookupExtension(method) != null) {
+ dart.throw(new core.ArgumentError(dart.str`Extension already registered: ${method}`));
+ }
+ if (!developer.ServiceExtensionHandler.is(handler)) {
+ dart.throw(new core.ArgumentError.value(handler, 'handler', 'Must be a ServiceExtensionHandler'));
+ }
+ developer._registerExtension(method, handler);
+ };
+ dart.fn(developer.registerExtension, StringAndServiceExtensionHandlerTovoid());
+ developer.postEvent = function(eventKind, eventData) {
+ if (!(typeof eventKind == 'string')) {
+ dart.throw(new core.ArgumentError.value(eventKind, 'eventKind', 'Must be a String'));
+ }
+ if (!core.Map.is(eventData)) {
+ dart.throw(new core.ArgumentError.value(eventData, 'eventData', 'Must be a Map'));
+ }
+ let eventDataAsString = convert.JSON.encode(eventData);
+ developer._postEvent(eventKind, eventDataAsString);
+ };
+ dart.fn(developer.postEvent, StringAndMapTovoid());
+ developer._postEvent = function(eventKind, eventData) {
+ };
+ dart.fn(developer._postEvent, StringAndStringTodynamic());
+ developer._lookupExtension = function(method) {
+ return developer._extensions[dartx._get](method);
+ };
+ dart.fn(developer._lookupExtension, StringToServiceExtensionHandler());
+ developer._registerExtension = function(method, handler) {
+ developer._extensions[dartx._set](method, handler);
+ };
+ dart.fn(developer._registerExtension, StringAndServiceExtensionHandlerTodynamic());
+ developer.UserTag = class UserTag extends core.Object {
+ static new(label) {
+ return developer._FakeUserTag.new(label);
+ }
+ static get defaultTag() {
+ return developer._FakeUserTag._defaultTag;
+ }
+ };
+ dart.setSignature(developer.UserTag, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.UserTag, [core.String])}),
+ sfields: () => ({MAX_USER_TAGS: core.int}),
+ sgetters: () => ({defaultTag: dart.definiteFunctionType(developer.UserTag, [])})
+ });
+ developer.UserTag.MAX_USER_TAGS = 64;
+ developer._FakeUserTag = class _FakeUserTag extends core.Object {
+ real(label) {
+ this.label = label;
+ }
+ static new(label) {
+ let existingTag = developer._FakeUserTag._instances[dartx._get](label);
+ if (existingTag != null) {
+ return developer._FakeUserTag._check(existingTag);
+ }
+ if (developer._FakeUserTag._instances[dartx.length] == developer.UserTag.MAX_USER_TAGS) {
+ dart.throw(new core.UnsupportedError(dart.str`UserTag instance limit (${developer.UserTag.MAX_USER_TAGS}) reached.`));
+ }
+ let instance = new developer._FakeUserTag.real(label);
+ developer._FakeUserTag._instances[dartx._set](label, instance);
+ return instance;
+ }
+ makeCurrent() {
+ let old = developer._currentTag;
+ developer._currentTag = this;
+ return old;
+ }
+ };
+ dart.defineNamedConstructor(developer._FakeUserTag, 'real');
+ developer._FakeUserTag[dart.implements] = () => [developer.UserTag];
+ dart.setSignature(developer._FakeUserTag, {
+ constructors: () => ({
+ real: dart.definiteFunctionType(developer._FakeUserTag, [core.String]),
+ new: dart.definiteFunctionType(developer._FakeUserTag, [core.String])
+ }),
+ fields: () => ({label: core.String}),
+ methods: () => ({makeCurrent: dart.definiteFunctionType(developer.UserTag, [])}),
+ sfields: () => ({
+ _instances: core.Map,
+ _defaultTag: developer.UserTag
+ })
+ });
+ dart.defineLazy(developer._FakeUserTag, {
+ get _instances() {
+ return dart.map();
+ },
+ set _instances(_) {},
+ get _defaultTag() {
+ return developer._FakeUserTag.new('Default');
+ }
+ });
+ dart.defineLazy(developer, {
+ get _currentTag() {
+ return developer._FakeUserTag._defaultTag;
+ },
+ set _currentTag(_) {}
+ });
+ developer.getCurrentTag = function() {
+ return developer._currentTag;
+ };
+ dart.fn(developer.getCurrentTag, VoidToUserTag());
+ developer.Metric = class Metric extends core.Object {
+ new(name, description) {
+ this.name = name;
+ this.description = description;
+ if (this.name == 'vm' || dart.test(this.name[dartx.contains]('/'))) {
+ dart.throw(new core.ArgumentError('Invalid Metric name.'));
+ }
+ }
+ };
+ dart.setSignature(developer.Metric, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.Metric, [core.String, core.String])}),
+ fields: () => ({
+ name: core.String,
+ description: core.String
+ })
+ });
+ const _value$0 = Symbol('_value');
+ const _toJSON = Symbol('_toJSON');
+ developer.Gauge = class Gauge extends developer.Metric {
+ get value() {
+ return this[_value$0];
+ }
+ set value(v) {
+ if (dart.notNull(v) < dart.notNull(this.min)) {
+ v = this.min;
+ } else if (dart.notNull(v) > dart.notNull(this.max)) {
+ v = this.max;
+ }
+ this[_value$0] = v;
+ }
+ new(name, description, min, max) {
+ this.min = min;
+ this.max = max;
+ this[_value$0] = null;
+ super.new(name, description);
+ if (!(typeof this.min == 'number')) {
+ dart.throw(new core.ArgumentError('min must be a double'));
+ }
+ if (!(typeof this.max == 'number')) {
+ dart.throw(new core.ArgumentError('max must be a double'));
+ }
+ if (!(dart.notNull(this.min) < dart.notNull(this.max))) {
+ dart.throw(new core.ArgumentError('min must be less than max'));
+ }
+ this[_value$0] = this.min;
+ }
+ [_toJSON]() {
+ let map = dart.map({type: 'Gauge', id: dart.str`metrics/${this.name}`, name: this.name, description: this.description, value: this.value, min: this.min, max: this.max}, core.String, core.Object);
+ return map;
+ }
+ };
+ dart.setSignature(developer.Gauge, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.Gauge, [core.String, core.String, core.double, core.double])}),
+ fields: () => ({
+ min: core.double,
+ max: core.double,
+ [_value$0]: core.double
+ }),
+ getters: () => ({value: dart.definiteFunctionType(core.double, [])}),
+ setters: () => ({value: dart.definiteFunctionType(dart.void, [core.double])}),
+ methods: () => ({[_toJSON]: dart.definiteFunctionType(core.Map, [])})
+ });
+ developer.Counter = class Counter extends developer.Metric {
+ new(name, description) {
+ this[_value$0] = 0.0;
+ super.new(name, description);
+ }
+ get value() {
+ return this[_value$0];
+ }
+ set value(v) {
+ this[_value$0] = v;
+ }
+ [_toJSON]() {
+ let map = dart.map({type: 'Counter', id: dart.str`metrics/${this.name}`, name: this.name, description: this.description, value: this.value}, core.String, core.Object);
+ return map;
+ }
+ };
+ dart.setSignature(developer.Counter, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.Counter, [core.String, core.String])}),
+ fields: () => ({[_value$0]: core.double}),
+ getters: () => ({value: dart.definiteFunctionType(core.double, [])}),
+ setters: () => ({value: dart.definiteFunctionType(dart.void, [core.double])}),
+ methods: () => ({[_toJSON]: dart.definiteFunctionType(core.Map, [])})
+ });
+ developer.Metrics = class Metrics extends core.Object {
+ static register(metric) {
+ if (!developer.Metric.is(metric)) {
+ dart.throw(new core.ArgumentError('metric must be a Metric'));
+ }
+ if (developer.Metrics._metrics[dartx._get](metric.name) != null) {
+ dart.throw(new core.ArgumentError('Registered metrics have unique names'));
+ }
+ developer.Metrics._metrics[dartx._set](metric.name, metric);
+ }
+ static deregister(metric) {
+ if (!developer.Metric.is(metric)) {
+ dart.throw(new core.ArgumentError('metric must be a Metric'));
+ }
+ developer.Metrics._metrics[dartx.remove](metric.name);
+ }
+ static _printMetric(id) {
+ let metric = developer.Metrics._metrics[dartx._get](id);
+ if (metric == null) {
+ return null;
+ }
+ return convert.JSON.encode(metric[_toJSON]());
+ }
+ static _printMetrics() {
+ let metrics = [];
+ for (let metric of developer.Metrics._metrics[dartx.values]) {
+ metrics[dartx.add](metric[_toJSON]());
+ }
+ let map = dart.map({type: 'MetricList', metrics: metrics}, core.String, core.Object);
+ return convert.JSON.encode(map);
+ }
+ };
+ dart.setSignature(developer.Metrics, {
+ sfields: () => ({_metrics: MapOfString$Metric()}),
+ statics: () => ({
+ register: dart.definiteFunctionType(dart.void, [developer.Metric]),
+ deregister: dart.definiteFunctionType(dart.void, [developer.Metric]),
+ _printMetric: dart.definiteFunctionType(core.String, [core.String]),
+ _printMetrics: dart.definiteFunctionType(core.String, [])
+ }),
+ names: ['register', 'deregister', '_printMetric', '_printMetrics']
+ });
+ dart.defineLazy(developer.Metrics, {
+ get _metrics() {
+ return MapOfString$Metric().new();
+ }
+ });
+ developer._isProduct = false;
+ developer.TimelineSyncFunction = dart.typedef('TimelineSyncFunction', () => dart.functionType(dart.dynamic, []));
+ developer.TimelineAsyncFunction = dart.typedef('TimelineAsyncFunction', () => dart.functionType(async.Future, []));
+ const _appendArguments = Symbol('_appendArguments');
+ developer.Timeline = class Timeline extends core.Object {
+ static startSync(name, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ if (developer._isProduct) {
+ return;
+ }
+ if (!(typeof name == 'string')) {
+ dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
+ }
+ if (!dart.test(developer._isDartStreamEnabled())) {
+ developer.Timeline._stack[dartx.add](null);
+ return;
+ }
+ let block = new developer._SyncBlock._(name, developer._getTraceClock(), developer._getThreadCpuClock());
+ if (core.Map.is(arguments$)) {
+ block[_appendArguments](arguments$);
+ }
+ developer.Timeline._stack[dartx.add](block);
+ }
+ static finishSync() {
+ if (developer._isProduct) {
+ return;
+ }
+ if (developer.Timeline._stack[dartx.length] == 0) {
+ dart.throw(new core.StateError('Uneven calls to startSync and finishSync'));
+ }
+ let block = developer.Timeline._stack[dartx.removeLast]();
+ if (block == null) {
+ return;
+ }
+ block.finish();
+ }
+ static instantSync(name, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ if (developer._isProduct) {
+ return;
+ }
+ if (!(typeof name == 'string')) {
+ dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
+ }
+ if (!dart.test(developer._isDartStreamEnabled())) {
+ return;
+ }
+ let instantArguments = null;
+ if (core.Map.is(arguments$)) {
+ instantArguments = core.Map.from(arguments$);
+ }
+ developer._reportInstantEvent(developer._getTraceClock(), 'Dart', name, developer._argumentsAsJson(instantArguments));
+ }
+ static timeSync(name, func, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ developer.Timeline.startSync(name, {arguments: arguments$});
+ try {
+ return func();
+ } finally {
+ developer.Timeline.finishSync();
+ }
+ }
+ static get now() {
+ return developer._getTraceClock();
+ }
+ };
+ dart.setSignature(developer.Timeline, {
+ sfields: () => ({
+ _stack: ListOf_SyncBlock(),
+ _isolateId: core.int,
+ _isolateIdString: core.String
+ }),
+ sgetters: () => ({now: dart.definiteFunctionType(core.int, [])}),
+ statics: () => ({
+ startSync: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
+ finishSync: dart.definiteFunctionType(dart.void, []),
+ instantSync: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
+ timeSync: dart.definiteFunctionType(dart.dynamic, [core.String, developer.TimelineSyncFunction], {arguments: core.Map})
+ }),
+ names: ['startSync', 'finishSync', 'instantSync', 'timeSync']
+ });
+ dart.defineLazy(developer.Timeline, {
+ get _stack() {
+ return ListOf_SyncBlock().new();
+ },
+ get _isolateId() {
+ return developer._getIsolateNum();
+ },
+ get _isolateIdString() {
+ return dart.toString(developer.Timeline._isolateId);
+ }
+ });
+ const _stack = Symbol('_stack');
+ const _taskId = Symbol('_taskId');
+ const _start$1 = Symbol('_start');
+ const _finish = Symbol('_finish');
+ developer.TimelineTask = class TimelineTask extends core.Object {
+ new() {
+ this[_stack] = JSArrayOf_AsyncBlock().of([]);
+ this[_taskId] = developer._getNextAsyncId();
+ }
+ withTaskId(taskId) {
+ this[_stack] = JSArrayOf_AsyncBlock().of([]);
+ this[_taskId] = taskId;
+ if (!(typeof taskId == 'number')) {
+ dart.throw(new core.ArgumentError.value(taskId, 'taskId', 'Must be an int'));
+ }
+ }
+ start(name, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ if (developer._isProduct) {
+ return;
+ }
+ if (!(typeof name == 'string')) {
+ dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
+ }
+ let block = new developer._AsyncBlock._(name, this[_taskId]);
+ if (core.Map.is(arguments$)) {
+ block[_appendArguments](arguments$);
+ }
+ this[_stack][dartx.add](block);
+ block[_start$1]();
+ }
+ instant(name, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ if (developer._isProduct) {
+ return;
+ }
+ if (!(typeof name == 'string')) {
+ dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
+ }
+ let instantArguments = null;
+ if (core.Map.is(arguments$)) {
+ instantArguments = core.Map.from(arguments$);
+ }
+ developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'n', 'Dart', name, developer._argumentsAsJson(instantArguments));
+ }
+ finish() {
+ if (developer._isProduct) {
+ return;
+ }
+ if (this[_stack][dartx.length] == 0) {
+ dart.throw(new core.StateError('Uneven calls to start and finish'));
+ }
+ let block = this[_stack][dartx.removeLast]();
+ block[_finish]();
+ }
+ pass() {
+ if (dart.notNull(this[_stack][dartx.length]) > 0) {
+ dart.throw(new core.StateError('You cannot pass a TimelineTask without finishing all started ' + 'operations'));
+ }
+ let r = this[_taskId];
+ return r;
+ }
+ };
+ dart.defineNamedConstructor(developer.TimelineTask, 'withTaskId');
+ dart.setSignature(developer.TimelineTask, {
+ constructors: () => ({
+ new: dart.definiteFunctionType(developer.TimelineTask, []),
+ withTaskId: dart.definiteFunctionType(developer.TimelineTask, [core.int])
+ }),
+ fields: () => ({
+ [_taskId]: core.int,
+ [_stack]: ListOf_AsyncBlock()
+ }),
+ methods: () => ({
+ start: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
+ instant: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
+ finish: dart.definiteFunctionType(dart.void, []),
+ pass: dart.definiteFunctionType(core.int, [])
+ })
+ });
+ const _arguments$ = Symbol('_arguments');
+ developer._AsyncBlock = class _AsyncBlock extends core.Object {
+ _(name, taskId) {
+ this.name = name;
+ this[_taskId] = taskId;
+ this.category = 'Dart';
+ this[_arguments$] = null;
+ }
+ [_start$1]() {
+ developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'b', this.category, this.name, developer._argumentsAsJson(this[_arguments$]));
+ }
+ [_finish]() {
+ developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'e', this.category, this.name, developer._argumentsAsJson(null));
+ }
+ [_appendArguments](arguments$) {
+ if (this[_arguments$] == null) {
+ this[_arguments$] = dart.map();
+ }
+ this[_arguments$][dartx.addAll](arguments$);
+ }
+ };
+ dart.defineNamedConstructor(developer._AsyncBlock, '_');
+ dart.setSignature(developer._AsyncBlock, {
+ constructors: () => ({_: dart.definiteFunctionType(developer._AsyncBlock, [core.String, core.int])}),
+ fields: () => ({
+ category: core.String,
+ name: core.String,
+ [_taskId]: core.int,
+ [_arguments$]: core.Map
+ }),
+ methods: () => ({
+ [_start$1]: dart.definiteFunctionType(dart.void, []),
+ [_finish]: dart.definiteFunctionType(dart.void, []),
+ [_appendArguments]: dart.definiteFunctionType(dart.void, [core.Map])
+ })
+ });
+ const _startCpu = Symbol('_startCpu');
+ developer._SyncBlock = class _SyncBlock extends core.Object {
+ _(name, start, startCpu) {
+ this.name = name;
+ this[_start$1] = start;
+ this[_startCpu] = startCpu;
+ this.category = 'Dart';
+ this[_arguments$] = null;
+ }
+ finish() {
+ developer._reportCompleteEvent(this[_start$1], this[_startCpu], this.category, this.name, developer._argumentsAsJson(this[_arguments$]));
+ }
+ [_appendArguments](arguments$) {
+ if (arguments$ == null) {
+ return;
+ }
+ if (this[_arguments$] == null) {
+ this[_arguments$] = dart.map();
+ }
+ this[_arguments$][dartx.addAll](arguments$);
+ }
+ };
+ dart.defineNamedConstructor(developer._SyncBlock, '_');
+ dart.setSignature(developer._SyncBlock, {
+ constructors: () => ({_: dart.definiteFunctionType(developer._SyncBlock, [core.String, core.int, core.int])}),
+ fields: () => ({
+ category: core.String,
+ name: core.String,
+ [_arguments$]: core.Map,
+ [_start$1]: core.int,
+ [_startCpu]: core.int
+ }),
+ methods: () => ({
+ finish: dart.definiteFunctionType(dart.void, []),
+ [_appendArguments]: dart.definiteFunctionType(dart.void, [core.Map])
+ })
+ });
+ developer._fastPathArguments = null;
+ developer._argumentsAsJson = function(arguments$) {
+ if (arguments$ == null || arguments$[dartx.length] == 0) {
+ if (developer._fastPathArguments == null) {
+ developer._fastPathArguments = dart.str`{"isolateNumber":"${developer.Timeline._isolateId}"}`;
+ }
+ return developer._fastPathArguments;
+ }
+ arguments$[dartx._set]('isolateNumber', developer.Timeline._isolateIdString);
+ return convert.JSON.encode(arguments$);
+ };
+ dart.fn(developer._argumentsAsJson, MapToString());
+ developer._isDartStreamEnabled = function() {
+ return false;
+ };
+ dart.fn(developer._isDartStreamEnabled, VoidTobool());
+ developer._getNextAsyncId = function() {
+ return 0;
+ };
+ dart.fn(developer._getNextAsyncId, VoidToint());
+ developer._getTraceClock = function() {
+ let x = developer._clockValue;
+ developer._clockValue = dart.notNull(x) + 1;
+ return x;
+ };
+ dart.fn(developer._getTraceClock, VoidToint());
+ developer._getThreadCpuClock = function() {
+ return -1;
+ };
+ dart.fn(developer._getThreadCpuClock, VoidToint());
+ developer._getIsolateNum = function() {
+ return 0;
+ };
+ dart.fn(developer._getIsolateNum, VoidToint());
+ developer._reportTaskEvent = function(start, taskId, phase, category, name, argumentsAsJson) {
+ };
+ dart.fn(developer._reportTaskEvent, intAndintAndString__Tovoid());
+ developer._reportCompleteEvent = function(start, startCpu, category, name, argumentsAsJson) {
+ };
+ dart.fn(developer._reportCompleteEvent, intAndintAndString__Tovoid$());
+ developer._reportInstantEvent = function(start, category, name, argumentsAsJson) {
+ };
+ dart.fn(developer._reportInstantEvent, intAndStringAndString__Tovoid());
+ developer.ServiceProtocolInfo = class ServiceProtocolInfo extends core.Object {
+ new(serverUri) {
+ this.majorVersion = developer._getServiceMajorVersion();
+ this.minorVersion = developer._getServiceMinorVersion();
+ this.serverUri = serverUri;
+ }
+ toString() {
+ if (this.serverUri != null) {
+ return dart.str`Dart VM Service Protocol v${this.majorVersion}.${this.minorVersion} ` + dart.str`listening on ${this.serverUri}`;
+ } else {
+ return dart.str`Dart VM Service Protocol v${this.majorVersion}.${this.minorVersion}`;
+ }
+ }
+ };
+ dart.setSignature(developer.ServiceProtocolInfo, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.ServiceProtocolInfo, [core.Uri])}),
+ fields: () => ({
+ majorVersion: core.int,
+ minorVersion: core.int,
+ serverUri: core.Uri
+ })
+ });
+ developer.Service = class Service extends core.Object {
+ static getInfo() {
+ return dart.async(function*() {
+ let receivePort = isolate.RawReceivePort.new();
+ let uriCompleter = CompleterOfUri().new();
+ receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
+ developer._getServerInfo(receivePort.sendPort);
+ let uri = (yield uriCompleter.future);
+ receivePort.close();
+ return new developer.ServiceProtocolInfo(uri);
+ }, developer.ServiceProtocolInfo);
+ }
+ static controlWebServer(opts) {
+ return dart.async(function*(opts) {
+ let enable = opts && 'enable' in opts ? opts.enable : false;
+ if (!(typeof enable == 'boolean')) {
+ dart.throw(new core.ArgumentError.value(enable, 'enable', 'Must be a bool'));
+ }
+ let receivePort = isolate.RawReceivePort.new();
+ let uriCompleter = CompleterOfUri().new();
+ receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
+ developer._webServerControl(receivePort.sendPort, enable);
+ let uri = (yield uriCompleter.future);
+ receivePort.close();
+ return new developer.ServiceProtocolInfo(uri);
+ }, developer.ServiceProtocolInfo, opts);
+ }
+ };
+ dart.setSignature(developer.Service, {
+ statics: () => ({
+ getInfo: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), []),
+ controlWebServer: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), [], {enable: core.bool})
+ }),
+ names: ['getInfo', 'controlWebServer']
+ });
+ developer._getServerInfo = function(sp) {
+ sp.send(null);
+ };
+ dart.lazyFn(developer._getServerInfo, () => SendPortTovoid());
+ developer._webServerControl = function(sp, enable) {
+ sp.send(null);
+ };
+ dart.lazyFn(developer._webServerControl, () => SendPortAndboolTovoid());
+ developer._getServiceMajorVersion = function() {
+ return 0;
+ };
+ dart.fn(developer._getServiceMajorVersion, VoidToint());
+ developer._getServiceMinorVersion = function() {
+ return 0;
+ };
+ dart.fn(developer._getServiceMinorVersion, VoidToint());
isolate.IsolateSpawnException = class IsolateSpawnException extends core.Object {
new(message) {
this.message = message;
@@ -56881,19 +57708,19 @@
statics: () => ({createElement_tag: dart.definiteFunctionType(dart.dynamic, [core.String, core.String])}),
names: ['createElement_tag']
});
- const _value$0 = Symbol('_value');
+ const _value$1 = Symbol('_value');
html$.ScrollAlignment = class ScrollAlignment extends core.Object {
_internal(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
}
toString() {
- return dart.str`ScrollAlignment.${this[_value$0]}`;
+ return dart.str`ScrollAlignment.${this[_value$1]}`;
}
};
dart.defineNamedConstructor(html$.ScrollAlignment, '_internal');
dart.setSignature(html$.ScrollAlignment, {
constructors: () => ({_internal: dart.definiteFunctionType(html$.ScrollAlignment, [dart.dynamic])}),
- fields: () => ({[_value$0]: dart.dynamic}),
+ fields: () => ({[_value$1]: dart.dynamic}),
sfields: () => ({
TOP: html$.ScrollAlignment,
CENTER: html$.ScrollAlignment,
@@ -80154,43 +80981,43 @@
const _unit = Symbol('_unit');
html$.Dimension = class Dimension extends core.Object {
percent(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = '%';
}
px(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'px';
}
pc(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'pc';
}
pt(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'pt';
}
inch(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'in';
}
cm(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'cm';
}
mm(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'mm';
}
em(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'em';
}
ex(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'ex';
}
css(cssValue) {
- this[_value$0] = null;
+ this[_value$1] = null;
this[_unit] = null;
if (cssValue == '') cssValue = '0px';
if (dart.test(cssValue[dartx.endsWith]('%'))) {
@@ -80199,16 +81026,16 @@
this[_unit] = cssValue[dartx.substring](dart.notNull(cssValue[dartx.length]) - 2);
}
if (dart.test(cssValue[dartx.contains]('.'))) {
- this[_value$0] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
+ this[_value$1] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
} else {
- this[_value$0] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
+ this[_value$1] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
}
}
toString() {
- return dart.str`${this[_value$0]}${this[_unit]}`;
+ return dart.str`${this[_value$1]}${this[_unit]}`;
}
get value() {
- return this[_value$0];
+ return this[_value$1];
}
};
dart.defineNamedConstructor(html$.Dimension, 'percent');
@@ -80235,7 +81062,7 @@
css: dart.definiteFunctionType(html$.Dimension, [core.String])
}),
fields: () => ({
- [_value$0]: core.num,
+ [_value$1]: core.num,
[_unit]: core.String
}),
getters: () => ({value: dart.definiteFunctionType(core.num, [])})
@@ -94850,6 +95677,7 @@
collection: collection,
convert: convert,
core: core,
+ developer: developer,
isolate: isolate,
js: js,
js_util: js_util,
diff --git a/pkg/dev_compiler/lib/js/common/dart_sdk.js b/pkg/dev_compiler/lib/js/common/dart_sdk.js
index 2656bda..c053cc4 100644
--- a/pkg/dev_compiler/lib/js/common/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/common/dart_sdk.js
@@ -17,6 +17,7 @@
const collection = Object.create(null);
const convert = Object.create(null);
const core = Object.create(null);
+ const developer = Object.create(null);
const isolate = Object.create(null);
const js = Object.create(null);
const js_util = Object.create(null);
@@ -376,6 +377,12 @@
let MapOfString$String = () => (MapOfString$String = dart.constFn(core.Map$(core.String, core.String)))();
let IterableOfString = () => (IterableOfString = dart.constFn(core.Iterable$(core.String)))();
let MapOfString$dynamic = () => (MapOfString$dynamic = dart.constFn(core.Map$(core.String, dart.dynamic)))();
+ let MapOfString$ServiceExtensionHandler = () => (MapOfString$ServiceExtensionHandler = dart.constFn(core.Map$(core.String, developer.ServiceExtensionHandler)))();
+ let MapOfString$Metric = () => (MapOfString$Metric = dart.constFn(core.Map$(core.String, developer.Metric)))();
+ let ListOf_SyncBlock = () => (ListOf_SyncBlock = dart.constFn(core.List$(developer._SyncBlock)))();
+ let JSArrayOf_AsyncBlock = () => (JSArrayOf_AsyncBlock = dart.constFn(_interceptors.JSArray$(developer._AsyncBlock)))();
+ let ListOf_AsyncBlock = () => (ListOf_AsyncBlock = dart.constFn(core.List$(developer._AsyncBlock)))();
+ let CompleterOfUri = () => (CompleterOfUri = dart.constFn(async.Completer$(core.Uri)))();
let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate.Isolate)))();
let JsArray = () => (JsArray = dart.constFn(js.JsArray$()))();
let ExpandoOfFunction = () => (ExpandoOfFunction = dart.constFn(core.Expando$(core.Function)))();
@@ -616,11 +623,12 @@
let TypeToTypeMirror = () => (TypeToTypeMirror = dart.constFn(dart.definiteFunctionType(mirrors.TypeMirror, [core.Type])))();
let dynamicAndListTodynamic = () => (dynamicAndListTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.List])))();
let dynamicAndStringAndListTodynamic = () => (dynamicAndStringAndListTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String, core.List])))();
- let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
+ let SymbolTodynamic = () => (SymbolTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Symbol])))();
+ let dynamicToSymbol = () => (dynamicToSymbol = dart.constFn(dart.definiteFunctionType(core.Symbol, [dart.dynamic])))();
+ let dynamicToMapOfSymbol$dynamic = () => (dynamicToMapOfSymbol$dynamic = dart.constFn(dart.definiteFunctionType(MapOfSymbol$dynamic(), [dart.dynamic])))();
let TypeAndInvocationTodynamic = () => (TypeAndInvocationTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, core.Invocation])))();
let SymbolAnddynamicTovoid = () => (SymbolAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Symbol, dart.dynamic])))();
let MapOfSymbol$dynamicTodynamic = () => (MapOfSymbol$dynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [MapOfSymbol$dynamic()])))();
- let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
let dynamicToTypeMirror = () => (dynamicToTypeMirror = dart.constFn(dart.definiteFunctionType(mirrors.TypeMirror, [dart.dynamic])))();
let dynamicAnddynamicAnddynamicTovoid = () => (dynamicAnddynamicAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic, dart.dynamic])))();
let ListToList = () => (ListToList = dart.constFn(dart.definiteFunctionType(core.List, [core.List])))();
@@ -678,9 +686,24 @@
let ObjectToint = () => (ObjectToint = dart.constFn(dart.definiteFunctionType(core.int, [core.Object])))();
let ObjectTovoid = () => (ObjectTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Object])))();
let StringAndStringTovoid$ = () => (StringAndStringTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.String])))();
+ let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
let intAndintAndintTovoid = () => (intAndintAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.int])))();
let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
+ let __Tobool = () => (__Tobool = dart.constFn(dart.definiteFunctionType(core.bool, [], {when: core.bool, message: core.String})))();
+ let String__Tovoid$ = () => (String__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], {time: core.DateTime, sequenceNumber: core.int, level: core.int, name: core.String, zone: async.Zone, error: core.Object, stackTrace: core.StackTrace})))();
+ let StringAndServiceExtensionHandlerTovoid = () => (StringAndServiceExtensionHandlerTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, developer.ServiceExtensionHandler])))();
+ let StringAndMapTovoid = () => (StringAndMapTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.Map])))();
+ let StringToServiceExtensionHandler = () => (StringToServiceExtensionHandler = dart.constFn(dart.definiteFunctionType(developer.ServiceExtensionHandler, [core.String])))();
+ let StringAndServiceExtensionHandlerTodynamic = () => (StringAndServiceExtensionHandlerTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, developer.ServiceExtensionHandler])))();
+ let VoidToUserTag = () => (VoidToUserTag = dart.constFn(dart.definiteFunctionType(developer.UserTag, [])))();
+ let MapToString = () => (MapToString = dart.constFn(dart.definiteFunctionType(core.String, [core.Map])))();
+ let intAndintAndString__Tovoid = () => (intAndintAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String, core.String])))();
+ let intAndintAndString__Tovoid$ = () => (intAndintAndString__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String])))();
+ let intAndStringAndString__Tovoid = () => (intAndStringAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.String, core.String, core.String])))();
+ let UriTovoid = () => (UriTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Uri])))();
+ let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort])))();
+ let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort, core.bool])))();
let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate.Isolate, [core.List])))();
let dynamicTo_DartObject = () => (dynamicTo_DartObject = dart.constFn(dart.definiteFunctionType(js._DartObject, [dart.dynamic])))();
let dynamicToJsObject = () => (dynamicToJsObject = dart.constFn(dart.definiteFunctionType(js.JsObject, [dart.dynamic])))();
@@ -749,6 +772,7 @@
let NodeAndNodeTovoid = () => (NodeAndNodeTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Node, html$.Node])))();
let dynamicToImageData = () => (dynamicToImageData = dart.constFn(dart.definiteFunctionType(html$.ImageData, [dart.dynamic])))();
let ImageDataTodynamic = () => (ImageDataTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [html$.ImageData])))();
+ let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
let Map__Todynamic = () => (Map__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Map], [dynamicTovoid()])))();
let ListOfStringToList = () => (ListOfStringToList = dart.constFn(dart.definiteFunctionType(core.List, [ListOfString()])))();
let dynamicToDateTime = () => (dynamicToDateTime = dart.constFn(dart.definiteFunctionType(core.DateTime, [dart.dynamic])))();
@@ -780,10 +804,10 @@
return Mixin;
};
dart.getMixins = function(clazz) {
- return clazz[dart._mixins];
+ return Object.hasOwnProperty.call(clazz, dart._mixins) ? clazz[dart._mixins] : null;
};
dart.getImplements = function(clazz) {
- return clazz[dart.implements];
+ return Object.hasOwnProperty.call(clazz, dart.implements) ? clazz[dart.implements] : null;
};
dart.flattenFutures = function(builder) {
function flatten(T) {
@@ -8657,18 +8681,26 @@
});
_internal.Sort._INSERTION_SORT_THRESHOLD = 32;
const _name = Symbol('_name');
+ const _nativeSymbol = Symbol('_nativeSymbol');
_internal.Symbol = class Symbol extends core.Object {
new(name) {
this[_name] = name;
+ this[_nativeSymbol] = null;
+ }
+ es6(name, nativeSymbol) {
+ this[_name] = name;
+ this[_nativeSymbol] = nativeSymbol;
}
unvalidated(name) {
this[_name] = name;
+ this[_nativeSymbol] = null;
}
validated(name) {
this[_name] = _internal.Symbol.validatePublicSymbol(name);
+ this[_nativeSymbol] = null;
}
['=='](other) {
- return _internal.Symbol.is(other) && this[_name] == other[_name];
+ return _internal.Symbol.is(other) && this[_name] == other[_name] && dart.equals(this[_nativeSymbol], other[_nativeSymbol]);
}
get hashCode() {
let hash = this._hashCode;
@@ -8684,6 +8716,9 @@
static getName(symbol) {
return symbol[_name];
}
+ static getNativeSymbol(symbol) {
+ return symbol[_nativeSymbol];
+ }
static validatePublicSymbol(name) {
if (dart.test(name[dartx.isEmpty]) || dart.test(_internal.Symbol.publicSymbolPattern.hasMatch(name))) return name;
if (dart.test(name[dartx.startsWith]('_'))) {
@@ -8695,16 +8730,21 @@
return dart.test(name[dartx.isEmpty]) || dart.test(_internal.Symbol.symbolPattern.hasMatch(name));
}
};
+ dart.defineNamedConstructor(_internal.Symbol, 'es6');
dart.defineNamedConstructor(_internal.Symbol, 'unvalidated');
dart.defineNamedConstructor(_internal.Symbol, 'validated');
_internal.Symbol[dart.implements] = () => [core.Symbol];
dart.setSignature(_internal.Symbol, {
constructors: () => ({
new: dart.definiteFunctionType(_internal.Symbol, [core.String]),
+ es6: dart.definiteFunctionType(_internal.Symbol, [core.String, dart.dynamic]),
unvalidated: dart.definiteFunctionType(_internal.Symbol, [core.String]),
validated: dart.definiteFunctionType(_internal.Symbol, [core.String])
}),
- fields: () => ({[_name]: core.String}),
+ fields: () => ({
+ [_name]: core.String,
+ [_nativeSymbol]: dart.dynamic
+ }),
methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])}),
sfields: () => ({
reservedWordRE: core.String,
@@ -8716,10 +8756,11 @@
}),
statics: () => ({
getName: dart.definiteFunctionType(core.String, [_internal.Symbol]),
+ getNativeSymbol: dart.definiteFunctionType(dart.dynamic, [_internal.Symbol]),
validatePublicSymbol: dart.definiteFunctionType(core.String, [core.String]),
isValidSymbol: dart.definiteFunctionType(core.bool, [core.String])
}),
- names: ['getName', 'validatePublicSymbol', 'isValidSymbol']
+ names: ['getName', 'getNativeSymbol', 'validatePublicSymbol', 'isValidSymbol']
});
_internal.Symbol.reservedWordRE = '(?:assert|break|c(?:a(?:se|tch)|lass|on(?:st|tinue))|d(?:efault|o)|' + 'e(?:lse|num|xtends)|f(?:alse|inal(?:ly)?|or)|i[fns]|n(?:ew|ull)|' + 'ret(?:hrow|urn)|s(?:uper|witch)|t(?:h(?:is|row)|r(?:ue|y))|' + 'v(?:ar|oid)|w(?:hile|ith))';
_internal.Symbol.operatorRE = '(?:[\\-+*/%&|^]|\\[\\]=?|==|~/?|<[<=]?|>[>=]?|unary-)';
@@ -13230,73 +13271,109 @@
return _js_mirrors._dart.definiteFunctionType(type, []);
};
dart.fn(_js_mirrors._defaultConstructorType, dynamicTodynamic$());
+ _js_mirrors._getMixins = function(type) {
+ return _js_mirrors._dart.getMixins(type, []);
+ };
+ dart.fn(_js_mirrors._getMixins, dynamicTodynamic$());
_js_mirrors._Lazy$ = dart.generic(T => {
const _Lazy = dart.typedef('_Lazy', () => dart.functionType(T, []));
return _Lazy;
});
_js_mirrors._Lazy = _Lazy();
+ _js_mirrors._getESSymbol = function(symbol) {
+ return _internal.Symbol.getNativeSymbol(_internal.Symbol.as(symbol));
+ };
+ dart.lazyFn(_js_mirrors._getESSymbol, () => SymbolTodynamic());
+ _js_mirrors._getMember = function(symbol) {
+ let privateSymbol = _js_mirrors._getESSymbol(symbol);
+ if (privateSymbol != null) {
+ return privateSymbol;
+ }
+ return _js_mirrors.getName(symbol);
+ };
+ dart.lazyFn(_js_mirrors._getMember, () => SymbolTodynamic());
_js_mirrors._getNameForESSymbol = function(member) {
+ dart.assert(typeof member == "symbol");
let str = dart.toString(member);
dart.assert(dart.test(str[dartx.startsWith]('Symbol(')) && dart.test(str[dartx.endsWith](')')));
return str[dartx.substring](7, dart.notNull(str[dartx.length]) - 1);
};
dart.lazyFn(_js_mirrors._getNameForESSymbol, () => dynamicToString());
+ _js_mirrors._getSymbolForESSymbol = function(member) {
+ let name = _js_mirrors._getNameForESSymbol(member);
+ return new _internal.Symbol.es6(name, member);
+ };
+ dart.lazyFn(_js_mirrors._getSymbolForESSymbol, () => dynamicToSymbol());
+ _js_mirrors._getSymbolForMember = function(member) {
+ if (typeof member == 'string') {
+ return core.Symbol.new(member);
+ } else {
+ let name = _js_mirrors._getNameForESSymbol(member);
+ return new _internal.Symbol.es6(name, member);
+ }
+ };
+ dart.lazyFn(_js_mirrors._getSymbolForMember, () => dynamicToSymbol());
_js_mirrors._toDartMap = function(data) {
- if (data == null) return dart.map();
- let map = _js_mirrors._dart.map(data);
+ if (data == null) return dart.map({}, core.Symbol, dart.dynamic);
+ let map = MapOfSymbol$dynamic().new();
+ let publicMembers = Object.getOwnPropertyNames(data);
+ for (let member of core.Iterable._check(publicMembers)) {
+ let symbol = core.Symbol.new(core.String._check(member));
+ map[dartx._set](symbol, data[member]);
+ }
let privateMembers = Object.getOwnPropertySymbols(data);
for (let member of core.Iterable._check(privateMembers)) {
- let name = _js_mirrors._getNameForESSymbol(member);
- map[dartx._set](name, data[member]);
+ let symbol = _js_mirrors._getSymbolForESSymbol(member);
+ map[dartx._set](symbol, data[member]);
}
return map;
};
- dart.lazyFn(_js_mirrors._toDartMap, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._toDartMap, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getConstructors = function(obj) {
let sig = _js_mirrors._dart.getConstructorSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getConstructors, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getConstructors, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getFields = function(obj) {
let sig = _js_mirrors._dart.getFieldSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getFields, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getFields, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getMethods = function(obj) {
let sig = _js_mirrors._dart.getMethodSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getMethods, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getMethods, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getGetters = function(obj) {
let sig = _js_mirrors._dart.getGetterSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getGetters, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getGetters, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getSetters = function(obj) {
let sig = _js_mirrors._dart.getSetterSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getSetters, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getSetters, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getStaticFields = function(obj) {
let sig = _js_mirrors._dart.getStaticFieldSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getStaticFields, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getStaticFields, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getStatics = function(obj) {
let sig = _js_mirrors._dart.getStaticSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getStatics, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getStatics, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getStaticGetters = function(obj) {
let sig = _js_mirrors._dart.getStaticGetterSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getStaticGetters, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getStaticGetters, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getStaticSetters = function(obj) {
let sig = _js_mirrors._dart.getStaticSetterSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getStaticSetters, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getStaticSetters, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._unwrap = function(obj) {
return _js_mirrors._dart.unwrapType(obj);
};
@@ -13435,15 +13512,7 @@
[_getAccessor](reflectee, symbol, args, namedArgs) {
if (args === void 0) args = null;
if (namedArgs === void 0) namedArgs = null;
- let name = _js_mirrors.getName(symbol);
- if (!dart.test(name[dartx.startsWith]('_'))) return name;
- let privateMembers = Object.getOwnPropertySymbols(reflectee);
- dart.dsend(privateMembers, 'addAll', Object.getOwnPropertySymbols(reflectee.__proto__));
- for (let member of core.Iterable._check(privateMembers)) {
- let privateName = _js_mirrors._getNameForESSymbol(member);
- if (name == privateName) return member;
- }
- return new core.NoSuchMethodError(reflectee, symbol, args, namedArgs);
+ return _js_mirrors._getMember(symbol);
}
getField(symbol) {
let name = this[_getAccessor](this.reflectee, symbol);
@@ -13520,6 +13589,7 @@
let const$0;
const _declarations = Symbol('_declarations');
const _raw = Symbol('_raw');
+ const _mixin = Symbol('_mixin');
const _typeArguments = Symbol('_typeArguments');
let const$1;
_js_mirrors.JsClassMirror = class JsClassMirror extends _js_mirrors.JsMirror {
@@ -13536,67 +13606,66 @@
this[_declarations] = MapOfSymbol$DeclarationMirror().new();
let unwrapped = _js_mirrors._unwrap(this[_cls]);
let constructors = _js_mirrors._getConstructors(unwrapped);
- constructors[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, name, ft));
- }, StringAnddynamicTovoid()));
+ constructors[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
if (dart.test(constructors[dartx.isEmpty])) {
let name = 'new';
let ft = _js_mirrors._defaultConstructorType(_js_mirrors._unwrap(this[_cls]));
let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, name, ft));
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, symbol, ft));
}
let fields = _js_mirrors._getFields(unwrapped);
- fields[dartx.forEach](dart.fn((name, t) => {
- let symbol = core.Symbol.new(name);
+ fields[dartx.forEach](dart.fn((symbol, t) => {
let metadata = [];
if (core.List.is(t)) {
metadata = core.List._check(dart.dsend(dart.dsend(t, 'skip', 1), 'toList'));
t = dart.dindex(t, 0);
}
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(name, core.Type._check(_js_mirrors._wrap(t)), metadata));
- }, StringAnddynamicTovoid()));
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(symbol, core.Type._check(_js_mirrors._wrap(t)), metadata));
+ }, SymbolAnddynamicTovoid()));
let methods = _js_mirrors._getMethods(unwrapped);
- methods[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ methods[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let getters = _js_mirrors._getGetters(unwrapped);
- getters[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ getters[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let setters = _js_mirrors._getSetters(unwrapped);
- setters[dartx.forEach](dart.fn((name, ft) => {
- name = dart.notNull(name) + '=';
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ setters[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = dart.notNull(_js_mirrors.getName(symbol)) + '=';
+ symbol = new _internal.Symbol.es6(name, _js_mirrors._getESSymbol(symbol));
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let staticFields = _js_mirrors._getStaticFields(unwrapped);
- staticFields[dartx.forEach](dart.fn((name, t) => {
- let symbol = core.Symbol.new(name);
+ staticFields[dartx.forEach](dart.fn((symbol, t) => {
+ let name = _js_mirrors.getName(symbol);
let metadata = [];
if (core.List.is(t)) {
metadata = core.List._check(dart.dsend(dart.dsend(t, 'skip', 1), 'toList'));
t = dart.dindex(t, 0);
}
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(name, core.Type._check(_js_mirrors._wrap(t)), metadata));
- }, StringAnddynamicTovoid()));
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(symbol, core.Type._check(_js_mirrors._wrap(t)), metadata));
+ }, SymbolAnddynamicTovoid()));
let statics = _js_mirrors._getStatics(unwrapped);
- statics[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ statics[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let staticGetters = _js_mirrors._getStaticGetters(unwrapped);
- staticGetters[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ staticGetters[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let staticSetters = _js_mirrors._getStaticSetters(unwrapped);
- staticSetters[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ staticSetters[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
this[_declarations] = MapOfSymbol$DeclarationMirror().unmodifiable(this[_declarations]);
}
return this[_declarations];
@@ -13605,7 +13674,7 @@
this[_cls] = cls;
this[_raw] = _js_mirrors._getGenericClass(_js_mirrors._unwrap(cls));
this.simpleName = core.Symbol.new(_js_mirrors._unwrap(cls).name);
- this.mixin = null;
+ this[_mixin] = null;
this[_typeArguments] = null;
this[_metadata$] = null;
this[_declarations] = null;
@@ -13676,6 +13745,21 @@
return mirrors.ClassMirror._check(_js_mirrors.reflectType(core.Type._check(_js_mirrors._wrap(_js_mirrors._unwrap(this[_cls]).__proto__))));
}
}
+ get mixin() {
+ if (this[_mixin] != null) {
+ return this[_mixin];
+ }
+ let mixins = _js_mirrors._getMixins(_js_mirrors._unwrap(this[_cls]));
+ if (mixins == null || dart.test(dart.dload(mixins, 'isEmpty'))) {
+ this[_mixin] = this;
+ return this[_mixin];
+ }
+ if (dart.test(dart.dsend(dart.dload(mixins, 'length'), '>', 1))) {
+ dart.throw(new core.UnsupportedError("ClassMirror.mixin not yet supported for " + dart.str`classes (${this[_cls]}) with multiple mixins`));
+ }
+ this[_mixin] = mirrors.ClassMirror._check(_js_mirrors.reflectType(core.Type._check(_js_mirrors._wrap(dart.dindex(mixins, 0)))));
+ return this[_mixin];
+ }
toString() {
return dart.str`ClassMirror on '${this[_cls]}'`;
}
@@ -13724,7 +13808,7 @@
[_cls]: core.Type,
simpleName: core.Symbol,
[_raw]: dart.dynamic,
- mixin: mirrors.ClassMirror,
+ [_mixin]: mirrors.ClassMirror,
[_typeArguments]: ListOfTypeMirror(),
[_metadata$]: ListOfInstanceMirror(),
[_declarations]: MapOfSymbol$DeclarationMirror()
@@ -13738,7 +13822,8 @@
isOriginalDeclaration: dart.definiteFunctionType(core.bool, []),
typeArguments: dart.definiteFunctionType(core.List$(mirrors.TypeMirror), []),
originalDeclaration: dart.definiteFunctionType(mirrors.TypeMirror, []),
- superclass: dart.definiteFunctionType(mirrors.ClassMirror, [])
+ superclass: dart.definiteFunctionType(mirrors.ClassMirror, []),
+ mixin: dart.definiteFunctionType(mirrors.ClassMirror, [])
}),
methods: () => ({
newInstance: dart.definiteFunctionType(mirrors.InstanceMirror, [core.Symbol, core.List], [MapOfSymbol$dynamic()]),
@@ -13747,13 +13832,15 @@
invoke: dart.definiteFunctionType(mirrors.InstanceMirror, [core.Symbol, core.List], [MapOfSymbol$dynamic()])
})
});
+ const _symbol = Symbol('_symbol');
const _name$ = Symbol('_name');
_js_mirrors.JsVariableMirror = class JsVariableMirror extends _js_mirrors.JsMirror {
get simpleName() {
- return core.Symbol.new(this[_name$]);
+ return this[_symbol];
}
- _(name, t, annotations) {
- this[_name$] = name;
+ _(symbol, t, annotations) {
+ this[_symbol] = symbol;
+ this[_name$] = _js_mirrors.getName(symbol);
this.type = _js_mirrors.reflectType(t);
this.metadata = ListOfInstanceMirror().unmodifiable(annotations[dartx.map](mirrors.InstanceMirror)(dart.fn(a => _js_mirrors.reflect(a), dynamicToInstanceMirror())));
this.isStatic = false;
@@ -13784,8 +13871,9 @@
dart.defineNamedConstructor(_js_mirrors.JsVariableMirror, '_');
_js_mirrors.JsVariableMirror[dart.implements] = () => [mirrors.VariableMirror];
dart.setSignature(_js_mirrors.JsVariableMirror, {
- constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsVariableMirror, [core.String, core.Type, core.List])}),
+ constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsVariableMirror, [core.Symbol, core.Type, core.List])}),
fields: () => ({
+ [_symbol]: core.Symbol,
[_name$]: core.String,
type: mirrors.TypeMirror,
metadata: ListOfInstanceMirror(),
@@ -13795,8 +13883,8 @@
getters: () => ({simpleName: dart.definiteFunctionType(core.Symbol, [])})
});
_js_mirrors.JsParameterMirror = class JsParameterMirror extends _js_mirrors.JsVariableMirror {
- _(name, t, annotations) {
- super._(name, t, annotations);
+ _(member, t, annotations) {
+ super._(member, t, annotations);
}
toString() {
return dart.str`ParameterMirror on '${this[_name$]}'`;
@@ -13835,7 +13923,7 @@
dart.defineNamedConstructor(_js_mirrors.JsParameterMirror, '_');
_js_mirrors.JsParameterMirror[dart.implements] = () => [mirrors.ParameterMirror];
dart.setSignature(_js_mirrors.JsParameterMirror, {
- constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsParameterMirror, [core.String, core.Type, core.List])})
+ constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsParameterMirror, [core.Symbol, core.Type, core.List])})
});
const _params = Symbol('_params');
const _createParameterMirrorList = Symbol('_createParameterMirrorList');
@@ -13850,10 +13938,11 @@
return this[_name$][dartx.startsWith]('_');
}
get simpleName() {
- return core.Symbol.new(this[_name$]);
+ return this[_symbol];
}
- _constructor(cls, name, ftype) {
- this[_name$] = name;
+ _constructor(cls, symbol, ftype) {
+ this[_symbol] = symbol;
+ this[_name$] = _js_mirrors.getName(symbol);
this.isConstructor = true;
this.isStatic = false;
this[_params] = null;
@@ -13861,8 +13950,9 @@
this.isFinal = false;
this[_createParameterMirrorList](ftype);
}
- _instanceMethod(cls, name, ftype) {
- this[_name$] = name;
+ _instanceMethod(cls, symbol, ftype) {
+ this[_symbol] = symbol;
+ this[_name$] = _js_mirrors.getName(symbol);
this.isConstructor = false;
this.isStatic = false;
this[_params] = null;
@@ -13870,8 +13960,9 @@
this.isFinal = false;
this[_createParameterMirrorList](ftype);
}
- _staticMethod(cls, name, ftype) {
- this[_name$] = name;
+ _staticMethod(cls, symbol, ftype) {
+ this[_symbol] = symbol;
+ this[_name$] = _js_mirrors.getName(symbol);
this.isConstructor = false;
this.isStatic = true;
this[_params] = null;
@@ -13880,7 +13971,7 @@
this[_createParameterMirrorList](ftype);
}
get constructorName() {
- return dart.test(this.isConstructor) ? core.Symbol.new(this[_name$]) : null;
+ return dart.test(this.isConstructor) ? this[_symbol] : null;
}
get parameters() {
return this[_params];
@@ -13909,13 +14000,13 @@
for (let i = 0; i < dart.notNull(args[dartx.length]); ++i) {
let type = args[dartx._get](i);
let metadata = dart.dindex(dart.dload(ftype, 'metadata'), i);
- let param = new _js_mirrors.JsParameterMirror._('', core.Type._check(_js_mirrors._wrap(type)), core.List._check(metadata));
+ let param = new _js_mirrors.JsParameterMirror._(core.Symbol.new(''), core.Type._check(_js_mirrors._wrap(type)), core.List._check(metadata));
params[dartx._set](i, param);
}
for (let i = 0; i < dart.notNull(opts[dartx.length]); ++i) {
let type = opts[dartx._get](i);
let metadata = dart.dindex(dart.dload(ftype, 'metadata'), dart.notNull(args[dartx.length]) + i);
- let param = new _js_mirrors.JsParameterMirror._('', core.Type._check(_js_mirrors._wrap(type)), core.List._check(metadata));
+ let param = new _js_mirrors.JsParameterMirror._(core.Symbol.new(''), core.Type._check(_js_mirrors._wrap(type)), core.List._check(metadata));
params[dartx._set](i + dart.notNull(args[dartx.length]), param);
}
this[_params] = ListOfParameterMirror().unmodifiable(params);
@@ -13975,11 +14066,12 @@
_js_mirrors.JsMethodMirror[dart.implements] = () => [mirrors.MethodMirror];
dart.setSignature(_js_mirrors.JsMethodMirror, {
constructors: () => ({
- _constructor: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.String, dart.dynamic]),
- _instanceMethod: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.String, dart.dynamic]),
- _staticMethod: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.String, dart.dynamic])
+ _constructor: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.Symbol, dart.dynamic]),
+ _instanceMethod: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.Symbol, dart.dynamic]),
+ _staticMethod: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.Symbol, dart.dynamic])
}),
fields: () => ({
+ [_symbol]: core.Symbol,
[_name$]: core.String,
[_params]: ListOfParameterMirror(),
[_metadata$]: ListOfInstanceMirror(),
@@ -36375,6 +36467,741 @@
core.UriData._noScheme = -1;
core.UriData._tokenCharTable = dart.constList([0, 0, 27858, 1023, 65534, 51199, 65535, 32767], core.int);
core.UriData._uricTable = core.Uri._queryCharTable;
+ developer.debugger = function(opts) {
+ let when = opts && 'when' in opts ? opts.when : true;
+ let message = opts && 'message' in opts ? opts.message : null;
+ if (dart.test(when)) {
+ debugger;
+ }
+ return when;
+ };
+ dart.fn(developer.debugger, __Tobool());
+ developer.inspect = function(object) {
+ return object;
+ };
+ dart.fn(developer.inspect, ObjectToObject());
+ developer.log = function(message, opts) {
+ let time = opts && 'time' in opts ? opts.time : null;
+ let sequenceNumber = opts && 'sequenceNumber' in opts ? opts.sequenceNumber : null;
+ let level = opts && 'level' in opts ? opts.level : 0;
+ let name = opts && 'name' in opts ? opts.name : '';
+ let zone = opts && 'zone' in opts ? opts.zone : null;
+ let error = opts && 'error' in opts ? opts.error : null;
+ let stackTrace = opts && 'stackTrace' in opts ? opts.stackTrace : null;
+ };
+ dart.fn(developer.log, String__Tovoid$());
+ dart.defineLazy(developer, {
+ get _extensions() {
+ return MapOfString$ServiceExtensionHandler().new();
+ }
+ });
+ developer._clockValue = 0;
+ const _result = Symbol('_result');
+ const _errorCode = Symbol('_errorCode');
+ const _errorDetail = Symbol('_errorDetail');
+ const _isError = Symbol('_isError');
+ const _toString = Symbol('_toString');
+ developer.ServiceExtensionResponse = class ServiceExtensionResponse extends core.Object {
+ result(result) {
+ this[_result] = result;
+ this[_errorCode] = null;
+ this[_errorDetail] = null;
+ if (!(typeof this[_result] == 'string')) {
+ dart.throw(new core.ArgumentError.value(this[_result], "result", "Must be a String"));
+ }
+ }
+ error(errorCode, errorDetail) {
+ this[_result] = null;
+ this[_errorCode] = errorCode;
+ this[_errorDetail] = errorDetail;
+ developer.ServiceExtensionResponse._validateErrorCode(this[_errorCode]);
+ if (!(typeof this[_errorDetail] == 'string')) {
+ dart.throw(new core.ArgumentError.value(this[_errorDetail], "errorDetail", "Must be a String"));
+ }
+ }
+ static _errorCodeMessage(errorCode) {
+ developer.ServiceExtensionResponse._validateErrorCode(errorCode);
+ if (errorCode == developer.ServiceExtensionResponse.kInvalidParams) {
+ return "Invalid params";
+ }
+ return "Server error";
+ }
+ static _validateErrorCode(errorCode) {
+ if (!(typeof errorCode == 'number')) {
+ dart.throw(new core.ArgumentError.value(errorCode, "errorCode", "Must be an int"));
+ }
+ if (errorCode == developer.ServiceExtensionResponse.invalidParams) {
+ return;
+ }
+ if (dart.notNull(errorCode) >= developer.ServiceExtensionResponse.extensionErrorMin && dart.notNull(errorCode) <= developer.ServiceExtensionResponse.extensionErrorMax) {
+ return;
+ }
+ dart.throw(new core.ArgumentError.value(errorCode, "errorCode", "Out of range"));
+ }
+ [_isError]() {
+ return this[_errorCode] != null && this[_errorDetail] != null;
+ }
+ [_toString]() {
+ if (this[_result] != null) {
+ return this[_result];
+ } else {
+ dart.assert(this[_errorCode] != null);
+ dart.assert(this[_errorDetail] != null);
+ return convert.JSON.encode(dart.map({code: this[_errorCode], message: developer.ServiceExtensionResponse._errorCodeMessage(this[_errorCode]), data: dart.map({details: this[_errorDetail]}, core.String, core.String)}, core.String, core.Object));
+ }
+ }
+ };
+ dart.defineNamedConstructor(developer.ServiceExtensionResponse, 'result');
+ dart.defineNamedConstructor(developer.ServiceExtensionResponse, 'error');
+ dart.setSignature(developer.ServiceExtensionResponse, {
+ constructors: () => ({
+ result: dart.definiteFunctionType(developer.ServiceExtensionResponse, [core.String]),
+ error: dart.definiteFunctionType(developer.ServiceExtensionResponse, [core.int, core.String])
+ }),
+ fields: () => ({
+ [_result]: core.String,
+ [_errorCode]: core.int,
+ [_errorDetail]: core.String
+ }),
+ methods: () => ({
+ [_isError]: dart.definiteFunctionType(core.bool, []),
+ [_toString]: dart.definiteFunctionType(core.String, [])
+ }),
+ sfields: () => ({
+ kInvalidParams: core.int,
+ kExtensionError: core.int,
+ kExtensionErrorMax: core.int,
+ kExtensionErrorMin: core.int,
+ invalidParams: core.int,
+ extensionError: core.int,
+ extensionErrorMax: core.int,
+ extensionErrorMin: core.int
+ }),
+ statics: () => ({
+ _errorCodeMessage: dart.definiteFunctionType(core.String, [core.int]),
+ _validateErrorCode: dart.definiteFunctionType(dart.dynamic, [core.int])
+ }),
+ names: ['_errorCodeMessage', '_validateErrorCode']
+ });
+ developer.ServiceExtensionResponse.invalidParams = -32602;
+ developer.ServiceExtensionResponse.extensionError = -32000;
+ developer.ServiceExtensionResponse.extensionErrorMax = -32000;
+ developer.ServiceExtensionResponse.extensionErrorMin = -32016;
+ dart.defineLazy(developer.ServiceExtensionResponse, {
+ get kInvalidParams() {
+ return developer.ServiceExtensionResponse.invalidParams;
+ },
+ get kExtensionError() {
+ return developer.ServiceExtensionResponse.extensionError;
+ },
+ get kExtensionErrorMax() {
+ return developer.ServiceExtensionResponse.extensionErrorMax;
+ },
+ get kExtensionErrorMin() {
+ return developer.ServiceExtensionResponse.extensionErrorMin;
+ }
+ });
+ developer.ServiceExtensionHandler = dart.typedef('ServiceExtensionHandler', () => dart.functionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]));
+ developer.registerExtension = function(method, handler) {
+ if (!(typeof method == 'string')) {
+ dart.throw(new core.ArgumentError.value(method, 'method', 'Must be a String'));
+ }
+ if (!dart.test(method[dartx.startsWith]('ext.'))) {
+ dart.throw(new core.ArgumentError.value(method, 'method', 'Must begin with ext.'));
+ }
+ if (developer._lookupExtension(method) != null) {
+ dart.throw(new core.ArgumentError(dart.str`Extension already registered: ${method}`));
+ }
+ if (!developer.ServiceExtensionHandler.is(handler)) {
+ dart.throw(new core.ArgumentError.value(handler, 'handler', 'Must be a ServiceExtensionHandler'));
+ }
+ developer._registerExtension(method, handler);
+ };
+ dart.fn(developer.registerExtension, StringAndServiceExtensionHandlerTovoid());
+ developer.postEvent = function(eventKind, eventData) {
+ if (!(typeof eventKind == 'string')) {
+ dart.throw(new core.ArgumentError.value(eventKind, 'eventKind', 'Must be a String'));
+ }
+ if (!core.Map.is(eventData)) {
+ dart.throw(new core.ArgumentError.value(eventData, 'eventData', 'Must be a Map'));
+ }
+ let eventDataAsString = convert.JSON.encode(eventData);
+ developer._postEvent(eventKind, eventDataAsString);
+ };
+ dart.fn(developer.postEvent, StringAndMapTovoid());
+ developer._postEvent = function(eventKind, eventData) {
+ };
+ dart.fn(developer._postEvent, StringAndStringTodynamic());
+ developer._lookupExtension = function(method) {
+ return developer._extensions[dartx._get](method);
+ };
+ dart.fn(developer._lookupExtension, StringToServiceExtensionHandler());
+ developer._registerExtension = function(method, handler) {
+ developer._extensions[dartx._set](method, handler);
+ };
+ dart.fn(developer._registerExtension, StringAndServiceExtensionHandlerTodynamic());
+ developer.UserTag = class UserTag extends core.Object {
+ static new(label) {
+ return developer._FakeUserTag.new(label);
+ }
+ static get defaultTag() {
+ return developer._FakeUserTag._defaultTag;
+ }
+ };
+ dart.setSignature(developer.UserTag, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.UserTag, [core.String])}),
+ sfields: () => ({MAX_USER_TAGS: core.int}),
+ sgetters: () => ({defaultTag: dart.definiteFunctionType(developer.UserTag, [])})
+ });
+ developer.UserTag.MAX_USER_TAGS = 64;
+ developer._FakeUserTag = class _FakeUserTag extends core.Object {
+ real(label) {
+ this.label = label;
+ }
+ static new(label) {
+ let existingTag = developer._FakeUserTag._instances[dartx._get](label);
+ if (existingTag != null) {
+ return developer._FakeUserTag._check(existingTag);
+ }
+ if (developer._FakeUserTag._instances[dartx.length] == developer.UserTag.MAX_USER_TAGS) {
+ dart.throw(new core.UnsupportedError(dart.str`UserTag instance limit (${developer.UserTag.MAX_USER_TAGS}) reached.`));
+ }
+ let instance = new developer._FakeUserTag.real(label);
+ developer._FakeUserTag._instances[dartx._set](label, instance);
+ return instance;
+ }
+ makeCurrent() {
+ let old = developer._currentTag;
+ developer._currentTag = this;
+ return old;
+ }
+ };
+ dart.defineNamedConstructor(developer._FakeUserTag, 'real');
+ developer._FakeUserTag[dart.implements] = () => [developer.UserTag];
+ dart.setSignature(developer._FakeUserTag, {
+ constructors: () => ({
+ real: dart.definiteFunctionType(developer._FakeUserTag, [core.String]),
+ new: dart.definiteFunctionType(developer._FakeUserTag, [core.String])
+ }),
+ fields: () => ({label: core.String}),
+ methods: () => ({makeCurrent: dart.definiteFunctionType(developer.UserTag, [])}),
+ sfields: () => ({
+ _instances: core.Map,
+ _defaultTag: developer.UserTag
+ })
+ });
+ dart.defineLazy(developer._FakeUserTag, {
+ get _instances() {
+ return dart.map();
+ },
+ set _instances(_) {},
+ get _defaultTag() {
+ return developer._FakeUserTag.new('Default');
+ }
+ });
+ dart.defineLazy(developer, {
+ get _currentTag() {
+ return developer._FakeUserTag._defaultTag;
+ },
+ set _currentTag(_) {}
+ });
+ developer.getCurrentTag = function() {
+ return developer._currentTag;
+ };
+ dart.fn(developer.getCurrentTag, VoidToUserTag());
+ developer.Metric = class Metric extends core.Object {
+ new(name, description) {
+ this.name = name;
+ this.description = description;
+ if (this.name == 'vm' || dart.test(this.name[dartx.contains]('/'))) {
+ dart.throw(new core.ArgumentError('Invalid Metric name.'));
+ }
+ }
+ };
+ dart.setSignature(developer.Metric, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.Metric, [core.String, core.String])}),
+ fields: () => ({
+ name: core.String,
+ description: core.String
+ })
+ });
+ const _value$0 = Symbol('_value');
+ const _toJSON = Symbol('_toJSON');
+ developer.Gauge = class Gauge extends developer.Metric {
+ get value() {
+ return this[_value$0];
+ }
+ set value(v) {
+ if (dart.notNull(v) < dart.notNull(this.min)) {
+ v = this.min;
+ } else if (dart.notNull(v) > dart.notNull(this.max)) {
+ v = this.max;
+ }
+ this[_value$0] = v;
+ }
+ new(name, description, min, max) {
+ this.min = min;
+ this.max = max;
+ this[_value$0] = null;
+ super.new(name, description);
+ if (!(typeof this.min == 'number')) {
+ dart.throw(new core.ArgumentError('min must be a double'));
+ }
+ if (!(typeof this.max == 'number')) {
+ dart.throw(new core.ArgumentError('max must be a double'));
+ }
+ if (!(dart.notNull(this.min) < dart.notNull(this.max))) {
+ dart.throw(new core.ArgumentError('min must be less than max'));
+ }
+ this[_value$0] = this.min;
+ }
+ [_toJSON]() {
+ let map = dart.map({type: 'Gauge', id: dart.str`metrics/${this.name}`, name: this.name, description: this.description, value: this.value, min: this.min, max: this.max}, core.String, core.Object);
+ return map;
+ }
+ };
+ dart.setSignature(developer.Gauge, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.Gauge, [core.String, core.String, core.double, core.double])}),
+ fields: () => ({
+ min: core.double,
+ max: core.double,
+ [_value$0]: core.double
+ }),
+ getters: () => ({value: dart.definiteFunctionType(core.double, [])}),
+ setters: () => ({value: dart.definiteFunctionType(dart.void, [core.double])}),
+ methods: () => ({[_toJSON]: dart.definiteFunctionType(core.Map, [])})
+ });
+ developer.Counter = class Counter extends developer.Metric {
+ new(name, description) {
+ this[_value$0] = 0.0;
+ super.new(name, description);
+ }
+ get value() {
+ return this[_value$0];
+ }
+ set value(v) {
+ this[_value$0] = v;
+ }
+ [_toJSON]() {
+ let map = dart.map({type: 'Counter', id: dart.str`metrics/${this.name}`, name: this.name, description: this.description, value: this.value}, core.String, core.Object);
+ return map;
+ }
+ };
+ dart.setSignature(developer.Counter, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.Counter, [core.String, core.String])}),
+ fields: () => ({[_value$0]: core.double}),
+ getters: () => ({value: dart.definiteFunctionType(core.double, [])}),
+ setters: () => ({value: dart.definiteFunctionType(dart.void, [core.double])}),
+ methods: () => ({[_toJSON]: dart.definiteFunctionType(core.Map, [])})
+ });
+ developer.Metrics = class Metrics extends core.Object {
+ static register(metric) {
+ if (!developer.Metric.is(metric)) {
+ dart.throw(new core.ArgumentError('metric must be a Metric'));
+ }
+ if (developer.Metrics._metrics[dartx._get](metric.name) != null) {
+ dart.throw(new core.ArgumentError('Registered metrics have unique names'));
+ }
+ developer.Metrics._metrics[dartx._set](metric.name, metric);
+ }
+ static deregister(metric) {
+ if (!developer.Metric.is(metric)) {
+ dart.throw(new core.ArgumentError('metric must be a Metric'));
+ }
+ developer.Metrics._metrics[dartx.remove](metric.name);
+ }
+ static _printMetric(id) {
+ let metric = developer.Metrics._metrics[dartx._get](id);
+ if (metric == null) {
+ return null;
+ }
+ return convert.JSON.encode(metric[_toJSON]());
+ }
+ static _printMetrics() {
+ let metrics = [];
+ for (let metric of developer.Metrics._metrics[dartx.values]) {
+ metrics[dartx.add](metric[_toJSON]());
+ }
+ let map = dart.map({type: 'MetricList', metrics: metrics}, core.String, core.Object);
+ return convert.JSON.encode(map);
+ }
+ };
+ dart.setSignature(developer.Metrics, {
+ sfields: () => ({_metrics: MapOfString$Metric()}),
+ statics: () => ({
+ register: dart.definiteFunctionType(dart.void, [developer.Metric]),
+ deregister: dart.definiteFunctionType(dart.void, [developer.Metric]),
+ _printMetric: dart.definiteFunctionType(core.String, [core.String]),
+ _printMetrics: dart.definiteFunctionType(core.String, [])
+ }),
+ names: ['register', 'deregister', '_printMetric', '_printMetrics']
+ });
+ dart.defineLazy(developer.Metrics, {
+ get _metrics() {
+ return MapOfString$Metric().new();
+ }
+ });
+ developer._isProduct = false;
+ developer.TimelineSyncFunction = dart.typedef('TimelineSyncFunction', () => dart.functionType(dart.dynamic, []));
+ developer.TimelineAsyncFunction = dart.typedef('TimelineAsyncFunction', () => dart.functionType(async.Future, []));
+ const _appendArguments = Symbol('_appendArguments');
+ developer.Timeline = class Timeline extends core.Object {
+ static startSync(name, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ if (developer._isProduct) {
+ return;
+ }
+ if (!(typeof name == 'string')) {
+ dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
+ }
+ if (!dart.test(developer._isDartStreamEnabled())) {
+ developer.Timeline._stack[dartx.add](null);
+ return;
+ }
+ let block = new developer._SyncBlock._(name, developer._getTraceClock(), developer._getThreadCpuClock());
+ if (core.Map.is(arguments$)) {
+ block[_appendArguments](arguments$);
+ }
+ developer.Timeline._stack[dartx.add](block);
+ }
+ static finishSync() {
+ if (developer._isProduct) {
+ return;
+ }
+ if (developer.Timeline._stack[dartx.length] == 0) {
+ dart.throw(new core.StateError('Uneven calls to startSync and finishSync'));
+ }
+ let block = developer.Timeline._stack[dartx.removeLast]();
+ if (block == null) {
+ return;
+ }
+ block.finish();
+ }
+ static instantSync(name, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ if (developer._isProduct) {
+ return;
+ }
+ if (!(typeof name == 'string')) {
+ dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
+ }
+ if (!dart.test(developer._isDartStreamEnabled())) {
+ return;
+ }
+ let instantArguments = null;
+ if (core.Map.is(arguments$)) {
+ instantArguments = core.Map.from(arguments$);
+ }
+ developer._reportInstantEvent(developer._getTraceClock(), 'Dart', name, developer._argumentsAsJson(instantArguments));
+ }
+ static timeSync(name, func, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ developer.Timeline.startSync(name, {arguments: arguments$});
+ try {
+ return func();
+ } finally {
+ developer.Timeline.finishSync();
+ }
+ }
+ static get now() {
+ return developer._getTraceClock();
+ }
+ };
+ dart.setSignature(developer.Timeline, {
+ sfields: () => ({
+ _stack: ListOf_SyncBlock(),
+ _isolateId: core.int,
+ _isolateIdString: core.String
+ }),
+ sgetters: () => ({now: dart.definiteFunctionType(core.int, [])}),
+ statics: () => ({
+ startSync: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
+ finishSync: dart.definiteFunctionType(dart.void, []),
+ instantSync: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
+ timeSync: dart.definiteFunctionType(dart.dynamic, [core.String, developer.TimelineSyncFunction], {arguments: core.Map})
+ }),
+ names: ['startSync', 'finishSync', 'instantSync', 'timeSync']
+ });
+ dart.defineLazy(developer.Timeline, {
+ get _stack() {
+ return ListOf_SyncBlock().new();
+ },
+ get _isolateId() {
+ return developer._getIsolateNum();
+ },
+ get _isolateIdString() {
+ return dart.toString(developer.Timeline._isolateId);
+ }
+ });
+ const _stack = Symbol('_stack');
+ const _taskId = Symbol('_taskId');
+ const _start$1 = Symbol('_start');
+ const _finish = Symbol('_finish');
+ developer.TimelineTask = class TimelineTask extends core.Object {
+ new() {
+ this[_stack] = JSArrayOf_AsyncBlock().of([]);
+ this[_taskId] = developer._getNextAsyncId();
+ }
+ withTaskId(taskId) {
+ this[_stack] = JSArrayOf_AsyncBlock().of([]);
+ this[_taskId] = taskId;
+ if (!(typeof taskId == 'number')) {
+ dart.throw(new core.ArgumentError.value(taskId, 'taskId', 'Must be an int'));
+ }
+ }
+ start(name, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ if (developer._isProduct) {
+ return;
+ }
+ if (!(typeof name == 'string')) {
+ dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
+ }
+ let block = new developer._AsyncBlock._(name, this[_taskId]);
+ if (core.Map.is(arguments$)) {
+ block[_appendArguments](arguments$);
+ }
+ this[_stack][dartx.add](block);
+ block[_start$1]();
+ }
+ instant(name, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ if (developer._isProduct) {
+ return;
+ }
+ if (!(typeof name == 'string')) {
+ dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
+ }
+ let instantArguments = null;
+ if (core.Map.is(arguments$)) {
+ instantArguments = core.Map.from(arguments$);
+ }
+ developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'n', 'Dart', name, developer._argumentsAsJson(instantArguments));
+ }
+ finish() {
+ if (developer._isProduct) {
+ return;
+ }
+ if (this[_stack][dartx.length] == 0) {
+ dart.throw(new core.StateError('Uneven calls to start and finish'));
+ }
+ let block = this[_stack][dartx.removeLast]();
+ block[_finish]();
+ }
+ pass() {
+ if (dart.notNull(this[_stack][dartx.length]) > 0) {
+ dart.throw(new core.StateError('You cannot pass a TimelineTask without finishing all started ' + 'operations'));
+ }
+ let r = this[_taskId];
+ return r;
+ }
+ };
+ dart.defineNamedConstructor(developer.TimelineTask, 'withTaskId');
+ dart.setSignature(developer.TimelineTask, {
+ constructors: () => ({
+ new: dart.definiteFunctionType(developer.TimelineTask, []),
+ withTaskId: dart.definiteFunctionType(developer.TimelineTask, [core.int])
+ }),
+ fields: () => ({
+ [_taskId]: core.int,
+ [_stack]: ListOf_AsyncBlock()
+ }),
+ methods: () => ({
+ start: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
+ instant: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
+ finish: dart.definiteFunctionType(dart.void, []),
+ pass: dart.definiteFunctionType(core.int, [])
+ })
+ });
+ const _arguments$ = Symbol('_arguments');
+ developer._AsyncBlock = class _AsyncBlock extends core.Object {
+ _(name, taskId) {
+ this.name = name;
+ this[_taskId] = taskId;
+ this.category = 'Dart';
+ this[_arguments$] = null;
+ }
+ [_start$1]() {
+ developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'b', this.category, this.name, developer._argumentsAsJson(this[_arguments$]));
+ }
+ [_finish]() {
+ developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'e', this.category, this.name, developer._argumentsAsJson(null));
+ }
+ [_appendArguments](arguments$) {
+ if (this[_arguments$] == null) {
+ this[_arguments$] = dart.map();
+ }
+ this[_arguments$][dartx.addAll](arguments$);
+ }
+ };
+ dart.defineNamedConstructor(developer._AsyncBlock, '_');
+ dart.setSignature(developer._AsyncBlock, {
+ constructors: () => ({_: dart.definiteFunctionType(developer._AsyncBlock, [core.String, core.int])}),
+ fields: () => ({
+ category: core.String,
+ name: core.String,
+ [_taskId]: core.int,
+ [_arguments$]: core.Map
+ }),
+ methods: () => ({
+ [_start$1]: dart.definiteFunctionType(dart.void, []),
+ [_finish]: dart.definiteFunctionType(dart.void, []),
+ [_appendArguments]: dart.definiteFunctionType(dart.void, [core.Map])
+ })
+ });
+ const _startCpu = Symbol('_startCpu');
+ developer._SyncBlock = class _SyncBlock extends core.Object {
+ _(name, start, startCpu) {
+ this.name = name;
+ this[_start$1] = start;
+ this[_startCpu] = startCpu;
+ this.category = 'Dart';
+ this[_arguments$] = null;
+ }
+ finish() {
+ developer._reportCompleteEvent(this[_start$1], this[_startCpu], this.category, this.name, developer._argumentsAsJson(this[_arguments$]));
+ }
+ [_appendArguments](arguments$) {
+ if (arguments$ == null) {
+ return;
+ }
+ if (this[_arguments$] == null) {
+ this[_arguments$] = dart.map();
+ }
+ this[_arguments$][dartx.addAll](arguments$);
+ }
+ };
+ dart.defineNamedConstructor(developer._SyncBlock, '_');
+ dart.setSignature(developer._SyncBlock, {
+ constructors: () => ({_: dart.definiteFunctionType(developer._SyncBlock, [core.String, core.int, core.int])}),
+ fields: () => ({
+ category: core.String,
+ name: core.String,
+ [_arguments$]: core.Map,
+ [_start$1]: core.int,
+ [_startCpu]: core.int
+ }),
+ methods: () => ({
+ finish: dart.definiteFunctionType(dart.void, []),
+ [_appendArguments]: dart.definiteFunctionType(dart.void, [core.Map])
+ })
+ });
+ developer._fastPathArguments = null;
+ developer._argumentsAsJson = function(arguments$) {
+ if (arguments$ == null || arguments$[dartx.length] == 0) {
+ if (developer._fastPathArguments == null) {
+ developer._fastPathArguments = dart.str`{"isolateNumber":"${developer.Timeline._isolateId}"}`;
+ }
+ return developer._fastPathArguments;
+ }
+ arguments$[dartx._set]('isolateNumber', developer.Timeline._isolateIdString);
+ return convert.JSON.encode(arguments$);
+ };
+ dart.fn(developer._argumentsAsJson, MapToString());
+ developer._isDartStreamEnabled = function() {
+ return false;
+ };
+ dart.fn(developer._isDartStreamEnabled, VoidTobool());
+ developer._getNextAsyncId = function() {
+ return 0;
+ };
+ dart.fn(developer._getNextAsyncId, VoidToint());
+ developer._getTraceClock = function() {
+ let x = developer._clockValue;
+ developer._clockValue = dart.notNull(x) + 1;
+ return x;
+ };
+ dart.fn(developer._getTraceClock, VoidToint());
+ developer._getThreadCpuClock = function() {
+ return -1;
+ };
+ dart.fn(developer._getThreadCpuClock, VoidToint());
+ developer._getIsolateNum = function() {
+ return 0;
+ };
+ dart.fn(developer._getIsolateNum, VoidToint());
+ developer._reportTaskEvent = function(start, taskId, phase, category, name, argumentsAsJson) {
+ };
+ dart.fn(developer._reportTaskEvent, intAndintAndString__Tovoid());
+ developer._reportCompleteEvent = function(start, startCpu, category, name, argumentsAsJson) {
+ };
+ dart.fn(developer._reportCompleteEvent, intAndintAndString__Tovoid$());
+ developer._reportInstantEvent = function(start, category, name, argumentsAsJson) {
+ };
+ dart.fn(developer._reportInstantEvent, intAndStringAndString__Tovoid());
+ developer.ServiceProtocolInfo = class ServiceProtocolInfo extends core.Object {
+ new(serverUri) {
+ this.majorVersion = developer._getServiceMajorVersion();
+ this.minorVersion = developer._getServiceMinorVersion();
+ this.serverUri = serverUri;
+ }
+ toString() {
+ if (this.serverUri != null) {
+ return dart.str`Dart VM Service Protocol v${this.majorVersion}.${this.minorVersion} ` + dart.str`listening on ${this.serverUri}`;
+ } else {
+ return dart.str`Dart VM Service Protocol v${this.majorVersion}.${this.minorVersion}`;
+ }
+ }
+ };
+ dart.setSignature(developer.ServiceProtocolInfo, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.ServiceProtocolInfo, [core.Uri])}),
+ fields: () => ({
+ majorVersion: core.int,
+ minorVersion: core.int,
+ serverUri: core.Uri
+ })
+ });
+ developer.Service = class Service extends core.Object {
+ static getInfo() {
+ return dart.async(function*() {
+ let receivePort = isolate.RawReceivePort.new();
+ let uriCompleter = CompleterOfUri().new();
+ receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
+ developer._getServerInfo(receivePort.sendPort);
+ let uri = (yield uriCompleter.future);
+ receivePort.close();
+ return new developer.ServiceProtocolInfo(uri);
+ }, developer.ServiceProtocolInfo);
+ }
+ static controlWebServer(opts) {
+ return dart.async(function*(opts) {
+ let enable = opts && 'enable' in opts ? opts.enable : false;
+ if (!(typeof enable == 'boolean')) {
+ dart.throw(new core.ArgumentError.value(enable, 'enable', 'Must be a bool'));
+ }
+ let receivePort = isolate.RawReceivePort.new();
+ let uriCompleter = CompleterOfUri().new();
+ receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
+ developer._webServerControl(receivePort.sendPort, enable);
+ let uri = (yield uriCompleter.future);
+ receivePort.close();
+ return new developer.ServiceProtocolInfo(uri);
+ }, developer.ServiceProtocolInfo, opts);
+ }
+ };
+ dart.setSignature(developer.Service, {
+ statics: () => ({
+ getInfo: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), []),
+ controlWebServer: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), [], {enable: core.bool})
+ }),
+ names: ['getInfo', 'controlWebServer']
+ });
+ developer._getServerInfo = function(sp) {
+ sp.send(null);
+ };
+ dart.lazyFn(developer._getServerInfo, () => SendPortTovoid());
+ developer._webServerControl = function(sp, enable) {
+ sp.send(null);
+ };
+ dart.lazyFn(developer._webServerControl, () => SendPortAndboolTovoid());
+ developer._getServiceMajorVersion = function() {
+ return 0;
+ };
+ dart.fn(developer._getServiceMajorVersion, VoidToint());
+ developer._getServiceMinorVersion = function() {
+ return 0;
+ };
+ dart.fn(developer._getServiceMinorVersion, VoidToint());
isolate.IsolateSpawnException = class IsolateSpawnException extends core.Object {
new(message) {
this.message = message;
@@ -56881,19 +57708,19 @@
statics: () => ({createElement_tag: dart.definiteFunctionType(dart.dynamic, [core.String, core.String])}),
names: ['createElement_tag']
});
- const _value$0 = Symbol('_value');
+ const _value$1 = Symbol('_value');
html$.ScrollAlignment = class ScrollAlignment extends core.Object {
_internal(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
}
toString() {
- return dart.str`ScrollAlignment.${this[_value$0]}`;
+ return dart.str`ScrollAlignment.${this[_value$1]}`;
}
};
dart.defineNamedConstructor(html$.ScrollAlignment, '_internal');
dart.setSignature(html$.ScrollAlignment, {
constructors: () => ({_internal: dart.definiteFunctionType(html$.ScrollAlignment, [dart.dynamic])}),
- fields: () => ({[_value$0]: dart.dynamic}),
+ fields: () => ({[_value$1]: dart.dynamic}),
sfields: () => ({
TOP: html$.ScrollAlignment,
CENTER: html$.ScrollAlignment,
@@ -80154,43 +80981,43 @@
const _unit = Symbol('_unit');
html$.Dimension = class Dimension extends core.Object {
percent(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = '%';
}
px(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'px';
}
pc(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'pc';
}
pt(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'pt';
}
inch(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'in';
}
cm(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'cm';
}
mm(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'mm';
}
em(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'em';
}
ex(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'ex';
}
css(cssValue) {
- this[_value$0] = null;
+ this[_value$1] = null;
this[_unit] = null;
if (cssValue == '') cssValue = '0px';
if (dart.test(cssValue[dartx.endsWith]('%'))) {
@@ -80199,16 +81026,16 @@
this[_unit] = cssValue[dartx.substring](dart.notNull(cssValue[dartx.length]) - 2);
}
if (dart.test(cssValue[dartx.contains]('.'))) {
- this[_value$0] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
+ this[_value$1] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
} else {
- this[_value$0] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
+ this[_value$1] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
}
}
toString() {
- return dart.str`${this[_value$0]}${this[_unit]}`;
+ return dart.str`${this[_value$1]}${this[_unit]}`;
}
get value() {
- return this[_value$0];
+ return this[_value$1];
}
};
dart.defineNamedConstructor(html$.Dimension, 'percent');
@@ -80235,7 +81062,7 @@
css: dart.definiteFunctionType(html$.Dimension, [core.String])
}),
fields: () => ({
- [_value$0]: core.num,
+ [_value$1]: core.num,
[_unit]: core.String
}),
getters: () => ({value: dart.definiteFunctionType(core.num, [])})
@@ -94849,6 +95676,7 @@
exports.collection = collection;
exports.convert = convert;
exports.core = core;
+ exports.developer = developer;
exports.isolate = isolate;
exports.js = js;
exports.js_util = js_util;
diff --git a/pkg/dev_compiler/lib/js/es6/dart_sdk.js b/pkg/dev_compiler/lib/js/es6/dart_sdk.js
index 754189c..1092e10 100644
--- a/pkg/dev_compiler/lib/js/es6/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/es6/dart_sdk.js
@@ -15,6 +15,7 @@
export const collection = Object.create(null);
export const convert = Object.create(null);
export const core = Object.create(null);
+export const developer = Object.create(null);
export const isolate = Object.create(null);
export const js = Object.create(null);
export const js_util = Object.create(null);
@@ -374,6 +375,12 @@
let MapOfString$String = () => (MapOfString$String = dart.constFn(core.Map$(core.String, core.String)))();
let IterableOfString = () => (IterableOfString = dart.constFn(core.Iterable$(core.String)))();
let MapOfString$dynamic = () => (MapOfString$dynamic = dart.constFn(core.Map$(core.String, dart.dynamic)))();
+let MapOfString$ServiceExtensionHandler = () => (MapOfString$ServiceExtensionHandler = dart.constFn(core.Map$(core.String, developer.ServiceExtensionHandler)))();
+let MapOfString$Metric = () => (MapOfString$Metric = dart.constFn(core.Map$(core.String, developer.Metric)))();
+let ListOf_SyncBlock = () => (ListOf_SyncBlock = dart.constFn(core.List$(developer._SyncBlock)))();
+let JSArrayOf_AsyncBlock = () => (JSArrayOf_AsyncBlock = dart.constFn(_interceptors.JSArray$(developer._AsyncBlock)))();
+let ListOf_AsyncBlock = () => (ListOf_AsyncBlock = dart.constFn(core.List$(developer._AsyncBlock)))();
+let CompleterOfUri = () => (CompleterOfUri = dart.constFn(async.Completer$(core.Uri)))();
let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate.Isolate)))();
let JsArray = () => (JsArray = dart.constFn(js.JsArray$()))();
let ExpandoOfFunction = () => (ExpandoOfFunction = dart.constFn(core.Expando$(core.Function)))();
@@ -614,11 +621,12 @@
let TypeToTypeMirror = () => (TypeToTypeMirror = dart.constFn(dart.definiteFunctionType(mirrors.TypeMirror, [core.Type])))();
let dynamicAndListTodynamic = () => (dynamicAndListTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.List])))();
let dynamicAndStringAndListTodynamic = () => (dynamicAndStringAndListTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String, core.List])))();
-let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
+let SymbolTodynamic = () => (SymbolTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Symbol])))();
+let dynamicToSymbol = () => (dynamicToSymbol = dart.constFn(dart.definiteFunctionType(core.Symbol, [dart.dynamic])))();
+let dynamicToMapOfSymbol$dynamic = () => (dynamicToMapOfSymbol$dynamic = dart.constFn(dart.definiteFunctionType(MapOfSymbol$dynamic(), [dart.dynamic])))();
let TypeAndInvocationTodynamic = () => (TypeAndInvocationTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, core.Invocation])))();
let SymbolAnddynamicTovoid = () => (SymbolAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Symbol, dart.dynamic])))();
let MapOfSymbol$dynamicTodynamic = () => (MapOfSymbol$dynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [MapOfSymbol$dynamic()])))();
-let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
let dynamicToTypeMirror = () => (dynamicToTypeMirror = dart.constFn(dart.definiteFunctionType(mirrors.TypeMirror, [dart.dynamic])))();
let dynamicAnddynamicAnddynamicTovoid = () => (dynamicAnddynamicAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic, dart.dynamic])))();
let ListToList = () => (ListToList = dart.constFn(dart.definiteFunctionType(core.List, [core.List])))();
@@ -676,9 +684,24 @@
let ObjectToint = () => (ObjectToint = dart.constFn(dart.definiteFunctionType(core.int, [core.Object])))();
let ObjectTovoid = () => (ObjectTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Object])))();
let StringAndStringTovoid = () => (StringAndStringTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.String])))();
+let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
let intAndintAndintTovoid = () => (intAndintAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.int])))();
let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
+let __Tobool = () => (__Tobool = dart.constFn(dart.definiteFunctionType(core.bool, [], {when: core.bool, message: core.String})))();
+let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], {time: core.DateTime, sequenceNumber: core.int, level: core.int, name: core.String, zone: async.Zone, error: core.Object, stackTrace: core.StackTrace})))();
+let StringAndServiceExtensionHandlerTovoid = () => (StringAndServiceExtensionHandlerTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, developer.ServiceExtensionHandler])))();
+let StringAndMapTovoid = () => (StringAndMapTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.Map])))();
+let StringToServiceExtensionHandler = () => (StringToServiceExtensionHandler = dart.constFn(dart.definiteFunctionType(developer.ServiceExtensionHandler, [core.String])))();
+let StringAndServiceExtensionHandlerTodynamic = () => (StringAndServiceExtensionHandlerTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, developer.ServiceExtensionHandler])))();
+let VoidToUserTag = () => (VoidToUserTag = dart.constFn(dart.definiteFunctionType(developer.UserTag, [])))();
+let MapToString = () => (MapToString = dart.constFn(dart.definiteFunctionType(core.String, [core.Map])))();
+let intAndintAndString__Tovoid = () => (intAndintAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String, core.String])))();
+let intAndintAndString__Tovoid = () => (intAndintAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String])))();
+let intAndStringAndString__Tovoid = () => (intAndStringAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.String, core.String, core.String])))();
+let UriTovoid = () => (UriTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Uri])))();
+let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort])))();
+let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort, core.bool])))();
let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate.Isolate, [core.List])))();
let dynamicTo_DartObject = () => (dynamicTo_DartObject = dart.constFn(dart.definiteFunctionType(js._DartObject, [dart.dynamic])))();
let dynamicToJsObject = () => (dynamicToJsObject = dart.constFn(dart.definiteFunctionType(js.JsObject, [dart.dynamic])))();
@@ -747,6 +770,7 @@
let NodeAndNodeTovoid = () => (NodeAndNodeTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html.Node, html.Node])))();
let dynamicToImageData = () => (dynamicToImageData = dart.constFn(dart.definiteFunctionType(html.ImageData, [dart.dynamic])))();
let ImageDataTodynamic = () => (ImageDataTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [html.ImageData])))();
+let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
let Map__Todynamic = () => (Map__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Map], [dynamicTovoid()])))();
let ListOfStringToList = () => (ListOfStringToList = dart.constFn(dart.definiteFunctionType(core.List, [ListOfString()])))();
let dynamicToDateTime = () => (dynamicToDateTime = dart.constFn(dart.definiteFunctionType(core.DateTime, [dart.dynamic])))();
@@ -778,10 +802,10 @@
return Mixin;
};
dart.getMixins = function(clazz) {
- return clazz[dart._mixins];
+ return Object.hasOwnProperty.call(clazz, dart._mixins) ? clazz[dart._mixins] : null;
};
dart.getImplements = function(clazz) {
- return clazz[dart.implements];
+ return Object.hasOwnProperty.call(clazz, dart.implements) ? clazz[dart.implements] : null;
};
dart.flattenFutures = function(builder) {
function flatten(T) {
@@ -8655,18 +8679,26 @@
});
_internal.Sort._INSERTION_SORT_THRESHOLD = 32;
const _name = Symbol('_name');
+const _nativeSymbol = Symbol('_nativeSymbol');
_internal.Symbol = class Symbol extends core.Object {
new(name) {
this[_name] = name;
+ this[_nativeSymbol] = null;
+ }
+ es6(name, nativeSymbol) {
+ this[_name] = name;
+ this[_nativeSymbol] = nativeSymbol;
}
unvalidated(name) {
this[_name] = name;
+ this[_nativeSymbol] = null;
}
validated(name) {
this[_name] = _internal.Symbol.validatePublicSymbol(name);
+ this[_nativeSymbol] = null;
}
['=='](other) {
- return _internal.Symbol.is(other) && this[_name] == other[_name];
+ return _internal.Symbol.is(other) && this[_name] == other[_name] && dart.equals(this[_nativeSymbol], other[_nativeSymbol]);
}
get hashCode() {
let hash = this._hashCode;
@@ -8682,6 +8714,9 @@
static getName(symbol) {
return symbol[_name];
}
+ static getNativeSymbol(symbol) {
+ return symbol[_nativeSymbol];
+ }
static validatePublicSymbol(name) {
if (dart.test(name[dartx.isEmpty]) || dart.test(_internal.Symbol.publicSymbolPattern.hasMatch(name))) return name;
if (dart.test(name[dartx.startsWith]('_'))) {
@@ -8693,16 +8728,21 @@
return dart.test(name[dartx.isEmpty]) || dart.test(_internal.Symbol.symbolPattern.hasMatch(name));
}
};
+dart.defineNamedConstructor(_internal.Symbol, 'es6');
dart.defineNamedConstructor(_internal.Symbol, 'unvalidated');
dart.defineNamedConstructor(_internal.Symbol, 'validated');
_internal.Symbol[dart.implements] = () => [core.Symbol];
dart.setSignature(_internal.Symbol, {
constructors: () => ({
new: dart.definiteFunctionType(_internal.Symbol, [core.String]),
+ es6: dart.definiteFunctionType(_internal.Symbol, [core.String, dart.dynamic]),
unvalidated: dart.definiteFunctionType(_internal.Symbol, [core.String]),
validated: dart.definiteFunctionType(_internal.Symbol, [core.String])
}),
- fields: () => ({[_name]: core.String}),
+ fields: () => ({
+ [_name]: core.String,
+ [_nativeSymbol]: dart.dynamic
+ }),
methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])}),
sfields: () => ({
reservedWordRE: core.String,
@@ -8714,10 +8754,11 @@
}),
statics: () => ({
getName: dart.definiteFunctionType(core.String, [_internal.Symbol]),
+ getNativeSymbol: dart.definiteFunctionType(dart.dynamic, [_internal.Symbol]),
validatePublicSymbol: dart.definiteFunctionType(core.String, [core.String]),
isValidSymbol: dart.definiteFunctionType(core.bool, [core.String])
}),
- names: ['getName', 'validatePublicSymbol', 'isValidSymbol']
+ names: ['getName', 'getNativeSymbol', 'validatePublicSymbol', 'isValidSymbol']
});
_internal.Symbol.reservedWordRE = '(?:assert|break|c(?:a(?:se|tch)|lass|on(?:st|tinue))|d(?:efault|o)|' + 'e(?:lse|num|xtends)|f(?:alse|inal(?:ly)?|or)|i[fns]|n(?:ew|ull)|' + 'ret(?:hrow|urn)|s(?:uper|witch)|t(?:h(?:is|row)|r(?:ue|y))|' + 'v(?:ar|oid)|w(?:hile|ith))';
_internal.Symbol.operatorRE = '(?:[\\-+*/%&|^]|\\[\\]=?|==|~/?|<[<=]?|>[>=]?|unary-)';
@@ -13228,73 +13269,109 @@
return _js_mirrors._dart.definiteFunctionType(type, []);
};
dart.fn(_js_mirrors._defaultConstructorType, dynamicTodynamic());
+_js_mirrors._getMixins = function(type) {
+ return _js_mirrors._dart.getMixins(type, []);
+};
+dart.fn(_js_mirrors._getMixins, dynamicTodynamic());
_js_mirrors._Lazy$ = dart.generic(T => {
const _Lazy = dart.typedef('_Lazy', () => dart.functionType(T, []));
return _Lazy;
});
_js_mirrors._Lazy = _Lazy();
+_js_mirrors._getESSymbol = function(symbol) {
+ return _internal.Symbol.getNativeSymbol(_internal.Symbol.as(symbol));
+};
+dart.lazyFn(_js_mirrors._getESSymbol, () => SymbolTodynamic());
+_js_mirrors._getMember = function(symbol) {
+ let privateSymbol = _js_mirrors._getESSymbol(symbol);
+ if (privateSymbol != null) {
+ return privateSymbol;
+ }
+ return _js_mirrors.getName(symbol);
+};
+dart.lazyFn(_js_mirrors._getMember, () => SymbolTodynamic());
_js_mirrors._getNameForESSymbol = function(member) {
+ dart.assert(typeof member == "symbol");
let str = dart.toString(member);
dart.assert(dart.test(str[dartx.startsWith]('Symbol(')) && dart.test(str[dartx.endsWith](')')));
return str[dartx.substring](7, dart.notNull(str[dartx.length]) - 1);
};
dart.lazyFn(_js_mirrors._getNameForESSymbol, () => dynamicToString());
+_js_mirrors._getSymbolForESSymbol = function(member) {
+ let name = _js_mirrors._getNameForESSymbol(member);
+ return new _internal.Symbol.es6(name, member);
+};
+dart.lazyFn(_js_mirrors._getSymbolForESSymbol, () => dynamicToSymbol());
+_js_mirrors._getSymbolForMember = function(member) {
+ if (typeof member == 'string') {
+ return core.Symbol.new(member);
+ } else {
+ let name = _js_mirrors._getNameForESSymbol(member);
+ return new _internal.Symbol.es6(name, member);
+ }
+};
+dart.lazyFn(_js_mirrors._getSymbolForMember, () => dynamicToSymbol());
_js_mirrors._toDartMap = function(data) {
- if (data == null) return dart.map();
- let map = _js_mirrors._dart.map(data);
+ if (data == null) return dart.map({}, core.Symbol, dart.dynamic);
+ let map = MapOfSymbol$dynamic().new();
+ let publicMembers = Object.getOwnPropertyNames(data);
+ for (let member of core.Iterable._check(publicMembers)) {
+ let symbol = core.Symbol.new(core.String._check(member));
+ map[dartx._set](symbol, data[member]);
+ }
let privateMembers = Object.getOwnPropertySymbols(data);
for (let member of core.Iterable._check(privateMembers)) {
- let name = _js_mirrors._getNameForESSymbol(member);
- map[dartx._set](name, data[member]);
+ let symbol = _js_mirrors._getSymbolForESSymbol(member);
+ map[dartx._set](symbol, data[member]);
}
return map;
};
-dart.lazyFn(_js_mirrors._toDartMap, () => dynamicToMap());
+dart.lazyFn(_js_mirrors._toDartMap, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getConstructors = function(obj) {
let sig = _js_mirrors._dart.getConstructorSig(obj);
return _js_mirrors._toDartMap(sig);
};
-dart.lazyFn(_js_mirrors._getConstructors, () => dynamicToMap());
+dart.lazyFn(_js_mirrors._getConstructors, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getFields = function(obj) {
let sig = _js_mirrors._dart.getFieldSig(obj);
return _js_mirrors._toDartMap(sig);
};
-dart.lazyFn(_js_mirrors._getFields, () => dynamicToMap());
+dart.lazyFn(_js_mirrors._getFields, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getMethods = function(obj) {
let sig = _js_mirrors._dart.getMethodSig(obj);
return _js_mirrors._toDartMap(sig);
};
-dart.lazyFn(_js_mirrors._getMethods, () => dynamicToMap());
+dart.lazyFn(_js_mirrors._getMethods, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getGetters = function(obj) {
let sig = _js_mirrors._dart.getGetterSig(obj);
return _js_mirrors._toDartMap(sig);
};
-dart.lazyFn(_js_mirrors._getGetters, () => dynamicToMap());
+dart.lazyFn(_js_mirrors._getGetters, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getSetters = function(obj) {
let sig = _js_mirrors._dart.getSetterSig(obj);
return _js_mirrors._toDartMap(sig);
};
-dart.lazyFn(_js_mirrors._getSetters, () => dynamicToMap());
+dart.lazyFn(_js_mirrors._getSetters, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getStaticFields = function(obj) {
let sig = _js_mirrors._dart.getStaticFieldSig(obj);
return _js_mirrors._toDartMap(sig);
};
-dart.lazyFn(_js_mirrors._getStaticFields, () => dynamicToMap());
+dart.lazyFn(_js_mirrors._getStaticFields, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getStatics = function(obj) {
let sig = _js_mirrors._dart.getStaticSig(obj);
return _js_mirrors._toDartMap(sig);
};
-dart.lazyFn(_js_mirrors._getStatics, () => dynamicToMap());
+dart.lazyFn(_js_mirrors._getStatics, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getStaticGetters = function(obj) {
let sig = _js_mirrors._dart.getStaticGetterSig(obj);
return _js_mirrors._toDartMap(sig);
};
-dart.lazyFn(_js_mirrors._getStaticGetters, () => dynamicToMap());
+dart.lazyFn(_js_mirrors._getStaticGetters, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getStaticSetters = function(obj) {
let sig = _js_mirrors._dart.getStaticSetterSig(obj);
return _js_mirrors._toDartMap(sig);
};
-dart.lazyFn(_js_mirrors._getStaticSetters, () => dynamicToMap());
+dart.lazyFn(_js_mirrors._getStaticSetters, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._unwrap = function(obj) {
return _js_mirrors._dart.unwrapType(obj);
};
@@ -13433,15 +13510,7 @@
[_getAccessor](reflectee, symbol, args, namedArgs) {
if (args === void 0) args = null;
if (namedArgs === void 0) namedArgs = null;
- let name = _js_mirrors.getName(symbol);
- if (!dart.test(name[dartx.startsWith]('_'))) return name;
- let privateMembers = Object.getOwnPropertySymbols(reflectee);
- dart.dsend(privateMembers, 'addAll', Object.getOwnPropertySymbols(reflectee.__proto__));
- for (let member of core.Iterable._check(privateMembers)) {
- let privateName = _js_mirrors._getNameForESSymbol(member);
- if (name == privateName) return member;
- }
- return new core.NoSuchMethodError(reflectee, symbol, args, namedArgs);
+ return _js_mirrors._getMember(symbol);
}
getField(symbol) {
let name = this[_getAccessor](this.reflectee, symbol);
@@ -13518,6 +13587,7 @@
let const;
const _declarations = Symbol('_declarations');
const _raw = Symbol('_raw');
+const _mixin = Symbol('_mixin');
const _typeArguments = Symbol('_typeArguments');
let const;
_js_mirrors.JsClassMirror = class JsClassMirror extends _js_mirrors.JsMirror {
@@ -13534,67 +13604,66 @@
this[_declarations] = MapOfSymbol$DeclarationMirror().new();
let unwrapped = _js_mirrors._unwrap(this[_cls]);
let constructors = _js_mirrors._getConstructors(unwrapped);
- constructors[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, name, ft));
- }, StringAnddynamicTovoid()));
+ constructors[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
if (dart.test(constructors[dartx.isEmpty])) {
let name = 'new';
let ft = _js_mirrors._defaultConstructorType(_js_mirrors._unwrap(this[_cls]));
let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, name, ft));
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, symbol, ft));
}
let fields = _js_mirrors._getFields(unwrapped);
- fields[dartx.forEach](dart.fn((name, t) => {
- let symbol = core.Symbol.new(name);
+ fields[dartx.forEach](dart.fn((symbol, t) => {
let metadata = [];
if (core.List.is(t)) {
metadata = core.List._check(dart.dsend(dart.dsend(t, 'skip', 1), 'toList'));
t = dart.dindex(t, 0);
}
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(name, core.Type._check(_js_mirrors._wrap(t)), metadata));
- }, StringAnddynamicTovoid()));
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(symbol, core.Type._check(_js_mirrors._wrap(t)), metadata));
+ }, SymbolAnddynamicTovoid()));
let methods = _js_mirrors._getMethods(unwrapped);
- methods[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ methods[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let getters = _js_mirrors._getGetters(unwrapped);
- getters[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ getters[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let setters = _js_mirrors._getSetters(unwrapped);
- setters[dartx.forEach](dart.fn((name, ft) => {
- name = dart.notNull(name) + '=';
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ setters[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = dart.notNull(_js_mirrors.getName(symbol)) + '=';
+ symbol = new _internal.Symbol.es6(name, _js_mirrors._getESSymbol(symbol));
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let staticFields = _js_mirrors._getStaticFields(unwrapped);
- staticFields[dartx.forEach](dart.fn((name, t) => {
- let symbol = core.Symbol.new(name);
+ staticFields[dartx.forEach](dart.fn((symbol, t) => {
+ let name = _js_mirrors.getName(symbol);
let metadata = [];
if (core.List.is(t)) {
metadata = core.List._check(dart.dsend(dart.dsend(t, 'skip', 1), 'toList'));
t = dart.dindex(t, 0);
}
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(name, core.Type._check(_js_mirrors._wrap(t)), metadata));
- }, StringAnddynamicTovoid()));
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(symbol, core.Type._check(_js_mirrors._wrap(t)), metadata));
+ }, SymbolAnddynamicTovoid()));
let statics = _js_mirrors._getStatics(unwrapped);
- statics[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ statics[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let staticGetters = _js_mirrors._getStaticGetters(unwrapped);
- staticGetters[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ staticGetters[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let staticSetters = _js_mirrors._getStaticSetters(unwrapped);
- staticSetters[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ staticSetters[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
this[_declarations] = MapOfSymbol$DeclarationMirror().unmodifiable(this[_declarations]);
}
return this[_declarations];
@@ -13603,7 +13672,7 @@
this[_cls] = cls;
this[_raw] = _js_mirrors._getGenericClass(_js_mirrors._unwrap(cls));
this.simpleName = core.Symbol.new(_js_mirrors._unwrap(cls).name);
- this.mixin = null;
+ this[_mixin] = null;
this[_typeArguments] = null;
this[_metadata] = null;
this[_declarations] = null;
@@ -13674,6 +13743,21 @@
return mirrors.ClassMirror._check(_js_mirrors.reflectType(core.Type._check(_js_mirrors._wrap(_js_mirrors._unwrap(this[_cls]).__proto__))));
}
}
+ get mixin() {
+ if (this[_mixin] != null) {
+ return this[_mixin];
+ }
+ let mixins = _js_mirrors._getMixins(_js_mirrors._unwrap(this[_cls]));
+ if (mixins == null || dart.test(dart.dload(mixins, 'isEmpty'))) {
+ this[_mixin] = this;
+ return this[_mixin];
+ }
+ if (dart.test(dart.dsend(dart.dload(mixins, 'length'), '>', 1))) {
+ dart.throw(new core.UnsupportedError("ClassMirror.mixin not yet supported for " + dart.str`classes (${this[_cls]}) with multiple mixins`));
+ }
+ this[_mixin] = mirrors.ClassMirror._check(_js_mirrors.reflectType(core.Type._check(_js_mirrors._wrap(dart.dindex(mixins, 0)))));
+ return this[_mixin];
+ }
toString() {
return dart.str`ClassMirror on '${this[_cls]}'`;
}
@@ -13722,7 +13806,7 @@
[_cls]: core.Type,
simpleName: core.Symbol,
[_raw]: dart.dynamic,
- mixin: mirrors.ClassMirror,
+ [_mixin]: mirrors.ClassMirror,
[_typeArguments]: ListOfTypeMirror(),
[_metadata]: ListOfInstanceMirror(),
[_declarations]: MapOfSymbol$DeclarationMirror()
@@ -13736,7 +13820,8 @@
isOriginalDeclaration: dart.definiteFunctionType(core.bool, []),
typeArguments: dart.definiteFunctionType(core.List$(mirrors.TypeMirror), []),
originalDeclaration: dart.definiteFunctionType(mirrors.TypeMirror, []),
- superclass: dart.definiteFunctionType(mirrors.ClassMirror, [])
+ superclass: dart.definiteFunctionType(mirrors.ClassMirror, []),
+ mixin: dart.definiteFunctionType(mirrors.ClassMirror, [])
}),
methods: () => ({
newInstance: dart.definiteFunctionType(mirrors.InstanceMirror, [core.Symbol, core.List], [MapOfSymbol$dynamic()]),
@@ -13745,13 +13830,15 @@
invoke: dart.definiteFunctionType(mirrors.InstanceMirror, [core.Symbol, core.List], [MapOfSymbol$dynamic()])
})
});
+const _symbol = Symbol('_symbol');
const _name = Symbol('_name');
_js_mirrors.JsVariableMirror = class JsVariableMirror extends _js_mirrors.JsMirror {
get simpleName() {
- return core.Symbol.new(this[_name]);
+ return this[_symbol];
}
- _(name, t, annotations) {
- this[_name] = name;
+ _(symbol, t, annotations) {
+ this[_symbol] = symbol;
+ this[_name] = _js_mirrors.getName(symbol);
this.type = _js_mirrors.reflectType(t);
this.metadata = ListOfInstanceMirror().unmodifiable(annotations[dartx.map](mirrors.InstanceMirror)(dart.fn(a => _js_mirrors.reflect(a), dynamicToInstanceMirror())));
this.isStatic = false;
@@ -13782,8 +13869,9 @@
dart.defineNamedConstructor(_js_mirrors.JsVariableMirror, '_');
_js_mirrors.JsVariableMirror[dart.implements] = () => [mirrors.VariableMirror];
dart.setSignature(_js_mirrors.JsVariableMirror, {
- constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsVariableMirror, [core.String, core.Type, core.List])}),
+ constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsVariableMirror, [core.Symbol, core.Type, core.List])}),
fields: () => ({
+ [_symbol]: core.Symbol,
[_name]: core.String,
type: mirrors.TypeMirror,
metadata: ListOfInstanceMirror(),
@@ -13793,8 +13881,8 @@
getters: () => ({simpleName: dart.definiteFunctionType(core.Symbol, [])})
});
_js_mirrors.JsParameterMirror = class JsParameterMirror extends _js_mirrors.JsVariableMirror {
- _(name, t, annotations) {
- super._(name, t, annotations);
+ _(member, t, annotations) {
+ super._(member, t, annotations);
}
toString() {
return dart.str`ParameterMirror on '${this[_name]}'`;
@@ -13833,7 +13921,7 @@
dart.defineNamedConstructor(_js_mirrors.JsParameterMirror, '_');
_js_mirrors.JsParameterMirror[dart.implements] = () => [mirrors.ParameterMirror];
dart.setSignature(_js_mirrors.JsParameterMirror, {
- constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsParameterMirror, [core.String, core.Type, core.List])})
+ constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsParameterMirror, [core.Symbol, core.Type, core.List])})
});
const _params = Symbol('_params');
const _createParameterMirrorList = Symbol('_createParameterMirrorList');
@@ -13848,10 +13936,11 @@
return this[_name][dartx.startsWith]('_');
}
get simpleName() {
- return core.Symbol.new(this[_name]);
+ return this[_symbol];
}
- _constructor(cls, name, ftype) {
- this[_name] = name;
+ _constructor(cls, symbol, ftype) {
+ this[_symbol] = symbol;
+ this[_name] = _js_mirrors.getName(symbol);
this.isConstructor = true;
this.isStatic = false;
this[_params] = null;
@@ -13859,8 +13948,9 @@
this.isFinal = false;
this[_createParameterMirrorList](ftype);
}
- _instanceMethod(cls, name, ftype) {
- this[_name] = name;
+ _instanceMethod(cls, symbol, ftype) {
+ this[_symbol] = symbol;
+ this[_name] = _js_mirrors.getName(symbol);
this.isConstructor = false;
this.isStatic = false;
this[_params] = null;
@@ -13868,8 +13958,9 @@
this.isFinal = false;
this[_createParameterMirrorList](ftype);
}
- _staticMethod(cls, name, ftype) {
- this[_name] = name;
+ _staticMethod(cls, symbol, ftype) {
+ this[_symbol] = symbol;
+ this[_name] = _js_mirrors.getName(symbol);
this.isConstructor = false;
this.isStatic = true;
this[_params] = null;
@@ -13878,7 +13969,7 @@
this[_createParameterMirrorList](ftype);
}
get constructorName() {
- return dart.test(this.isConstructor) ? core.Symbol.new(this[_name]) : null;
+ return dart.test(this.isConstructor) ? this[_symbol] : null;
}
get parameters() {
return this[_params];
@@ -13907,13 +13998,13 @@
for (let i = 0; i < dart.notNull(args[dartx.length]); ++i) {
let type = args[dartx._get](i);
let metadata = dart.dindex(dart.dload(ftype, 'metadata'), i);
- let param = new _js_mirrors.JsParameterMirror._('', core.Type._check(_js_mirrors._wrap(type)), core.List._check(metadata));
+ let param = new _js_mirrors.JsParameterMirror._(core.Symbol.new(''), core.Type._check(_js_mirrors._wrap(type)), core.List._check(metadata));
params[dartx._set](i, param);
}
for (let i = 0; i < dart.notNull(opts[dartx.length]); ++i) {
let type = opts[dartx._get](i);
let metadata = dart.dindex(dart.dload(ftype, 'metadata'), dart.notNull(args[dartx.length]) + i);
- let param = new _js_mirrors.JsParameterMirror._('', core.Type._check(_js_mirrors._wrap(type)), core.List._check(metadata));
+ let param = new _js_mirrors.JsParameterMirror._(core.Symbol.new(''), core.Type._check(_js_mirrors._wrap(type)), core.List._check(metadata));
params[dartx._set](i + dart.notNull(args[dartx.length]), param);
}
this[_params] = ListOfParameterMirror().unmodifiable(params);
@@ -13973,11 +14064,12 @@
_js_mirrors.JsMethodMirror[dart.implements] = () => [mirrors.MethodMirror];
dart.setSignature(_js_mirrors.JsMethodMirror, {
constructors: () => ({
- _constructor: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.String, dart.dynamic]),
- _instanceMethod: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.String, dart.dynamic]),
- _staticMethod: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.String, dart.dynamic])
+ _constructor: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.Symbol, dart.dynamic]),
+ _instanceMethod: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.Symbol, dart.dynamic]),
+ _staticMethod: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.Symbol, dart.dynamic])
}),
fields: () => ({
+ [_symbol]: core.Symbol,
[_name]: core.String,
[_params]: ListOfParameterMirror(),
[_metadata]: ListOfInstanceMirror(),
@@ -36373,6 +36465,741 @@
core.UriData._noScheme = -1;
core.UriData._tokenCharTable = dart.constList([0, 0, 27858, 1023, 65534, 51199, 65535, 32767], core.int);
core.UriData._uricTable = core.Uri._queryCharTable;
+developer.debugger = function(opts) {
+ let when = opts && 'when' in opts ? opts.when : true;
+ let message = opts && 'message' in opts ? opts.message : null;
+ if (dart.test(when)) {
+ debugger;
+ }
+ return when;
+};
+dart.fn(developer.debugger, __Tobool());
+developer.inspect = function(object) {
+ return object;
+};
+dart.fn(developer.inspect, ObjectToObject());
+developer.log = function(message, opts) {
+ let time = opts && 'time' in opts ? opts.time : null;
+ let sequenceNumber = opts && 'sequenceNumber' in opts ? opts.sequenceNumber : null;
+ let level = opts && 'level' in opts ? opts.level : 0;
+ let name = opts && 'name' in opts ? opts.name : '';
+ let zone = opts && 'zone' in opts ? opts.zone : null;
+ let error = opts && 'error' in opts ? opts.error : null;
+ let stackTrace = opts && 'stackTrace' in opts ? opts.stackTrace : null;
+};
+dart.fn(developer.log, String__Tovoid());
+dart.defineLazy(developer, {
+ get _extensions() {
+ return MapOfString$ServiceExtensionHandler().new();
+ }
+});
+developer._clockValue = 0;
+const _result = Symbol('_result');
+const _errorCode = Symbol('_errorCode');
+const _errorDetail = Symbol('_errorDetail');
+const _isError = Symbol('_isError');
+const _toString = Symbol('_toString');
+developer.ServiceExtensionResponse = class ServiceExtensionResponse extends core.Object {
+ result(result) {
+ this[_result] = result;
+ this[_errorCode] = null;
+ this[_errorDetail] = null;
+ if (!(typeof this[_result] == 'string')) {
+ dart.throw(new core.ArgumentError.value(this[_result], "result", "Must be a String"));
+ }
+ }
+ error(errorCode, errorDetail) {
+ this[_result] = null;
+ this[_errorCode] = errorCode;
+ this[_errorDetail] = errorDetail;
+ developer.ServiceExtensionResponse._validateErrorCode(this[_errorCode]);
+ if (!(typeof this[_errorDetail] == 'string')) {
+ dart.throw(new core.ArgumentError.value(this[_errorDetail], "errorDetail", "Must be a String"));
+ }
+ }
+ static _errorCodeMessage(errorCode) {
+ developer.ServiceExtensionResponse._validateErrorCode(errorCode);
+ if (errorCode == developer.ServiceExtensionResponse.kInvalidParams) {
+ return "Invalid params";
+ }
+ return "Server error";
+ }
+ static _validateErrorCode(errorCode) {
+ if (!(typeof errorCode == 'number')) {
+ dart.throw(new core.ArgumentError.value(errorCode, "errorCode", "Must be an int"));
+ }
+ if (errorCode == developer.ServiceExtensionResponse.invalidParams) {
+ return;
+ }
+ if (dart.notNull(errorCode) >= developer.ServiceExtensionResponse.extensionErrorMin && dart.notNull(errorCode) <= developer.ServiceExtensionResponse.extensionErrorMax) {
+ return;
+ }
+ dart.throw(new core.ArgumentError.value(errorCode, "errorCode", "Out of range"));
+ }
+ [_isError]() {
+ return this[_errorCode] != null && this[_errorDetail] != null;
+ }
+ [_toString]() {
+ if (this[_result] != null) {
+ return this[_result];
+ } else {
+ dart.assert(this[_errorCode] != null);
+ dart.assert(this[_errorDetail] != null);
+ return convert.JSON.encode(dart.map({code: this[_errorCode], message: developer.ServiceExtensionResponse._errorCodeMessage(this[_errorCode]), data: dart.map({details: this[_errorDetail]}, core.String, core.String)}, core.String, core.Object));
+ }
+ }
+};
+dart.defineNamedConstructor(developer.ServiceExtensionResponse, 'result');
+dart.defineNamedConstructor(developer.ServiceExtensionResponse, 'error');
+dart.setSignature(developer.ServiceExtensionResponse, {
+ constructors: () => ({
+ result: dart.definiteFunctionType(developer.ServiceExtensionResponse, [core.String]),
+ error: dart.definiteFunctionType(developer.ServiceExtensionResponse, [core.int, core.String])
+ }),
+ fields: () => ({
+ [_result]: core.String,
+ [_errorCode]: core.int,
+ [_errorDetail]: core.String
+ }),
+ methods: () => ({
+ [_isError]: dart.definiteFunctionType(core.bool, []),
+ [_toString]: dart.definiteFunctionType(core.String, [])
+ }),
+ sfields: () => ({
+ kInvalidParams: core.int,
+ kExtensionError: core.int,
+ kExtensionErrorMax: core.int,
+ kExtensionErrorMin: core.int,
+ invalidParams: core.int,
+ extensionError: core.int,
+ extensionErrorMax: core.int,
+ extensionErrorMin: core.int
+ }),
+ statics: () => ({
+ _errorCodeMessage: dart.definiteFunctionType(core.String, [core.int]),
+ _validateErrorCode: dart.definiteFunctionType(dart.dynamic, [core.int])
+ }),
+ names: ['_errorCodeMessage', '_validateErrorCode']
+});
+developer.ServiceExtensionResponse.invalidParams = -32602;
+developer.ServiceExtensionResponse.extensionError = -32000;
+developer.ServiceExtensionResponse.extensionErrorMax = -32000;
+developer.ServiceExtensionResponse.extensionErrorMin = -32016;
+dart.defineLazy(developer.ServiceExtensionResponse, {
+ get kInvalidParams() {
+ return developer.ServiceExtensionResponse.invalidParams;
+ },
+ get kExtensionError() {
+ return developer.ServiceExtensionResponse.extensionError;
+ },
+ get kExtensionErrorMax() {
+ return developer.ServiceExtensionResponse.extensionErrorMax;
+ },
+ get kExtensionErrorMin() {
+ return developer.ServiceExtensionResponse.extensionErrorMin;
+ }
+});
+developer.ServiceExtensionHandler = dart.typedef('ServiceExtensionHandler', () => dart.functionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]));
+developer.registerExtension = function(method, handler) {
+ if (!(typeof method == 'string')) {
+ dart.throw(new core.ArgumentError.value(method, 'method', 'Must be a String'));
+ }
+ if (!dart.test(method[dartx.startsWith]('ext.'))) {
+ dart.throw(new core.ArgumentError.value(method, 'method', 'Must begin with ext.'));
+ }
+ if (developer._lookupExtension(method) != null) {
+ dart.throw(new core.ArgumentError(dart.str`Extension already registered: ${method}`));
+ }
+ if (!developer.ServiceExtensionHandler.is(handler)) {
+ dart.throw(new core.ArgumentError.value(handler, 'handler', 'Must be a ServiceExtensionHandler'));
+ }
+ developer._registerExtension(method, handler);
+};
+dart.fn(developer.registerExtension, StringAndServiceExtensionHandlerTovoid());
+developer.postEvent = function(eventKind, eventData) {
+ if (!(typeof eventKind == 'string')) {
+ dart.throw(new core.ArgumentError.value(eventKind, 'eventKind', 'Must be a String'));
+ }
+ if (!core.Map.is(eventData)) {
+ dart.throw(new core.ArgumentError.value(eventData, 'eventData', 'Must be a Map'));
+ }
+ let eventDataAsString = convert.JSON.encode(eventData);
+ developer._postEvent(eventKind, eventDataAsString);
+};
+dart.fn(developer.postEvent, StringAndMapTovoid());
+developer._postEvent = function(eventKind, eventData) {
+};
+dart.fn(developer._postEvent, StringAndStringTodynamic());
+developer._lookupExtension = function(method) {
+ return developer._extensions[dartx._get](method);
+};
+dart.fn(developer._lookupExtension, StringToServiceExtensionHandler());
+developer._registerExtension = function(method, handler) {
+ developer._extensions[dartx._set](method, handler);
+};
+dart.fn(developer._registerExtension, StringAndServiceExtensionHandlerTodynamic());
+developer.UserTag = class UserTag extends core.Object {
+ static new(label) {
+ return developer._FakeUserTag.new(label);
+ }
+ static get defaultTag() {
+ return developer._FakeUserTag._defaultTag;
+ }
+};
+dart.setSignature(developer.UserTag, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.UserTag, [core.String])}),
+ sfields: () => ({MAX_USER_TAGS: core.int}),
+ sgetters: () => ({defaultTag: dart.definiteFunctionType(developer.UserTag, [])})
+});
+developer.UserTag.MAX_USER_TAGS = 64;
+developer._FakeUserTag = class _FakeUserTag extends core.Object {
+ real(label) {
+ this.label = label;
+ }
+ static new(label) {
+ let existingTag = developer._FakeUserTag._instances[dartx._get](label);
+ if (existingTag != null) {
+ return developer._FakeUserTag._check(existingTag);
+ }
+ if (developer._FakeUserTag._instances[dartx.length] == developer.UserTag.MAX_USER_TAGS) {
+ dart.throw(new core.UnsupportedError(dart.str`UserTag instance limit (${developer.UserTag.MAX_USER_TAGS}) reached.`));
+ }
+ let instance = new developer._FakeUserTag.real(label);
+ developer._FakeUserTag._instances[dartx._set](label, instance);
+ return instance;
+ }
+ makeCurrent() {
+ let old = developer._currentTag;
+ developer._currentTag = this;
+ return old;
+ }
+};
+dart.defineNamedConstructor(developer._FakeUserTag, 'real');
+developer._FakeUserTag[dart.implements] = () => [developer.UserTag];
+dart.setSignature(developer._FakeUserTag, {
+ constructors: () => ({
+ real: dart.definiteFunctionType(developer._FakeUserTag, [core.String]),
+ new: dart.definiteFunctionType(developer._FakeUserTag, [core.String])
+ }),
+ fields: () => ({label: core.String}),
+ methods: () => ({makeCurrent: dart.definiteFunctionType(developer.UserTag, [])}),
+ sfields: () => ({
+ _instances: core.Map,
+ _defaultTag: developer.UserTag
+ })
+});
+dart.defineLazy(developer._FakeUserTag, {
+ get _instances() {
+ return dart.map();
+ },
+ set _instances(_) {},
+ get _defaultTag() {
+ return developer._FakeUserTag.new('Default');
+ }
+});
+dart.defineLazy(developer, {
+ get _currentTag() {
+ return developer._FakeUserTag._defaultTag;
+ },
+ set _currentTag(_) {}
+});
+developer.getCurrentTag = function() {
+ return developer._currentTag;
+};
+dart.fn(developer.getCurrentTag, VoidToUserTag());
+developer.Metric = class Metric extends core.Object {
+ new(name, description) {
+ this.name = name;
+ this.description = description;
+ if (this.name == 'vm' || dart.test(this.name[dartx.contains]('/'))) {
+ dart.throw(new core.ArgumentError('Invalid Metric name.'));
+ }
+ }
+};
+dart.setSignature(developer.Metric, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.Metric, [core.String, core.String])}),
+ fields: () => ({
+ name: core.String,
+ description: core.String
+ })
+});
+const _value = Symbol('_value');
+const _toJSON = Symbol('_toJSON');
+developer.Gauge = class Gauge extends developer.Metric {
+ get value() {
+ return this[_value];
+ }
+ set value(v) {
+ if (dart.notNull(v) < dart.notNull(this.min)) {
+ v = this.min;
+ } else if (dart.notNull(v) > dart.notNull(this.max)) {
+ v = this.max;
+ }
+ this[_value] = v;
+ }
+ new(name, description, min, max) {
+ this.min = min;
+ this.max = max;
+ this[_value] = null;
+ super.new(name, description);
+ if (!(typeof this.min == 'number')) {
+ dart.throw(new core.ArgumentError('min must be a double'));
+ }
+ if (!(typeof this.max == 'number')) {
+ dart.throw(new core.ArgumentError('max must be a double'));
+ }
+ if (!(dart.notNull(this.min) < dart.notNull(this.max))) {
+ dart.throw(new core.ArgumentError('min must be less than max'));
+ }
+ this[_value] = this.min;
+ }
+ [_toJSON]() {
+ let map = dart.map({type: 'Gauge', id: dart.str`metrics/${this.name}`, name: this.name, description: this.description, value: this.value, min: this.min, max: this.max}, core.String, core.Object);
+ return map;
+ }
+};
+dart.setSignature(developer.Gauge, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.Gauge, [core.String, core.String, core.double, core.double])}),
+ fields: () => ({
+ min: core.double,
+ max: core.double,
+ [_value]: core.double
+ }),
+ getters: () => ({value: dart.definiteFunctionType(core.double, [])}),
+ setters: () => ({value: dart.definiteFunctionType(dart.void, [core.double])}),
+ methods: () => ({[_toJSON]: dart.definiteFunctionType(core.Map, [])})
+});
+developer.Counter = class Counter extends developer.Metric {
+ new(name, description) {
+ this[_value] = 0.0;
+ super.new(name, description);
+ }
+ get value() {
+ return this[_value];
+ }
+ set value(v) {
+ this[_value] = v;
+ }
+ [_toJSON]() {
+ let map = dart.map({type: 'Counter', id: dart.str`metrics/${this.name}`, name: this.name, description: this.description, value: this.value}, core.String, core.Object);
+ return map;
+ }
+};
+dart.setSignature(developer.Counter, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.Counter, [core.String, core.String])}),
+ fields: () => ({[_value]: core.double}),
+ getters: () => ({value: dart.definiteFunctionType(core.double, [])}),
+ setters: () => ({value: dart.definiteFunctionType(dart.void, [core.double])}),
+ methods: () => ({[_toJSON]: dart.definiteFunctionType(core.Map, [])})
+});
+developer.Metrics = class Metrics extends core.Object {
+ static register(metric) {
+ if (!developer.Metric.is(metric)) {
+ dart.throw(new core.ArgumentError('metric must be a Metric'));
+ }
+ if (developer.Metrics._metrics[dartx._get](metric.name) != null) {
+ dart.throw(new core.ArgumentError('Registered metrics have unique names'));
+ }
+ developer.Metrics._metrics[dartx._set](metric.name, metric);
+ }
+ static deregister(metric) {
+ if (!developer.Metric.is(metric)) {
+ dart.throw(new core.ArgumentError('metric must be a Metric'));
+ }
+ developer.Metrics._metrics[dartx.remove](metric.name);
+ }
+ static _printMetric(id) {
+ let metric = developer.Metrics._metrics[dartx._get](id);
+ if (metric == null) {
+ return null;
+ }
+ return convert.JSON.encode(metric[_toJSON]());
+ }
+ static _printMetrics() {
+ let metrics = [];
+ for (let metric of developer.Metrics._metrics[dartx.values]) {
+ metrics[dartx.add](metric[_toJSON]());
+ }
+ let map = dart.map({type: 'MetricList', metrics: metrics}, core.String, core.Object);
+ return convert.JSON.encode(map);
+ }
+};
+dart.setSignature(developer.Metrics, {
+ sfields: () => ({_metrics: MapOfString$Metric()}),
+ statics: () => ({
+ register: dart.definiteFunctionType(dart.void, [developer.Metric]),
+ deregister: dart.definiteFunctionType(dart.void, [developer.Metric]),
+ _printMetric: dart.definiteFunctionType(core.String, [core.String]),
+ _printMetrics: dart.definiteFunctionType(core.String, [])
+ }),
+ names: ['register', 'deregister', '_printMetric', '_printMetrics']
+});
+dart.defineLazy(developer.Metrics, {
+ get _metrics() {
+ return MapOfString$Metric().new();
+ }
+});
+developer._isProduct = false;
+developer.TimelineSyncFunction = dart.typedef('TimelineSyncFunction', () => dart.functionType(dart.dynamic, []));
+developer.TimelineAsyncFunction = dart.typedef('TimelineAsyncFunction', () => dart.functionType(async.Future, []));
+const _appendArguments = Symbol('_appendArguments');
+developer.Timeline = class Timeline extends core.Object {
+ static startSync(name, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ if (developer._isProduct) {
+ return;
+ }
+ if (!(typeof name == 'string')) {
+ dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
+ }
+ if (!dart.test(developer._isDartStreamEnabled())) {
+ developer.Timeline._stack[dartx.add](null);
+ return;
+ }
+ let block = new developer._SyncBlock._(name, developer._getTraceClock(), developer._getThreadCpuClock());
+ if (core.Map.is(arguments$)) {
+ block[_appendArguments](arguments$);
+ }
+ developer.Timeline._stack[dartx.add](block);
+ }
+ static finishSync() {
+ if (developer._isProduct) {
+ return;
+ }
+ if (developer.Timeline._stack[dartx.length] == 0) {
+ dart.throw(new core.StateError('Uneven calls to startSync and finishSync'));
+ }
+ let block = developer.Timeline._stack[dartx.removeLast]();
+ if (block == null) {
+ return;
+ }
+ block.finish();
+ }
+ static instantSync(name, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ if (developer._isProduct) {
+ return;
+ }
+ if (!(typeof name == 'string')) {
+ dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
+ }
+ if (!dart.test(developer._isDartStreamEnabled())) {
+ return;
+ }
+ let instantArguments = null;
+ if (core.Map.is(arguments$)) {
+ instantArguments = core.Map.from(arguments$);
+ }
+ developer._reportInstantEvent(developer._getTraceClock(), 'Dart', name, developer._argumentsAsJson(instantArguments));
+ }
+ static timeSync(name, func, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ developer.Timeline.startSync(name, {arguments: arguments$});
+ try {
+ return func();
+ } finally {
+ developer.Timeline.finishSync();
+ }
+ }
+ static get now() {
+ return developer._getTraceClock();
+ }
+};
+dart.setSignature(developer.Timeline, {
+ sfields: () => ({
+ _stack: ListOf_SyncBlock(),
+ _isolateId: core.int,
+ _isolateIdString: core.String
+ }),
+ sgetters: () => ({now: dart.definiteFunctionType(core.int, [])}),
+ statics: () => ({
+ startSync: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
+ finishSync: dart.definiteFunctionType(dart.void, []),
+ instantSync: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
+ timeSync: dart.definiteFunctionType(dart.dynamic, [core.String, developer.TimelineSyncFunction], {arguments: core.Map})
+ }),
+ names: ['startSync', 'finishSync', 'instantSync', 'timeSync']
+});
+dart.defineLazy(developer.Timeline, {
+ get _stack() {
+ return ListOf_SyncBlock().new();
+ },
+ get _isolateId() {
+ return developer._getIsolateNum();
+ },
+ get _isolateIdString() {
+ return dart.toString(developer.Timeline._isolateId);
+ }
+});
+const _stack = Symbol('_stack');
+const _taskId = Symbol('_taskId');
+const _start = Symbol('_start');
+const _finish = Symbol('_finish');
+developer.TimelineTask = class TimelineTask extends core.Object {
+ new() {
+ this[_stack] = JSArrayOf_AsyncBlock().of([]);
+ this[_taskId] = developer._getNextAsyncId();
+ }
+ withTaskId(taskId) {
+ this[_stack] = JSArrayOf_AsyncBlock().of([]);
+ this[_taskId] = taskId;
+ if (!(typeof taskId == 'number')) {
+ dart.throw(new core.ArgumentError.value(taskId, 'taskId', 'Must be an int'));
+ }
+ }
+ start(name, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ if (developer._isProduct) {
+ return;
+ }
+ if (!(typeof name == 'string')) {
+ dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
+ }
+ let block = new developer._AsyncBlock._(name, this[_taskId]);
+ if (core.Map.is(arguments$)) {
+ block[_appendArguments](arguments$);
+ }
+ this[_stack][dartx.add](block);
+ block[_start]();
+ }
+ instant(name, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ if (developer._isProduct) {
+ return;
+ }
+ if (!(typeof name == 'string')) {
+ dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
+ }
+ let instantArguments = null;
+ if (core.Map.is(arguments$)) {
+ instantArguments = core.Map.from(arguments$);
+ }
+ developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'n', 'Dart', name, developer._argumentsAsJson(instantArguments));
+ }
+ finish() {
+ if (developer._isProduct) {
+ return;
+ }
+ if (this[_stack][dartx.length] == 0) {
+ dart.throw(new core.StateError('Uneven calls to start and finish'));
+ }
+ let block = this[_stack][dartx.removeLast]();
+ block[_finish]();
+ }
+ pass() {
+ if (dart.notNull(this[_stack][dartx.length]) > 0) {
+ dart.throw(new core.StateError('You cannot pass a TimelineTask without finishing all started ' + 'operations'));
+ }
+ let r = this[_taskId];
+ return r;
+ }
+};
+dart.defineNamedConstructor(developer.TimelineTask, 'withTaskId');
+dart.setSignature(developer.TimelineTask, {
+ constructors: () => ({
+ new: dart.definiteFunctionType(developer.TimelineTask, []),
+ withTaskId: dart.definiteFunctionType(developer.TimelineTask, [core.int])
+ }),
+ fields: () => ({
+ [_taskId]: core.int,
+ [_stack]: ListOf_AsyncBlock()
+ }),
+ methods: () => ({
+ start: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
+ instant: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
+ finish: dart.definiteFunctionType(dart.void, []),
+ pass: dart.definiteFunctionType(core.int, [])
+ })
+});
+const _arguments = Symbol('_arguments');
+developer._AsyncBlock = class _AsyncBlock extends core.Object {
+ _(name, taskId) {
+ this.name = name;
+ this[_taskId] = taskId;
+ this.category = 'Dart';
+ this[_arguments] = null;
+ }
+ [_start]() {
+ developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'b', this.category, this.name, developer._argumentsAsJson(this[_arguments]));
+ }
+ [_finish]() {
+ developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'e', this.category, this.name, developer._argumentsAsJson(null));
+ }
+ [_appendArguments](arguments$) {
+ if (this[_arguments] == null) {
+ this[_arguments] = dart.map();
+ }
+ this[_arguments][dartx.addAll](arguments$);
+ }
+};
+dart.defineNamedConstructor(developer._AsyncBlock, '_');
+dart.setSignature(developer._AsyncBlock, {
+ constructors: () => ({_: dart.definiteFunctionType(developer._AsyncBlock, [core.String, core.int])}),
+ fields: () => ({
+ category: core.String,
+ name: core.String,
+ [_taskId]: core.int,
+ [_arguments]: core.Map
+ }),
+ methods: () => ({
+ [_start]: dart.definiteFunctionType(dart.void, []),
+ [_finish]: dart.definiteFunctionType(dart.void, []),
+ [_appendArguments]: dart.definiteFunctionType(dart.void, [core.Map])
+ })
+});
+const _startCpu = Symbol('_startCpu');
+developer._SyncBlock = class _SyncBlock extends core.Object {
+ _(name, start, startCpu) {
+ this.name = name;
+ this[_start] = start;
+ this[_startCpu] = startCpu;
+ this.category = 'Dart';
+ this[_arguments] = null;
+ }
+ finish() {
+ developer._reportCompleteEvent(this[_start], this[_startCpu], this.category, this.name, developer._argumentsAsJson(this[_arguments]));
+ }
+ [_appendArguments](arguments$) {
+ if (arguments$ == null) {
+ return;
+ }
+ if (this[_arguments] == null) {
+ this[_arguments] = dart.map();
+ }
+ this[_arguments][dartx.addAll](arguments$);
+ }
+};
+dart.defineNamedConstructor(developer._SyncBlock, '_');
+dart.setSignature(developer._SyncBlock, {
+ constructors: () => ({_: dart.definiteFunctionType(developer._SyncBlock, [core.String, core.int, core.int])}),
+ fields: () => ({
+ category: core.String,
+ name: core.String,
+ [_arguments]: core.Map,
+ [_start]: core.int,
+ [_startCpu]: core.int
+ }),
+ methods: () => ({
+ finish: dart.definiteFunctionType(dart.void, []),
+ [_appendArguments]: dart.definiteFunctionType(dart.void, [core.Map])
+ })
+});
+developer._fastPathArguments = null;
+developer._argumentsAsJson = function(arguments$) {
+ if (arguments$ == null || arguments$[dartx.length] == 0) {
+ if (developer._fastPathArguments == null) {
+ developer._fastPathArguments = dart.str`{"isolateNumber":"${developer.Timeline._isolateId}"}`;
+ }
+ return developer._fastPathArguments;
+ }
+ arguments$[dartx._set]('isolateNumber', developer.Timeline._isolateIdString);
+ return convert.JSON.encode(arguments$);
+};
+dart.fn(developer._argumentsAsJson, MapToString());
+developer._isDartStreamEnabled = function() {
+ return false;
+};
+dart.fn(developer._isDartStreamEnabled, VoidTobool());
+developer._getNextAsyncId = function() {
+ return 0;
+};
+dart.fn(developer._getNextAsyncId, VoidToint());
+developer._getTraceClock = function() {
+ let x = developer._clockValue;
+ developer._clockValue = dart.notNull(x) + 1;
+ return x;
+};
+dart.fn(developer._getTraceClock, VoidToint());
+developer._getThreadCpuClock = function() {
+ return -1;
+};
+dart.fn(developer._getThreadCpuClock, VoidToint());
+developer._getIsolateNum = function() {
+ return 0;
+};
+dart.fn(developer._getIsolateNum, VoidToint());
+developer._reportTaskEvent = function(start, taskId, phase, category, name, argumentsAsJson) {
+};
+dart.fn(developer._reportTaskEvent, intAndintAndString__Tovoid());
+developer._reportCompleteEvent = function(start, startCpu, category, name, argumentsAsJson) {
+};
+dart.fn(developer._reportCompleteEvent, intAndintAndString__Tovoid());
+developer._reportInstantEvent = function(start, category, name, argumentsAsJson) {
+};
+dart.fn(developer._reportInstantEvent, intAndStringAndString__Tovoid());
+developer.ServiceProtocolInfo = class ServiceProtocolInfo extends core.Object {
+ new(serverUri) {
+ this.majorVersion = developer._getServiceMajorVersion();
+ this.minorVersion = developer._getServiceMinorVersion();
+ this.serverUri = serverUri;
+ }
+ toString() {
+ if (this.serverUri != null) {
+ return dart.str`Dart VM Service Protocol v${this.majorVersion}.${this.minorVersion} ` + dart.str`listening on ${this.serverUri}`;
+ } else {
+ return dart.str`Dart VM Service Protocol v${this.majorVersion}.${this.minorVersion}`;
+ }
+ }
+};
+dart.setSignature(developer.ServiceProtocolInfo, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.ServiceProtocolInfo, [core.Uri])}),
+ fields: () => ({
+ majorVersion: core.int,
+ minorVersion: core.int,
+ serverUri: core.Uri
+ })
+});
+developer.Service = class Service extends core.Object {
+ static getInfo() {
+ return dart.async(function*() {
+ let receivePort = isolate.RawReceivePort.new();
+ let uriCompleter = CompleterOfUri().new();
+ receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
+ developer._getServerInfo(receivePort.sendPort);
+ let uri = (yield uriCompleter.future);
+ receivePort.close();
+ return new developer.ServiceProtocolInfo(uri);
+ }, developer.ServiceProtocolInfo);
+ }
+ static controlWebServer(opts) {
+ return dart.async(function*(opts) {
+ let enable = opts && 'enable' in opts ? opts.enable : false;
+ if (!(typeof enable == 'boolean')) {
+ dart.throw(new core.ArgumentError.value(enable, 'enable', 'Must be a bool'));
+ }
+ let receivePort = isolate.RawReceivePort.new();
+ let uriCompleter = CompleterOfUri().new();
+ receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
+ developer._webServerControl(receivePort.sendPort, enable);
+ let uri = (yield uriCompleter.future);
+ receivePort.close();
+ return new developer.ServiceProtocolInfo(uri);
+ }, developer.ServiceProtocolInfo, opts);
+ }
+};
+dart.setSignature(developer.Service, {
+ statics: () => ({
+ getInfo: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), []),
+ controlWebServer: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), [], {enable: core.bool})
+ }),
+ names: ['getInfo', 'controlWebServer']
+});
+developer._getServerInfo = function(sp) {
+ sp.send(null);
+};
+dart.lazyFn(developer._getServerInfo, () => SendPortTovoid());
+developer._webServerControl = function(sp, enable) {
+ sp.send(null);
+};
+dart.lazyFn(developer._webServerControl, () => SendPortAndboolTovoid());
+developer._getServiceMajorVersion = function() {
+ return 0;
+};
+dart.fn(developer._getServiceMajorVersion, VoidToint());
+developer._getServiceMinorVersion = function() {
+ return 0;
+};
+dart.fn(developer._getServiceMinorVersion, VoidToint());
isolate.IsolateSpawnException = class IsolateSpawnException extends core.Object {
new(message) {
this.message = message;
diff --git a/pkg/dev_compiler/lib/js/legacy/dart_sdk.js b/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
index c9d9c75..5a352a1 100644
--- a/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
@@ -18,6 +18,7 @@
const collection = Object.create(null);
const convert = Object.create(null);
const core = Object.create(null);
+ const developer = Object.create(null);
const isolate = Object.create(null);
const js = Object.create(null);
const js_util = Object.create(null);
@@ -377,6 +378,12 @@
let MapOfString$String = () => (MapOfString$String = dart.constFn(core.Map$(core.String, core.String)))();
let IterableOfString = () => (IterableOfString = dart.constFn(core.Iterable$(core.String)))();
let MapOfString$dynamic = () => (MapOfString$dynamic = dart.constFn(core.Map$(core.String, dart.dynamic)))();
+ let MapOfString$ServiceExtensionHandler = () => (MapOfString$ServiceExtensionHandler = dart.constFn(core.Map$(core.String, developer.ServiceExtensionHandler)))();
+ let MapOfString$Metric = () => (MapOfString$Metric = dart.constFn(core.Map$(core.String, developer.Metric)))();
+ let ListOf_SyncBlock = () => (ListOf_SyncBlock = dart.constFn(core.List$(developer._SyncBlock)))();
+ let JSArrayOf_AsyncBlock = () => (JSArrayOf_AsyncBlock = dart.constFn(_interceptors.JSArray$(developer._AsyncBlock)))();
+ let ListOf_AsyncBlock = () => (ListOf_AsyncBlock = dart.constFn(core.List$(developer._AsyncBlock)))();
+ let CompleterOfUri = () => (CompleterOfUri = dart.constFn(async.Completer$(core.Uri)))();
let FutureOfIsolate = () => (FutureOfIsolate = dart.constFn(async.Future$(isolate.Isolate)))();
let JsArray = () => (JsArray = dart.constFn(js.JsArray$()))();
let ExpandoOfFunction = () => (ExpandoOfFunction = dart.constFn(core.Expando$(core.Function)))();
@@ -617,11 +624,12 @@
let TypeToTypeMirror = () => (TypeToTypeMirror = dart.constFn(dart.definiteFunctionType(mirrors.TypeMirror, [core.Type])))();
let dynamicAndListTodynamic = () => (dynamicAndListTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.List])))();
let dynamicAndStringAndListTodynamic = () => (dynamicAndStringAndListTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [dart.dynamic, core.String, core.List])))();
- let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
+ let SymbolTodynamic = () => (SymbolTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Symbol])))();
+ let dynamicToSymbol = () => (dynamicToSymbol = dart.constFn(dart.definiteFunctionType(core.Symbol, [dart.dynamic])))();
+ let dynamicToMapOfSymbol$dynamic = () => (dynamicToMapOfSymbol$dynamic = dart.constFn(dart.definiteFunctionType(MapOfSymbol$dynamic(), [dart.dynamic])))();
let TypeAndInvocationTodynamic = () => (TypeAndInvocationTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Type, core.Invocation])))();
let SymbolAnddynamicTovoid = () => (SymbolAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Symbol, dart.dynamic])))();
let MapOfSymbol$dynamicTodynamic = () => (MapOfSymbol$dynamicTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [MapOfSymbol$dynamic()])))();
- let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
let dynamicToTypeMirror = () => (dynamicToTypeMirror = dart.constFn(dart.definiteFunctionType(mirrors.TypeMirror, [dart.dynamic])))();
let dynamicAnddynamicAnddynamicTovoid = () => (dynamicAnddynamicAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [dart.dynamic, dart.dynamic, dart.dynamic])))();
let ListToList = () => (ListToList = dart.constFn(dart.definiteFunctionType(core.List, [core.List])))();
@@ -679,9 +687,24 @@
let ObjectToint = () => (ObjectToint = dart.constFn(dart.definiteFunctionType(core.int, [core.Object])))();
let ObjectTovoid = () => (ObjectTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Object])))();
let StringAndStringTovoid$ = () => (StringAndStringTovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.String])))();
+ let StringAnddynamicTovoid = () => (StringAnddynamicTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, dart.dynamic])))();
let MapOfString$StringAndStringToMapOfString$String = () => (MapOfString$StringAndStringToMapOfString$String = dart.constFn(dart.definiteFunctionType(MapOfString$String(), [MapOfString$String(), core.String])))();
let intAndintAndintTovoid = () => (intAndintAndintTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.int])))();
let String__Tovoid = () => (String__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], [dart.dynamic])))();
+ let __Tobool = () => (__Tobool = dart.constFn(dart.definiteFunctionType(core.bool, [], {when: core.bool, message: core.String})))();
+ let String__Tovoid$ = () => (String__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.String], {time: core.DateTime, sequenceNumber: core.int, level: core.int, name: core.String, zone: async.Zone, error: core.Object, stackTrace: core.StackTrace})))();
+ let StringAndServiceExtensionHandlerTovoid = () => (StringAndServiceExtensionHandlerTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, developer.ServiceExtensionHandler])))();
+ let StringAndMapTovoid = () => (StringAndMapTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.String, core.Map])))();
+ let StringToServiceExtensionHandler = () => (StringToServiceExtensionHandler = dart.constFn(dart.definiteFunctionType(developer.ServiceExtensionHandler, [core.String])))();
+ let StringAndServiceExtensionHandlerTodynamic = () => (StringAndServiceExtensionHandlerTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.String, developer.ServiceExtensionHandler])))();
+ let VoidToUserTag = () => (VoidToUserTag = dart.constFn(dart.definiteFunctionType(developer.UserTag, [])))();
+ let MapToString = () => (MapToString = dart.constFn(dart.definiteFunctionType(core.String, [core.Map])))();
+ let intAndintAndString__Tovoid = () => (intAndintAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String, core.String])))();
+ let intAndintAndString__Tovoid$ = () => (intAndintAndString__Tovoid$ = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.int, core.String, core.String, core.String])))();
+ let intAndStringAndString__Tovoid = () => (intAndStringAndString__Tovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.int, core.String, core.String, core.String])))();
+ let UriTovoid = () => (UriTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [core.Uri])))();
+ let SendPortTovoid = () => (SendPortTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort])))();
+ let SendPortAndboolTovoid = () => (SendPortAndboolTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [isolate.SendPort, core.bool])))();
let ListToIsolate = () => (ListToIsolate = dart.constFn(dart.definiteFunctionType(isolate.Isolate, [core.List])))();
let dynamicTo_DartObject = () => (dynamicTo_DartObject = dart.constFn(dart.definiteFunctionType(js._DartObject, [dart.dynamic])))();
let dynamicToJsObject = () => (dynamicToJsObject = dart.constFn(dart.definiteFunctionType(js.JsObject, [dart.dynamic])))();
@@ -750,6 +773,7 @@
let NodeAndNodeTovoid = () => (NodeAndNodeTovoid = dart.constFn(dart.definiteFunctionType(dart.void, [html$.Node, html$.Node])))();
let dynamicToImageData = () => (dynamicToImageData = dart.constFn(dart.definiteFunctionType(html$.ImageData, [dart.dynamic])))();
let ImageDataTodynamic = () => (ImageDataTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [html$.ImageData])))();
+ let dynamicToMap = () => (dynamicToMap = dart.constFn(dart.definiteFunctionType(core.Map, [dart.dynamic])))();
let Map__Todynamic = () => (Map__Todynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [core.Map], [dynamicTovoid()])))();
let ListOfStringToList = () => (ListOfStringToList = dart.constFn(dart.definiteFunctionType(core.List, [ListOfString()])))();
let dynamicToDateTime = () => (dynamicToDateTime = dart.constFn(dart.definiteFunctionType(core.DateTime, [dart.dynamic])))();
@@ -781,10 +805,10 @@
return Mixin;
};
dart.getMixins = function(clazz) {
- return clazz[dart._mixins];
+ return Object.hasOwnProperty.call(clazz, dart._mixins) ? clazz[dart._mixins] : null;
};
dart.getImplements = function(clazz) {
- return clazz[dart.implements];
+ return Object.hasOwnProperty.call(clazz, dart.implements) ? clazz[dart.implements] : null;
};
dart.flattenFutures = function(builder) {
function flatten(T) {
@@ -8658,18 +8682,26 @@
});
_internal.Sort._INSERTION_SORT_THRESHOLD = 32;
const _name = Symbol('_name');
+ const _nativeSymbol = Symbol('_nativeSymbol');
_internal.Symbol = class Symbol extends core.Object {
new(name) {
this[_name] = name;
+ this[_nativeSymbol] = null;
+ }
+ es6(name, nativeSymbol) {
+ this[_name] = name;
+ this[_nativeSymbol] = nativeSymbol;
}
unvalidated(name) {
this[_name] = name;
+ this[_nativeSymbol] = null;
}
validated(name) {
this[_name] = _internal.Symbol.validatePublicSymbol(name);
+ this[_nativeSymbol] = null;
}
['=='](other) {
- return _internal.Symbol.is(other) && this[_name] == other[_name];
+ return _internal.Symbol.is(other) && this[_name] == other[_name] && dart.equals(this[_nativeSymbol], other[_nativeSymbol]);
}
get hashCode() {
let hash = this._hashCode;
@@ -8685,6 +8717,9 @@
static getName(symbol) {
return symbol[_name];
}
+ static getNativeSymbol(symbol) {
+ return symbol[_nativeSymbol];
+ }
static validatePublicSymbol(name) {
if (dart.test(name[dartx.isEmpty]) || dart.test(_internal.Symbol.publicSymbolPattern.hasMatch(name))) return name;
if (dart.test(name[dartx.startsWith]('_'))) {
@@ -8696,16 +8731,21 @@
return dart.test(name[dartx.isEmpty]) || dart.test(_internal.Symbol.symbolPattern.hasMatch(name));
}
};
+ dart.defineNamedConstructor(_internal.Symbol, 'es6');
dart.defineNamedConstructor(_internal.Symbol, 'unvalidated');
dart.defineNamedConstructor(_internal.Symbol, 'validated');
_internal.Symbol[dart.implements] = () => [core.Symbol];
dart.setSignature(_internal.Symbol, {
constructors: () => ({
new: dart.definiteFunctionType(_internal.Symbol, [core.String]),
+ es6: dart.definiteFunctionType(_internal.Symbol, [core.String, dart.dynamic]),
unvalidated: dart.definiteFunctionType(_internal.Symbol, [core.String]),
validated: dart.definiteFunctionType(_internal.Symbol, [core.String])
}),
- fields: () => ({[_name]: core.String}),
+ fields: () => ({
+ [_name]: core.String,
+ [_nativeSymbol]: dart.dynamic
+ }),
methods: () => ({'==': dart.definiteFunctionType(core.bool, [core.Object])}),
sfields: () => ({
reservedWordRE: core.String,
@@ -8717,10 +8757,11 @@
}),
statics: () => ({
getName: dart.definiteFunctionType(core.String, [_internal.Symbol]),
+ getNativeSymbol: dart.definiteFunctionType(dart.dynamic, [_internal.Symbol]),
validatePublicSymbol: dart.definiteFunctionType(core.String, [core.String]),
isValidSymbol: dart.definiteFunctionType(core.bool, [core.String])
}),
- names: ['getName', 'validatePublicSymbol', 'isValidSymbol']
+ names: ['getName', 'getNativeSymbol', 'validatePublicSymbol', 'isValidSymbol']
});
_internal.Symbol.reservedWordRE = '(?:assert|break|c(?:a(?:se|tch)|lass|on(?:st|tinue))|d(?:efault|o)|' + 'e(?:lse|num|xtends)|f(?:alse|inal(?:ly)?|or)|i[fns]|n(?:ew|ull)|' + 'ret(?:hrow|urn)|s(?:uper|witch)|t(?:h(?:is|row)|r(?:ue|y))|' + 'v(?:ar|oid)|w(?:hile|ith))';
_internal.Symbol.operatorRE = '(?:[\\-+*/%&|^]|\\[\\]=?|==|~/?|<[<=]?|>[>=]?|unary-)';
@@ -13231,73 +13272,109 @@
return _js_mirrors._dart.definiteFunctionType(type, []);
};
dart.fn(_js_mirrors._defaultConstructorType, dynamicTodynamic$());
+ _js_mirrors._getMixins = function(type) {
+ return _js_mirrors._dart.getMixins(type, []);
+ };
+ dart.fn(_js_mirrors._getMixins, dynamicTodynamic$());
_js_mirrors._Lazy$ = dart.generic(T => {
const _Lazy = dart.typedef('_Lazy', () => dart.functionType(T, []));
return _Lazy;
});
_js_mirrors._Lazy = _Lazy();
+ _js_mirrors._getESSymbol = function(symbol) {
+ return _internal.Symbol.getNativeSymbol(_internal.Symbol.as(symbol));
+ };
+ dart.lazyFn(_js_mirrors._getESSymbol, () => SymbolTodynamic());
+ _js_mirrors._getMember = function(symbol) {
+ let privateSymbol = _js_mirrors._getESSymbol(symbol);
+ if (privateSymbol != null) {
+ return privateSymbol;
+ }
+ return _js_mirrors.getName(symbol);
+ };
+ dart.lazyFn(_js_mirrors._getMember, () => SymbolTodynamic());
_js_mirrors._getNameForESSymbol = function(member) {
+ dart.assert(typeof member == "symbol");
let str = dart.toString(member);
dart.assert(dart.test(str[dartx.startsWith]('Symbol(')) && dart.test(str[dartx.endsWith](')')));
return str[dartx.substring](7, dart.notNull(str[dartx.length]) - 1);
};
dart.lazyFn(_js_mirrors._getNameForESSymbol, () => dynamicToString());
+ _js_mirrors._getSymbolForESSymbol = function(member) {
+ let name = _js_mirrors._getNameForESSymbol(member);
+ return new _internal.Symbol.es6(name, member);
+ };
+ dart.lazyFn(_js_mirrors._getSymbolForESSymbol, () => dynamicToSymbol());
+ _js_mirrors._getSymbolForMember = function(member) {
+ if (typeof member == 'string') {
+ return core.Symbol.new(member);
+ } else {
+ let name = _js_mirrors._getNameForESSymbol(member);
+ return new _internal.Symbol.es6(name, member);
+ }
+ };
+ dart.lazyFn(_js_mirrors._getSymbolForMember, () => dynamicToSymbol());
_js_mirrors._toDartMap = function(data) {
- if (data == null) return dart.map();
- let map = _js_mirrors._dart.map(data);
+ if (data == null) return dart.map({}, core.Symbol, dart.dynamic);
+ let map = MapOfSymbol$dynamic().new();
+ let publicMembers = Object.getOwnPropertyNames(data);
+ for (let member of core.Iterable._check(publicMembers)) {
+ let symbol = core.Symbol.new(core.String._check(member));
+ map[dartx._set](symbol, data[member]);
+ }
let privateMembers = Object.getOwnPropertySymbols(data);
for (let member of core.Iterable._check(privateMembers)) {
- let name = _js_mirrors._getNameForESSymbol(member);
- map[dartx._set](name, data[member]);
+ let symbol = _js_mirrors._getSymbolForESSymbol(member);
+ map[dartx._set](symbol, data[member]);
}
return map;
};
- dart.lazyFn(_js_mirrors._toDartMap, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._toDartMap, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getConstructors = function(obj) {
let sig = _js_mirrors._dart.getConstructorSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getConstructors, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getConstructors, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getFields = function(obj) {
let sig = _js_mirrors._dart.getFieldSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getFields, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getFields, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getMethods = function(obj) {
let sig = _js_mirrors._dart.getMethodSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getMethods, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getMethods, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getGetters = function(obj) {
let sig = _js_mirrors._dart.getGetterSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getGetters, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getGetters, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getSetters = function(obj) {
let sig = _js_mirrors._dart.getSetterSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getSetters, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getSetters, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getStaticFields = function(obj) {
let sig = _js_mirrors._dart.getStaticFieldSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getStaticFields, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getStaticFields, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getStatics = function(obj) {
let sig = _js_mirrors._dart.getStaticSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getStatics, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getStatics, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getStaticGetters = function(obj) {
let sig = _js_mirrors._dart.getStaticGetterSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getStaticGetters, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getStaticGetters, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._getStaticSetters = function(obj) {
let sig = _js_mirrors._dart.getStaticSetterSig(obj);
return _js_mirrors._toDartMap(sig);
};
- dart.lazyFn(_js_mirrors._getStaticSetters, () => dynamicToMap());
+ dart.lazyFn(_js_mirrors._getStaticSetters, () => dynamicToMapOfSymbol$dynamic());
_js_mirrors._unwrap = function(obj) {
return _js_mirrors._dart.unwrapType(obj);
};
@@ -13436,15 +13513,7 @@
[_getAccessor](reflectee, symbol, args, namedArgs) {
if (args === void 0) args = null;
if (namedArgs === void 0) namedArgs = null;
- let name = _js_mirrors.getName(symbol);
- if (!dart.test(name[dartx.startsWith]('_'))) return name;
- let privateMembers = Object.getOwnPropertySymbols(reflectee);
- dart.dsend(privateMembers, 'addAll', Object.getOwnPropertySymbols(reflectee.__proto__));
- for (let member of core.Iterable._check(privateMembers)) {
- let privateName = _js_mirrors._getNameForESSymbol(member);
- if (name == privateName) return member;
- }
- return new core.NoSuchMethodError(reflectee, symbol, args, namedArgs);
+ return _js_mirrors._getMember(symbol);
}
getField(symbol) {
let name = this[_getAccessor](this.reflectee, symbol);
@@ -13521,6 +13590,7 @@
let const$0;
const _declarations = Symbol('_declarations');
const _raw = Symbol('_raw');
+ const _mixin = Symbol('_mixin');
const _typeArguments = Symbol('_typeArguments');
let const$1;
_js_mirrors.JsClassMirror = class JsClassMirror extends _js_mirrors.JsMirror {
@@ -13537,67 +13607,66 @@
this[_declarations] = MapOfSymbol$DeclarationMirror().new();
let unwrapped = _js_mirrors._unwrap(this[_cls]);
let constructors = _js_mirrors._getConstructors(unwrapped);
- constructors[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, name, ft));
- }, StringAnddynamicTovoid()));
+ constructors[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
if (dart.test(constructors[dartx.isEmpty])) {
let name = 'new';
let ft = _js_mirrors._defaultConstructorType(_js_mirrors._unwrap(this[_cls]));
let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, name, ft));
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._constructor(this, symbol, ft));
}
let fields = _js_mirrors._getFields(unwrapped);
- fields[dartx.forEach](dart.fn((name, t) => {
- let symbol = core.Symbol.new(name);
+ fields[dartx.forEach](dart.fn((symbol, t) => {
let metadata = [];
if (core.List.is(t)) {
metadata = core.List._check(dart.dsend(dart.dsend(t, 'skip', 1), 'toList'));
t = dart.dindex(t, 0);
}
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(name, core.Type._check(_js_mirrors._wrap(t)), metadata));
- }, StringAnddynamicTovoid()));
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(symbol, core.Type._check(_js_mirrors._wrap(t)), metadata));
+ }, SymbolAnddynamicTovoid()));
let methods = _js_mirrors._getMethods(unwrapped);
- methods[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ methods[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let getters = _js_mirrors._getGetters(unwrapped);
- getters[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ getters[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let setters = _js_mirrors._getSetters(unwrapped);
- setters[dartx.forEach](dart.fn((name, ft) => {
- name = dart.notNull(name) + '=';
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ setters[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = dart.notNull(_js_mirrors.getName(symbol)) + '=';
+ symbol = new _internal.Symbol.es6(name, _js_mirrors._getESSymbol(symbol));
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._instanceMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let staticFields = _js_mirrors._getStaticFields(unwrapped);
- staticFields[dartx.forEach](dart.fn((name, t) => {
- let symbol = core.Symbol.new(name);
+ staticFields[dartx.forEach](dart.fn((symbol, t) => {
+ let name = _js_mirrors.getName(symbol);
let metadata = [];
if (core.List.is(t)) {
metadata = core.List._check(dart.dsend(dart.dsend(t, 'skip', 1), 'toList'));
t = dart.dindex(t, 0);
}
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(name, core.Type._check(_js_mirrors._wrap(t)), metadata));
- }, StringAnddynamicTovoid()));
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsVariableMirror._(symbol, core.Type._check(_js_mirrors._wrap(t)), metadata));
+ }, SymbolAnddynamicTovoid()));
let statics = _js_mirrors._getStatics(unwrapped);
- statics[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ statics[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let staticGetters = _js_mirrors._getStaticGetters(unwrapped);
- staticGetters[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ staticGetters[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
let staticSetters = _js_mirrors._getStaticSetters(unwrapped);
- staticSetters[dartx.forEach](dart.fn((name, ft) => {
- let symbol = core.Symbol.new(name);
- this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, name, ft));
- }, StringAnddynamicTovoid()));
+ staticSetters[dartx.forEach](dart.fn((symbol, ft) => {
+ let name = _js_mirrors.getName(symbol);
+ this[_declarations][dartx._set](symbol, new _js_mirrors.JsMethodMirror._staticMethod(this, symbol, ft));
+ }, SymbolAnddynamicTovoid()));
this[_declarations] = MapOfSymbol$DeclarationMirror().unmodifiable(this[_declarations]);
}
return this[_declarations];
@@ -13606,7 +13675,7 @@
this[_cls] = cls;
this[_raw] = _js_mirrors._getGenericClass(_js_mirrors._unwrap(cls));
this.simpleName = core.Symbol.new(_js_mirrors._unwrap(cls).name);
- this.mixin = null;
+ this[_mixin] = null;
this[_typeArguments] = null;
this[_metadata$] = null;
this[_declarations] = null;
@@ -13677,6 +13746,21 @@
return mirrors.ClassMirror._check(_js_mirrors.reflectType(core.Type._check(_js_mirrors._wrap(_js_mirrors._unwrap(this[_cls]).__proto__))));
}
}
+ get mixin() {
+ if (this[_mixin] != null) {
+ return this[_mixin];
+ }
+ let mixins = _js_mirrors._getMixins(_js_mirrors._unwrap(this[_cls]));
+ if (mixins == null || dart.test(dart.dload(mixins, 'isEmpty'))) {
+ this[_mixin] = this;
+ return this[_mixin];
+ }
+ if (dart.test(dart.dsend(dart.dload(mixins, 'length'), '>', 1))) {
+ dart.throw(new core.UnsupportedError("ClassMirror.mixin not yet supported for " + dart.str`classes (${this[_cls]}) with multiple mixins`));
+ }
+ this[_mixin] = mirrors.ClassMirror._check(_js_mirrors.reflectType(core.Type._check(_js_mirrors._wrap(dart.dindex(mixins, 0)))));
+ return this[_mixin];
+ }
toString() {
return dart.str`ClassMirror on '${this[_cls]}'`;
}
@@ -13725,7 +13809,7 @@
[_cls]: core.Type,
simpleName: core.Symbol,
[_raw]: dart.dynamic,
- mixin: mirrors.ClassMirror,
+ [_mixin]: mirrors.ClassMirror,
[_typeArguments]: ListOfTypeMirror(),
[_metadata$]: ListOfInstanceMirror(),
[_declarations]: MapOfSymbol$DeclarationMirror()
@@ -13739,7 +13823,8 @@
isOriginalDeclaration: dart.definiteFunctionType(core.bool, []),
typeArguments: dart.definiteFunctionType(core.List$(mirrors.TypeMirror), []),
originalDeclaration: dart.definiteFunctionType(mirrors.TypeMirror, []),
- superclass: dart.definiteFunctionType(mirrors.ClassMirror, [])
+ superclass: dart.definiteFunctionType(mirrors.ClassMirror, []),
+ mixin: dart.definiteFunctionType(mirrors.ClassMirror, [])
}),
methods: () => ({
newInstance: dart.definiteFunctionType(mirrors.InstanceMirror, [core.Symbol, core.List], [MapOfSymbol$dynamic()]),
@@ -13748,13 +13833,15 @@
invoke: dart.definiteFunctionType(mirrors.InstanceMirror, [core.Symbol, core.List], [MapOfSymbol$dynamic()])
})
});
+ const _symbol = Symbol('_symbol');
const _name$ = Symbol('_name');
_js_mirrors.JsVariableMirror = class JsVariableMirror extends _js_mirrors.JsMirror {
get simpleName() {
- return core.Symbol.new(this[_name$]);
+ return this[_symbol];
}
- _(name, t, annotations) {
- this[_name$] = name;
+ _(symbol, t, annotations) {
+ this[_symbol] = symbol;
+ this[_name$] = _js_mirrors.getName(symbol);
this.type = _js_mirrors.reflectType(t);
this.metadata = ListOfInstanceMirror().unmodifiable(annotations[dartx.map](mirrors.InstanceMirror)(dart.fn(a => _js_mirrors.reflect(a), dynamicToInstanceMirror())));
this.isStatic = false;
@@ -13785,8 +13872,9 @@
dart.defineNamedConstructor(_js_mirrors.JsVariableMirror, '_');
_js_mirrors.JsVariableMirror[dart.implements] = () => [mirrors.VariableMirror];
dart.setSignature(_js_mirrors.JsVariableMirror, {
- constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsVariableMirror, [core.String, core.Type, core.List])}),
+ constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsVariableMirror, [core.Symbol, core.Type, core.List])}),
fields: () => ({
+ [_symbol]: core.Symbol,
[_name$]: core.String,
type: mirrors.TypeMirror,
metadata: ListOfInstanceMirror(),
@@ -13796,8 +13884,8 @@
getters: () => ({simpleName: dart.definiteFunctionType(core.Symbol, [])})
});
_js_mirrors.JsParameterMirror = class JsParameterMirror extends _js_mirrors.JsVariableMirror {
- _(name, t, annotations) {
- super._(name, t, annotations);
+ _(member, t, annotations) {
+ super._(member, t, annotations);
}
toString() {
return dart.str`ParameterMirror on '${this[_name$]}'`;
@@ -13836,7 +13924,7 @@
dart.defineNamedConstructor(_js_mirrors.JsParameterMirror, '_');
_js_mirrors.JsParameterMirror[dart.implements] = () => [mirrors.ParameterMirror];
dart.setSignature(_js_mirrors.JsParameterMirror, {
- constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsParameterMirror, [core.String, core.Type, core.List])})
+ constructors: () => ({_: dart.definiteFunctionType(_js_mirrors.JsParameterMirror, [core.Symbol, core.Type, core.List])})
});
const _params = Symbol('_params');
const _createParameterMirrorList = Symbol('_createParameterMirrorList');
@@ -13851,10 +13939,11 @@
return this[_name$][dartx.startsWith]('_');
}
get simpleName() {
- return core.Symbol.new(this[_name$]);
+ return this[_symbol];
}
- _constructor(cls, name, ftype) {
- this[_name$] = name;
+ _constructor(cls, symbol, ftype) {
+ this[_symbol] = symbol;
+ this[_name$] = _js_mirrors.getName(symbol);
this.isConstructor = true;
this.isStatic = false;
this[_params] = null;
@@ -13862,8 +13951,9 @@
this.isFinal = false;
this[_createParameterMirrorList](ftype);
}
- _instanceMethod(cls, name, ftype) {
- this[_name$] = name;
+ _instanceMethod(cls, symbol, ftype) {
+ this[_symbol] = symbol;
+ this[_name$] = _js_mirrors.getName(symbol);
this.isConstructor = false;
this.isStatic = false;
this[_params] = null;
@@ -13871,8 +13961,9 @@
this.isFinal = false;
this[_createParameterMirrorList](ftype);
}
- _staticMethod(cls, name, ftype) {
- this[_name$] = name;
+ _staticMethod(cls, symbol, ftype) {
+ this[_symbol] = symbol;
+ this[_name$] = _js_mirrors.getName(symbol);
this.isConstructor = false;
this.isStatic = true;
this[_params] = null;
@@ -13881,7 +13972,7 @@
this[_createParameterMirrorList](ftype);
}
get constructorName() {
- return dart.test(this.isConstructor) ? core.Symbol.new(this[_name$]) : null;
+ return dart.test(this.isConstructor) ? this[_symbol] : null;
}
get parameters() {
return this[_params];
@@ -13910,13 +14001,13 @@
for (let i = 0; i < dart.notNull(args[dartx.length]); ++i) {
let type = args[dartx._get](i);
let metadata = dart.dindex(dart.dload(ftype, 'metadata'), i);
- let param = new _js_mirrors.JsParameterMirror._('', core.Type._check(_js_mirrors._wrap(type)), core.List._check(metadata));
+ let param = new _js_mirrors.JsParameterMirror._(core.Symbol.new(''), core.Type._check(_js_mirrors._wrap(type)), core.List._check(metadata));
params[dartx._set](i, param);
}
for (let i = 0; i < dart.notNull(opts[dartx.length]); ++i) {
let type = opts[dartx._get](i);
let metadata = dart.dindex(dart.dload(ftype, 'metadata'), dart.notNull(args[dartx.length]) + i);
- let param = new _js_mirrors.JsParameterMirror._('', core.Type._check(_js_mirrors._wrap(type)), core.List._check(metadata));
+ let param = new _js_mirrors.JsParameterMirror._(core.Symbol.new(''), core.Type._check(_js_mirrors._wrap(type)), core.List._check(metadata));
params[dartx._set](i + dart.notNull(args[dartx.length]), param);
}
this[_params] = ListOfParameterMirror().unmodifiable(params);
@@ -13976,11 +14067,12 @@
_js_mirrors.JsMethodMirror[dart.implements] = () => [mirrors.MethodMirror];
dart.setSignature(_js_mirrors.JsMethodMirror, {
constructors: () => ({
- _constructor: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.String, dart.dynamic]),
- _instanceMethod: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.String, dart.dynamic]),
- _staticMethod: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.String, dart.dynamic])
+ _constructor: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.Symbol, dart.dynamic]),
+ _instanceMethod: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.Symbol, dart.dynamic]),
+ _staticMethod: dart.definiteFunctionType(_js_mirrors.JsMethodMirror, [_js_mirrors.JsClassMirror, core.Symbol, dart.dynamic])
}),
fields: () => ({
+ [_symbol]: core.Symbol,
[_name$]: core.String,
[_params]: ListOfParameterMirror(),
[_metadata$]: ListOfInstanceMirror(),
@@ -36376,6 +36468,741 @@
core.UriData._noScheme = -1;
core.UriData._tokenCharTable = dart.constList([0, 0, 27858, 1023, 65534, 51199, 65535, 32767], core.int);
core.UriData._uricTable = core.Uri._queryCharTable;
+ developer.debugger = function(opts) {
+ let when = opts && 'when' in opts ? opts.when : true;
+ let message = opts && 'message' in opts ? opts.message : null;
+ if (dart.test(when)) {
+ debugger;
+ }
+ return when;
+ };
+ dart.fn(developer.debugger, __Tobool());
+ developer.inspect = function(object) {
+ return object;
+ };
+ dart.fn(developer.inspect, ObjectToObject());
+ developer.log = function(message, opts) {
+ let time = opts && 'time' in opts ? opts.time : null;
+ let sequenceNumber = opts && 'sequenceNumber' in opts ? opts.sequenceNumber : null;
+ let level = opts && 'level' in opts ? opts.level : 0;
+ let name = opts && 'name' in opts ? opts.name : '';
+ let zone = opts && 'zone' in opts ? opts.zone : null;
+ let error = opts && 'error' in opts ? opts.error : null;
+ let stackTrace = opts && 'stackTrace' in opts ? opts.stackTrace : null;
+ };
+ dart.fn(developer.log, String__Tovoid$());
+ dart.defineLazy(developer, {
+ get _extensions() {
+ return MapOfString$ServiceExtensionHandler().new();
+ }
+ });
+ developer._clockValue = 0;
+ const _result = Symbol('_result');
+ const _errorCode = Symbol('_errorCode');
+ const _errorDetail = Symbol('_errorDetail');
+ const _isError = Symbol('_isError');
+ const _toString = Symbol('_toString');
+ developer.ServiceExtensionResponse = class ServiceExtensionResponse extends core.Object {
+ result(result) {
+ this[_result] = result;
+ this[_errorCode] = null;
+ this[_errorDetail] = null;
+ if (!(typeof this[_result] == 'string')) {
+ dart.throw(new core.ArgumentError.value(this[_result], "result", "Must be a String"));
+ }
+ }
+ error(errorCode, errorDetail) {
+ this[_result] = null;
+ this[_errorCode] = errorCode;
+ this[_errorDetail] = errorDetail;
+ developer.ServiceExtensionResponse._validateErrorCode(this[_errorCode]);
+ if (!(typeof this[_errorDetail] == 'string')) {
+ dart.throw(new core.ArgumentError.value(this[_errorDetail], "errorDetail", "Must be a String"));
+ }
+ }
+ static _errorCodeMessage(errorCode) {
+ developer.ServiceExtensionResponse._validateErrorCode(errorCode);
+ if (errorCode == developer.ServiceExtensionResponse.kInvalidParams) {
+ return "Invalid params";
+ }
+ return "Server error";
+ }
+ static _validateErrorCode(errorCode) {
+ if (!(typeof errorCode == 'number')) {
+ dart.throw(new core.ArgumentError.value(errorCode, "errorCode", "Must be an int"));
+ }
+ if (errorCode == developer.ServiceExtensionResponse.invalidParams) {
+ return;
+ }
+ if (dart.notNull(errorCode) >= developer.ServiceExtensionResponse.extensionErrorMin && dart.notNull(errorCode) <= developer.ServiceExtensionResponse.extensionErrorMax) {
+ return;
+ }
+ dart.throw(new core.ArgumentError.value(errorCode, "errorCode", "Out of range"));
+ }
+ [_isError]() {
+ return this[_errorCode] != null && this[_errorDetail] != null;
+ }
+ [_toString]() {
+ if (this[_result] != null) {
+ return this[_result];
+ } else {
+ dart.assert(this[_errorCode] != null);
+ dart.assert(this[_errorDetail] != null);
+ return convert.JSON.encode(dart.map({code: this[_errorCode], message: developer.ServiceExtensionResponse._errorCodeMessage(this[_errorCode]), data: dart.map({details: this[_errorDetail]}, core.String, core.String)}, core.String, core.Object));
+ }
+ }
+ };
+ dart.defineNamedConstructor(developer.ServiceExtensionResponse, 'result');
+ dart.defineNamedConstructor(developer.ServiceExtensionResponse, 'error');
+ dart.setSignature(developer.ServiceExtensionResponse, {
+ constructors: () => ({
+ result: dart.definiteFunctionType(developer.ServiceExtensionResponse, [core.String]),
+ error: dart.definiteFunctionType(developer.ServiceExtensionResponse, [core.int, core.String])
+ }),
+ fields: () => ({
+ [_result]: core.String,
+ [_errorCode]: core.int,
+ [_errorDetail]: core.String
+ }),
+ methods: () => ({
+ [_isError]: dart.definiteFunctionType(core.bool, []),
+ [_toString]: dart.definiteFunctionType(core.String, [])
+ }),
+ sfields: () => ({
+ kInvalidParams: core.int,
+ kExtensionError: core.int,
+ kExtensionErrorMax: core.int,
+ kExtensionErrorMin: core.int,
+ invalidParams: core.int,
+ extensionError: core.int,
+ extensionErrorMax: core.int,
+ extensionErrorMin: core.int
+ }),
+ statics: () => ({
+ _errorCodeMessage: dart.definiteFunctionType(core.String, [core.int]),
+ _validateErrorCode: dart.definiteFunctionType(dart.dynamic, [core.int])
+ }),
+ names: ['_errorCodeMessage', '_validateErrorCode']
+ });
+ developer.ServiceExtensionResponse.invalidParams = -32602;
+ developer.ServiceExtensionResponse.extensionError = -32000;
+ developer.ServiceExtensionResponse.extensionErrorMax = -32000;
+ developer.ServiceExtensionResponse.extensionErrorMin = -32016;
+ dart.defineLazy(developer.ServiceExtensionResponse, {
+ get kInvalidParams() {
+ return developer.ServiceExtensionResponse.invalidParams;
+ },
+ get kExtensionError() {
+ return developer.ServiceExtensionResponse.extensionError;
+ },
+ get kExtensionErrorMax() {
+ return developer.ServiceExtensionResponse.extensionErrorMax;
+ },
+ get kExtensionErrorMin() {
+ return developer.ServiceExtensionResponse.extensionErrorMin;
+ }
+ });
+ developer.ServiceExtensionHandler = dart.typedef('ServiceExtensionHandler', () => dart.functionType(async.Future$(developer.ServiceExtensionResponse), [core.String, MapOfString$String()]));
+ developer.registerExtension = function(method, handler) {
+ if (!(typeof method == 'string')) {
+ dart.throw(new core.ArgumentError.value(method, 'method', 'Must be a String'));
+ }
+ if (!dart.test(method[dartx.startsWith]('ext.'))) {
+ dart.throw(new core.ArgumentError.value(method, 'method', 'Must begin with ext.'));
+ }
+ if (developer._lookupExtension(method) != null) {
+ dart.throw(new core.ArgumentError(dart.str`Extension already registered: ${method}`));
+ }
+ if (!developer.ServiceExtensionHandler.is(handler)) {
+ dart.throw(new core.ArgumentError.value(handler, 'handler', 'Must be a ServiceExtensionHandler'));
+ }
+ developer._registerExtension(method, handler);
+ };
+ dart.fn(developer.registerExtension, StringAndServiceExtensionHandlerTovoid());
+ developer.postEvent = function(eventKind, eventData) {
+ if (!(typeof eventKind == 'string')) {
+ dart.throw(new core.ArgumentError.value(eventKind, 'eventKind', 'Must be a String'));
+ }
+ if (!core.Map.is(eventData)) {
+ dart.throw(new core.ArgumentError.value(eventData, 'eventData', 'Must be a Map'));
+ }
+ let eventDataAsString = convert.JSON.encode(eventData);
+ developer._postEvent(eventKind, eventDataAsString);
+ };
+ dart.fn(developer.postEvent, StringAndMapTovoid());
+ developer._postEvent = function(eventKind, eventData) {
+ };
+ dart.fn(developer._postEvent, StringAndStringTodynamic());
+ developer._lookupExtension = function(method) {
+ return developer._extensions[dartx._get](method);
+ };
+ dart.fn(developer._lookupExtension, StringToServiceExtensionHandler());
+ developer._registerExtension = function(method, handler) {
+ developer._extensions[dartx._set](method, handler);
+ };
+ dart.fn(developer._registerExtension, StringAndServiceExtensionHandlerTodynamic());
+ developer.UserTag = class UserTag extends core.Object {
+ static new(label) {
+ return developer._FakeUserTag.new(label);
+ }
+ static get defaultTag() {
+ return developer._FakeUserTag._defaultTag;
+ }
+ };
+ dart.setSignature(developer.UserTag, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.UserTag, [core.String])}),
+ sfields: () => ({MAX_USER_TAGS: core.int}),
+ sgetters: () => ({defaultTag: dart.definiteFunctionType(developer.UserTag, [])})
+ });
+ developer.UserTag.MAX_USER_TAGS = 64;
+ developer._FakeUserTag = class _FakeUserTag extends core.Object {
+ real(label) {
+ this.label = label;
+ }
+ static new(label) {
+ let existingTag = developer._FakeUserTag._instances[dartx._get](label);
+ if (existingTag != null) {
+ return developer._FakeUserTag._check(existingTag);
+ }
+ if (developer._FakeUserTag._instances[dartx.length] == developer.UserTag.MAX_USER_TAGS) {
+ dart.throw(new core.UnsupportedError(dart.str`UserTag instance limit (${developer.UserTag.MAX_USER_TAGS}) reached.`));
+ }
+ let instance = new developer._FakeUserTag.real(label);
+ developer._FakeUserTag._instances[dartx._set](label, instance);
+ return instance;
+ }
+ makeCurrent() {
+ let old = developer._currentTag;
+ developer._currentTag = this;
+ return old;
+ }
+ };
+ dart.defineNamedConstructor(developer._FakeUserTag, 'real');
+ developer._FakeUserTag[dart.implements] = () => [developer.UserTag];
+ dart.setSignature(developer._FakeUserTag, {
+ constructors: () => ({
+ real: dart.definiteFunctionType(developer._FakeUserTag, [core.String]),
+ new: dart.definiteFunctionType(developer._FakeUserTag, [core.String])
+ }),
+ fields: () => ({label: core.String}),
+ methods: () => ({makeCurrent: dart.definiteFunctionType(developer.UserTag, [])}),
+ sfields: () => ({
+ _instances: core.Map,
+ _defaultTag: developer.UserTag
+ })
+ });
+ dart.defineLazy(developer._FakeUserTag, {
+ get _instances() {
+ return dart.map();
+ },
+ set _instances(_) {},
+ get _defaultTag() {
+ return developer._FakeUserTag.new('Default');
+ }
+ });
+ dart.defineLazy(developer, {
+ get _currentTag() {
+ return developer._FakeUserTag._defaultTag;
+ },
+ set _currentTag(_) {}
+ });
+ developer.getCurrentTag = function() {
+ return developer._currentTag;
+ };
+ dart.fn(developer.getCurrentTag, VoidToUserTag());
+ developer.Metric = class Metric extends core.Object {
+ new(name, description) {
+ this.name = name;
+ this.description = description;
+ if (this.name == 'vm' || dart.test(this.name[dartx.contains]('/'))) {
+ dart.throw(new core.ArgumentError('Invalid Metric name.'));
+ }
+ }
+ };
+ dart.setSignature(developer.Metric, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.Metric, [core.String, core.String])}),
+ fields: () => ({
+ name: core.String,
+ description: core.String
+ })
+ });
+ const _value$0 = Symbol('_value');
+ const _toJSON = Symbol('_toJSON');
+ developer.Gauge = class Gauge extends developer.Metric {
+ get value() {
+ return this[_value$0];
+ }
+ set value(v) {
+ if (dart.notNull(v) < dart.notNull(this.min)) {
+ v = this.min;
+ } else if (dart.notNull(v) > dart.notNull(this.max)) {
+ v = this.max;
+ }
+ this[_value$0] = v;
+ }
+ new(name, description, min, max) {
+ this.min = min;
+ this.max = max;
+ this[_value$0] = null;
+ super.new(name, description);
+ if (!(typeof this.min == 'number')) {
+ dart.throw(new core.ArgumentError('min must be a double'));
+ }
+ if (!(typeof this.max == 'number')) {
+ dart.throw(new core.ArgumentError('max must be a double'));
+ }
+ if (!(dart.notNull(this.min) < dart.notNull(this.max))) {
+ dart.throw(new core.ArgumentError('min must be less than max'));
+ }
+ this[_value$0] = this.min;
+ }
+ [_toJSON]() {
+ let map = dart.map({type: 'Gauge', id: dart.str`metrics/${this.name}`, name: this.name, description: this.description, value: this.value, min: this.min, max: this.max}, core.String, core.Object);
+ return map;
+ }
+ };
+ dart.setSignature(developer.Gauge, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.Gauge, [core.String, core.String, core.double, core.double])}),
+ fields: () => ({
+ min: core.double,
+ max: core.double,
+ [_value$0]: core.double
+ }),
+ getters: () => ({value: dart.definiteFunctionType(core.double, [])}),
+ setters: () => ({value: dart.definiteFunctionType(dart.void, [core.double])}),
+ methods: () => ({[_toJSON]: dart.definiteFunctionType(core.Map, [])})
+ });
+ developer.Counter = class Counter extends developer.Metric {
+ new(name, description) {
+ this[_value$0] = 0.0;
+ super.new(name, description);
+ }
+ get value() {
+ return this[_value$0];
+ }
+ set value(v) {
+ this[_value$0] = v;
+ }
+ [_toJSON]() {
+ let map = dart.map({type: 'Counter', id: dart.str`metrics/${this.name}`, name: this.name, description: this.description, value: this.value}, core.String, core.Object);
+ return map;
+ }
+ };
+ dart.setSignature(developer.Counter, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.Counter, [core.String, core.String])}),
+ fields: () => ({[_value$0]: core.double}),
+ getters: () => ({value: dart.definiteFunctionType(core.double, [])}),
+ setters: () => ({value: dart.definiteFunctionType(dart.void, [core.double])}),
+ methods: () => ({[_toJSON]: dart.definiteFunctionType(core.Map, [])})
+ });
+ developer.Metrics = class Metrics extends core.Object {
+ static register(metric) {
+ if (!developer.Metric.is(metric)) {
+ dart.throw(new core.ArgumentError('metric must be a Metric'));
+ }
+ if (developer.Metrics._metrics[dartx._get](metric.name) != null) {
+ dart.throw(new core.ArgumentError('Registered metrics have unique names'));
+ }
+ developer.Metrics._metrics[dartx._set](metric.name, metric);
+ }
+ static deregister(metric) {
+ if (!developer.Metric.is(metric)) {
+ dart.throw(new core.ArgumentError('metric must be a Metric'));
+ }
+ developer.Metrics._metrics[dartx.remove](metric.name);
+ }
+ static _printMetric(id) {
+ let metric = developer.Metrics._metrics[dartx._get](id);
+ if (metric == null) {
+ return null;
+ }
+ return convert.JSON.encode(metric[_toJSON]());
+ }
+ static _printMetrics() {
+ let metrics = [];
+ for (let metric of developer.Metrics._metrics[dartx.values]) {
+ metrics[dartx.add](metric[_toJSON]());
+ }
+ let map = dart.map({type: 'MetricList', metrics: metrics}, core.String, core.Object);
+ return convert.JSON.encode(map);
+ }
+ };
+ dart.setSignature(developer.Metrics, {
+ sfields: () => ({_metrics: MapOfString$Metric()}),
+ statics: () => ({
+ register: dart.definiteFunctionType(dart.void, [developer.Metric]),
+ deregister: dart.definiteFunctionType(dart.void, [developer.Metric]),
+ _printMetric: dart.definiteFunctionType(core.String, [core.String]),
+ _printMetrics: dart.definiteFunctionType(core.String, [])
+ }),
+ names: ['register', 'deregister', '_printMetric', '_printMetrics']
+ });
+ dart.defineLazy(developer.Metrics, {
+ get _metrics() {
+ return MapOfString$Metric().new();
+ }
+ });
+ developer._isProduct = false;
+ developer.TimelineSyncFunction = dart.typedef('TimelineSyncFunction', () => dart.functionType(dart.dynamic, []));
+ developer.TimelineAsyncFunction = dart.typedef('TimelineAsyncFunction', () => dart.functionType(async.Future, []));
+ const _appendArguments = Symbol('_appendArguments');
+ developer.Timeline = class Timeline extends core.Object {
+ static startSync(name, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ if (developer._isProduct) {
+ return;
+ }
+ if (!(typeof name == 'string')) {
+ dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
+ }
+ if (!dart.test(developer._isDartStreamEnabled())) {
+ developer.Timeline._stack[dartx.add](null);
+ return;
+ }
+ let block = new developer._SyncBlock._(name, developer._getTraceClock(), developer._getThreadCpuClock());
+ if (core.Map.is(arguments$)) {
+ block[_appendArguments](arguments$);
+ }
+ developer.Timeline._stack[dartx.add](block);
+ }
+ static finishSync() {
+ if (developer._isProduct) {
+ return;
+ }
+ if (developer.Timeline._stack[dartx.length] == 0) {
+ dart.throw(new core.StateError('Uneven calls to startSync and finishSync'));
+ }
+ let block = developer.Timeline._stack[dartx.removeLast]();
+ if (block == null) {
+ return;
+ }
+ block.finish();
+ }
+ static instantSync(name, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ if (developer._isProduct) {
+ return;
+ }
+ if (!(typeof name == 'string')) {
+ dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
+ }
+ if (!dart.test(developer._isDartStreamEnabled())) {
+ return;
+ }
+ let instantArguments = null;
+ if (core.Map.is(arguments$)) {
+ instantArguments = core.Map.from(arguments$);
+ }
+ developer._reportInstantEvent(developer._getTraceClock(), 'Dart', name, developer._argumentsAsJson(instantArguments));
+ }
+ static timeSync(name, func, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ developer.Timeline.startSync(name, {arguments: arguments$});
+ try {
+ return func();
+ } finally {
+ developer.Timeline.finishSync();
+ }
+ }
+ static get now() {
+ return developer._getTraceClock();
+ }
+ };
+ dart.setSignature(developer.Timeline, {
+ sfields: () => ({
+ _stack: ListOf_SyncBlock(),
+ _isolateId: core.int,
+ _isolateIdString: core.String
+ }),
+ sgetters: () => ({now: dart.definiteFunctionType(core.int, [])}),
+ statics: () => ({
+ startSync: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
+ finishSync: dart.definiteFunctionType(dart.void, []),
+ instantSync: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
+ timeSync: dart.definiteFunctionType(dart.dynamic, [core.String, developer.TimelineSyncFunction], {arguments: core.Map})
+ }),
+ names: ['startSync', 'finishSync', 'instantSync', 'timeSync']
+ });
+ dart.defineLazy(developer.Timeline, {
+ get _stack() {
+ return ListOf_SyncBlock().new();
+ },
+ get _isolateId() {
+ return developer._getIsolateNum();
+ },
+ get _isolateIdString() {
+ return dart.toString(developer.Timeline._isolateId);
+ }
+ });
+ const _stack = Symbol('_stack');
+ const _taskId = Symbol('_taskId');
+ const _start$1 = Symbol('_start');
+ const _finish = Symbol('_finish');
+ developer.TimelineTask = class TimelineTask extends core.Object {
+ new() {
+ this[_stack] = JSArrayOf_AsyncBlock().of([]);
+ this[_taskId] = developer._getNextAsyncId();
+ }
+ withTaskId(taskId) {
+ this[_stack] = JSArrayOf_AsyncBlock().of([]);
+ this[_taskId] = taskId;
+ if (!(typeof taskId == 'number')) {
+ dart.throw(new core.ArgumentError.value(taskId, 'taskId', 'Must be an int'));
+ }
+ }
+ start(name, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ if (developer._isProduct) {
+ return;
+ }
+ if (!(typeof name == 'string')) {
+ dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
+ }
+ let block = new developer._AsyncBlock._(name, this[_taskId]);
+ if (core.Map.is(arguments$)) {
+ block[_appendArguments](arguments$);
+ }
+ this[_stack][dartx.add](block);
+ block[_start$1]();
+ }
+ instant(name, opts) {
+ let arguments$ = opts && 'arguments' in opts ? opts.arguments : null;
+ if (developer._isProduct) {
+ return;
+ }
+ if (!(typeof name == 'string')) {
+ dart.throw(new core.ArgumentError.value(name, 'name', 'Must be a String'));
+ }
+ let instantArguments = null;
+ if (core.Map.is(arguments$)) {
+ instantArguments = core.Map.from(arguments$);
+ }
+ developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'n', 'Dart', name, developer._argumentsAsJson(instantArguments));
+ }
+ finish() {
+ if (developer._isProduct) {
+ return;
+ }
+ if (this[_stack][dartx.length] == 0) {
+ dart.throw(new core.StateError('Uneven calls to start and finish'));
+ }
+ let block = this[_stack][dartx.removeLast]();
+ block[_finish]();
+ }
+ pass() {
+ if (dart.notNull(this[_stack][dartx.length]) > 0) {
+ dart.throw(new core.StateError('You cannot pass a TimelineTask without finishing all started ' + 'operations'));
+ }
+ let r = this[_taskId];
+ return r;
+ }
+ };
+ dart.defineNamedConstructor(developer.TimelineTask, 'withTaskId');
+ dart.setSignature(developer.TimelineTask, {
+ constructors: () => ({
+ new: dart.definiteFunctionType(developer.TimelineTask, []),
+ withTaskId: dart.definiteFunctionType(developer.TimelineTask, [core.int])
+ }),
+ fields: () => ({
+ [_taskId]: core.int,
+ [_stack]: ListOf_AsyncBlock()
+ }),
+ methods: () => ({
+ start: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
+ instant: dart.definiteFunctionType(dart.void, [core.String], {arguments: core.Map}),
+ finish: dart.definiteFunctionType(dart.void, []),
+ pass: dart.definiteFunctionType(core.int, [])
+ })
+ });
+ const _arguments$ = Symbol('_arguments');
+ developer._AsyncBlock = class _AsyncBlock extends core.Object {
+ _(name, taskId) {
+ this.name = name;
+ this[_taskId] = taskId;
+ this.category = 'Dart';
+ this[_arguments$] = null;
+ }
+ [_start$1]() {
+ developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'b', this.category, this.name, developer._argumentsAsJson(this[_arguments$]));
+ }
+ [_finish]() {
+ developer._reportTaskEvent(developer._getTraceClock(), this[_taskId], 'e', this.category, this.name, developer._argumentsAsJson(null));
+ }
+ [_appendArguments](arguments$) {
+ if (this[_arguments$] == null) {
+ this[_arguments$] = dart.map();
+ }
+ this[_arguments$][dartx.addAll](arguments$);
+ }
+ };
+ dart.defineNamedConstructor(developer._AsyncBlock, '_');
+ dart.setSignature(developer._AsyncBlock, {
+ constructors: () => ({_: dart.definiteFunctionType(developer._AsyncBlock, [core.String, core.int])}),
+ fields: () => ({
+ category: core.String,
+ name: core.String,
+ [_taskId]: core.int,
+ [_arguments$]: core.Map
+ }),
+ methods: () => ({
+ [_start$1]: dart.definiteFunctionType(dart.void, []),
+ [_finish]: dart.definiteFunctionType(dart.void, []),
+ [_appendArguments]: dart.definiteFunctionType(dart.void, [core.Map])
+ })
+ });
+ const _startCpu = Symbol('_startCpu');
+ developer._SyncBlock = class _SyncBlock extends core.Object {
+ _(name, start, startCpu) {
+ this.name = name;
+ this[_start$1] = start;
+ this[_startCpu] = startCpu;
+ this.category = 'Dart';
+ this[_arguments$] = null;
+ }
+ finish() {
+ developer._reportCompleteEvent(this[_start$1], this[_startCpu], this.category, this.name, developer._argumentsAsJson(this[_arguments$]));
+ }
+ [_appendArguments](arguments$) {
+ if (arguments$ == null) {
+ return;
+ }
+ if (this[_arguments$] == null) {
+ this[_arguments$] = dart.map();
+ }
+ this[_arguments$][dartx.addAll](arguments$);
+ }
+ };
+ dart.defineNamedConstructor(developer._SyncBlock, '_');
+ dart.setSignature(developer._SyncBlock, {
+ constructors: () => ({_: dart.definiteFunctionType(developer._SyncBlock, [core.String, core.int, core.int])}),
+ fields: () => ({
+ category: core.String,
+ name: core.String,
+ [_arguments$]: core.Map,
+ [_start$1]: core.int,
+ [_startCpu]: core.int
+ }),
+ methods: () => ({
+ finish: dart.definiteFunctionType(dart.void, []),
+ [_appendArguments]: dart.definiteFunctionType(dart.void, [core.Map])
+ })
+ });
+ developer._fastPathArguments = null;
+ developer._argumentsAsJson = function(arguments$) {
+ if (arguments$ == null || arguments$[dartx.length] == 0) {
+ if (developer._fastPathArguments == null) {
+ developer._fastPathArguments = dart.str`{"isolateNumber":"${developer.Timeline._isolateId}"}`;
+ }
+ return developer._fastPathArguments;
+ }
+ arguments$[dartx._set]('isolateNumber', developer.Timeline._isolateIdString);
+ return convert.JSON.encode(arguments$);
+ };
+ dart.fn(developer._argumentsAsJson, MapToString());
+ developer._isDartStreamEnabled = function() {
+ return false;
+ };
+ dart.fn(developer._isDartStreamEnabled, VoidTobool());
+ developer._getNextAsyncId = function() {
+ return 0;
+ };
+ dart.fn(developer._getNextAsyncId, VoidToint());
+ developer._getTraceClock = function() {
+ let x = developer._clockValue;
+ developer._clockValue = dart.notNull(x) + 1;
+ return x;
+ };
+ dart.fn(developer._getTraceClock, VoidToint());
+ developer._getThreadCpuClock = function() {
+ return -1;
+ };
+ dart.fn(developer._getThreadCpuClock, VoidToint());
+ developer._getIsolateNum = function() {
+ return 0;
+ };
+ dart.fn(developer._getIsolateNum, VoidToint());
+ developer._reportTaskEvent = function(start, taskId, phase, category, name, argumentsAsJson) {
+ };
+ dart.fn(developer._reportTaskEvent, intAndintAndString__Tovoid());
+ developer._reportCompleteEvent = function(start, startCpu, category, name, argumentsAsJson) {
+ };
+ dart.fn(developer._reportCompleteEvent, intAndintAndString__Tovoid$());
+ developer._reportInstantEvent = function(start, category, name, argumentsAsJson) {
+ };
+ dart.fn(developer._reportInstantEvent, intAndStringAndString__Tovoid());
+ developer.ServiceProtocolInfo = class ServiceProtocolInfo extends core.Object {
+ new(serverUri) {
+ this.majorVersion = developer._getServiceMajorVersion();
+ this.minorVersion = developer._getServiceMinorVersion();
+ this.serverUri = serverUri;
+ }
+ toString() {
+ if (this.serverUri != null) {
+ return dart.str`Dart VM Service Protocol v${this.majorVersion}.${this.minorVersion} ` + dart.str`listening on ${this.serverUri}`;
+ } else {
+ return dart.str`Dart VM Service Protocol v${this.majorVersion}.${this.minorVersion}`;
+ }
+ }
+ };
+ dart.setSignature(developer.ServiceProtocolInfo, {
+ constructors: () => ({new: dart.definiteFunctionType(developer.ServiceProtocolInfo, [core.Uri])}),
+ fields: () => ({
+ majorVersion: core.int,
+ minorVersion: core.int,
+ serverUri: core.Uri
+ })
+ });
+ developer.Service = class Service extends core.Object {
+ static getInfo() {
+ return dart.async(function*() {
+ let receivePort = isolate.RawReceivePort.new();
+ let uriCompleter = CompleterOfUri().new();
+ receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
+ developer._getServerInfo(receivePort.sendPort);
+ let uri = (yield uriCompleter.future);
+ receivePort.close();
+ return new developer.ServiceProtocolInfo(uri);
+ }, developer.ServiceProtocolInfo);
+ }
+ static controlWebServer(opts) {
+ return dart.async(function*(opts) {
+ let enable = opts && 'enable' in opts ? opts.enable : false;
+ if (!(typeof enable == 'boolean')) {
+ dart.throw(new core.ArgumentError.value(enable, 'enable', 'Must be a bool'));
+ }
+ let receivePort = isolate.RawReceivePort.new();
+ let uriCompleter = CompleterOfUri().new();
+ receivePort.handler = dart.fn(uri => uriCompleter.complete(uri), UriTovoid());
+ developer._webServerControl(receivePort.sendPort, enable);
+ let uri = (yield uriCompleter.future);
+ receivePort.close();
+ return new developer.ServiceProtocolInfo(uri);
+ }, developer.ServiceProtocolInfo, opts);
+ }
+ };
+ dart.setSignature(developer.Service, {
+ statics: () => ({
+ getInfo: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), []),
+ controlWebServer: dart.definiteFunctionType(async.Future$(developer.ServiceProtocolInfo), [], {enable: core.bool})
+ }),
+ names: ['getInfo', 'controlWebServer']
+ });
+ developer._getServerInfo = function(sp) {
+ sp.send(null);
+ };
+ dart.lazyFn(developer._getServerInfo, () => SendPortTovoid());
+ developer._webServerControl = function(sp, enable) {
+ sp.send(null);
+ };
+ dart.lazyFn(developer._webServerControl, () => SendPortAndboolTovoid());
+ developer._getServiceMajorVersion = function() {
+ return 0;
+ };
+ dart.fn(developer._getServiceMajorVersion, VoidToint());
+ developer._getServiceMinorVersion = function() {
+ return 0;
+ };
+ dart.fn(developer._getServiceMinorVersion, VoidToint());
isolate.IsolateSpawnException = class IsolateSpawnException extends core.Object {
new(message) {
this.message = message;
@@ -56882,19 +57709,19 @@
statics: () => ({createElement_tag: dart.definiteFunctionType(dart.dynamic, [core.String, core.String])}),
names: ['createElement_tag']
});
- const _value$0 = Symbol('_value');
+ const _value$1 = Symbol('_value');
html$.ScrollAlignment = class ScrollAlignment extends core.Object {
_internal(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
}
toString() {
- return dart.str`ScrollAlignment.${this[_value$0]}`;
+ return dart.str`ScrollAlignment.${this[_value$1]}`;
}
};
dart.defineNamedConstructor(html$.ScrollAlignment, '_internal');
dart.setSignature(html$.ScrollAlignment, {
constructors: () => ({_internal: dart.definiteFunctionType(html$.ScrollAlignment, [dart.dynamic])}),
- fields: () => ({[_value$0]: dart.dynamic}),
+ fields: () => ({[_value$1]: dart.dynamic}),
sfields: () => ({
TOP: html$.ScrollAlignment,
CENTER: html$.ScrollAlignment,
@@ -80155,43 +80982,43 @@
const _unit = Symbol('_unit');
html$.Dimension = class Dimension extends core.Object {
percent(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = '%';
}
px(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'px';
}
pc(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'pc';
}
pt(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'pt';
}
inch(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'in';
}
cm(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'cm';
}
mm(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'mm';
}
em(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'em';
}
ex(value) {
- this[_value$0] = value;
+ this[_value$1] = value;
this[_unit] = 'ex';
}
css(cssValue) {
- this[_value$0] = null;
+ this[_value$1] = null;
this[_unit] = null;
if (cssValue == '') cssValue = '0px';
if (dart.test(cssValue[dartx.endsWith]('%'))) {
@@ -80200,16 +81027,16 @@
this[_unit] = cssValue[dartx.substring](dart.notNull(cssValue[dartx.length]) - 2);
}
if (dart.test(cssValue[dartx.contains]('.'))) {
- this[_value$0] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
+ this[_value$1] = core.double.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
} else {
- this[_value$0] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
+ this[_value$1] = core.int.parse(cssValue[dartx.substring](0, dart.notNull(cssValue[dartx.length]) - dart.notNull(this[_unit][dartx.length])));
}
}
toString() {
- return dart.str`${this[_value$0]}${this[_unit]}`;
+ return dart.str`${this[_value$1]}${this[_unit]}`;
}
get value() {
- return this[_value$0];
+ return this[_value$1];
}
};
dart.defineNamedConstructor(html$.Dimension, 'percent');
@@ -80236,7 +81063,7 @@
css: dart.definiteFunctionType(html$.Dimension, [core.String])
}),
fields: () => ({
- [_value$0]: core.num,
+ [_value$1]: core.num,
[_unit]: core.String
}),
getters: () => ({value: dart.definiteFunctionType(core.num, [])})
@@ -94850,6 +95677,7 @@
exports.collection = collection;
exports.convert = convert;
exports.core = core;
+ exports.developer = developer;
exports.isolate = isolate;
exports.js = js;
exports.js_util = js_util;
diff --git a/pkg/dev_compiler/lib/sdk/ddc_sdk.sum b/pkg/dev_compiler/lib/sdk/ddc_sdk.sum
index fda5a6d..5c8c4f1 100644
--- a/pkg/dev_compiler/lib/sdk/ddc_sdk.sum
+++ b/pkg/dev_compiler/lib/sdk/ddc_sdk.sum
Binary files differ
diff --git a/pkg/dev_compiler/lib/src/compiler/code_generator.dart b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
index 361f5ec..0bbe9ed 100644
--- a/pkg/dev_compiler/lib/src/compiler/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/compiler/code_generator.dart
@@ -124,6 +124,7 @@
final ClassElement numClass;
final ClassElement objectClass;
final ClassElement stringClass;
+ final ClassElement symbolClass;
ConstFieldVisitor _constants;
@@ -164,6 +165,7 @@
nullClass = _getLibrary(c, 'dart:core').getType('Null'),
objectClass = _getLibrary(c, 'dart:core').getType('Object'),
stringClass = _getLibrary(c, 'dart:core').getType('String'),
+ symbolClass = _getLibrary(c, 'dart:_internal').getType('Symbol'),
dartJSLibrary = _getLibrary(c, 'dart:js');
LibraryElement get currentLibrary => _loader.currentElement.library;
@@ -324,11 +326,8 @@
elementJSName = getAnnotationName(e, isPublicJSAnnotation) ?? '';
}
- if (e is TopLevelVariableElement &&
- e.getter != null &&
- (e.getter.isExternal ||
- findAnnotation(e.getter, isPublicJSAnnotation) != null)) {
- elementJSName = getAnnotationName(e.getter, isPublicJSAnnotation) ?? '';
+ if (e is TopLevelVariableElement) {
+ elementJSName = _jsInteropStaticMemberName(e);
}
if (elementJSName == null) return null;
@@ -353,6 +352,38 @@
return access;
}
+ String _jsInteropStaticMemberName(Element e, {String name}) {
+ if (e == null ||
+ e.library == null ||
+ findAnnotation(e.library, isPublicJSAnnotation) == null) {
+ return null;
+ }
+ if (e is PropertyInducingElement) {
+ // Assume properties have consistent JS names for getters and setters.
+ return _jsInteropStaticMemberName(e.getter, name: e.name) ??
+ _jsInteropStaticMemberName(e.setter, name: e.name);
+ }
+ if (e is ExecutableElement &&
+ e.isExternal &&
+ findAnnotation(e, isPublicJSAnnotation) != null) {
+ return getAnnotationName(e, isPublicJSAnnotation) ?? name ?? e.name;
+ }
+ return null;
+ }
+
+ JS.Expression _emitJSInteropStaticMemberName(Element e) {
+ var name = _jsInteropStaticMemberName(e);
+ if (name == null) return null;
+ // We do not support statics names with JS annotations containing dots.
+ // See https://github.com/dart-lang/sdk/issues/27926
+ if (name.contains('.')) {
+ throw new UnimplementedError(
+ 'We do not support JS annotations containing dots on static members. '
+ 'See https://github.com/dart-lang/sdk/issues/27926');
+ }
+ return js.string(name);
+ }
+
/// Flattens blocks in [items] to a single list.
///
/// This will not flatten blocks that are marked as being scopes.
@@ -2705,7 +2736,8 @@
if (element is ClassMemberElement && element is! ConstructorElement) {
bool isStatic = element.isStatic;
var type = element.enclosingElement.type;
- var member = _emitMemberName(name, isStatic: isStatic, type: type);
+ var member = _emitMemberName(name,
+ isStatic: isStatic, type: type, element: element);
if (isStatic) {
var dynType = _emitStaticAccess(type);
@@ -3271,7 +3303,8 @@
ClassElement classElement = element.enclosingElement;
var type = classElement.type;
var dynType = _emitStaticAccess(type);
- var member = _emitMemberName(element.name, isStatic: true, type: type);
+ var member = _emitMemberName(element.name,
+ isStatic: true, type: type, element: element);
return _visit(rhs).toAssignExpression(
annotate(new JS.PropertyAccess(dynType, member), lhs));
}
@@ -3282,7 +3315,7 @@
JS.Expression jsTarget, Element element, JS.Expression value) {
String memberName = element.name;
var type = (element.enclosingElement as ClassElement).type;
- var name = _emitMemberName(memberName, type: type);
+ var name = _emitMemberName(memberName, type: type, element: element);
return value.toAssignExpression(
annotate(new JS.PropertyAccess(jsTarget, name), lhs));
}
@@ -3430,21 +3463,25 @@
return _emitStaticAccess(
(element.enclosingElement as ClassElement).type);
}
+ if (element is FieldElement) {
+ return _emitStaticAccess(element.enclosingElement.type);
+ }
}
return _visit(target);
}
- /// Emits a (possibly generic) instance method call.
+ /// Emits a (possibly generic) instance, or static method call.
JS.Expression _emitMethodCallInternal(
Expression target,
MethodInvocation node,
List<JS.Expression> args,
List<JS.Expression> typeArgs) {
var type = getStaticType(target);
- var name = node.methodName.name;
var element = node.methodName.staticElement;
bool isStatic = element is ExecutableElement && element.isStatic;
- var memberName = _emitMemberName(name, type: type, isStatic: isStatic);
+ var name = node.methodName.name;
+ var memberName =
+ _emitMemberName(name, type: type, isStatic: isStatic, element: element);
JS.Expression jsTarget = _emitTarget(target, element, isStatic);
if (isDynamicInvoke(target) || isDynamicInvoke(node.methodName)) {
@@ -4807,7 +4844,7 @@
String memberName, List<JS.Expression> typeArgs) {
bool isStatic = member is ClassMemberElement && member.isStatic;
var name = _emitMemberName(memberName,
- type: getStaticType(target), isStatic: isStatic);
+ type: getStaticType(target), isStatic: isStatic, element: member);
if (isDynamicInvoke(target)) {
if (_inWhitelistCode(target)) {
var vars = <JS.MetaLetVariable, JS.Expression>{};
@@ -5192,11 +5229,17 @@
@override
visitSymbolLiteral(SymbolLiteral node) {
JS.Expression emitSymbol() {
- // TODO(vsm): When we canonicalize, we need to treat private symbols
- // correctly.
+ // TODO(vsm): Handle qualified symbols correctly.
+ var last = node.components.last.toString();
var name = js.string(node.components.join('.'), "'");
- return js
- .call('#.new(#)', [_emitConstructorAccess(types.symbolType), name]);
+ if (last.startsWith('_')) {
+ var nativeSymbol = _emitPrivateNameSymbol(currentLibrary, last);
+ return js.call('new #.es6(#, #)',
+ [_emitConstructorAccess(symbolClass.type), name, nativeSymbol]);
+ } else {
+ return js
+ .call('#.new(#)', [_emitConstructorAccess(types.symbolType), name]);
+ }
}
return _emitConst(emitSymbol);
@@ -5426,9 +5469,14 @@
/// helper, that checks for null. The user defined method is called '=='.
///
JS.Expression _emitMemberName(String name,
- {DartType type, bool isStatic: false, bool useExtension}) {
- // Static members skip the rename steps.
- if (isStatic) return _propertyName(name);
+ {DartType type,
+ bool isStatic: false,
+ bool useExtension,
+ Element element}) {
+ // Static members skip the rename steps and may require JS interop renames.
+ if (isStatic) {
+ return _emitJSInteropStaticMemberName(element) ?? _propertyName(name);
+ }
if (name.startsWith('_')) {
return _emitPrivateNameSymbol(currentLibrary, name);
diff --git a/pkg/dev_compiler/test/codegen/language/parameter_initializer5_negative_test.dart b/pkg/dev_compiler/test/codegen/language/parameter_initializer5_test.dart
similarity index 66%
rename from pkg/dev_compiler/test/codegen/language/parameter_initializer5_negative_test.dart
rename to pkg/dev_compiler/test/codegen/language/parameter_initializer5_test.dart
index afa5e2a..eb7208d 100644
--- a/pkg/dev_compiler/test/codegen/language/parameter_initializer5_negative_test.dart
+++ b/pkg/dev_compiler/test/codegen/language/parameter_initializer5_test.dart
@@ -1,15 +1,17 @@
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
// 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.
+//
+// DartOptions=--initializing-formal-access
+// VMOptions=--initializing-formal-access
-// Fails because this.x parameter is used in initializer expression.
+// Use the this.x parameter in an initializer expression.
class Foo {
var x, y;
Foo(this.x): y = x { }
}
-
main() {
new Foo(12);
}
diff --git a/pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_rename_static_test.dart b/pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_rename_static_test.dart
new file mode 100644
index 0000000..99c3bac
--- /dev/null
+++ b/pkg/dev_compiler/test/codegen/lib/html/js_typed_interop_rename_static_test.dart
@@ -0,0 +1,95 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+@JS()
+library js_typed_interop_rename_static_test;
+
+import 'dart:html';
+
+import 'package:js/js.dart';
+import 'package:js/js_util.dart' as js_util;
+import 'package:expect/minitest.dart';
+
+@JS('JSTopLevelField')
+external set topLevelFieldOnlySetter(v);
+
+@JS('JSTopLevelField')
+external get topLevelFieldOnlyGetter;
+
+@JS()
+external get topLevelFieldNoRename;
+
+@JS()
+external set topLevelSetterNoRename(v);
+
+@JS()
+external topLevelMethod(v);
+
+@JS('topLevelMethod')
+external renamedTopLevelMethod(v);
+
+@JS('JSFoo')
+class Foo {
+ @JS('JSBar')
+ external static get bar;
+
+ @JS('JSBar')
+ external static set bar(v);
+
+ @JS('JSBar2')
+ external static get bar2;
+
+ @JS('JSBaz')
+ external static set baz(v);
+
+ @JS('JSMethodAddBar')
+ external static addBar(a);
+}
+
+main() {
+ document.body.append(new ScriptElement()
+ ..type = 'text/javascript'
+ ..innerHtml = r"""
+window.JSFoo = {
+ 'JSBar': 42,
+ 'JSBar2': 80,
+ 'JSMethodAddBar': function(a,b) { return a + this.JSBar; }
+};
+window.JSTopLevelField = 91;
+window.topLevelFieldNoRename = 8;
+window.topLevelMethod = function(a) { return a * 2; };
+""");
+
+ group('rename static', () {
+ test('getter', () {
+ expect(Foo.bar, equals(42));
+ expect(Foo.bar2, equals(80));
+ expect(topLevelFieldOnlyGetter, 91);
+ expect(topLevelFieldNoRename, 8);
+ });
+
+ test('setter', () {
+ Foo.baz = 100;
+ expect(js_util.getProperty(js_util.getProperty(window, 'JSFoo'), 'JSBaz'),
+ equals(100));
+ Foo.bar = 30;
+ expect(Foo.bar, equals(30));
+ expect(js_util.getProperty(js_util.getProperty(window, 'JSFoo'), 'JSBar'),
+ equals(30));
+ topLevelFieldOnlySetter = 83;
+ expect(topLevelFieldOnlyGetter, 83);
+ topLevelSetterNoRename = 10;
+ expect(js_util.getProperty(window, 'topLevelSetterNoRename'), 10);
+ });
+
+ test('method', () {
+ Foo.bar = 100;
+ expect(Foo.addBar(10), equals(110));
+ Foo.bar = 200;
+ expect(Foo.addBar(10), equals(210));
+ expect(topLevelMethod(10), equals(20));
+ expect(renamedTopLevelMethod(10), equals(20));
+ });
+ });
+}
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/mixin_simple_test.dart b/pkg/dev_compiler/test/codegen/lib/mirrors/mixin_simple_test.dart
new file mode 100644
index 0000000..7edcbe4
--- /dev/null
+++ b/pkg/dev_compiler/test/codegen/lib/mirrors/mixin_simple_test.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+library test.mixin;
+
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+class Super {}
+class Mixin {}
+class Mixin2 {}
+
+class Class extends Super with Mixin {}
+class MultipleMixins extends Class with Mixin2 {}
+
+main() {
+ Expect.equals(reflectClass(Class),
+ reflectClass(Class).mixin);
+ Expect.equals(reflectClass(Mixin),
+ reflectClass(Class).superclass.mixin);
+ Expect.equals(reflectClass(Super),
+ reflectClass(Class).superclass.superclass.mixin);
+
+ Expect.equals(reflectClass(MultipleMixins),
+ reflectClass(MultipleMixins).mixin);
+ Expect.equals(reflectClass(Mixin2),
+ reflectClass(MultipleMixins).superclass.mixin);
+ Expect.equals(reflectClass(Class),
+ reflectClass(MultipleMixins).superclass.superclass.mixin);
+ Expect.equals(reflectClass(Mixin),
+ reflectClass(MultipleMixins).superclass.superclass.superclass
+ .mixin);
+ Expect.equals(reflectClass(Super),
+ reflectClass(MultipleMixins).superclass.superclass.superclass
+ .superclass.mixin);
+}
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/private_field_helper.dart b/pkg/dev_compiler/test/codegen/lib/mirrors/private_field_helper.dart
new file mode 100644
index 0000000..8c82450
--- /dev/null
+++ b/pkg/dev_compiler/test/codegen/lib/mirrors/private_field_helper.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+library test.mixin;
+
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+class Bar {
+ String _field = "hello";
+ String get field => _field;
+}
+
+var privateSymbol2 = #_field;
+var publicSymbol2 = #field;
+
diff --git a/pkg/dev_compiler/test/codegen/lib/mirrors/private_field_test.dart b/pkg/dev_compiler/test/codegen/lib/mirrors/private_field_test.dart
new file mode 100644
index 0000000..14c110c
--- /dev/null
+++ b/pkg/dev_compiler/test/codegen/lib/mirrors/private_field_test.dart
@@ -0,0 +1,36 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+library test.mixin;
+
+import 'dart:mirrors';
+
+import 'package:expect/expect.dart';
+
+import 'private_field_helper.dart';
+
+class Foo extends Bar {
+ int _field = 42;
+
+ static int _staticField = 99;
+}
+
+var privateSymbol = #_field;
+var publicSymbol = #field;
+
+main() {
+ Expect.equals(publicSymbol, publicSymbol2);
+ Expect.notEquals(privateSymbol, privateSymbol2);
+
+ var foo = new Foo();
+ var m = reflect(foo);
+ m.setField(privateSymbol, 38);
+ Expect.equals(38, foo._field);
+ m.setField(privateSymbol2, "world");
+ Expect.equals("world", foo.field);
+ Expect.equals("world", m.getField(publicSymbol).reflectee);
+
+ var type = reflectClass(Foo);
+ Expect.equals(99, type.getField(#_staticField).reflectee);
+}
diff --git a/pkg/dev_compiler/test/codegen_test.dart b/pkg/dev_compiler/test/codegen_test.dart
index 80a1a8a..b0a74ae 100644
--- a/pkg/dev_compiler/test/codegen_test.dart
+++ b/pkg/dev_compiler/test/codegen_test.dart
@@ -20,6 +20,7 @@
StringLiteral,
UriBasedDirective,
parseDirectives;
+import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer/src/generated/source.dart' show Source;
import 'package:args/args.dart' show ArgParser, ArgResults;
import 'package:dev_compiler/src/analyzer/context.dart'
@@ -351,5 +352,7 @@
uriContent = uriContent.trim();
directive.uriContent = uriContent;
}
- return directive.validate() == null ? uriContent : null;
+ return (directive as UriBasedDirectiveImpl).validate() == null
+ ? uriContent
+ : null;
}
diff --git a/pkg/dev_compiler/test/not_yet_strong_tests.dart b/pkg/dev_compiler/test/not_yet_strong_tests.dart
index d6d3976..0769af7 100644
--- a/pkg/dev_compiler/test/not_yet_strong_tests.dart
+++ b/pkg/dev_compiler/test/not_yet_strong_tests.dart
@@ -2345,7 +2345,6 @@
'language/parameter_initializer2_negative_test',
'language/parameter_initializer3_negative_test',
'language/parameter_initializer4_negative_test',
- 'language/parameter_initializer5_negative_test',
'language/parameter_initializer6_negative_test',
'language/prefix11_negative_test',
'language/prefix12_negative_test',
diff --git a/pkg/dev_compiler/tool/build_sdk.dart b/pkg/dev_compiler/tool/build_sdk.dart
index 7041b38..1b2b2cc 100644
--- a/pkg/dev_compiler/tool/build_sdk.dart
+++ b/pkg/dev_compiler/tool/build_sdk.dart
@@ -35,6 +35,7 @@
'dart:collection',
'dart:convert',
'dart:core',
+ 'dart:developer',
'dart:isolate',
'dart:js',
'dart:js_util',
diff --git a/pkg/dev_compiler/tool/global_compile.dart b/pkg/dev_compiler/tool/global_compile.dart
index b604099..56f1b0a 100644
--- a/pkg/dev_compiler/tool/global_compile.dart
+++ b/pkg/dev_compiler/tool/global_compile.dart
@@ -14,6 +14,7 @@
StringLiteral,
UriBasedDirective,
parseDirectives;
+import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:args/args.dart' show ArgParser;
import 'package:path/path.dart' as path;
@@ -257,7 +258,9 @@
uriContent = uriContent.trim();
directive.uriContent = uriContent;
}
- return directive.validate() == null ? uriContent : null;
+ return (directive as UriBasedDirectiveImpl).validate() == null
+ ? uriContent
+ : null;
}
String _loadFile(String uri, String packageRoot) {
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/_internal/libraries.dart b/pkg/dev_compiler/tool/input_sdk/lib/_internal/libraries.dart
index 2814a08..4e56e9f 100644
--- a/pkg/dev_compiler/tool/input_sdk/lib/_internal/libraries.dart
+++ b/pkg/dev_compiler/tool/input_sdk/lib/_internal/libraries.dart
@@ -42,6 +42,11 @@
maturity: Maturity.STABLE,
dart2jsPatchPath: "_internal/compiler/js_lib/core_patch.dart"),
+ "developer": const LibraryInfo(
+ "developer/developer.dart",
+ maturity: Maturity.STABLE,
+ dart2jsPatchPath: "_internal/js_runtime/lib/developer_patch.dart"),
+
"html": const LibraryInfo(
"html/dart2js/html_dart2js.dart",
category: "Client",
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/developer/developer.dart b/pkg/dev_compiler/tool/input_sdk/lib/developer/developer.dart
new file mode 100644
index 0000000..47ea5ba
--- /dev/null
+++ b/pkg/dev_compiler/tool/input_sdk/lib/developer/developer.dart
@@ -0,0 +1,60 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+/// Interact with developer tools such as the debugger and inspector.
+///
+/// The dart:developer library is _unstable_ and its API might change slightly
+/// as a result of developer feedback. This library is platform dependent and
+/// therefore it has implementations for both dart2js and the Dart VM. Both are
+/// under development and may not support all operations yet.
+///
+/// To use this library in your code:
+///
+/// import 'dart:developer';
+///
+library dart.developer;
+
+import 'dart:async';
+import 'dart:convert';
+import 'dart:isolate' show RawReceivePort, SendPort;
+
+part 'extension.dart';
+part 'profiler.dart';
+part 'timeline.dart';
+part 'service.dart';
+
+/// If [when] is true, stop the program as if a breakpoint were hit at the
+/// following statement.
+///
+/// Returns the value of [when]. Some debuggers may display [message].
+///
+/// NOTE: When invoked, the isolate will not return until a debugger
+/// continues execution. When running in the Dart VM the behaviour is the same
+/// regardless of whether or not a debugger is connected. When compiled to
+/// JavaScript, this uses the "debugger" statement, and behaves exactly as
+/// that does.
+external bool debugger({bool when: true, String message});
+
+/// Send a reference to [object] to any attached debuggers.
+///
+/// Debuggers may open an inspector on the object. Returns the argument.
+external Object inspect(Object object);
+
+/// Emit a log event.
+/// [message] is the log message.
+/// [time] (optional) is the timestamp.
+/// [sequenceNumber] (optional) is a monotonically increasing sequence number.
+/// [level] (optional) is the severity level (value between 0 and 2000).
+/// [name] (optional) is the name of the source of the log message.
+/// [zone] (optional) the zone where the log was emitted
+/// [error] (optional) an error object associated with this log event.
+/// [stackTrace] (optional) a stack trace associated with this log event.
+external void log(String message,
+ {DateTime time,
+ int sequenceNumber,
+ int level: 0,
+ String name: '',
+ Zone zone,
+ Object error,
+ StackTrace stackTrace});
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/developer/extension.dart b/pkg/dev_compiler/tool/input_sdk/lib/developer/extension.dart
new file mode 100644
index 0000000..5883fb5
--- /dev/null
+++ b/pkg/dev_compiler/tool/input_sdk/lib/developer/extension.dart
@@ -0,0 +1,177 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+part of dart.developer;
+
+/// A response to a service protocol extension RPC.
+///
+/// If the RPC was successful, use [ServiceExtensionResponse.result], otherwise
+/// use [ServiceExtensionResponse.error].
+class ServiceExtensionResponse {
+ final String _result;
+ final int _errorCode;
+ final String _errorDetail;
+
+ /// Creates a successful response to a service protocol extension RPC.
+ ///
+ /// Requires [result] to be a JSON object encoded as a string. When forming
+ /// the JSON-RPC message [result] will be inlined directly.
+ ServiceExtensionResponse.result(String result)
+ : _result = result,
+ _errorCode = null,
+ _errorDetail = null {
+ if (_result is! String) {
+ throw new ArgumentError.value(_result, "result", "Must be a String");
+ }
+ }
+
+ /// Creates an error response to a service protocol extension RPC.
+ ///
+ /// Requires [errorCode] to be [invalidParams] or between [extensionErrorMin]
+ /// and [extensionErrorMax]. Requires [errorDetail] to be a JSON object
+ /// encoded as a string. When forming the JSON-RPC message [errorDetail] will
+ /// be inlined directly.
+ ServiceExtensionResponse.error(int errorCode, String errorDetail)
+ : _result = null,
+ _errorCode = errorCode,
+ _errorDetail = errorDetail {
+ _validateErrorCode(_errorCode);
+ if (_errorDetail is! String) {
+ throw new ArgumentError.value(_errorDetail,
+ "errorDetail",
+ "Must be a String");
+ }
+ }
+
+ /// Invalid method parameter(s) error code.
+ @deprecated static const kInvalidParams = invalidParams;
+ /// Generic extension error code.
+ @deprecated static const kExtensionError = extensionError;
+ /// Maximum extension provided error code.
+ @deprecated static const kExtensionErrorMax = extensionErrorMax;
+ /// Minimum extension provided error code.
+ @deprecated static const kExtensionErrorMin = extensionErrorMin;
+
+ /// Invalid method parameter(s) error code.
+ static const invalidParams = -32602;
+ /// Generic extension error code.
+ static const extensionError = -32000;
+ /// Maximum extension provided error code.
+ static const extensionErrorMax = -32000;
+ /// Minimum extension provided error code.
+ static const extensionErrorMin = -32016;
+
+
+ static String _errorCodeMessage(int errorCode) {
+ _validateErrorCode(errorCode);
+ if (errorCode == kInvalidParams) {
+ return "Invalid params";
+ }
+ return "Server error";
+ }
+
+ static _validateErrorCode(int errorCode) {
+ if (errorCode is! int) {
+ throw new ArgumentError.value(errorCode, "errorCode", "Must be an int");
+ }
+ if (errorCode == invalidParams) {
+ return;
+ }
+ if ((errorCode >= extensionErrorMin) &&
+ (errorCode <= extensionErrorMax)) {
+ return;
+ }
+ throw new ArgumentError.value(errorCode, "errorCode", "Out of range");
+ }
+
+ bool _isError() => (_errorCode != null) && (_errorDetail != null);
+
+ String _toString() {
+ if (_result != null) {
+ return _result;
+ } else {
+ assert(_errorCode != null);
+ assert(_errorDetail != null);
+ return JSON.encode({
+ 'code': _errorCode,
+ 'message': _errorCodeMessage(_errorCode),
+ 'data': {
+ 'details': _errorDetail
+ }
+ });
+ }
+ }
+}
+
+/// A service protocol extension handler. Registered with [registerExtension].
+///
+/// Must complete to a [ServiceExtensionResponse].
+///
+/// [method] - the method name of the service protocol request.
+/// [parameters] - A map holding the parameters to the service protocol request.
+///
+/// *NOTE*: All parameter names and values are **encoded as strings**.
+typedef Future<ServiceExtensionResponse>
+ ServiceExtensionHandler(String method, Map<String, String> parameters);
+
+/// Register a [ServiceExtensionHandler] that will be invoked in this isolate
+/// for [method]. *NOTE*: Service protocol extensions must be registered
+/// in each isolate.
+///
+/// *NOTE*: [method] must begin with 'ext.' and you should use the following
+/// structure to avoid conflicts with other packages: 'ext.package.command'.
+/// That is, immediately following the 'ext.' prefix, should be the registering
+/// package name followed by another period ('.') and then the command name.
+/// For example: 'ext.dart.io.getOpenFiles'.
+///
+/// Because service extensions are isolate specific, clients using extensions
+/// must always include an 'isolateId' parameter with each RPC.
+void registerExtension(String method, ServiceExtensionHandler handler) {
+ if (method is! String) {
+ throw new ArgumentError.value(method,
+ 'method',
+ 'Must be a String');
+ }
+ if (!method.startsWith('ext.')) {
+ throw new ArgumentError.value(method,
+ 'method',
+ 'Must begin with ext.');
+ }
+ if (_lookupExtension(method) != null) {
+ throw new ArgumentError('Extension already registered: $method');
+ }
+ if (handler is! ServiceExtensionHandler) {
+ throw new ArgumentError.value(handler,
+ 'handler',
+ 'Must be a ServiceExtensionHandler');
+ }
+ _registerExtension(method, handler);
+}
+
+/// Post an event of [eventKind] with payload of [eventData] to the `Extension`
+/// event stream.
+void postEvent(String eventKind, Map eventData) {
+ if (eventKind is! String) {
+ throw new ArgumentError.value(eventKind,
+ 'eventKind',
+ 'Must be a String');
+ }
+ if (eventData is! Map) {
+ throw new ArgumentError.value(eventData,
+ 'eventData',
+ 'Must be a Map');
+ }
+ String eventDataAsString = JSON.encode(eventData);
+ _postEvent(eventKind, eventDataAsString);
+}
+
+external _postEvent(String eventKind, String eventData);
+
+// Both of these functions are written inside C++ to avoid updating the data
+// structures in Dart, getting an OOB, and observing stale state. Do not move
+// these into Dart code unless you can ensure that the operations will can be
+// done atomically. Native code lives in vm/isolate.cc-
+// LookupServiceExtensionHandler and RegisterServiceExtensionHandler.
+external ServiceExtensionHandler _lookupExtension(String method);
+external _registerExtension(String method, ServiceExtensionHandler handler);
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/developer/profiler.dart b/pkg/dev_compiler/tool/input_sdk/lib/developer/profiler.dart
new file mode 100644
index 0000000..566d015
--- /dev/null
+++ b/pkg/dev_compiler/tool/input_sdk/lib/developer/profiler.dart
@@ -0,0 +1,197 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+part of dart.developer;
+
+/// A UserTag can be used to group samples in the Observatory profiler.
+abstract class UserTag {
+ /// The maximum number of UserTag instances that can be created by a program.
+ static const MAX_USER_TAGS = 64;
+
+ factory UserTag(String label) => new _FakeUserTag(label);
+
+ /// Label of [this].
+ String get label;
+
+ /// Make [this] the current tag for the isolate. Returns the current tag
+ /// before setting.
+ UserTag makeCurrent();
+
+ /// The default [UserTag] with label 'Default'.
+ static UserTag get defaultTag => _FakeUserTag._defaultTag;
+}
+
+// This is a fake implementation of UserTag so that code can compile and run
+// in dart2js.
+class _FakeUserTag implements UserTag {
+ static Map _instances = {};
+
+ _FakeUserTag.real(this.label);
+
+ factory _FakeUserTag(String label) {
+ // Canonicalize by name.
+ var existingTag = _instances[label];
+ if (existingTag != null) {
+ return existingTag;
+ }
+ // Throw an exception if we've reached the maximum number of user tags.
+ if (_instances.length == UserTag.MAX_USER_TAGS) {
+ throw new UnsupportedError(
+ 'UserTag instance limit (${UserTag.MAX_USER_TAGS}) reached.');
+ }
+ // Create a new instance and add it to the instance map.
+ var instance = new _FakeUserTag.real(label);
+ _instances[label] = instance;
+ return instance;
+ }
+
+ final String label;
+
+ UserTag makeCurrent() {
+ var old = _currentTag;
+ _currentTag = this;
+ return old;
+ }
+
+ static final UserTag _defaultTag = new _FakeUserTag('Default');
+}
+
+var _currentTag = _FakeUserTag._defaultTag;
+
+/// Returns the current [UserTag] for the isolate.
+UserTag getCurrentTag() {
+ return _currentTag;
+}
+
+/// Abstract [Metric] class. Metric names must be unique, are hierarchical,
+/// and use periods as separators. For example, 'a.b.c'. Uniqueness is only
+/// enforced when a Metric is registered. The name of a metric cannot contain
+/// the slash ('/') character.
+abstract class Metric {
+ /// [name] of this metric.
+ final String name;
+ /// [description] of this metric.
+ final String description;
+
+ Metric(this.name, this.description) {
+ if ((name == 'vm') || name.contains('/')) {
+ throw new ArgumentError('Invalid Metric name.');
+ }
+
+ }
+
+ Map _toJSON();
+}
+
+/// A measured value with a min and max. Initial value is min. Value will
+/// be clamped to the interval [min, max].
+class Gauge extends Metric {
+ final double min;
+ final double max;
+
+ double _value;
+ double get value => _value;
+ set value(double v) {
+ if (v < min) {
+ v = min;
+ } else if (v > max) {
+ v = max;
+ }
+ _value = v;
+ }
+
+ Gauge(String name, String description, this.min, this.max)
+ : super(name, description) {
+ if (min is! double) {
+ throw new ArgumentError('min must be a double');
+ }
+ if (max is! double) {
+ throw new ArgumentError('max must be a double');
+ }
+ if (!(min < max)) {
+ throw new ArgumentError('min must be less than max');
+ }
+ _value = min;
+ }
+
+ Map _toJSON() {
+ var map = {
+ 'type': 'Gauge',
+ 'id': 'metrics/$name',
+ 'name': name,
+ 'description': description,
+ 'value': value,
+ 'min': min,
+ 'max': max,
+ };
+ return map;
+ }
+}
+
+
+/// A changing value. Initial value is 0.0.
+class Counter extends Metric {
+ Counter(String name, String description)
+ : super(name, description);
+
+ double _value = 0.0;
+ double get value => _value;
+ set value(double v) {
+ _value = v;
+ }
+
+ Map _toJSON() {
+ var map = {
+ 'type': 'Counter',
+ 'id': 'metrics/$name',
+ 'name': name,
+ 'description': description,
+ 'value': value,
+ };
+ return map;
+ }
+}
+
+class Metrics {
+ static final Map<String, Metric> _metrics = new Map<String, Metric>();
+
+ /// Register [Metric]s to make them visible to Observatory.
+ static void register(Metric metric) {
+ if (metric is! Metric) {
+ throw new ArgumentError('metric must be a Metric');
+ }
+ if (_metrics[metric.name] != null) {
+ throw new ArgumentError('Registered metrics have unique names');
+ }
+ _metrics[metric.name] = metric;
+ }
+
+ /// Deregister [Metric]s to make them not visible to Observatory.
+ static void deregister(Metric metric) {
+ if (metric is! Metric) {
+ throw new ArgumentError('metric must be a Metric');
+ }
+ _metrics.remove(metric.name);
+ }
+
+ static String _printMetric(String id) {
+ var metric = _metrics[id];
+ if (metric == null) {
+ return null;
+ }
+ return JSON.encode(metric._toJSON());
+ }
+
+ static String _printMetrics() {
+ var metrics = [];
+ for (var metric in _metrics.values) {
+ metrics.add(metric._toJSON());
+ }
+ var map = {
+ 'type': 'MetricList',
+ 'metrics': metrics,
+ };
+ return JSON.encode(map);
+ }
+}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/developer/service.dart b/pkg/dev_compiler/tool/input_sdk/lib/developer/service.dart
new file mode 100644
index 0000000..9ccf0dc
--- /dev/null
+++ b/pkg/dev_compiler/tool/input_sdk/lib/developer/service.dart
@@ -0,0 +1,89 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+part of dart.developer;
+
+/// Service protocol is the protocol that a client like the observatory
+/// could use to access the services provided by the Dart VM for
+/// debugging and inspecting Dart programs. This class encapsulates the
+/// version number and Uri for accessing this service.
+class ServiceProtocolInfo {
+ /// The major version of the protocol. If the running Dart environment does
+ /// not support the service protocol, this is 0.
+ final int majorVersion = _getServiceMajorVersion();
+ /// The minor version of the protocol. If the running Dart environment does
+ /// not support the service protocol, this is 0.
+ final int minorVersion = _getServiceMinorVersion();
+ /// The Uri to access the service. If the web server is not running, this
+ /// will be null.
+ final Uri serverUri;
+
+ ServiceProtocolInfo(this.serverUri);
+
+ String toString() {
+ if (serverUri != null) {
+ return 'Dart VM Service Protocol v$majorVersion.$minorVersion '
+ 'listening on $serverUri';
+ } else {
+ return 'Dart VM Service Protocol v$majorVersion.$minorVersion';
+ }
+ }
+}
+
+/// Access information about the service protocol and control the web server
+/// that provides access to the services provided by the Dart VM for
+/// debugging and inspecting Dart programs.
+class Service {
+ /// Get information about the service protocol (version number and
+ /// Uri to access the service).
+ static Future<ServiceProtocolInfo> getInfo() async {
+ // Port to receive response from service isolate.
+ final RawReceivePort receivePort = new RawReceivePort();
+ final Completer<Uri> uriCompleter = new Completer<Uri>();
+ receivePort.handler = (Uri uri) => uriCompleter.complete(uri);
+ // Request the information from the service isolate.
+ _getServerInfo(receivePort.sendPort);
+ // Await the response from the service isolate.
+ Uri uri = await uriCompleter.future;
+ // Close the port.
+ receivePort.close();
+ return new ServiceProtocolInfo(uri);
+ }
+
+ /// Control the web server that the service protocol is accessed through.
+ /// The [enable] argument must be a boolean and is used as a toggle to
+ /// enable(true) or disable(false) the web server servicing requests.
+ static Future<ServiceProtocolInfo> controlWebServer(
+ {bool enable: false}) async {
+ if (enable is! bool) {
+ throw new ArgumentError.value(enable,
+ 'enable',
+ 'Must be a bool');
+ }
+ // Port to receive response from service isolate.
+ final RawReceivePort receivePort = new RawReceivePort();
+ final Completer<Uri> uriCompleter = new Completer<Uri>();
+ receivePort.handler = (Uri uri) => uriCompleter.complete(uri);
+ // Request the information from the service isolate.
+ _webServerControl(receivePort.sendPort, enable);
+ // Await the response from the service isolate.
+ Uri uri = await uriCompleter.future;
+ // Close the port.
+ receivePort.close();
+ return new ServiceProtocolInfo(uri);
+ }
+}
+
+/// [sp] will receive a Uri or null.
+external void _getServerInfo(SendPort sp);
+
+/// [sp] will receive a Uri or null.
+external void _webServerControl(SendPort sp, bool enable);
+
+/// Returns the major version of the service protocol.
+external int _getServiceMajorVersion();
+
+/// Returns the minor version of the service protocol.
+external int _getServiceMinorVersion();
+
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/developer/timeline.dart b/pkg/dev_compiler/tool/input_sdk/lib/developer/timeline.dart
new file mode 100644
index 0000000..b6118af
--- /dev/null
+++ b/pkg/dev_compiler/tool/input_sdk/lib/developer/timeline.dart
@@ -0,0 +1,328 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+part of dart.developer;
+
+const bool _isProduct = const bool.fromEnvironment("dart.vm.product");
+
+typedef dynamic TimelineSyncFunction();
+typedef Future TimelineAsyncFunction();
+
+/// Add to the timeline.
+class Timeline {
+ /// Start a synchronous operation labeled [name]. Optionally takes
+ /// a [Map] of [arguments]. This operation must be finished before
+ /// returning to the event queue.
+ static void startSync(String name, {Map arguments}) {
+ if (_isProduct) {
+ return;
+ }
+ if (name is! String) {
+ throw new ArgumentError.value(name,
+ 'name',
+ 'Must be a String');
+ }
+ if (!_isDartStreamEnabled()) {
+ // Push a null onto the stack and return.
+ _stack.add(null);
+ return;
+ }
+ var block = new _SyncBlock._(name, _getTraceClock(), _getThreadCpuClock());
+ if (arguments is Map) {
+ block._appendArguments(arguments);
+ }
+ _stack.add(block);
+ }
+
+ /// Finish the last synchronous operation that was started.
+ static void finishSync() {
+ if (_isProduct) {
+ return;
+ }
+ if (_stack.length == 0) {
+ throw new StateError(
+ 'Uneven calls to startSync and finishSync');
+ }
+ // Pop top item off of stack.
+ var block = _stack.removeLast();
+ if (block == null) {
+ // Dart stream was disabled when startSync was called.
+ return;
+ }
+ // Finish it.
+ block.finish();
+ }
+
+ /// Emit an instant event.
+ static void instantSync(String name, {Map arguments}) {
+ if (_isProduct) {
+ return;
+ }
+ if (name is! String) {
+ throw new ArgumentError.value(name,
+ 'name',
+ 'Must be a String');
+ }
+ if (!_isDartStreamEnabled()) {
+ // Stream is disabled.
+ return;
+ }
+ Map instantArguments;
+ if (arguments is Map) {
+ instantArguments = new Map.from(arguments);
+ }
+ _reportInstantEvent(_getTraceClock(),
+ 'Dart',
+ name,
+ _argumentsAsJson(instantArguments));
+ }
+
+
+ /// A utility method to time a synchronous [function]. Internally calls
+ /// [function] bracketed by calls to [startSync] and [finishSync].
+ static dynamic timeSync(String name,
+ TimelineSyncFunction function,
+ {Map arguments}) {
+ startSync(name, arguments: arguments);
+ try {
+ return function();
+ } finally {
+ finishSync();
+ }
+ }
+
+ /// The current time stamp from the clock used by the timeline. Units are
+ /// microseconds.
+ static int get now => _getTraceClock();
+ static final List<_SyncBlock> _stack = new List<_SyncBlock>();
+ static final int _isolateId = _getIsolateNum();
+ static final String _isolateIdString = _isolateId.toString();
+}
+
+/// An asynchronous task on the timeline. An asynchronous task can have many
+/// (nested) synchronous operations. Synchronous operations can live longer than
+/// the current isolate event. To pass a [TimelineTask] to another isolate,
+/// you must first call [pass] to get the task id and then construct a new
+/// [TimelineTask] in the other isolate.
+class TimelineTask {
+ /// Create a task. [taskId] will be set by the system.
+ TimelineTask()
+ : _taskId = _getNextAsyncId() {
+ }
+
+ /// Create a task with an explicit [taskId]. This is useful if you are
+ /// passing a task from one isolate to another.
+ TimelineTask.withTaskId(int taskId)
+ : _taskId = taskId {
+ if (taskId is! int) {
+ throw new ArgumentError.value(taskId,
+ 'taskId',
+ 'Must be an int');
+ }
+ }
+
+ /// Start a synchronous operation within this task named [name].
+ /// Optionally takes a [Map] of [arguments].
+ void start(String name, {Map arguments}) {
+ if (_isProduct) {
+ return;
+ }
+ if (name is! String) {
+ throw new ArgumentError.value(name,
+ 'name',
+ 'Must be a String');
+ }
+ var block = new _AsyncBlock._(name, _taskId);
+ if (arguments is Map) {
+ block._appendArguments(arguments);
+ }
+ _stack.add(block);
+ block._start();
+ }
+
+ /// Emit an instant event for this task.
+ void instant(String name, {Map arguments}) {
+ if (_isProduct) {
+ return;
+ }
+ if (name is! String) {
+ throw new ArgumentError.value(name,
+ 'name',
+ 'Must be a String');
+ }
+ Map instantArguments;
+ if (arguments is Map) {
+ instantArguments = new Map.from(arguments);
+ }
+ _reportTaskEvent(_getTraceClock(),
+ _taskId,
+ 'n',
+ 'Dart',
+ name,
+ _argumentsAsJson(instantArguments));
+ }
+
+ /// Finish the last synchronous operation that was started.
+ void finish() {
+ if (_isProduct) {
+ return;
+ }
+ if (_stack.length == 0) {
+ throw new StateError(
+ 'Uneven calls to start and finish');
+ }
+ // Pop top item off of stack.
+ var block = _stack.removeLast();
+ block._finish();
+ }
+
+ /// Retrieve the [TimelineTask]'s task id. Will throw an exception if the
+ /// stack is not empty.
+ int pass() {
+ if (_stack.length > 0) {
+ throw new StateError(
+ 'You cannot pass a TimelineTask without finishing all started '
+ 'operations');
+ }
+ int r = _taskId;
+ return r;
+ }
+
+ final int _taskId;
+ final List<_AsyncBlock> _stack = [];
+}
+
+/// An asynchronous block of time on the timeline. This block can be kept
+/// open across isolate messages.
+class _AsyncBlock {
+ /// The category this block belongs to.
+ final String category = 'Dart';
+ /// The name of this block.
+ final String name;
+ /// The asynchronous task id.
+ final int _taskId;
+ /// An (optional) set of arguments which will be serialized to JSON and
+ /// associated with this block.
+ Map _arguments;
+
+ _AsyncBlock._(this.name, this._taskId);
+
+ // Emit the start event.
+ void _start() {
+ _reportTaskEvent(_getTraceClock(),
+ _taskId,
+ 'b',
+ category,
+ name,
+ _argumentsAsJson(_arguments));
+ }
+
+ // Emit the finish event.
+ void _finish() {
+ _reportTaskEvent(_getTraceClock(),
+ _taskId,
+ 'e',
+ category,
+ name,
+ _argumentsAsJson(null));
+ }
+
+ void _appendArguments(Map arguments) {
+ if (_arguments == null) {
+ _arguments = {};
+ }
+ _arguments.addAll(arguments);
+ }
+}
+
+/// A synchronous block of time on the timeline. This block should not be
+/// kept open across isolate messages.
+class _SyncBlock {
+ /// The category this block belongs to.
+ final String category = 'Dart';
+ /// The name of this block.
+ final String name;
+ /// An (optional) set of arguments which will be serialized to JSON and
+ /// associated with this block.
+ Map _arguments;
+ // The start time stamp.
+ final int _start;
+ // The start time stamp of the thread cpu clock.
+ final int _startCpu;
+
+ _SyncBlock._(this.name,
+ this._start,
+ this._startCpu);
+
+ /// Finish this block of time. At this point, this block can no longer be
+ /// used.
+ void finish() {
+ // Report event to runtime.
+ _reportCompleteEvent(_start,
+ _startCpu,
+ category,
+ name,
+ _argumentsAsJson(_arguments));
+ }
+
+ void _appendArguments(Map arguments) {
+ if (arguments == null) {
+ return;
+ }
+ if (_arguments == null) {
+ _arguments = {};
+ }
+ _arguments.addAll(arguments);
+ }
+}
+
+String _fastPathArguments;
+String _argumentsAsJson(Map arguments) {
+ if ((arguments == null) || (arguments.length == 0)) {
+ // Fast path no arguments. Avoid calling JSON.encode.
+ if (_fastPathArguments == null) {
+ _fastPathArguments = '{"isolateNumber":"${Timeline._isolateId}"}';
+ }
+ return _fastPathArguments;
+ }
+ // Add isolateNumber to arguments map.
+ arguments['isolateNumber'] = Timeline._isolateIdString;
+ return JSON.encode(arguments);
+}
+
+/// Returns true if the Dart Timeline stream is enabled.
+external bool _isDartStreamEnabled();
+
+/// Returns the next async task id.
+external int _getNextAsyncId();
+
+/// Returns the current value from the trace clock.
+external int _getTraceClock();
+
+/// Returns the current value from the thread CPU usage clock.
+external int _getThreadCpuClock();
+
+/// Returns the isolate's main port number.
+external int _getIsolateNum();
+
+/// Reports an event for a task.
+external void _reportTaskEvent(int start,
+ int taskId,
+ String phase,
+ String category,
+ String name,
+ String argumentsAsJson);
+
+/// Reports a complete synchronous event.
+external void _reportCompleteEvent(int start,
+ int startCpu,
+ String category,
+ String name,
+ String argumentsAsJson);
+
+/// Reports an instant event.
+external void _reportInstantEvent(int start,
+ String category,
+ String name,
+ String argumentsAsJson);
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/internal/symbol.dart b/pkg/dev_compiler/tool/input_sdk/lib/internal/symbol.dart
index 6722d98..b1aa855 100644
--- a/pkg/dev_compiler/tool/input_sdk/lib/internal/symbol.dart
+++ b/pkg/dev_compiler/tool/input_sdk/lib/internal/symbol.dart
@@ -15,6 +15,9 @@
class Symbol implements core.Symbol {
final String _name;
+ // Used internally by DDC to map ES6 symbols to Dart.
+ final dynamic _nativeSymbol;
+
/**
* Source of RegExp matching Dart reserved words.
*
@@ -95,22 +98,28 @@
* The empty symbol is handled before this regexp is used, and is not
* accepted.
*/
- static final RegExp symbolPattern = new RegExp(
- '^(?:$operatorRE\$|$identifierRE(?:=?\$|[.](?!\$)))+?\$');
+ static final RegExp symbolPattern =
+ new RegExp('^(?:$operatorRE\$|$identifierRE(?:=?\$|[.](?!\$)))+?\$');
external const Symbol(String name);
+ external const Symbol.es6(String name, nativeSymbol);
+
/**
* Platform-private method used by the mirror system to create
* otherwise invalid names.
*/
- const Symbol.unvalidated(this._name);
+ const Symbol.unvalidated(this._name) : this._nativeSymbol = null;
// This is called by dart2js.
Symbol.validated(String name)
- : this._name = validatePublicSymbol(name);
+ : this._name = validatePublicSymbol(name),
+ this._nativeSymbol = null;
- bool operator ==(Object other) => other is Symbol && _name == other._name;
+ bool operator ==(Object other) =>
+ other is Symbol &&
+ _name == other._name &&
+ _nativeSymbol == other._nativeSymbol;
external int get hashCode;
@@ -119,6 +128,8 @@
/// Platform-private accessor which cannot be called from user libraries.
static String getName(Symbol symbol) => symbol._name;
+ static dynamic getNativeSymbol(Symbol symbol) => symbol._nativeSymbol;
+
static String validatePublicSymbol(String name) {
if (name.isEmpty || publicSymbolPattern.hasMatch(name)) return name;
if (name.startsWith('_')) {
@@ -127,8 +138,7 @@
// message.
throw new ArgumentError('"$name" is a private identifier');
}
- throw new ArgumentError(
- '"$name" is not a valid (qualified) symbol name');
+ throw new ArgumentError('"$name" is not a valid (qualified) symbol name');
}
/**
diff --git a/pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart
new file mode 100644
index 0000000..93f19fb
--- /dev/null
+++ b/pkg/dev_compiler/tool/input_sdk/patch/developer_patch.dart
@@ -0,0 +1,127 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+// Patch file for dart:developer library.
+
+import 'dart:_js_helper' show patch, ForceInline;
+import 'dart:_foreign_helper' show JS;
+
+@patch
+// @ForceInline()
+bool debugger({bool when: true, String message}) {
+ if (when) {
+ JS('', 'debugger');
+ }
+ return when;
+}
+
+@patch
+Object inspect(Object object) {
+ return object;
+}
+
+@patch
+void log(String message,
+ {DateTime time,
+ int sequenceNumber,
+ int level: 0,
+ String name: '',
+ Zone zone,
+ Object error,
+ StackTrace stackTrace}) {
+ // TODO.
+}
+
+final _extensions = new Map<String, ServiceExtensionHandler>();
+
+@patch
+ServiceExtensionHandler _lookupExtension(String method) {
+ return _extensions[method];
+}
+
+@patch
+_registerExtension(String method, ServiceExtensionHandler handler) {
+ _extensions[method] = handler;
+}
+
+@patch
+_postEvent(String eventKind, String eventData) {
+ // TODO.
+}
+
+
+@patch
+bool _isDartStreamEnabled() {
+ return false;
+}
+
+@patch
+int _getTraceClock() {
+ // TODO.
+ return _clockValue++;
+}
+int _clockValue = 0;
+
+@patch
+int _getThreadCpuClock() {
+ return -1;
+}
+
+
+@patch
+void _reportCompleteEvent(int start,
+ int startCpu,
+ String category,
+ String name,
+ String argumentsAsJson) {
+ // TODO.
+}
+
+@patch
+void _reportInstantEvent(int start,
+ String category,
+ String name,
+ String argumentsAsJson) {
+ // TODO.
+}
+
+@patch
+int _getNextAsyncId() {
+ return 0;
+}
+
+@patch
+int _getIsolateNum() {
+ return 0;
+}
+
+@patch
+void _reportTaskEvent(int start,
+ int taskId,
+ String phase,
+ String category,
+ String name,
+ String argumentsAsJson) {
+ // TODO.
+}
+
+@patch
+int _getServiceMajorVersion() {
+ return 0;
+}
+
+@patch
+int _getServiceMinorVersion() {
+ return 0;
+}
+
+@patch
+void _getServerInfo(SendPort sp) {
+ sp.send(null);
+}
+
+@patch
+void _webServerControl(SendPort sp, bool enable) {
+ sp.send(null);
+}
diff --git a/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart
index e4fd296..22f67d3 100644
--- a/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart
+++ b/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart
@@ -11,7 +11,11 @@
class Symbol implements core.Symbol {
@patch
const Symbol(String name)
- : this._name = name;
+ : this._name = name, this._nativeSymbol = null;
+
+ @patch
+ const Symbol.es6(String name, dynamic nativeSymbol)
+ : this._name = name, this._nativeSymbol = nativeSymbol;
@patch
int get hashCode {
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart
index 1899f96..629db38 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart
@@ -64,12 +64,12 @@
/// The Symbol for storing type arguments on a specialized generic type.
final _mixins = JS('', 'Symbol("mixins")');
-getMixins(clazz) => JS('', '$clazz[$_mixins]');
+getMixins(clazz) => JS('', 'Object.hasOwnProperty.call(#, #) ? #[#] : null', clazz, _mixins, clazz, _mixins);
@JSExportName('implements')
final _implements = JS('', 'Symbol("implements")');
-getImplements(clazz) => JS('', '#[#]', clazz, _implements);
+getImplements(clazz) => JS('', 'Object.hasOwnProperty.call(#, #) ? #[#] : null', clazz, _implements, clazz, _implements);
/// The Symbol for storing type arguments on a specialized generic type.
final _typeArguments = JS('', 'Symbol("typeArguments")');
diff --git a/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart b/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart
index 6c985d7..8560096 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/js_mirrors.dart
@@ -71,71 +71,108 @@
return JS('', '#.definiteFunctionType(#, [])', _dart, type);
}
+dynamic _getMixins(type) {
+ return JS('', '#.getMixins(#, [])', _dart, type);
+}
+
typedef T _Lazy<T>();
+dynamic _getESSymbol(Symbol symbol) =>
+ _internal.Symbol.getNativeSymbol(symbol as _internal.Symbol);
+
+dynamic _getMember(Symbol symbol) {
+ var privateSymbol = _getESSymbol(symbol);
+ if (privateSymbol != null) {
+ return privateSymbol;
+ }
+ return getName(symbol);
+}
+
String _getNameForESSymbol(member) {
// Convert private JS symbol "Symbol(_foo)" to string "_foo".
+ assert(JS('bool', 'typeof # == "symbol"', member));
var str = member.toString();
assert(str.startsWith('Symbol(') && str.endsWith(')'));
return str.substring(7, str.length - 1);
}
-Map _toDartMap(data) {
+Symbol _getSymbolForESSymbol(member) {
+ var name = _getNameForESSymbol(member);
+ return new _internal.Symbol.es6(name, member);
+}
+
+// The [member] must be either a string (public) or an ES6 symbol (private).
+Symbol _getSymbolForMember(member) {
+ if (member is String) {
+ return new Symbol(member);
+ } else {
+ var name = _getNameForESSymbol(member);
+ return new _internal.Symbol.es6(name, member);
+ }
+}
+
+Map<Symbol, dynamic> _toDartMap(data) {
if (data == null) return {};
- var map = JS('Map', '#.map(#)', _dart, data);
+ var map = new Map<Symbol, dynamic>();
// Note: we recorded a map from fields/methods to their type and metadata.
// The key is a string name for public members but an ES6 symbol for private
// ones. That's works nicely for dynamic operations, but dart:mirrors expects
- // strings, so we convert back here.
+ // Dart symbols, so we convert here.
+ var publicMembers = JS('', 'Object.getOwnPropertyNames(#)', data);
+ for (var member in publicMembers) {
+ var symbol = new Symbol(member);
+ map[symbol] = JS('', '#[#]', data, member);
+ }
+
var privateMembers = JS('', 'Object.getOwnPropertySymbols(#)', data);
for (var member in privateMembers) {
- var name = _getNameForESSymbol(member);
- map[name] = JS('', '#[#]', data, member);
+ var symbol = _getSymbolForESSymbol(member);
+ map[symbol] = JS('', '#[#]', data, member);
}
return map;
}
-Map _getConstructors(obj) {
+Map<Symbol, dynamic> _getConstructors(obj) {
List sig = JS('', '#.getConstructorSig(#)', _dart, obj);
return _toDartMap(sig);
}
-Map _getFields(obj) {
+Map<Symbol, dynamic> _getFields(obj) {
List sig = JS('', '#.getFieldSig(#)', _dart, obj);
return _toDartMap(sig);
}
-Map _getMethods(obj) {
+Map<Symbol, dynamic> _getMethods(obj) {
List sig = JS('', '#.getMethodSig(#)', _dart, obj);
return _toDartMap(sig);
}
-Map _getGetters(obj) {
+Map<Symbol, dynamic> _getGetters(obj) {
List sig = JS('', '#.getGetterSig(#)', _dart, obj);
return _toDartMap(sig);
}
-Map _getSetters(obj) {
+Map<Symbol, dynamic> _getSetters(obj) {
List sig = JS('', '#.getSetterSig(#)', _dart, obj);
return _toDartMap(sig);
}
-Map _getStaticFields(obj) {
+Map<Symbol, dynamic> _getStaticFields(obj) {
List sig = JS('', '#.getStaticFieldSig(#)', _dart, obj);
return _toDartMap(sig);
}
-Map _getStatics(obj) {
+Map<Symbol, dynamic> _getStatics(obj) {
List sig = JS('', '#.getStaticSig(#)', _dart, obj);
return _toDartMap(sig);
}
-Map _getStaticGetters(obj) {
+Map<Symbol, dynamic> _getStaticGetters(obj) {
List sig = JS('', '#.getStaticGetterSig(#)', _dart, obj);
return _toDartMap(sig);
}
-Map _getStaticSetters(obj) {
+Map<Symbol, dynamic> _getStaticSetters(obj) {
List sig = JS('', '#.getStaticSetterSig(#)', _dart, obj);
return _toDartMap(sig);
}
@@ -211,21 +248,7 @@
// Returns a String for public members or an ES6 symbol for private members.
_getAccessor(dynamic reflectee, Symbol symbol, [List<dynamic> args,
Map<Symbol, dynamic> namedArgs]) {
- var name = getName(symbol);
- if (!name.startsWith('_')) return name;
-
- // TODO(vsm): Ideally, we'd record ES6 symbols properly during codegen if
- // mirrors is enabled. Here, we're trying to recover it from the receiver
- // instead.
- //
- // Get private fields and members. Members are on proto.
- var privateMembers = JS('', 'Object.getOwnPropertySymbols(#)', reflectee)
- ..addAll(JS('', 'Object.getOwnPropertySymbols(#.__proto__)', reflectee));
- for (var member in privateMembers) {
- var privateName = _getNameForESSymbol(member);
- if (name == privateName) return member;
- }
- return new NoSuchMethodError(reflectee, symbol, args, namedArgs);
+ return _getMember(symbol);
}
InstanceMirror getField(Symbol symbol) {
@@ -275,7 +298,7 @@
final dynamic _raw;
// TODO(vsm): Do this properly
- final ClassMirror mixin = null;
+ ClassMirror _mixin = null;
List<TypeMirror> _typeArguments;
List<InstanceMirror> _metadata;
@@ -305,67 +328,67 @@
_declarations = new Map<Symbol, DeclarationMirror>();
var unwrapped = _unwrap(_cls);
var constructors = _getConstructors(unwrapped);
- constructors.forEach((String name, ft) {
- var symbol = new Symbol(name);
- _declarations[symbol] = new JsMethodMirror._constructor(this, name, ft);
+ constructors.forEach((symbol, ft) {
+ var name = getName(symbol);
+ _declarations[symbol] = new JsMethodMirror._constructor(this, symbol, ft);
});
if (constructors.isEmpty) {
// Add a default
var name = 'new';
var ft = _defaultConstructorType(_unwrap(_cls));
var symbol = new Symbol(name);
- _declarations[symbol] = new JsMethodMirror._constructor(this, name, ft);
+ _declarations[symbol] = new JsMethodMirror._constructor(this, symbol, ft);
}
var fields = _getFields(unwrapped);
- fields.forEach((String name, t) {
- var symbol = new Symbol(name);
+ fields.forEach((symbol, t) {
var metadata = [];
if (t is List) {
metadata = t.skip(1).toList();
t = t[0];
}
- _declarations[symbol] = new JsVariableMirror._(name, _wrap(t), metadata);
+ _declarations[symbol] = new JsVariableMirror._(symbol, _wrap(t), metadata);
});
var methods = _getMethods(unwrapped);
- methods.forEach((String name, ft) {
- var symbol = new Symbol(name);
- _declarations[symbol] = new JsMethodMirror._instanceMethod(this, name, ft);
+ methods.forEach((symbol, ft) {
+ var name = getName(symbol);
+ _declarations[symbol] = new JsMethodMirror._instanceMethod(this, symbol, ft);
});
var getters = _getGetters(unwrapped);
- getters.forEach((String name, ft) {
- var symbol = new Symbol(name);
- _declarations[symbol] = new JsMethodMirror._instanceMethod(this, name, ft);
+ getters.forEach((symbol, ft) {
+ var name = getName(symbol);
+ _declarations[symbol] = new JsMethodMirror._instanceMethod(this, symbol, ft);
});
var setters = _getSetters(unwrapped);
- setters.forEach((String name, ft) {
- name += '=';
- var symbol = new Symbol(name);
- _declarations[symbol] = new JsMethodMirror._instanceMethod(this, name, ft);
+ setters.forEach((symbol, ft) {
+ var name = getName(symbol) + '=';
+ // Create a separate symbol for the setter.
+ symbol = new _internal.Symbol.es6(name, _getESSymbol(symbol));
+ _declarations[symbol] = new JsMethodMirror._instanceMethod(this, symbol, ft);
});
var staticFields = _getStaticFields(unwrapped);
- staticFields.forEach((String name, t) {
- var symbol = new Symbol(name);
+ staticFields.forEach((symbol, t) {
+ var name = getName(symbol);
var metadata = [];
if (t is List) {
metadata = t.skip(1).toList();
t = t[0];
}
- _declarations[symbol] = new JsVariableMirror._(name, _wrap(t), metadata);
+ _declarations[symbol] = new JsVariableMirror._(symbol, _wrap(t), metadata);
});
var statics = _getStatics(unwrapped);
- statics.forEach((String name, ft) {
- var symbol = new Symbol(name);
- _declarations[symbol] = new JsMethodMirror._staticMethod(this, name, ft);
+ statics.forEach((symbol, ft) {
+ var name = getName(symbol);
+ _declarations[symbol] = new JsMethodMirror._staticMethod(this, symbol, ft);
});
var staticGetters = _getStaticGetters(unwrapped);
- staticGetters.forEach((String name, ft) {
- var symbol = new Symbol(name);
- _declarations[symbol] = new JsMethodMirror._staticMethod(this, name, ft);
+ staticGetters.forEach((symbol, ft) {
+ var name = getName(symbol);
+ _declarations[symbol] = new JsMethodMirror._staticMethod(this, symbol, ft);
});
var staticSetters = _getStaticSetters(unwrapped);
- staticSetters.forEach((String name, ft) {
- var symbol = new Symbol(name);
- _declarations[symbol] = new JsMethodMirror._staticMethod(this, name, ft);
+ staticSetters.forEach((symbol, ft) {
+ var name = getName(symbol);
+ _declarations[symbol] = new JsMethodMirror._staticMethod(this, symbol, ft);
});
_declarations = new Map<Symbol, DeclarationMirror>.unmodifiable(_declarations);
}
@@ -455,23 +478,44 @@
}
}
+ ClassMirror get mixin {
+ if (_mixin != null) {
+ return _mixin;
+ }
+ var mixins = _getMixins(_unwrap(_cls));
+ if (mixins == null || mixins.isEmpty) {
+ // If there is no mixin, return this mirror per API.
+ _mixin = this;
+ return _mixin;
+ }
+ if (mixins.length > 1) {
+ throw new UnsupportedError("ClassMirror.mixin not yet supported for "
+ "classes ($_cls) with multiple mixins");
+ }
+ _mixin = reflectType(_wrap(mixins[0]));
+ return _mixin;
+ }
+
String toString() => "ClassMirror on '$_cls'";
}
class JsVariableMirror extends JsMirror implements VariableMirror {
+ final Symbol _symbol;
final String _name;
final TypeMirror type;
final List<InstanceMirror> metadata;
// TODO(vsm): Refactor this out.
- Symbol get simpleName => new Symbol(_name);
+ Symbol get simpleName => _symbol;
// TODO(vsm): Fix this
final bool isStatic = false;
final bool isFinal = false;
- JsVariableMirror._(this._name, Type t, List annotations)
- : type = reflectType(t),
+ JsVariableMirror._(Symbol symbol, Type t, List annotations)
+ : _symbol = symbol,
+ _name = getName(symbol),
+ type = reflectType(t),
metadata = new List<InstanceMirror>.unmodifiable(
annotations.map((a) => reflect(a)));
@@ -479,14 +523,14 @@
}
class JsParameterMirror extends JsVariableMirror implements ParameterMirror {
- JsParameterMirror._(String name, Type t, List annotations)
- : super._(name, t, annotations);
+ JsParameterMirror._(Symbol member, Type t, List annotations)
+ : super._(member, t, annotations);
String toString() => "ParameterMirror on '$_name'";
}
class JsMethodMirror extends JsMirror implements MethodMirror {
- // TODO(vsm): This could be a JS symbol for private methods
+ final Symbol _symbol;
final String _name;
List<ParameterMirror> _params;
List<InstanceMirror> _metadata;
@@ -499,25 +543,25 @@
bool get isPrivate => _name.startsWith('_');
// TODO(vsm): Refactor this out.
- Symbol get simpleName => new Symbol(_name);
+ Symbol get simpleName => _symbol;
- JsMethodMirror._constructor(JsClassMirror cls, String name, ftype)
- : _name = name, isConstructor = true, isStatic = false {
+ JsMethodMirror._constructor(JsClassMirror cls, Symbol symbol, ftype)
+ : _symbol = symbol, _name = getName(symbol), isConstructor = true, isStatic = false {
_createParameterMirrorList(ftype);
}
- JsMethodMirror._instanceMethod(JsClassMirror cls, String name, ftype)
- : _name = name, isConstructor = false, isStatic = false {
+ JsMethodMirror._instanceMethod(JsClassMirror cls, Symbol symbol, ftype)
+ : _symbol = symbol, _name = getName(symbol), isConstructor = false, isStatic = false {
_createParameterMirrorList(ftype);
}
- JsMethodMirror._staticMethod(JsClassMirror cls, String name, ftype)
- : _name = name, isConstructor = false, isStatic = true {
+ JsMethodMirror._staticMethod(JsClassMirror cls, Symbol symbol, ftype)
+ : _symbol = symbol, _name = getName(symbol), isConstructor = false, isStatic = true {
_createParameterMirrorList(ftype);
}
// TODO(vsm): Support named constructors.
- Symbol get constructorName => isConstructor ? new Symbol(_name) : null;
+ Symbol get constructorName => isConstructor ? _symbol : null;
List<ParameterMirror> get parameters => _params;
List<InstanceMirror> get metadata => _metadata;
@@ -556,7 +600,7 @@
var type = args[i];
var metadata = ftype.metadata[i];
// TODO(vsm): Recover the param name.
- var param = new JsParameterMirror._('', _wrap(type), metadata);
+ var param = new JsParameterMirror._(new Symbol(''), _wrap(type), metadata);
params[i] = param;
}
@@ -564,7 +608,7 @@
var type = opts[i];
var metadata = ftype.metadata[args.length + i];
// TODO(vsm): Recover the param name.
- var param = new JsParameterMirror._('', _wrap(type), metadata);
+ var param = new JsParameterMirror._(new Symbol(''), _wrap(type), metadata);
params[i + args.length] = param;
}
diff --git a/pkg/kernel/lib/target/flutter.dart b/pkg/kernel/lib/target/flutter.dart
index ea9e704..5673a22 100644
--- a/pkg/kernel/lib/target/flutter.dart
+++ b/pkg/kernel/lib/target/flutter.dart
@@ -17,7 +17,7 @@
FlutterTarget(this.flags);
bool get strongMode => flags.strongMode;
-
+
bool get strongModeSdk => false;
String get name => 'flutter';
@@ -47,7 +47,6 @@
// Required for flutter.
'dart:ui',
'dart:jni',
- 'dart:mojo.internal',
'dart:vmservice_sky',
];
diff --git a/pkg/kernel/lib/verifier.dart b/pkg/kernel/lib/verifier.dart
index 27cc492..e40b2c0 100644
--- a/pkg/kernel/lib/verifier.dart
+++ b/pkg/kernel/lib/verifier.dart
@@ -92,6 +92,19 @@
variable.flags &= ~VariableDeclaration.FlagInScope;
}
+ void declareTypeParameters(List<TypeParameter> parameters) {
+ for (int i = 0; i < parameters.length; ++i) {
+ var parameter = parameters[i];
+ if (!typeParameters.add(parameter)) {
+ throw 'Type parameter $parameter redeclared in $context';
+ }
+ }
+ }
+
+ void undeclareTypeParameters(List<TypeParameter> parameters) {
+ typeParameters.removeAll(parameters);
+ }
+
void checkVariableInScope(VariableDeclaration variable, TreeNode where) {
if (variable.flags & VariableDeclaration.FlagInScope == 0) {
throw 'Variable $variable used out of scope in $context '
@@ -101,7 +114,11 @@
visitProgram(Program program) {
for (var library in program.libraries) {
- classes.addAll(library.classes);
+ for (var class_ in library.classes) {
+ if (!classes.add(class_)) {
+ throw 'Class $class_ declared more than once';
+ }
+ }
library.members.forEach(declareMember);
for (var class_ in library.classes) {
class_.members.forEach(declareMember);
@@ -157,7 +174,7 @@
visitClass(Class node) {
currentClass = node;
- typeParameters.addAll(node.typeParameters);
+ declareTypeParameters(node.typeParameters);
var oldParent = enterParent(node);
classTypeParametersAreInScope = false;
visitList(node.annotations, this);
@@ -167,14 +184,14 @@
visitList(node.constructors, this);
visitList(node.procedures, this);
exitParent(oldParent);
- typeParameters.removeAll(node.typeParameters);
+ undeclareTypeParameters(node.typeParameters);
currentClass = null;
}
visitFunctionNode(FunctionNode node) {
- typeParameters.addAll(node.typeParameters);
+ declareTypeParameters(node.typeParameters);
visitWithLocalScope(node);
- typeParameters.removeAll(node.typeParameters);
+ undeclareTypeParameters(node.typeParameters);
}
visitFunctionType(FunctionType node) {
@@ -184,14 +201,14 @@
'$context';
}
}
- typeParameters.addAll(node.typeParameters);
+ declareTypeParameters(node.typeParameters);
for (var typeParameter in node.typeParameters) {
typeParameter.bound?.accept(this);
}
visitList(node.positionalParameters, this);
visitList(node.namedParameters, this);
node.returnType.accept(this);
- typeParameters.removeAll(node.typeParameters);
+ undeclareTypeParameters(node.typeParameters);
}
visitBlock(Block node) {
diff --git a/pkg/kernel/test/verify_test.dart b/pkg/kernel/test/verify_test.dart
index 67a7e96..e9f03b9 100644
--- a/pkg/kernel/test/verify_test.dart
+++ b/pkg/kernel/test/verify_test.dart
@@ -6,14 +6,17 @@
import 'package:kernel/verifier.dart';
import 'package:test/test.dart';
-/// Checks that the sanity checks correctly find errors in invalid programs.
+/// Checks that the verifier correctly find errors in invalid programs.
///
/// The frontend should never generate invalid programs, so we have to test
/// these by manually constructing invalid ASTs.
///
-/// We only test negative cases here, as we get plenty of positive cases by
-/// compiling the Dart test suite with sanity checks enabled.
+/// We mostly test negative cases here, as we get plenty of positive cases by
+/// compiling the Dart test suite with the verifier enabled.
main() {
+ positiveTest('Test harness has no errors', () {
+ return new NullLiteral();
+ });
negativeTest('VariableGet out of scope', () {
return new VariableGet(makeVariable());
});
@@ -43,6 +46,24 @@
supertype: objectClass.asRawSupertype,
fields: [field, field]);
});
+ negativeTest('Class redeclared', () {
+ return otherClass; // Test harness also adds otherClass to program.
+ });
+ negativeTest('Class type parameter redeclared', () {
+ var parameter = makeTypeParameter();
+ return new Class(
+ name: 'Test',
+ supertype: objectClass.asRawSupertype,
+ typeParameters: [parameter, parameter]);
+ });
+ negativeTest('Member type parameter redeclared', () {
+ var parameter = makeTypeParameter();
+ return new Procedure(
+ new Name('test'),
+ ProcedureKind.Method,
+ new FunctionNode(new ReturnStatement(new NullLiteral()),
+ typeParameters: [parameter, parameter]));
+ });
negativeTest('Type parameter out of scope', () {
var parameter = makeTypeParameter();
return new ListLiteral([], typeArgument: new TypeParameterType(parameter));
@@ -129,33 +150,43 @@
typeParameters: [makeTypeParameter('OtherT')],
supertype: objectClass.asRawSupertype);
+Program makeProgram(TreeNode makeBody()) {
+ var node = makeBody();
+ if (node is Expression) {
+ node = new ReturnStatement(node);
+ }
+ if (node is Statement) {
+ node = new FunctionNode(node);
+ }
+ if (node is FunctionNode) {
+ node = new Procedure(new Name('test'), ProcedureKind.Method, node);
+ }
+ if (node is Member) {
+ node = new Class(
+ name: 'Test',
+ typeParameters: [classTypeParameter],
+ supertype: objectClass.asRawSupertype)..addMember(node);
+ }
+ if (node is Class) {
+ node =
+ new Library(Uri.parse('test.dart'), classes: <Class>[node, otherClass]);
+ }
+ if (node is Library) {
+ node = new Program(<Library>[node, stubLibrary]);
+ }
+ assert(node is Program);
+ return node;
+}
+
negativeTest(String name, TreeNode makeBody()) {
test(name, () {
- var node = makeBody();
- if (node is Expression) {
- node = new ReturnStatement(node);
- }
- if (node is Statement) {
- node = new FunctionNode(node);
- }
- if (node is FunctionNode) {
- node = new Procedure(new Name('test'), ProcedureKind.Method, node);
- }
- if (node is Member) {
- node = new Class(
- name: 'Test',
- typeParameters: [classTypeParameter],
- supertype: objectClass.asRawSupertype)..addMember(node);
- }
- if (node is Class) {
- node = new Library(Uri.parse('test.dart'),
- classes: <Class>[node, otherClass]);
- }
- if (node is Library) {
- node = new Program(<Library>[node, stubLibrary]);
- }
- assert(node is Program);
- checkHasError(node);
+ checkHasError(makeProgram(makeBody));
+ });
+}
+
+positiveTest(String name, TreeNode makeBody()) {
+ test(name, () {
+ verifyProgram(makeProgram(makeBody));
});
}
diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn
index 0e75ba274..903cc40 100644
--- a/runtime/bin/BUILD.gn
+++ b/runtime/bin/BUILD.gn
@@ -7,7 +7,7 @@
declare_args() {
# Whether to fall back to built-in root certificates when they cannot be
# verified at the operating system level.
- dart_use_fallback_root_certificates = true
+ dart_use_fallback_root_certificates = false
# The BUILD.gn file that we pull from chromium as part of zlib has a
# dependence on //base, which we don't pull in. In a standalone build of the
@@ -20,6 +20,11 @@
dart_use_tcmalloc = false
}
+# TODO(zra): Remove this when Fuchsia has a root cert cache on the filesystem.
+if (defined(is_fuchsia) && is_fuchsia) {
+ dart_use_fallback_root_certificates = true
+}
+
# Generate a resources.cc file for the service isolate without Observatory.
action("gen_resources_cc") {
visibility = [ ":*" ] # Only targets in this file can see this.
diff --git a/runtime/bin/secure_socket_boringssl.cc b/runtime/bin/secure_socket_boringssl.cc
index 6e3b7fc..90d22fb 100644
--- a/runtime/bin/secure_socket_boringssl.cc
+++ b/runtime/bin/secure_socket_boringssl.cc
@@ -1505,6 +1505,10 @@
SSL_set_mode(ssl_, SSL_MODE_AUTO_RETRY); // TODO(whesse): Is this right?
SSL_set_ex_data(ssl_, filter_ssl_index, this);
+#if defined(TARGET_OS_FUCHSIA)
+ // Temporary workaround until we isolate the memory leak issue.
+ SSL_set_verify(ssl_, SSL_VERIFY_NONE, NULL);
+#else
if (is_server_) {
int certificate_mode =
request_client_certificate ? SSL_VERIFY_PEER : SSL_VERIFY_NONE;
@@ -1529,6 +1533,7 @@
CheckStatus(status, "TlsException",
"Set hostname for certificate checking");
}
+#endif // defined(TARGET_OS_FUCHSIA)
// Make the connection:
if (is_server_) {
status = SSL_accept(ssl_);
@@ -1564,6 +1569,7 @@
return 1;
}
+
void SSLFilter::Handshake() {
// Try and push handshake along.
int status;
@@ -1605,6 +1611,7 @@
}
}
+
void SSLFilter::GetSelectedProtocol(Dart_NativeArguments args) {
const uint8_t* protocol;
unsigned length;
diff --git a/runtime/observatory/lib/object_graph.dart b/runtime/observatory/lib/object_graph.dart
index d1c171b..146badc 100644
--- a/runtime/observatory/lib/object_graph.dart
+++ b/runtime/observatory/lib/object_graph.dart
@@ -8,6 +8,8 @@
import 'dart:collection';
import 'dart:typed_data';
+import 'package:logging/logging.dart';
+
class _JenkinsSmiHash {
static int combine(int hash, int value) {
hash = 0x1fffffff & (hash + value);
@@ -227,6 +229,7 @@
ObjectVertex._(this._id, this._graph);
bool get isRoot => ROOT == _id;
+ bool get isStack => vmCid == _graph._kStackCid;
bool operator ==(other) => _id == other._id && _graph == other._graph;
int get hashCode => _id;
@@ -300,6 +303,7 @@
MergedObjectVertex._(this._id, this._graph);
bool get isRoot => ROOT == _id;
+ bool get isStack => vmCid == _graph._kStackCid;
bool operator ==(other) => _id == other._id && _graph == other._graph;
int get hashCode => _id;
@@ -497,8 +501,10 @@
List<ByteData> _chunks;
int _kObjectAlignment;
- int _N;
- int _E;
+ int _kStackCid;
+ int _N; // Objects in the snapshot.
+ int _Nconnected; // Objects reachable from root.
+ int _E; // References in the snapshot.
int _size;
// Indexed by node id, with id 0 representing invalid/uninitialized.
@@ -537,6 +543,8 @@
var stream = new ReadStream(_chunks);
stream.readUnsigned();
_kObjectAlignment = stream.clampedUint32;
+ stream.readUnsigned();
+ _kStackCid = stream.clampedUint32;
var id = ROOT;
while (stream.pendingBytes > 0) {
@@ -577,7 +585,8 @@
var succs = new Uint32List(E);
var stream = new ReadStream(_chunks);
- stream.skipUnsigned(); // addr alignment
+ stream.skipUnsigned(); // kObjectAlignment
+ stream.skipUnsigned(); // kStackCid
var id = 1, edge = 0;
while (stream.pendingBytes > 0) {
@@ -660,15 +669,40 @@
}
}
- assert(dfsNumber == N);
- for (var i = ROOT; i <= N; i++) {
- assert(semi[i] != SENTINEL);
- }
- assert(parent[ROOT] == SENTINEL);
- for (var i = ROOT + 1; i <= N; i++) {
- assert(parent[i] != SENTINEL);
+ if (dfsNumber != N) {
+ // This may happen in filtered snapshots.
+ Logger.root.warning('Heap snapshot contains unreachable nodes.');
}
+ assert(() {
+ for (var i = 1; i <= dfsNumber; i++) {
+ var v = vertex[i];
+ assert(semi[v] != SENTINEL);
+ }
+ assert(parent[1] == SENTINEL);
+ for (var i = 2; i <= dfsNumber; i++) {
+ var v = vertex[i];
+ assert(parent[v] != SENTINEL);
+ }
+ return true;
+ });
+
+ if (dfsNumber != N) {
+ // Remove successors of unconnected nodes
+ for (var i = ROOT + 1; i <= N; i++) {
+ if (parent[i] == SENTINEL) {
+ var startSuccIndex = firstSuccs[i];
+ var limitSuccIndex = firstSuccs[i + 1];
+ for (var succIndex = startSuccIndex;
+ succIndex < limitSuccIndex;
+ succIndex++) {
+ succs[succIndex] = SENTINEL;
+ }
+ }
+ }
+ }
+
+ _Nconnected = dfsNumber;
_vertex = vertex;
_semi = semi;
_parent = parent;
@@ -676,6 +710,7 @@
void _buildPredecessors() {
var N = _N;
+ var Nconnected = _Nconnected;
var E = _E;
var firstSuccs = _firstSuccs;
var succs = _succs;
@@ -691,7 +726,9 @@
// Count predecessors of each node.
for (var succIndex = 0; succIndex < E; succIndex++) {
var succId = succs[succIndex];
- numPreds[succId]++;
+ if (succId != SENTINEL) {
+ numPreds[succId]++;
+ }
}
// Assign indices into predecessors array.
@@ -704,8 +741,10 @@
firstPreds[i] = thisPredIndex;
nextPreds[i] = thisPredIndex;
}
- assert(predIndex == E);
- firstPreds[N + 1] = E; // Extra entry for cheap boundary detection.
+ if (N == Nconnected) {
+ assert(predIndex == E);
+ }
+ firstPreds[N + 1] = predIndex; // Extra entry for cheap boundary detection.
// Fill predecessors array.
for (var i = 1; i <= N; i++) {
@@ -715,8 +754,10 @@
succIndex < limitSuccIndex;
succIndex++) {
var succId = succs[succIndex];
- var predIndex = nextPreds[succId]++;
- preds[predIndex] = i;
+ if (succId != SENTINEL) {
+ var predIndex = nextPreds[succId]++;
+ preds[predIndex] = i;
+ }
}
}
@@ -802,6 +843,7 @@
// in a Flowgraph."
void _buildDominators() {
var N = _N;
+ var Nconnected = _Nconnected;
var vertex = _vertex;
var semi = _semi;
@@ -825,7 +867,7 @@
var stackNode = new Uint32List(N + 1);
var stackState = new Uint8List(N + 1);
- for (var i = N; i > 1; i--) {
+ for (var i = Nconnected; i > 1; i--) {
var w = vertex[i];
assert(w != ROOT);
@@ -864,7 +906,7 @@
assert(buckets[i] == null);
}
// Lengauer & Tarjan Step 4.
- for (var i = 2; i <= N; i++) {
+ for (var i = 2; i <= Nconnected; i++) {
var w = vertex[i];
if (dom[w] != vertex[semi[w]]) {
dom[w] = dom[dom[w]];
@@ -876,6 +918,7 @@
void _calculateRetainedSizes() {
var N = _N;
+ var Nconnected = _Nconnected;
var size = 0;
var shallowSizes = _shallowSizes;
@@ -883,8 +926,9 @@
var doms = _doms;
// Sum shallow sizes.
- for (var i = ROOT; i < N; i++) {
- size += shallowSizes[i];
+ for (var i = 1; i <= Nconnected; i++) {
+ var v = vertex[i];
+ size += shallowSizes[v];
}
// Start with retained size as shallow size.
@@ -892,12 +936,14 @@
// In post order (bottom up), add retained size to dominator's retained
// size, skipping root.
- for (var i = N; i > 1; i--) {
+ for (var i = Nconnected; i > 1; i--) {
var v = vertex[i];
assert(v != ROOT);
- retainedSizes[doms[i]] += retainedSizes[i];
+ retainedSizes[doms[v]] += retainedSizes[v];
}
+ assert(retainedSizes[ROOT] == size); // Root retains everything.
+
_retainedSizes = retainedSizes;
_size = size;
}
diff --git a/runtime/observatory/lib/src/elements/heap_snapshot.dart b/runtime/observatory/lib/src/elements/heap_snapshot.dart
index 7389daa..830e1a0 100644
--- a/runtime/observatory/lib/src/elements/heap_snapshot.dart
+++ b/runtime/observatory/lib/src/elements/heap_snapshot.dart
@@ -17,6 +17,7 @@
import 'package:observatory/src/elements/helpers/nav_menu.dart';
import 'package:observatory/src/elements/helpers/rendering_scheduler.dart';
import 'package:observatory/src/elements/helpers/tag.dart';
+import 'package:observatory/src/elements/helpers/uris.dart';
import 'package:observatory/src/elements/nav/isolate_menu.dart';
import 'package:observatory/src/elements/nav/notify.dart';
import 'package:observatory/src/elements/nav/refresh.dart';
@@ -51,6 +52,7 @@
M.HeapSnapshot _snapshot;
Stream<M.HeapSnapshotLoadingProgressEvent> _progressStream;
M.HeapSnapshotLoadingProgress _progress;
+ M.HeapSnapshotRoots _roots = M.HeapSnapshotRoots.user;
HeapSnapshotTreeMode _mode = HeapSnapshotTreeMode.dominatorTree;
M.IsolateRef get isolate => _isolate;
@@ -138,7 +140,9 @@
Future _refresh() async {
_progress = null;
- _progressStream = _snapshots.get(isolate);
+ _progressStream = _snapshots.get(isolate,
+ roots: _roots,
+ gc: true);
_r.dirty();
_progressStream.listen((e) {
_progress = e.progress;
@@ -233,6 +237,16 @@
..children = [
new DivElement()
..classes = ['memberName']
+ ..text = 'Roots ',
+ new DivElement()
+ ..classes = ['memberName']
+ ..children = _createRootsSelect()
+ ],
+ new DivElement()
+ ..classes = ['memberItem']
+ ..children = [
+ new DivElement()
+ ..classes = ['memberName']
..text = 'Analysis ',
new DivElement()
..classes = ['memberName']
@@ -396,11 +410,20 @@
..classes = ['name']
..text = 'Loading...';
element.children[4] = wrapper;
- node.object.then((object) {
+ if (node.isStack) {
wrapper
..text = ''
- ..children = [anyRef(_isolate, object, _instances, queue: _r.queue)];
- });
+ ..children = [
+ new AnchorElement(href: Uris.debugger(isolate))
+ ..text = 'stack frames'
+ ];
+ } else {
+ node.object.then((object) {
+ wrapper
+ ..text = ''
+ ..children = [anyRef(_isolate, object, _instances, queue: _r.queue)];
+ });
+ }
}
void _updateMergedDominator(
@@ -418,14 +441,23 @@
..classes = ['name']
..text = 'Loading...';
element.children[4] = wrapper;
- node.klass.then((klass) {
+ if (node.isStack) {
wrapper
..text = ''
..children = [
- new SpanElement()..text = '${node.instanceCount} instances of ',
- anyRef(_isolate, klass, _instances, queue: _r.queue)
+ new AnchorElement(href: Uris.debugger(isolate))
+ ..text = 'stack frames'
];
- });
+ } else {
+ node.klass.then((klass) {
+ wrapper
+ ..text = ''
+ ..children = [
+ new SpanElement()..text = '${node.instanceCount} instances of ',
+ anyRef(_isolate, klass, _instances, queue: _r.queue)
+ ];
+ });
+ }
}
void _updateGroup(HtmlElement element, item, int depth) {
@@ -487,6 +519,34 @@
}
}
+ static String rootsToString(M.HeapSnapshotRoots roots) {
+ switch (roots) {
+ case M.HeapSnapshotRoots.user:
+ return 'User';
+ case M.HeapSnapshotRoots.vm:
+ return 'VM';
+ }
+ throw new Exception('Unknown HeapSnapshotRoots');
+ }
+
+ List<Element> _createRootsSelect() {
+ var s;
+ return [
+ s = new SelectElement()
+ ..classes = ['roots-select']
+ ..value = rootsToString(_roots)
+ ..children = M.HeapSnapshotRoots.values.map((roots) {
+ return new OptionElement(
+ value: rootsToString(roots),
+ selected: _roots == roots)..text = rootsToString(roots);
+ }).toList(growable: false)
+ ..onChange.listen((_) {
+ _roots = M.HeapSnapshotRoots.values[s.selectedIndex];
+ _refresh();
+ })
+ ];
+ }
+
static String modeToString(HeapSnapshotTreeMode mode) {
switch (mode) {
case HeapSnapshotTreeMode.dominatorTree:
@@ -496,7 +556,7 @@
case HeapSnapshotTreeMode.groupByClass:
return 'Group by class';
}
- throw new Exception('Unknown ProfileTreeMode');
+ throw new Exception('Unknown HeapSnapshotTreeMode');
}
List<Element> _createModeSelect() {
diff --git a/runtime/observatory/lib/src/heap_snapshot/heap_snapshot.dart b/runtime/observatory/lib/src/heap_snapshot/heap_snapshot.dart
index 2d7abcd..5f0bd3e 100644
--- a/runtime/observatory/lib/src/heap_snapshot/heap_snapshot.dart
+++ b/runtime/observatory/lib/src/heap_snapshot/heap_snapshot.dart
@@ -124,6 +124,8 @@
final S.Isolate isolate;
S.HeapObject _preloaded;
+ bool get isStack => v.isStack;
+
Future<S.HeapObject> get object {
if (_preloaded != null) {
return new Future.value(_preloaded);
@@ -159,6 +161,8 @@
final MergedObjectVertex v;
final S.Isolate isolate;
+ bool get isStack => v.isStack;
+
Future<S.HeapObject> get klass {
return new Future.value(isolate.getClassByCid(v.vmCid));
}
diff --git a/runtime/observatory/lib/src/models/objects/heap_snapshot.dart b/runtime/observatory/lib/src/models/objects/heap_snapshot.dart
index ff4cefe..aae5493 100644
--- a/runtime/observatory/lib/src/models/objects/heap_snapshot.dart
+++ b/runtime/observatory/lib/src/models/objects/heap_snapshot.dart
@@ -4,6 +4,8 @@
part of models;
+enum HeapSnapshotRoots { user, vm }
+
abstract class HeapSnapshot {
DateTime get timestamp;
int get objects;
@@ -17,6 +19,7 @@
abstract class HeapSnapshotDominatorNode {
int get shallowSize;
int get retainedSize;
+ bool get isStack;
Future<ObjectRef> get object;
Iterable<HeapSnapshotDominatorNode> get children;
}
@@ -25,6 +28,7 @@
int get instanceCount;
int get shallowSize;
int get retainedSize;
+ bool get isStack;
Future<ObjectRef> get klass;
Iterable<HeapSnapshotMergedDominatorNode> get children;
}
diff --git a/runtime/observatory/lib/src/models/repositories/heap_snapshot.dart b/runtime/observatory/lib/src/models/repositories/heap_snapshot.dart
index da71fe9..9e87e64 100644
--- a/runtime/observatory/lib/src/models/repositories/heap_snapshot.dart
+++ b/runtime/observatory/lib/src/models/repositories/heap_snapshot.dart
@@ -30,6 +30,8 @@
}
abstract class HeapSnapshotRepository {
- Stream<HeapSnapshotLoadingProgressEvent> get(IsolateRef isolate,
- {bool gc: false});
+ Stream<HeapSnapshotLoadingProgressEvent> get(
+ IsolateRef isolate,
+ {HeapSnapshotRoots roots: HeapSnapshotRoots.vm,
+ bool gc: false});
}
diff --git a/runtime/observatory/lib/src/repositories/heap_snapshot.dart b/runtime/observatory/lib/src/repositories/heap_snapshot.dart
index e56b352..a4f90b3 100644
--- a/runtime/observatory/lib/src/repositories/heap_snapshot.dart
+++ b/runtime/observatory/lib/src/repositories/heap_snapshot.dart
@@ -16,6 +16,7 @@
Stream<HeapSnapshotLoadingProgressEvent> get onProgress => _onProgress.stream;
final S.Isolate isolate;
+ final M.HeapSnapshotRoots roots;
final bool gc;
M.HeapSnapshotLoadingStatus _status = M.HeapSnapshotLoadingStatus.fetching;
@@ -32,7 +33,7 @@
Duration get loadingTime => _loadingTime.elapsed;
HeapSnapshot get snapshot => _snapshot;
- HeapSnapshotLoadingProgress(this.isolate, this.gc) {
+ HeapSnapshotLoadingProgress(this.isolate, this.roots, this.gc) {
_run();
}
@@ -44,7 +45,7 @@
await isolate.getClassRefs();
- final stream = isolate.fetchHeapSnapshot(gc);
+ final stream = isolate.fetchHeapSnapshot(roots, gc);
stream.listen((status) {
if (status is List) {
@@ -99,11 +100,13 @@
}
class HeapSnapshotRepository implements M.HeapSnapshotRepository {
- Stream<HeapSnapshotLoadingProgressEvent> get(M.IsolateRef i,
- {bool gc: false}) {
+ Stream<HeapSnapshotLoadingProgressEvent> get(
+ M.IsolateRef i,
+ {M.HeapSnapshotRoots roots: M.HeapSnapshotRoots.vm,
+ bool gc: false}) {
S.Isolate isolate = i as S.Isolate;
assert(isolate != null);
assert(gc != null);
- return new HeapSnapshotLoadingProgress(isolate, gc).onProgress;
+ return new HeapSnapshotLoadingProgress(isolate, roots, gc).onProgress;
}
}
diff --git a/runtime/observatory/lib/src/repositories/top_retaining_instances.dart b/runtime/observatory/lib/src/repositories/top_retaining_instances.dart
index 0094762..400ac14 100644
--- a/runtime/observatory/lib/src/repositories/top_retaining_instances.dart
+++ b/runtime/observatory/lib/src/repositories/top_retaining_instances.dart
@@ -11,7 +11,8 @@
S.Class cls = c as S.Class;
assert(isolate != null);
assert(cls != null);
- final raw = await isolate.fetchHeapSnapshot(true).last;
+ final raw =
+ await isolate.fetchHeapSnapshot(M.HeapSnapshotRoots.vm, true).last;
final snapshot = new HeapSnapshot();
await snapshot.loadProgress(isolate, raw).last;
return (await Future.wait(
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index c638dd9..c3ea07da 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -1531,12 +1531,21 @@
}
}
- Stream fetchHeapSnapshot(collectGarbage) {
+ static String _rootsToString(M.HeapSnapshotRoots roots) {
+ switch (roots) {
+ case M.HeapSnapshotRoots.user: return "User";
+ case M.HeapSnapshotRoots.vm: return "VM";
+ }
+ return null;
+ }
+
+ Stream fetchHeapSnapshot(M.HeapSnapshotRoots roots, bool collectGarbage) {
if (_snapshotFetch == null || _snapshotFetch.isClosed) {
_snapshotFetch = new StreamController.broadcast();
// isolate.vm.streamListen('_Graph');
- isolate.invokeRpcNoUpgrade(
- '_requestHeapSnapshot', {'collectGarbage': collectGarbage});
+ isolate.invokeRpcNoUpgrade('_requestHeapSnapshot',
+ {'roots': _rootsToString(roots),
+ 'collectGarbage': collectGarbage});
}
return _snapshotFetch.stream;
}
diff --git a/runtime/observatory/tests/observatory_ui/observatory_ui.status b/runtime/observatory/tests/observatory_ui/observatory_ui.status
index a5665d5..0aa7e3f 100644
--- a/runtime/observatory/tests/observatory_ui/observatory_ui.status
+++ b/runtime/observatory/tests/observatory_ui/observatory_ui.status
@@ -9,12 +9,15 @@
isolate/*: Skip
allocation_profile: Skip
vm_connect/element_test: Skip # See issue 27714
+heap_snapshot/element_test: RuntimeError # Issue 27925
[ $runtime == ff || $runtime == safari ]
allocation_profile: Skip
cpu_profile_table: Skip
persistent_handles_page: Skip
vm_connect/element_test: Skip # See issue 27714
+heap_snapshot/element_test: RuntimeError # Issue 27925
[ $runtime == ff || $runtime == chrome ]
vm_connect/element_test: Skip # Times out
+heap_snapshot/element_test: RuntimeError # Issue 27925
diff --git a/runtime/observatory/tests/service/dominator_tree_test.dart b/runtime/observatory/tests/service/dominator_tree_user_test.dart
similarity index 94%
copy from runtime/observatory/tests/service/dominator_tree_test.dart
copy to runtime/observatory/tests/service/dominator_tree_user_test.dart
index 037fbeb..c312dd0 100644
--- a/runtime/observatory/tests/service/dominator_tree_test.dart
+++ b/runtime/observatory/tests/service/dominator_tree_user_test.dart
@@ -4,6 +4,7 @@
// VMOptions=--error_on_bad_type --error_on_bad_override
import 'package:observatory/heap_snapshot.dart';
+import 'package:observatory/models.dart' as M;
import 'package:observatory/service_io.dart';
import 'package:unittest/unittest.dart';
import 'test_helper.dart';
@@ -58,7 +59,8 @@
var tests = [
(Isolate isolate) async {
final rootLib = await isolate.rootLibrary.load();
- final raw = await isolate.fetchHeapSnapshot(false).last;
+ final raw =
+ await isolate.fetchHeapSnapshot(M.HeapSnapshotRoots.user, false).last;
final snapshot = new HeapSnapshot();
await snapshot.loadProgress(isolate, raw).last;
diff --git a/runtime/observatory/tests/service/dominator_tree_test.dart b/runtime/observatory/tests/service/dominator_tree_vm_test.dart
similarity index 94%
rename from runtime/observatory/tests/service/dominator_tree_test.dart
rename to runtime/observatory/tests/service/dominator_tree_vm_test.dart
index 037fbeb..ceee90a 100644
--- a/runtime/observatory/tests/service/dominator_tree_test.dart
+++ b/runtime/observatory/tests/service/dominator_tree_vm_test.dart
@@ -4,6 +4,7 @@
// VMOptions=--error_on_bad_type --error_on_bad_override
import 'package:observatory/heap_snapshot.dart';
+import 'package:observatory/models.dart' as M;
import 'package:observatory/service_io.dart';
import 'package:unittest/unittest.dart';
import 'test_helper.dart';
@@ -58,7 +59,8 @@
var tests = [
(Isolate isolate) async {
final rootLib = await isolate.rootLibrary.load();
- final raw = await isolate.fetchHeapSnapshot(false).last;
+ final raw =
+ await isolate.fetchHeapSnapshot(M.HeapSnapshotRoots.vm, false).last;
final snapshot = new HeapSnapshot();
await snapshot.loadProgress(isolate, raw).last;
diff --git a/runtime/observatory/tests/service/object_graph_stack_reference_test.dart b/runtime/observatory/tests/service/object_graph_stack_reference_test.dart
new file mode 100644
index 0000000..9fc88ce
--- /dev/null
+++ b/runtime/observatory/tests/service/object_graph_stack_reference_test.dart
@@ -0,0 +1,60 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
+// VMOptions=--error_on_bad_type --error_on_bad_override
+
+import 'dart:developer';
+
+import 'test_helper.dart';
+import 'service_test_common.dart';
+
+import 'package:observatory/heap_snapshot.dart';
+import 'package:observatory/models.dart' as M;
+import 'package:observatory/object_graph.dart';
+import 'package:observatory/service_io.dart';
+import 'package:unittest/unittest.dart';
+
+int arrayLength = 1024 * 1024;
+int minArraySize = arrayLength * 4;
+
+void script() {
+ var stackSlot = new List(arrayLength);
+ debugger();
+ print(stackSlot); // Prevent optimizing away the stack slot.
+}
+
+checkForStackReferent(Isolate isolate) async {
+ Library corelib =
+ isolate.libraries.singleWhere((lib) => lib.uri == 'dart:core');
+ await corelib.load();
+ Class _List =
+ corelib.classes.singleWhere((cls) => cls.vmName.startsWith('_List'));
+ int kArrayCid = _List.vmCid;
+
+ RawHeapSnapshot raw =
+ await isolate.fetchHeapSnapshot(M.HeapSnapshotRoots.user, false).last;
+ HeapSnapshot snapshot = new HeapSnapshot();
+ await snapshot.loadProgress(isolate, raw).last;
+ ObjectGraph graph = snapshot.graph;
+
+ var root = graph.root;
+ var stack = graph.root.dominatorTreeChildren()
+ .singleWhere((child) => child.isStack);
+ expect(stack.retainedSize, greaterThanOrEqualTo(minArraySize));
+
+ bool foundBigArray = false;
+ for (var stackReferent in stack.dominatorTreeChildren()) {
+ if (stackReferent.vmCid == kArrayCid &&
+ stackReferent.shallowSize >= minArraySize) {
+ foundBigArray = true;
+ }
+ }
+}
+
+var tests = [
+ hasStoppedAtBreakpoint,
+ checkForStackReferent,
+ resumeIsolate,
+];
+
+main(args) => runIsolateTests(args, tests, testeeConcurrent: script);
diff --git a/runtime/observatory/tests/service/graph_test.dart b/runtime/observatory/tests/service/object_graph_user_test.dart
similarity index 95%
copy from runtime/observatory/tests/service/graph_test.dart
copy to runtime/observatory/tests/service/object_graph_user_test.dart
index 85556ba..c51976a 100644
--- a/runtime/observatory/tests/service/graph_test.dart
+++ b/runtime/observatory/tests/service/object_graph_user_test.dart
@@ -4,6 +4,7 @@
// VMOptions=--error_on_bad_type --error_on_bad_override
import 'package:observatory/heap_snapshot.dart';
+import 'package:observatory/models.dart' as M;
import 'package:observatory/object_graph.dart';
import 'package:observatory/service_io.dart';
import 'package:unittest/unittest.dart';
@@ -43,7 +44,8 @@
Class fooClass = lib.classes.first;
fooId = fooClass.vmCid;
- RawHeapSnapshot raw = await isolate.fetchHeapSnapshot(false).last;
+ RawHeapSnapshot raw =
+ await isolate.fetchHeapSnapshot(M.HeapSnapshotRoots.user, false).last;
HeapSnapshot snapshot = new HeapSnapshot();
await snapshot.loadProgress(isolate, raw).last;
ObjectGraph graph = snapshot.graph;
diff --git a/runtime/observatory/tests/service/graph_test.dart b/runtime/observatory/tests/service/object_graph_vm_test.dart
similarity index 95%
rename from runtime/observatory/tests/service/graph_test.dart
rename to runtime/observatory/tests/service/object_graph_vm_test.dart
index 85556ba..eae1679 100644
--- a/runtime/observatory/tests/service/graph_test.dart
+++ b/runtime/observatory/tests/service/object_graph_vm_test.dart
@@ -4,6 +4,7 @@
// VMOptions=--error_on_bad_type --error_on_bad_override
import 'package:observatory/heap_snapshot.dart';
+import 'package:observatory/models.dart' as M;
import 'package:observatory/object_graph.dart';
import 'package:observatory/service_io.dart';
import 'package:unittest/unittest.dart';
@@ -43,7 +44,8 @@
Class fooClass = lib.classes.first;
fooId = fooClass.vmCid;
- RawHeapSnapshot raw = await isolate.fetchHeapSnapshot(false).last;
+ RawHeapSnapshot raw =
+ await isolate.fetchHeapSnapshot(M.HeapSnapshotRoots.vm, false).last;
HeapSnapshot snapshot = new HeapSnapshot();
await snapshot.loadProgress(isolate, raw).last;
ObjectGraph graph = snapshot.graph;
diff --git a/runtime/tests/vm/dart/hello_fuchsia_test.dart b/runtime/tests/vm/dart/hello_fuchsia_test.dart
index e2ac092..35f2cef3 100644
--- a/runtime/tests/vm/dart/hello_fuchsia_test.dart
+++ b/runtime/tests/vm/dart/hello_fuchsia_test.dart
@@ -397,19 +397,17 @@
await testSimpleReadWriteClose();
print("testSimpleReadWriteClose done");
- // TODO(US-81): Enable.
- // print("testSimpleReadWriteShutdown");
- // await testSimpleReadWriteShutdown(dropReads: false);
- // print("testSimpleReadWriteShutdown done");
+ print("testSimpleReadWriteShutdown");
+ await testSimpleReadWriteShutdown(dropReads: false);
+ print("testSimpleReadWriteShutdown done");
print("testGoogleHttp");
await testGoogleHttp(null, 'pass');
print("testGoogleHttp done");
- // TODO(US-96)
- // print("testGoogleHttps");
- // await testGoogleHttps(null, 'pass');
- // print("testGoogleHttps done");
+ print("testGoogleHttps");
+ await testGoogleHttps(null, 'pass');
+ print("testGoogleHttps done");
print("Goodbyte, Fuchsia!");
}
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 5e08876..e4cbfaf 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -1792,6 +1792,13 @@
}
+void Isolate::IterateStackPointers(ObjectPointerVisitor* visitor,
+ bool validate_frames) {
+ HeapIterationScope heap_iteration_scope;
+ VisitStackPointers(visitor, validate_frames);
+}
+
+
void Isolate::VisitObjectPointers(ObjectPointerVisitor* visitor,
bool validate_frames) {
ASSERT(visitor != NULL);
@@ -1863,6 +1870,12 @@
deopt_context()->VisitObjectPointers(visitor);
}
+ VisitStackPointers(visitor, validate_frames);
+}
+
+
+void Isolate::VisitStackPointers(ObjectPointerVisitor* visitor,
+ bool validate_frames) {
// Visit objects in all threads (e.g., Dart stack, handles in zones).
thread_registry()->VisitObjectPointers(visitor, validate_frames);
}
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index 625be62..9fa4361 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -161,6 +161,8 @@
// Visit all object pointers.
void IterateObjectPointers(ObjectPointerVisitor* visitor,
bool validate_frames);
+ void IterateStackPointers(ObjectPointerVisitor* visitor,
+ bool validate_frames);
// Visits weak object pointers.
void VisitWeakPersistentHandles(HandleVisitor* visitor);
@@ -667,6 +669,7 @@
// Visit all object pointers. Caller must ensure concurrent sweeper is not
// running, and the visitor must not allocate.
void VisitObjectPointers(ObjectPointerVisitor* visitor, bool validate_frames);
+ void VisitStackPointers(ObjectPointerVisitor* visitor, bool validate_frames);
void set_user_tag(uword tag) { user_tag_ = tag; }
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 428dfa3..ac586d9 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -11008,8 +11008,8 @@
Exceptions::PropagateError(Error::Cast(obj));
}
} else {
- // Another load request is in flight.
- ASSERT(deferred_lib.LoadRequested());
+ // Another load request is in flight or previously failed.
+ ASSERT(deferred_lib.LoadRequested() || deferred_lib.LoadFailed());
}
return false; // Load request not yet completed.
}
diff --git a/runtime/vm/object_graph.cc b/runtime/vm/object_graph.cc
index c80c80c..2352bd88 100644
--- a/runtime/vm/object_graph.cc
+++ b/runtime/vm/object_graph.cc
@@ -8,6 +8,7 @@
#include "vm/growable_array.h"
#include "vm/isolate.h"
#include "vm/object.h"
+#include "vm/object_store.h"
#include "vm/raw_object.h"
#include "vm/reusable_handles.h"
#include "vm/visitor.h"
@@ -487,8 +488,13 @@
class WritePointerVisitor : public ObjectPointerVisitor {
public:
- WritePointerVisitor(Isolate* isolate, WriteStream* stream)
- : ObjectPointerVisitor(isolate), stream_(stream), count_(0) {}
+ WritePointerVisitor(Isolate* isolate,
+ WriteStream* stream,
+ bool only_instances)
+ : ObjectPointerVisitor(isolate),
+ stream_(stream),
+ only_instances_(only_instances),
+ count_(0) {}
virtual void VisitPointers(RawObject** first, RawObject** last) {
for (RawObject** current = first; current <= last; ++current) {
RawObject* object = *current;
@@ -498,6 +504,9 @@
// we'll need to encode which fields were omitted here.
continue;
}
+ if (only_instances_ && (object->GetClassId() < kInstanceCid)) {
+ continue;
+ }
WritePtr(object, stream_);
++count_;
}
@@ -507,6 +516,7 @@
private:
WriteStream* stream_;
+ bool only_instances_;
intptr_t count_;
};
@@ -524,8 +534,13 @@
class WriteGraphVisitor : public ObjectGraph::Visitor {
public:
- WriteGraphVisitor(Isolate* isolate, WriteStream* stream)
- : stream_(stream), ptr_writer_(isolate, stream), count_(0) {}
+ WriteGraphVisitor(Isolate* isolate,
+ WriteStream* stream,
+ ObjectGraph::SnapshotRoots roots)
+ : stream_(stream),
+ ptr_writer_(isolate, stream, roots == ObjectGraph::kUser),
+ roots_(roots),
+ count_(0) {}
virtual Direction VisitObject(ObjectGraph::StackIterator* it) {
RawObject* raw_obj = it->Get();
@@ -533,11 +548,13 @@
REUSABLE_OBJECT_HANDLESCOPE(thread);
Object& obj = thread->ObjectHandle();
obj = raw_obj;
- // Each object is a header + a zero-terminated list of its neighbors.
- WriteHeader(raw_obj, raw_obj->Size(), obj.GetClassId(), stream_);
- raw_obj->VisitPointers(&ptr_writer_);
- stream_->WriteUnsigned(0);
- ++count_;
+ if ((roots_ == ObjectGraph::kVM) || obj.IsField() || obj.IsInstance()) {
+ // Each object is a header + a zero-terminated list of its neighbors.
+ WriteHeader(raw_obj, raw_obj->Size(), obj.GetClassId(), stream_);
+ raw_obj->VisitPointers(&ptr_writer_);
+ stream_->WriteUnsigned(0);
+ ++count_;
+ }
return kProceed;
}
@@ -546,29 +563,98 @@
private:
WriteStream* stream_;
WritePointerVisitor ptr_writer_;
+ ObjectGraph::SnapshotRoots roots_;
intptr_t count_;
};
-intptr_t ObjectGraph::Serialize(WriteStream* stream, bool collect_garbage) {
+static void IterateUserFields(ObjectPointerVisitor* visitor) {
+ Thread* thread = Thread::Current();
+ // Scope to prevent handles create here from appearing as stack references.
+ HANDLESCOPE(thread);
+ Zone* zone = thread->zone();
+ const GrowableObjectArray& libraries = GrowableObjectArray::Handle(
+ zone, thread->isolate()->object_store()->libraries());
+ Library& library = Library::Handle(zone);
+ Object& entry = Object::Handle(zone);
+ Class& cls = Class::Handle(zone);
+ Array& fields = Array::Handle(zone);
+ Field& field = Field::Handle(zone);
+ for (intptr_t i = 0; i < libraries.Length(); i++) {
+ library ^= libraries.At(i);
+ DictionaryIterator entries(library);
+ while (entries.HasNext()) {
+ entry = entries.GetNext();
+ if (entry.IsClass()) {
+ cls ^= entry.raw();
+ fields = cls.fields();
+ for (intptr_t j = 0; j < fields.Length(); j++) {
+ field ^= fields.At(j);
+ RawObject* ptr = field.raw();
+ visitor->VisitPointer(&ptr);
+ }
+ } else if (entry.IsField()) {
+ field ^= entry.raw();
+ RawObject* ptr = field.raw();
+ visitor->VisitPointer(&ptr);
+ }
+ }
+ }
+}
+
+
+intptr_t ObjectGraph::Serialize(WriteStream* stream,
+ SnapshotRoots roots,
+ bool collect_garbage) {
if (collect_garbage) {
isolate()->heap()->CollectAllGarbage();
}
// Current encoding assumes objects do not move, so promote everything to old.
isolate()->heap()->new_space()->Evacuate();
- WriteGraphVisitor visitor(isolate(), stream);
+ RawObject* kRootAddress = reinterpret_cast<RawObject*>(kHeapObjectTag);
+ const intptr_t kRootCid = kIllegalCid;
+ RawObject* kStackAddress =
+ reinterpret_cast<RawObject*>(kObjectAlignment + kHeapObjectTag);
+
stream->WriteUnsigned(kObjectAlignment);
- stream->WriteUnsigned(0);
- stream->WriteUnsigned(0);
- stream->WriteUnsigned(0);
- {
- WritePointerVisitor ptr_writer(isolate(), stream);
+ stream->WriteUnsigned(kStackCid);
+
+ if (roots == kVM) {
+ // Write root "object".
+ WriteHeader(kRootAddress, 0, kRootCid, stream);
+ WritePointerVisitor ptr_writer(isolate(), stream, false);
isolate()->IterateObjectPointers(&ptr_writer, false);
+ stream->WriteUnsigned(0);
+ } else {
+ {
+ // Write root "object".
+ WriteHeader(kRootAddress, 0, kRootCid, stream);
+ WritePointerVisitor ptr_writer(isolate(), stream, false);
+ IterateUserFields(&ptr_writer);
+ WritePtr(kStackAddress, stream);
+ stream->WriteUnsigned(0);
+ }
+
+ {
+ // Write stack "object".
+ WriteHeader(kStackAddress, 0, kStackCid, stream);
+ WritePointerVisitor ptr_writer(isolate(), stream, true);
+ isolate()->IterateStackPointers(&ptr_writer, false);
+ stream->WriteUnsigned(0);
+ }
}
- stream->WriteUnsigned(0);
+
+ WriteGraphVisitor visitor(isolate(), stream, roots);
IterateObjects(&visitor);
- return visitor.count() + 1; // + root
+
+ intptr_t object_count = visitor.count();
+ if (roots == kVM) {
+ object_count += 1; // root
+ } else {
+ object_count += 2; // root and stack
+ }
+ return object_count;
}
} // namespace dart
diff --git a/runtime/vm/object_graph.h b/runtime/vm/object_graph.h
index cae668a..8060fba 100644
--- a/runtime/vm/object_graph.h
+++ b/runtime/vm/object_graph.h
@@ -6,11 +6,14 @@
#define RUNTIME_VM_OBJECT_GRAPH_H_
#include "vm/allocation.h"
-#include "vm/object.h"
namespace dart {
+class Array;
class Isolate;
+class Object;
+class RawObject;
+class WriteStream;
// Utility to traverse the object graph in an ordered fashion.
// Example uses:
@@ -93,12 +96,16 @@
// be live due to references from the stack or embedder handles.
intptr_t InboundReferences(Object* obj, const Array& references);
+ enum SnapshotRoots { kVM, kUser };
+
// Write the isolate's object graph to 'stream'. Smis and nulls are omitted.
// Returns the number of nodes in the stream, including the root.
// If collect_garabage is false, the graph will include weakly-reachable
// objects.
// TODO(koda): Document format; support streaming/chunking.
- intptr_t Serialize(WriteStream* stream, bool collect_garbage);
+ intptr_t Serialize(WriteStream* stream,
+ SnapshotRoots roots,
+ bool collect_garbage);
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectGraph);
diff --git a/runtime/vm/os_fuchsia.cc b/runtime/vm/os_fuchsia.cc
index 6c13dde..1e3fc48 100644
--- a/runtime/vm/os_fuchsia.cc
+++ b/runtime/vm/os_fuchsia.cc
@@ -10,7 +10,6 @@
#include <errno.h>
#include <magenta/syscalls.h>
#include <magenta/types.h>
-#include <sys/time.h>
#include "platform/assert.h"
#include "vm/zone.h"
@@ -78,12 +77,7 @@
int64_t OS::GetCurrentTimeMicros() {
- struct timeval tv;
- if (gettimeofday(&tv, NULL) < 0) {
- UNREACHABLE();
- return 0;
- }
- return (static_cast<int64_t>(tv.tv_sec) * 1000000) + tv.tv_usec;
+ return mx_time_get(MX_CLOCK_UTC) / kNanosecondsPerMicrosecond;
}
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 9097b1d..253c304 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -150,6 +150,10 @@
// Illegal class id.
kIllegalCid = 0,
+ // A sentinel used by the vm service's heap snapshots to represent references
+ // from the stack.
+ kStackCid = 1,
+
// The following entries describes classes for pseudo-objects in the heap
// that should never be reachable from live objects. Free list elements
// maintain the free list for old space, and forwarding corpses are used to
@@ -179,7 +183,7 @@
kByteBufferCid,
// The following entries do not describe a predefined class, but instead
- // are class indexes for pre-allocated instance (Null, dynamic and Void).
+ // are class indexes for pre-allocated instances (Null, dynamic and Void).
kNullCid,
kDynamicCid,
kVoidCid,
@@ -618,6 +622,7 @@
friend class StackFrame; // GetCodeObject assertion.
friend class CodeLookupTableBuilder; // profiler
friend class NativeEntry; // GetClassId
+ friend class WritePointerVisitor; // GetClassId
friend class Simulator;
friend class SimulatorHelpers;
friend class ObjectLocator;
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index 5e34b4a..259b2c0 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -3244,17 +3244,33 @@
}
+static const char* snapshot_roots_names[] = {
+ "User", "VM", NULL,
+};
+
+
+static ObjectGraph::SnapshotRoots snapshot_roots_values[] = {
+ ObjectGraph::kUser, ObjectGraph::kVM,
+};
+
+
static const MethodParameter* request_heap_snapshot_params[] = {
RUNNABLE_ISOLATE_PARAMETER,
+ new EnumParameter("roots", false /* not required */, snapshot_roots_names),
new BoolParameter("collectGarbage", false /* not required */), NULL,
};
static bool RequestHeapSnapshot(Thread* thread, JSONStream* js) {
+ ObjectGraph::SnapshotRoots roots = ObjectGraph::kVM;
+ const char* roots_arg = js->LookupParam("roots");
+ if (roots_arg != NULL) {
+ roots = EnumMapper(roots_arg, snapshot_roots_names, snapshot_roots_values);
+ }
const bool collect_garbage =
BoolParameter::Parse(js->LookupParam("collectGarbage"), true);
if (Service::graph_stream.enabled()) {
- Service::SendGraphEvent(thread, collect_garbage);
+ Service::SendGraphEvent(thread, roots, collect_garbage);
}
// TODO(koda): Provide some id that ties this request to async response(s).
JSONObject jsobj(js);
@@ -3263,11 +3279,13 @@
}
-void Service::SendGraphEvent(Thread* thread, bool collect_garbage) {
+void Service::SendGraphEvent(Thread* thread,
+ ObjectGraph::SnapshotRoots roots,
+ bool collect_garbage) {
uint8_t* buffer = NULL;
WriteStream stream(&buffer, &allocator, 1 * MB);
ObjectGraph graph(thread);
- intptr_t node_count = graph.Serialize(&stream, collect_garbage);
+ intptr_t node_count = graph.Serialize(&stream, roots, collect_garbage);
// Chrome crashes receiving a single tens-of-megabytes blob, so send the
// snapshot in megabyte-sized chunks instead.
diff --git a/runtime/vm/service.h b/runtime/vm/service.h
index a47fdbe..8ee0c00 100644
--- a/runtime/vm/service.h
+++ b/runtime/vm/service.h
@@ -8,6 +8,7 @@
#include "include/dart_tools_api.h"
#include "vm/allocation.h"
+#include "vm/object_graph.h"
#include "vm/object_id_ring.h"
#include "vm/os_thread.h"
@@ -107,7 +108,9 @@
Dart_GetVMServiceAssetsArchive get_service_assets);
static void SendEchoEvent(Isolate* isolate, const char* text);
- static void SendGraphEvent(Thread* thread, bool collect_garbage);
+ static void SendGraphEvent(Thread* thread,
+ ObjectGraph::SnapshotRoots roots,
+ bool collect_garbage);
static void SendInspectEvent(Isolate* isolate, const Object& inspectee);
static void SendEmbedderEvent(Isolate* isolate,
diff --git a/runtime/vm/stack_frame.cc b/runtime/vm/stack_frame.cc
index b621047..a07e414 100644
--- a/runtime/vm/stack_frame.cc
+++ b/runtime/vm/stack_frame.cc
@@ -95,7 +95,7 @@
// helper functions to the raw object interface.
NoSafepointScope no_safepoint;
Code code;
- code = LookupDartCode();
+ code = GetCodeObject();
if (!code.IsNull()) {
// Visit the code object.
RawObject* raw_code = code.raw();
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index 7de6fe8..ba7e90e 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -2681,9 +2681,6 @@
LayoutTests/fast/dom/HTMLScriptElement/remove-source_t01: RuntimeError # Please triage this failure
LayoutTests/fast/events/event-listener-html-non-html-confusion_t01: RuntimeError # Please triage this failure
-[ $compiler == dart2js && $runtime == drt && ($fast_startup != true || $checked != true) ]
-WebPlatformTest/custom-elements/instantiating/createElement_A04_t01: RuntimeError # Please triage this failure
-
[ $compiler == dart2js && $runtime == drt && $fast_startup && $checked ]
LayoutTests/fast/css-grid-layout/auto-content-resolution-rows_t01: RuntimeError # Please triage this failure
LayoutTests/fast/css-grid-layout/breadth-size-resolution-grid_t01: RuntimeError # Please triage this failure
@@ -10525,6 +10522,11 @@
LayoutTests/fast/canvas/webgl/tex-sub-image-cube-maps_t01: RuntimeError # Please triage this failure
LayoutTests/fast/canvas/webgl/webgl-depth-texture_t01: RuntimeError # Please triage this failure
+[ $compiler == dart2js && $runtime == ie11 && $builder_tag == win8]
+LibTest/typed_data/ByteData/offsetInBytes_A01_t01: RuntimeError # Please triage this failure
+LayoutTests/fast/dom/XMLSerializer-attribute-entities_t01: RuntimeError # Please triage this failure
+LayoutTests/fast/dom/serialize-attribute_t01: RuntimeError # Please triage this failure
+
[ $compiler == dart2js && $cps_ir ]
Language/Types/Interface_Types/subtype_t09: Crash # Pending static: JSArray
LibTest/collection/ListBase/ListBase_class_A01_t02: Pass, Timeout
diff --git a/tests/co19/co19-kernel.status b/tests/co19/co19-kernel.status
index b7d42e2..6b4334a 100644
--- a/tests/co19/co19-kernel.status
+++ b/tests/co19/co19-kernel.status
@@ -607,3 +607,7 @@
Language/Variables/final_t07: MissingCompileTimeError
LibTest/core/StringBuffer/StringBuffer_A01_t02: RuntimeError
LibTest/core/StringBuffer/write_A01_t02: RuntimeError
+
+# dartk: precompilation failures (debug)
+[ $compiler == dartkp && $runtime == dart_precompiled && $mode == debug ]
+Language/Libraries_and_Scripts/Scripts/top_level_main_t05: Crash # !main_obj.IsNull()
diff --git a/tests/compiler/dart2js/assert_message_throw_test.dart b/tests/compiler/dart2js/assert_message_throw_test.dart
new file mode 100644
index 0000000..75a5bb4
--- /dev/null
+++ b/tests/compiler/dart2js/assert_message_throw_test.dart
@@ -0,0 +1,76 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+import 'package:async_helper/async_helper.dart';
+import 'package:compiler/src/commandline_options.dart';
+import 'package:compiler/src/compiler.dart';
+import 'package:compiler/src/elements/elements.dart';
+import 'package:compiler/src/types/masks.dart';
+import 'package:expect/expect.dart';
+import 'memory_compiler.dart';
+import 'type_mask_test_helper.dart';
+
+const String SOURCE = '''
+main(args) {
+ test0();
+ test1(args == null);
+ test2(args == null);
+ test3(args);
+}
+
+// Check that `throw` in the message does is handled conditionally.
+test0() {
+ assert(true, throw "unreachable");
+ var list = [];
+ return list;
+}
+
+// Check that side-effects of the assert message is not included after the
+// assert.
+test1(b) {
+ var a;
+ assert(b, a = 42);
+ return a;
+}
+
+// Check that side-effects of the assert message is included after the assert
+// through the thrown exception.
+test2(b) {
+ var a;
+ try {
+ assert(b, a = 42);
+ } catch (e) {}
+ return a;
+}
+
+// Check that type tests are preserved after the assert.
+test3(a) {
+ assert(a is int);
+ return a;
+}
+''';
+
+main() {
+ asyncTest(() async {
+ CompilationResult result = await runCompiler(
+ entryPoint: Uri.parse('memory:main.dart'),
+ memorySourceFiles: {'main.dart': SOURCE},
+ options: [Flags.enableCheckedMode, Flags.enableAssertMessage]);
+ Compiler compiler = result.compiler;
+
+ void check(String methodName, TypeMask expectedReturnType) {
+ Element element = compiler.mainApp.find(methodName);
+ TypeMask typeMask = simplify(
+ compiler.globalInference.results.resultOf(element).returnType,
+ compiler);
+ Expect.equals(expectedReturnType, typeMask,
+ "Unexpected return type on method '$methodName'.");
+ }
+
+ check('test0', compiler.closedWorld.commonMasks.growableListType);
+ check('test1', compiler.closedWorld.commonMasks.nullType);
+ check('test2', compiler.closedWorld.commonMasks.uint31Type.nullable());
+ check('test3', compiler.closedWorld.commonMasks.intType);
+ });
+}
diff --git a/tests/compiler/dart2js/compiler_helper.dart b/tests/compiler/dart2js/compiler_helper.dart
index eaa26df..ff3dffa 100644
--- a/tests/compiler/dart2js/compiler_helper.dart
+++ b/tests/compiler/dart2js/compiler_helper.dart
@@ -72,15 +72,17 @@
lego.Element element = compiler.mainApp.find(entry);
if (element == null) return null;
compiler.phase = Compiler.PHASE_RESOLVING;
- compiler.backend.enqueueHelpers(compiler.enqueuer.resolution);
+ compiler.enqueuer.resolution
+ .applyImpact(compiler.backend.computeHelpersImpact());
compiler.processQueue(compiler.enqueuer.resolution, element);
compiler.openWorld.closeWorld(compiler.reporter);
compiler.backend.onResolutionComplete();
- ResolutionWorkItem resolutionWork = new ResolutionWorkItem(element);
- resolutionWork.run(compiler, compiler.enqueuer.resolution);
- CodegenWorkItem work = new CodegenWorkItem(compiler, element);
+ ResolutionWorkItem resolutionWork =
+ new ResolutionWorkItem(compiler.resolution, element);
+ resolutionWork.run();
+ CodegenWorkItem work = new CodegenWorkItem(compiler.backend, element);
compiler.phase = Compiler.PHASE_COMPILING;
- work.run(compiler, compiler.enqueuer.codegen);
+ work.run();
js.JavaScriptBackend backend = compiler.backend;
String generated = backend.getGeneratedCode(element);
if (check != null) {
diff --git a/tests/compiler/dart2js/embedded_category_api_boundary_test.dart b/tests/compiler/dart2js/embedded_category_api_boundary_test.dart
index 042bc37..c6e391d 100644
--- a/tests/compiler/dart2js/embedded_category_api_boundary_test.dart
+++ b/tests/compiler/dart2js/embedded_category_api_boundary_test.dart
@@ -23,7 +23,8 @@
}
});
asyncTest(() async {
- analyze(uriList, {}, checkResults: checkResults, mode: AnalysisMode.MAIN);
+ await analyze(uriList, {},
+ checkResults: checkResults, mode: AnalysisMode.MAIN);
});
}
@@ -42,6 +43,10 @@
LibraryInfo info = libraries[element.library.canonicalUri.path];
bool isAllowedInEmbedded =
info.isInternal || info.categories.contains(Category.embedded);
+ if (!isAllowedInEmbedded) {
+ print(
+ 'Disallowed element: $element from ${element.library.canonicalUri}');
+ }
return isAllowedInEmbedded;
});
}
diff --git a/tests/compiler/dart2js/exit_code_test.dart b/tests/compiler/dart2js/exit_code_test.dart
index 1ca76fc..8478d42 100644
--- a/tests/compiler/dart2js/exit_code_test.dart
+++ b/tests/compiler/dart2js/exit_code_test.dart
@@ -11,7 +11,9 @@
import 'package:expect/expect.dart';
import 'package:compiler/compiler_new.dart' as api;
+import 'package:compiler/src/common/backend_api.dart';
import 'package:compiler/src/common/codegen.dart';
+import 'package:compiler/src/common/resolution.dart';
import 'package:compiler/src/compile_time_constants.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/dart2js.dart' as entry;
@@ -20,8 +22,8 @@
import 'package:compiler/src/diagnostics/messages.dart';
import 'package:compiler/src/diagnostics/spannable.dart';
import 'package:compiler/src/apiimpl.dart' as apiimpl;
-import 'package:compiler/src/enqueue.dart';
import 'package:compiler/src/elements/elements.dart';
+import 'package:compiler/src/js_backend/js_backend.dart';
import 'package:compiler/src/library_loader.dart';
import 'package:compiler/src/null_compiler_output.dart';
import 'package:compiler/src/options.dart' show CompilerOptions;
@@ -52,9 +54,17 @@
}
@override
+ Backend createBackend() {
+ return new TestBackend(this);
+ }
+
+ @override
ScannerTask createScannerTask() => new TestScanner(this);
@override
+ Resolution createResolution() => new TestResolution(this);
+
+ @override
ResolverTask createResolverTask() {
return new TestResolver(this, backend.constantCompilerTask);
}
@@ -74,16 +84,6 @@
return super.onLibrariesLoaded(loadedLibraries);
}
- WorldImpact analyzeElement(Element element) {
- test('Compiler.analyzeElement');
- return super.analyzeElement(element);
- }
-
- WorldImpact codegen(CodegenWorkItem work, Enqueuer world) {
- test('Compiler.codegen');
- return super.codegen(work, world);
- }
-
test(String marker) {
if (marker == testMarker) {
switch (testType) {
@@ -121,6 +121,23 @@
}
}
+class TestBackend extends JavaScriptBackend {
+ final TestCompiler compiler;
+ TestBackend(TestCompiler compiler)
+ : this.compiler = compiler,
+ super(compiler,
+ generateSourceMap: compiler.options.generateSourceMap,
+ useStartupEmitter: compiler.options.useStartupEmitter,
+ useNewSourceInfo: compiler.options.useNewSourceInfo,
+ useKernel: compiler.options.useKernel);
+
+ @override
+ WorldImpact codegen(CodegenWorkItem work) {
+ compiler.test('Compiler.codegen');
+ return super.codegen(work);
+ }
+}
+
class TestDiagnosticReporter extends DiagnosticReporterWrapper {
TestCompiler compiler;
DiagnosticReporter reporter;
@@ -161,6 +178,20 @@
}
}
+class TestResolution extends CompilerResolution {
+ TestCompiler compiler;
+
+ TestResolution(TestCompiler compiler)
+ : this.compiler = compiler,
+ super(compiler);
+
+ @override
+ WorldImpact computeWorldImpact(Element element) {
+ compiler.test('Compiler.analyzeElement');
+ return super.computeWorldImpact(element);
+ }
+}
+
int checkedResults = 0;
Future testExitCode(
diff --git a/tests/compiler/dart2js/kernel/closed_world_test.dart b/tests/compiler/dart2js/kernel/closed_world_test.dart
index aa21341..cf642fa 100644
--- a/tests/compiler/dart2js/kernel/closed_world_test.dart
+++ b/tests/compiler/dart2js/kernel/closed_world_test.dart
@@ -89,7 +89,6 @@
compiler.enqueuer,
compiler.options,
compiler.resolution,
- compiler.enqueuerFilter,
const TreeShakingEnqueuerStrategy(),
compiler.globalDependencies,
backend,
@@ -101,21 +100,21 @@
// enqueuing twice.
backend.typeVariableHandler = new TypeVariableHandler(compiler);
- backend.enqueueHelpers(enqueuer);
+ if (compiler.deferredLoadTask.isProgramSplit) {
+ enqueuer.applyImpact(backend.computeDeferredLoadingImpact());
+ }
+ enqueuer.applyImpact(backend.computeHelpersImpact());
+ enqueuer.applyImpact(enqueuer.nativeEnqueuer
+ .processNativeClasses(compiler.libraryLoader.libraries));
enqueuer.applyImpact(
- compiler.impactStrategy,
- enqueuer.nativeEnqueuer
- .processNativeClasses(compiler.libraryLoader.libraries));
- enqueuer.applyImpact(compiler.impactStrategy,
- backend.computeMainImpact(enqueuer, compiler.mainFunction));
+ backend.computeMainImpact(compiler.mainFunction, forResolution: true));
enqueuer.forEach((work) {
AstElement element = work.element;
ResolutionImpact resolutionImpact = build(compiler, element.resolvedAst);
WorldImpact worldImpact = compiler.backend.impactTransformer
.transformResolutionImpact(enqueuer, resolutionImpact);
enqueuer.registerProcessedElement(element);
- enqueuer.applyImpact(compiler.impactStrategy, worldImpact,
- impactSource: element);
+ enqueuer.applyImpact(worldImpact, impactSource: element);
});
ClosedWorld closedWorld =
enqueuer.universe.openWorld.closeWorld(compiler.reporter);
diff --git a/tests/compiler/dart2js/patch_test.dart b/tests/compiler/dart2js/patch_test.dart
index f7b34dd..95ee5c3 100644
--- a/tests/compiler/dart2js/patch_test.dart
+++ b/tests/compiler/dart2js/patch_test.dart
@@ -200,7 +200,7 @@
Expect.equals(patchText, patch.node.toString());
}
- compiler.analyzeElement(origin);
+ compiler.resolution.computeWorldImpact(origin);
compiler.enqueuer.resolution.emptyDeferredQueueForTesting();
DiagnosticCollector collector = compiler.diagnosticCollector;
diff --git a/tests/compiler/dart2js/resolver_test.dart b/tests/compiler/dart2js/resolver_test.dart
index f88787b..7be75ef1 100644
--- a/tests/compiler/dart2js/resolver_test.dart
+++ b/tests/compiler/dart2js/resolver_test.dart
@@ -16,6 +16,8 @@
import 'package:compiler/src/resolution/resolution_result.dart';
import 'package:compiler/src/resolution/scope.dart';
import 'package:compiler/src/resolution/tree_elements.dart';
+import 'package:compiler/src/universe/use.dart';
+import 'package:compiler/src/universe/world_impact.dart';
import 'compiler_helper.dart';
import 'link_helper.dart';
@@ -241,7 +243,8 @@
compiler.resolveStatement("Foo foo;");
ClassElement fooElement = compiler.mainApp.find("Foo");
FunctionElement funElement = fooElement.lookupLocalMember("foo");
- compiler.enqueuer.resolution.addToWorkList(funElement);
+ compiler.enqueuer.resolution.applyImpact(new WorldImpactBuilderImpl()
+ ..registerStaticUse(new StaticUse.foreignUse(funElement)));
compiler.processQueue(compiler.enqueuer.resolution, null);
DiagnosticCollector collector = compiler.diagnosticCollector;
Expect.equals(0, collector.warnings.length);
diff --git a/tests/compiler/dart2js/type_combination_test.dart b/tests/compiler/dart2js/type_combination_test.dart
index 875f276..bde511b 100644
--- a/tests/compiler/dart2js/type_combination_test.dart
+++ b/tests/compiler/dart2js/type_combination_test.dart
@@ -8,6 +8,8 @@
import 'package:compiler/src/js_backend/js_backend.dart';
import 'package:compiler/src/types/types.dart';
import 'package:compiler/src/world.dart';
+import 'package:compiler/src/universe/use.dart';
+import 'package:compiler/src/universe/world_impact.dart';
import 'compiler_helper.dart';
import 'type_mask_test_helper.dart';
@@ -737,21 +739,24 @@
JavaScriptBackend backend = compiler.backend;
BackendHelpers helpers = backend.helpers;
ClosedWorld world = compiler.openWorld.closeWorld(compiler.reporter);
+ WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
helpers.interceptorsLibrary.forEachLocalMember((element) {
if (element.isClass) {
element.ensureResolved(compiler.resolution);
- compiler.enqueuer.resolution.registerInstantiatedType(element.rawType);
+ impactBuilder
+ .registerTypeUse(new TypeUse.instantiation(element.rawType));
}
});
ClassElement patternImplClass = compiler.mainApp.find('PatternImpl');
patternImplClass.ensureResolved(compiler.resolution);
- compiler.enqueuer.resolution
- .registerInstantiatedType(compiler.coreTypes.mapType());
- compiler.enqueuer.resolution
- .registerInstantiatedType(compiler.coreTypes.functionType);
- compiler.enqueuer.resolution
- .registerInstantiatedType(patternImplClass.rawType);
+ impactBuilder.registerTypeUse(
+ new TypeUse.instantiation(compiler.coreTypes.mapType()));
+ impactBuilder.registerTypeUse(
+ new TypeUse.instantiation(compiler.coreTypes.functionType));
+ impactBuilder
+ .registerTypeUse(new TypeUse.instantiation(patternImplClass.rawType));
+ compiler.enqueuer.resolution.applyImpact(impactBuilder);
compiler.openWorld.closeWorld(compiler.reporter);
// Grab hold of a supertype for String so we can produce potential
diff --git a/tests/corelib/corelib.status b/tests/corelib/corelib.status
index 4f7663f..48cfb52 100644
--- a/tests/corelib/corelib.status
+++ b/tests/corelib/corelib.status
@@ -84,7 +84,7 @@
list_test/none: RuntimeError # Issue 27871
list_test/01: RuntimeError # Issue 27871
-[ $compiler == dart2js && $runtime == drt && $csp && $minimized ]
+[ $compiler == dart2js && $runtime == drt && $csp && $minified ]
core_runtime_types_test: Pass, Fail # Issue 27913
[ $compiler == dart2js ]
diff --git a/tests/language/language.status b/tests/language/language.status
index 68a294c..c0489a5 100644
--- a/tests/language/language.status
+++ b/tests/language/language.status
@@ -199,6 +199,7 @@
tearoff_basic_test: Fail
regress_22443_test: Fail
deferred_not_loaded_check_test: Fail
+vm/regress_27201_test: Fail
[ $mode == product || $compiler == dart2appjit || $compiler == dart2app || $compiler == precompiler ]
# Deferred loading happens eagerly. Issue #27587
@@ -209,10 +210,12 @@
deferred_load_constants_test/05: Fail
tearoff_basic_test: Fail
deferred_not_loaded_check_test: Fail
+vm/regress_27201_test: Fail
[ $compiler == precompiler ]
# Deferred loading happens eagerly. Issue #27587
deferred_global_test: Fail
+vm/regress_27201_test: Fail
[ $compiler == precompiler || $compiler == dart2app || $compiler == dart2appjit ]
ct_const2_test: Skip # Incompatible flag: --compile_all
@@ -300,6 +303,7 @@
override_field_method2_negative_test: Pass, Crash # Issue 27835
override_field_method4_negative_test: Pass, Crash # Issue 27835
override_field_method5_negative_test: Pass, Crash # Issue 27835
+vm/regress_27201_test: Pass, Crash # Requires deferred libraries
[$runtime != vm || $compiler != none]
assert_initializer_test: SKIP # not implemented yet, experiment is VM only.
@@ -315,3 +319,6 @@
[$runtime == vm && $compiler == none]
duplicate_part_test/01: MissingCompileTimeError # Issue 27516
+
+[$compiler == dart2analyzer]
+vm/regress_27201_test: SkipByDesign # Loads bad library, so will always crash.
diff --git a/tests/language/language_kernel.status b/tests/language/language_kernel.status
index 6262b1b..b5cc7b3 100644
--- a/tests/language/language_kernel.status
+++ b/tests/language/language_kernel.status
@@ -189,11 +189,7 @@
getter_closure_execution_order_test: RuntimeError
getter_setter_in_lib_test: RuntimeError
inferrer_closure_test: RuntimeError
-initializing_formal_access_test: CompileTimeError
-initializing_formal_capture_test: CompileTimeError
-initializing_formal_final_test: CompileTimeError
-initializing_formal_promotion_test: CompileTimeError
-initializing_formal_type_test: CompileTimeError
+initializing_formal_final_test: RuntimeError
instance_creation_in_function_annotation_test: RuntimeError
is_not_class2_test: RuntimeError
issue13474_test: RuntimeError
@@ -292,7 +288,6 @@
not_enough_positional_arguments_test/05: MissingRuntimeError
null_test/none: RuntimeError
number_identifier_test/05: RuntimeError
-parameter_initializer5_test: CompileTimeError
positional_parameters_type_test/01: MissingRuntimeError
positional_parameters_type_test/02: MissingRuntimeError
prefix10_negative_test: Fail
@@ -526,11 +521,7 @@
getter_setter_in_lib_test: RuntimeError
if_null_assignment_static_test/35: Crash
inferrer_closure_test: RuntimeError
-initializing_formal_access_test: CompileTimeError
-initializing_formal_capture_test: CompileTimeError
-initializing_formal_final_test: CompileTimeError
-initializing_formal_promotion_test: CompileTimeError
-initializing_formal_type_test: CompileTimeError
+initializing_formal_final_test: RuntimeError
instance_creation_in_function_annotation_test: Crash
invocation_mirror_invoke_on2_test: Crash
is_not_class2_test: RuntimeError
@@ -632,7 +623,6 @@
not_enough_positional_arguments_test/05: MissingRuntimeError
null_test/none: RuntimeError
number_identifier_test/05: RuntimeError
-parameter_initializer5_test: CompileTimeError
positional_parameters_type_test/01: MissingRuntimeError
positional_parameters_type_test/02: MissingRuntimeError
prefix10_negative_test: Fail
@@ -677,3 +667,10 @@
vm/reflect_core_vm_test: CompileTimeError
vm/type_cast_vm_test: RuntimeError
vm/type_vm_test: RuntimeError
+
+# dartk: precompilation failures (debug)
+[ $compiler == dartkp && $runtime == dart_precompiled && $mode == debug ]
+constructor_named_arguments_test/01: Crash
+enum_syntax_test/05: Crash
+generic_sends_test: Crash
+not_enough_positional_arguments_test/05: Crash
diff --git a/tests/language/vm/regress_27201_lib.dart b/tests/language/vm/regress_27201_lib.dart
new file mode 100644
index 0000000..4973ee7
--- /dev/null
+++ b/tests/language/vm/regress_27201_lib.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+// 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.
+
+library import_lib;
+
+final foo = 1;
+var someVar = 3;
+var _privateVar;
+
+int get someGetter => 2;
+
+void set someSetter(int val) {}
+
+int someFunc() => 0;
+
+class SomeClass {
+}
+
+typedef int Func(Object a);
diff --git a/tests/language/vm/regress_27201_test.dart b/tests/language/vm/regress_27201_test.dart
new file mode 100644
index 0000000..251a1ad
--- /dev/null
+++ b/tests/language/vm/regress_27201_test.dart
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
+ * 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.
+ */
+import "dart:async";
+import "package:expect/expect.dart";
+import "regress_27201_lib.dart" deferred as p;
+import "regress_27201_bad_lib_path.dart" deferred as q;
+
+test_loaded() {
+ try {
+ p.someFunc();
+ } catch (e) {
+ Expect.fail("Should not be here");
+ }
+ try {
+ p.someGetter;
+ } catch (e) {
+ Expect.fail("Should not be here");
+ }
+ try {
+ p.someSetter = 1;
+ } catch (e) {
+ Expect.fail("Should not be here");
+ }
+ try {
+ p.Func;
+ } catch (e) {
+ Expect.fail("Should not be here");
+ }
+ try {
+ Expect.isTrue(p.loadLibrary() is Future);
+ } catch (e) {
+ Expect.fail("Should not be here");
+ }
+}
+
+
+main() {
+ p.loadLibrary().then((v) {
+ test_loaded();
+ },
+ onError: (e) {
+ Expect.fail("Should have loaded library!");
+ });
+
+ // Ensure bad library import is handled correctly.
+ q.loadLibrary().then((v) {
+ Expect.fail("Should have failed");
+ },
+ onError: (e) {
+ Expect.throws(() => q.x);
+ });
+}
+
diff --git a/tools/VERSION b/tools/VERSION
index 4af9fe7..99f11c9 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -28,5 +28,5 @@
MAJOR 1
MINOR 21
PATCH 0
-PRERELEASE 10
+PRERELEASE 11
PRERELEASE_PATCH 0
diff --git a/tools/bots/dart_sdk.py b/tools/bots/dart_sdk.py
index 66905de..588061a 100644
--- a/tools/bots/dart_sdk.py
+++ b/tools/bots/dart_sdk.py
@@ -56,8 +56,8 @@
url = 'https://api.dartlang.org/stable'
with bot.BuildStep('Build API docs by dartdoc'):
bot_utils.run([dart_exe, dartdoc_dart,
- '--sdk-docs','--output', dirname, '--dart-sdk', dart_sdk,
- '--footer' , footer_file, '--rel-canonical-prefix=' + url])
+ '--sdk-docs','--output', dirname, '--footer' , footer_file,
+ '--rel-canonical-prefix=' + url])
def CreateUploadVersionFile():
file_path = os.path.join(bot_utils.DART_DIR,
diff --git a/tools/gn.py b/tools/gn.py
index 91caa19..fd9a1b7 100755
--- a/tools/gn.py
+++ b/tools/gn.py
@@ -77,6 +77,11 @@
# dart_bootstrap if the prebuilt SDK doesn't work.
gn_args['dart_host_pub_exe'] = ""
+ # We only want the fallback root certs in the standalone VM on
+ # Linux and Windows.
+ if gn_args['target_os'] in ['linux', 'win']:
+ gn_args['dart_use_fallback_root_certificates'] = True
+
gn_args['dart_zlib_path'] = "//runtime/bin/zlib"
# Use tcmalloc only when targeting Linux and when not using ASAN.