Version 2.0.0-dev.14.0
Merge commit '72736aff0ddd03b01241946a8280b6ae5bfe6a64' into dev
diff --git a/CHANGELOG.md b/CHANGELOG.md
index e0d48cb..9941193 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -46,6 +46,7 @@
`SECONDS_PER_DAY` to `secondsPerDay`,
`MINUTES_PER_DAY` to `minutesPerDay`, and
`ZERO` to `zero`.
+ * Added `Provisional` annotation to `dart:core`.
* `dart:convert`
* `Utf8Decoder` when compiled with dart2js uses the browser's `TextDecoder` in
@@ -195,6 +196,20 @@
}
```
+## 1.24.3 - 14-12-2017
+
+* Fix for constructing a new SecurityContext that contains the built-in
+ certificate authority roots
+ (https://github.com/dart-lang/sdk/issues/24693).
+
+### Core library changes
+
+* `dart:io`
+ * Unified backends for `SecureSocket`, `SecurityContext`, and
+ `X509Certificate` to be consistent across all platforms. All
+ `SecureSocket`, `SecurityContext`, and `X509Certificate` properties and
+ methods are now supported on iOS and OSX.
+
## 1.24.2 - 22-06-2017
* Fixes for debugging in Dartium.
diff --git a/build/gn_run_binary.py b/build/gn_run_binary.py
index 224936a..f6f9bac 100755
--- a/build/gn_run_binary.py
+++ b/build/gn_run_binary.py
@@ -26,6 +26,9 @@
except subprocess.CalledProcessError as e:
return ("Command failed: " + ' '.join(command) + "\n" +
"output: " + e.output)
+ except OSError as e:
+ return ("Command failed: " + ' '.join(command) + "\n" +
+ "output: " + e.strerror)
def main(argv):
error_exit = 0
diff --git a/docs/language/dartLangSpec.tex b/docs/language/dartLangSpec.tex
index fb976cf..a0879ba 100644
--- a/docs/language/dartLangSpec.tex
+++ b/docs/language/dartLangSpec.tex
@@ -28,11 +28,13 @@
% namedArguments on Invocation.
% - Remove the, now unnecessary, handling of invalid overrides of noSuchMethod.
% - Add >>> as overridable operator.
-% - If initializing formal has type annotation, require subtype of field.
+% - If initializing formal has type annotation, require subtype of field type.
% - Constant `==` operations now also allowed if just one operand is null.
% - Make flatten not be recursive.
% - Disallow implementing two instantiations of the same generic interface.
% - Update "FutureOr" specification for Dart 2.0.
+% - Require that a top-level "main" declaration is a valid script-entry
+% function declaration.
%
% 1.15
% - Change how language specification describes control flow.
@@ -7868,10 +7870,15 @@
}
\LMHash{}
-If a non-script library is provided where a script is expected,
-it precludes execution.
-As such, it should be reported as a compile-time error,
-even if that library compiles successfully as a non-script library.
+It is a compile-time error if a library's export scope contains a declaration
+named \code{main}, and the library is not a script.
+\commentary{This restriction ensures that all top-level \code{main} declarations
+introduce a script main-function, so there cannot be a top-level getter or field
+named \code{main}, nor can it be a function that requires more than two
+arguments. The restriction allows tools to fail early on invalid \code{main}
+methods, without needing to know whether a library will be used as the entry
+point of a Dart program. It is possible that this restriction will be removed
+in the future.}
\subsection{URIs}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart b/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
index 8803b5a..4667311 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/keyword_contributor.dart
@@ -71,6 +71,18 @@
}
if (entity is SimpleIdentifier && node.arguments.contains(entity)) {
_addExpressionKeywords(node);
+ int index = node.arguments.indexOf(entity);
+ if (index > 0) {
+ Expression previousArgument = node.arguments[index - 1];
+ Token endToken = previousArgument?.endToken;
+ if (endToken?.lexeme == ')' &&
+ endToken.next?.lexeme == ',' &&
+ endToken.next.isSynthetic) {
+ _addSuggestion(Keyword.ASYNC);
+ _addSuggestion2(ASYNC_STAR);
+ _addSuggestion2(SYNC_STAR);
+ }
+ }
}
}
diff --git a/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
index deff0db..d8a0b4b 100644
--- a/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
@@ -4,6 +4,7 @@
import 'package:analysis_server/src/provisional/completion/dart/completion_dart.dart';
import 'package:analysis_server/src/services/completion/dart/keyword_contributor.dart';
+import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
@@ -316,8 +317,18 @@
test_anonymous_function_async2() async {
addTestSource('main() {foo(() a^ {}}}');
await computeSuggestions();
- assertSuggestKeywords(STMT_START_OUTSIDE_CLASS,
- pseudoKeywords: ['async', 'async*', 'sync*']);
+ // Fasta adds a closing paren after the first `}`
+ // and reports a single function expression argument
+ // while analyzer adds the closing paren before the `a`
+ // and adds synthetic `;`s making `a` a statement.
+ if (request.target.entity is BlockFunctionBody) {
+ assertSuggestKeywords([],
+ pseudoKeywords: ['async', 'async*', 'sync*'],
+ relevance: DART_RELEVANCE_HIGH);
+ } else {
+ assertSuggestKeywords(STMT_START_OUTSIDE_CLASS,
+ pseudoKeywords: ['async', 'async*', 'sync*']);
+ }
}
test_anonymous_function_async3() async {
@@ -352,10 +363,35 @@
addTestSource('main() {foo("bar", () as^ => null');
await computeSuggestions();
assertSuggestKeywords([],
+ pseudoKeywords: request.target.entity is ExpressionFunctionBody
+ ? ['async']
+ : ['async', 'async*', 'sync*'],
+ relevance: DART_RELEVANCE_HIGH);
+ }
+
+ test_anonymous_function_async8() async {
+ addTestSource('main() {foo(() ^ {})}}');
+ await computeSuggestions();
+ assertSuggestKeywords([],
pseudoKeywords: ['async', 'async*', 'sync*'],
relevance: DART_RELEVANCE_HIGH);
}
+ test_anonymous_function_async9() async {
+ addTestSource('main() {foo(() a^ {})}}');
+ await computeSuggestions();
+ // Fasta interprets the argument as a function expression
+ // while analyzer adds synthetic `;`s making `a` a statement.
+ if (request.target.entity is BlockFunctionBody) {
+ assertSuggestKeywords([],
+ pseudoKeywords: ['async', 'async*', 'sync*'],
+ relevance: DART_RELEVANCE_HIGH);
+ } else {
+ assertSuggestKeywords(STMT_START_OUTSIDE_CLASS,
+ pseudoKeywords: ['async', 'async*', 'sync*']);
+ }
+ }
+
test_argument() async {
addTestSource('main() {foo(^);}');
await computeSuggestions();
@@ -703,16 +739,20 @@
test_class_implements2() async {
addTestSource('class A e^ implements foo');
await computeSuggestions();
- // TODO (danrubel) refinement: don't suggest implements
- assertSuggestKeywords([Keyword.EXTENDS, Keyword.IMPLEMENTS],
+ assertSuggestKeywords(
+ request.target.containingNode is ClassDeclaration
+ ? [Keyword.EXTENDS]
+ : [Keyword.EXTENDS, Keyword.IMPLEMENTS],
relevance: DART_RELEVANCE_HIGH);
}
test_class_implements3() async {
addTestSource('class A e^ implements foo { }');
await computeSuggestions();
- // TODO (danrubel) refinement: don't suggest implements
- assertSuggestKeywords([Keyword.EXTENDS, Keyword.IMPLEMENTS],
+ assertSuggestKeywords(
+ request.target.containingNode is ClassDeclaration
+ ? [Keyword.EXTENDS]
+ : [Keyword.EXTENDS, Keyword.IMPLEMENTS],
relevance: DART_RELEVANCE_HIGH);
}
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index 34148ff..24a231f 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -512,6 +512,7 @@
StaticTypeWarningCode.NON_NULLABLE_FIELD_NOT_INITIALIZED,
StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT,
StaticTypeWarningCode.RETURN_OF_INVALID_TYPE,
+ StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE,
StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS,
StaticTypeWarningCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND,
StaticTypeWarningCode.UNDEFINED_ENUM_CONSTANT,
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
index 5ac8673..20bd277 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
@@ -438,7 +438,7 @@
ResolutionApplier _createResolutionApplier(
ElementImpl context, CollectedResolution resolution) {
return new _ResolutionApplierContext(
- _resynthesizer, _typeProvider, resolution, context)
+ _resynthesizer, _typeProvider, _libraryElement, resolution, context)
.applier;
}
@@ -462,9 +462,7 @@
bool isIgnored(AnalysisError error) {
int errorLine = lineInfo.getLocation(error.offset).lineNumber;
String errorCode = error.errorCode.name.toLowerCase();
- // Ignores can be on the line or just preceding the error.
- return ignoreInfo.ignoredAt(errorCode, errorLine) ||
- ignoreInfo.ignoredAt(errorCode, errorLine - 1);
+ return ignoreInfo.ignoredAt(errorCode, errorLine);
}
return errors.where((AnalysisError e) => !isIgnored(e)).toList();
@@ -1011,6 +1009,7 @@
class _ResolutionApplierContext implements TypeContext {
final KernelResynthesizer resynthesizer;
final TypeProvider typeProvider;
+ final LibraryElement libraryElement;
final CollectedResolution resolution;
@override
@@ -1028,8 +1027,8 @@
ResolutionApplier applier;
- _ResolutionApplierContext(
- this.resynthesizer, this.typeProvider, this.resolution, this.context) {
+ _ResolutionApplierContext(this.resynthesizer, this.typeProvider,
+ this.libraryElement, this.resolution, this.context) {
for (Element element = context;
element != null;
element = element.enclosingElement) {
@@ -1110,6 +1109,15 @@
element = memberElement;
}
}
+ } else if (referencedNode is kernel.ImportPrefixNode) {
+ assert(referencedNode.name != null);
+ for (var import in libraryElement.imports) {
+ if (import.prefix?.name == referencedNode.name) {
+ element = import.prefix;
+ break;
+ }
+ }
+ assert(element != null);
} else if (referencedNode is kernel.NullNode) {
element = null;
} else if (referencedNode == null) {
@@ -1213,7 +1221,9 @@
@override
DartType translateType(kernel.DartType kernelType) {
- if (kernelType is kernel.FunctionReferenceDartType) {
+ if (kernelType is kernel.NullType) {
+ return null;
+ } else if (kernelType is kernel.FunctionReferenceDartType) {
kernel.VariableDeclaration variable = kernelType.function.variable;
FunctionElement element = declarationToElement[variable];
return element.type;
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 6241319..e55219b 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -2865,6 +2865,19 @@
"The return type '{0}' isn't a '{1}', as defined by the method '{2}'.");
/**
+ * 13.11 Return: It is a static type warning if the type of <i>e</i> may not
+ * be assigned to the declared return type of the immediately enclosing
+ * function.
+ *
+ * Parameters:
+ * 0: the return type as declared in the return statement
+ * 1: the expected return type as defined by the method
+ */
+ static const StaticTypeWarningCode RETURN_OF_INVALID_TYPE_FROM_CLOSURE =
+ const StaticTypeWarningCode('RETURN_OF_INVALID_TYPE_FROM_CLOSURE',
+ "The return type '{0}' isn't a '{1}', as defined by anonymous closure.");
+
+ /**
* 12.11 Instance Creation: It is a static type warning if any of the type
* arguments to a constructor of a generic type <i>G</i> invoked by a new
* expression or a constant object expression are not subtypes of the bounds
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 6d25fab..f5c683c 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -1173,8 +1173,10 @@
members.add(ast.switchDefault(
<Label>[], defaultKeyword, colonAfterDefault, <Statement>[]));
}
- members.last.statements.addAll(statements);
- members.first.labels.addAll(labels);
+ if (members.isNotEmpty) {
+ members.last.statements.addAll(statements);
+ members.first.labels.addAll(labels);
+ }
push(members);
}
diff --git a/pkg/analyzer/lib/src/fasta/error_converter.dart b/pkg/analyzer/lib/src/fasta/error_converter.dart
index a4c0bec..02e3688 100644
--- a/pkg/analyzer/lib/src/fasta/error_converter.dart
+++ b/pkg/analyzer/lib/src/fasta/error_converter.dart
@@ -431,6 +431,14 @@
errorReporter?.reportErrorForOffset(
ParserErrorCode.STATIC_OPERATOR, offset, length);
return;
+ case "SWITCH_HAS_CASE_AFTER_DEFAULT_CASE":
+ errorReporter?.reportErrorForOffset(
+ ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE, offset, length);
+ return;
+ case "SWITCH_HAS_MULTIPLE_DEFAULT_CASES":
+ errorReporter?.reportErrorForOffset(
+ ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES, offset, length);
+ return;
case "TOP_LEVEL_OPERATOR":
errorReporter?.reportErrorForOffset(
ParserErrorCode.TOP_LEVEL_OPERATOR, offset, length);
diff --git a/pkg/analyzer/lib/src/fasta/resolution_applier.dart b/pkg/analyzer/lib/src/fasta/resolution_applier.dart
index 1cf2182..ccc7295 100644
--- a/pkg/analyzer/lib/src/fasta/resolution_applier.dart
+++ b/pkg/analyzer/lib/src/fasta/resolution_applier.dart
@@ -802,6 +802,10 @@
/// [ResolutionStorer]) to an analyzer AST, and also checks file offsets to
/// verify that the types are applied to the correct subexpressions.
class ValidatingResolutionApplier extends ResolutionApplier {
+ /// The offset that is used when the actual offset is not know.
+ /// The applier should not validate this offset.
+ static const UNKNOWN_OFFSET = -2;
+
/// Indicates whether debug messages should be printed.
static const bool _debug = false;
@@ -865,7 +869,7 @@
'No reference information for $entity at $entityOffset');
}
int elementOffset = _referencedElementOffsets[_referencedElementIndex];
- if (entityOffset != elementOffset) {
+ if (elementOffset != UNKNOWN_OFFSET && entityOffset != elementOffset) {
throw new StateError(
'Expected element reference for analyzer offset $entityOffset; '
'got one for kernel offset $elementOffset');
@@ -882,9 +886,10 @@
if (_typeIndex >= _types.length) {
throw new StateError('No type information for $entity at $entityOffset');
}
- if (entityOffset != _typeOffsets[_typeIndex]) {
+ int typeOffset = _typeOffsets[_typeIndex];
+ if (typeOffset != UNKNOWN_OFFSET && entityOffset != typeOffset) {
throw new StateError('Expected a type for $entity at $entityOffset; '
- 'got one for kernel offset ${_typeOffsets[_typeIndex]}');
+ 'got one for kernel offset $typeOffset');
}
return super._getTypeFor(entity);
}
diff --git a/pkg/analyzer/lib/src/fasta/resolution_storer.dart b/pkg/analyzer/lib/src/fasta/resolution_storer.dart
index 8a59929..d1d04a9 100644
--- a/pkg/analyzer/lib/src/fasta/resolution_storer.dart
+++ b/pkg/analyzer/lib/src/fasta/resolution_storer.dart
@@ -24,6 +24,20 @@
}
}
+/// The reference to the import prefix with the [name].
+class ImportPrefixNode implements TreeNode {
+ final String name;
+
+ ImportPrefixNode(this.name);
+
+ noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
+
+ @override
+ String toString() {
+ return '(prefix-$name)';
+ }
+}
+
/// The type of [DartType] node that is used as a marker for using `null`
/// as the [FunctionType] for index assignment.
class IndexAssignNullFunctionType implements DartType {
@@ -192,9 +206,28 @@
}
}
+/// The type of [DartType] node that is used as a marker for `null`.
+///
+/// It is used for import prefix identifiers, which are resolved to elements,
+/// but don't have any types.
+class NullType implements DartType {
+ const NullType();
+
+ noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
+
+ @override
+ String toString() {
+ return '(null-type)';
+ }
+}
+
/// Type inference listener that records inferred types for later use by
/// [ResolutionApplier].
class ResolutionStorer extends TypeInferenceListener {
+ /// The offset that is used when the actual offset is not know.
+ /// The consumer of information should not validate this offset.
+ static const UNKNOWN_OFFSET = -2;
+
final List<TreeNode> _declarations;
final List<Node> _references;
final List<DartType> _types;
@@ -494,8 +527,18 @@
}
@override
- bool staticAssignEnter(Expression expression, int targetOffset,
- Class targetClass, Expression write, DartType typeContext) {
+ bool staticAssignEnter(
+ Expression expression,
+ String prefixName,
+ int targetOffset,
+ Class targetClass,
+ Expression write,
+ DartType typeContext) {
+ // if there was an import prefix, record it.
+ if (prefixName != null) {
+ _recordReference(new ImportPrefixNode(prefixName), UNKNOWN_OFFSET);
+ _recordType(const NullType(), UNKNOWN_OFFSET);
+ }
// If the static target is explicit (and is a class), record it.
if (targetClass != null) {
_recordReference(targetClass, targetOffset);
@@ -505,7 +548,7 @@
_deferReference(write.fileOffset);
_deferType(write.fileOffset);
return super.staticAssignEnter(
- expression, targetOffset, targetClass, write, typeContext);
+ expression, prefixName, targetOffset, targetClass, write, typeContext);
}
@override
@@ -524,15 +567,20 @@
}
@override
- bool staticGetEnter(StaticGet expression, int targetOffset, Class targetClass,
- DartType typeContext) {
+ bool staticGetEnter(StaticGet expression, String prefixName, int targetOffset,
+ Class targetClass, DartType typeContext) {
+ // if there was an import prefix, record it.
+ if (prefixName != null) {
+ _recordReference(new ImportPrefixNode(prefixName), UNKNOWN_OFFSET);
+ _recordType(const NullType(), UNKNOWN_OFFSET);
+ }
// If the static target is explicit (and is a class), record it.
if (targetClass != null) {
_recordReference(targetClass, targetOffset);
_recordType(targetClass.rawType, targetOffset);
}
- return super
- .staticGetEnter(expression, targetOffset, targetClass, typeContext);
+ return super.staticGetEnter(
+ expression, prefixName, targetOffset, targetClass, typeContext);
}
@override
@@ -543,8 +591,13 @@
}
@override
- bool staticInvocationEnter(StaticInvocation expression, int targetOffset,
- Class targetClass, DartType typeContext) {
+ bool staticInvocationEnter(StaticInvocation expression, String prefixName,
+ int targetOffset, Class targetClass, DartType typeContext) {
+ // if there was an import prefix, record it.
+ if (prefixName != null) {
+ _recordReference(new ImportPrefixNode(prefixName), UNKNOWN_OFFSET);
+ _recordType(const NullType(), UNKNOWN_OFFSET);
+ }
// If the static target is explicit (and is a class), record it.
if (targetClass != null) {
_recordReference(targetClass, targetOffset);
@@ -568,7 +621,7 @@
_deferType(expression.fileOffset);
_deferType(expression.arguments.fileOffset);
return super.staticInvocationEnter(
- expression, targetOffset, targetClass, typeContext);
+ expression, prefixName, targetOffset, targetClass, typeContext);
}
@override
@@ -596,6 +649,16 @@
@override
void thisExpressionExit(ThisExpression expression, DartType inferredType) {}
+ bool typeLiteralEnter(@override TypeLiteral expression, String prefixName,
+ DartType typeContext) {
+ // if there was an import prefix, record it.
+ if (prefixName != null) {
+ _recordReference(new ImportPrefixNode(prefixName), UNKNOWN_OFFSET);
+ _recordType(const NullType(), UNKNOWN_OFFSET);
+ }
+ return super.typeLiteralEnter(expression, prefixName, typeContext);
+ }
+
void typeLiteralExit(TypeLiteral expression, DartType inferredType) {
_recordReference(expression.type, expression.fileOffset);
super.typeLiteralExit(expression, inferredType);
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index a0b598b..ae5a2b3 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -4225,8 +4225,8 @@
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY,
- directive,
- [directive.uri]);
+ directive.uri,
+ [directive.uri.stringValue]);
}
/**
@@ -5632,6 +5632,17 @@
return;
}
DartType staticReturnType = _computeReturnTypeForMethod(returnExpression);
+ String displayName = _enclosingFunction.displayName;
+
+ void reportTypeError() => _errorReporter.reportTypeErrorForNode(
+ StaticTypeWarningCode.RETURN_OF_INVALID_TYPE,
+ returnExpression,
+ [staticReturnType, expectedReturnType, displayName]);
+ void reportTypeErrorFromClosure() => _errorReporter.reportTypeErrorForNode(
+ StaticTypeWarningCode.RETURN_OF_INVALID_TYPE_FROM_CLOSURE,
+ returnExpression,
+ [staticReturnType, expectedReturnType]);
+
if (expectedReturnType.isVoid) {
if (isArrowFunction) {
// "void f(..) => e" admits all types for "e".
@@ -5643,22 +5654,22 @@
staticReturnType.isDartCoreNull) {
return;
}
- _errorReporter.reportTypeErrorForNode(
- StaticTypeWarningCode.RETURN_OF_INVALID_TYPE, returnExpression, [
- staticReturnType,
- expectedReturnType,
- _enclosingFunction.displayName
- ]);
+ if (displayName.isEmpty) {
+ reportTypeErrorFromClosure();
+ } else {
+ reportTypeError();
+ }
return;
}
if (_expressionIsAssignableAtType(
returnExpression, staticReturnType, expectedReturnType)) {
return;
}
- _errorReporter.reportTypeErrorForNode(
- StaticTypeWarningCode.RETURN_OF_INVALID_TYPE,
- returnExpression,
- [staticReturnType, expectedReturnType, _enclosingFunction.displayName]);
+ if (displayName.isEmpty) {
+ reportTypeErrorFromClosure();
+ } else {
+ reportTypeError();
+ }
// TODO(brianwilkerson) Define a hint corresponding to the warning and
// report it if appropriate.
diff --git a/pkg/analyzer/lib/src/generated/parser_fasta.dart b/pkg/analyzer/lib/src/generated/parser_fasta.dart
index abb2e16..98b88b7 100644
--- a/pkg/analyzer/lib/src/generated/parser_fasta.dart
+++ b/pkg/analyzer/lib/src/generated/parser_fasta.dart
@@ -130,7 +130,7 @@
@override
List<Combinator> parseCombinators() {
currentToken = fastaParser
- .parseCombinators(fastaParser.syntheticPreviousToken(currentToken))
+ .parseCombinatorStar(fastaParser.syntheticPreviousToken(currentToken))
.next;
return astBuilder.pop();
}
@@ -210,8 +210,8 @@
@override
FunctionBody parseFunctionBody(
bool mayBeEmpty, ParserErrorCode emptyErrorCode, bool inExpression) {
- currentToken = fastaParser
- .parseAsyncModifier(fastaParser.syntheticPreviousToken(currentToken));
+ currentToken = fastaParser.parseAsyncModifierOpt(
+ fastaParser.syntheticPreviousToken(currentToken));
currentToken =
fastaParser.parseFunctionBody(currentToken, inExpression, mayBeEmpty);
return astBuilder.pop();
@@ -270,7 +270,7 @@
@override
Statement parseStatement2() {
currentToken = fastaParser
- .parseStatementOpt(fastaParser.syntheticPreviousToken(currentToken))
+ .parseStatement(fastaParser.syntheticPreviousToken(currentToken))
.next;
return astBuilder.pop();
}
diff --git a/pkg/analyzer/lib/src/task/dart.dart b/pkg/analyzer/lib/src/task/dart.dart
index 289fb42..98aaf75 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -2575,9 +2575,7 @@
bool isIgnored(AnalysisError error) {
int errorLine = lineInfo.getLocation(error.offset).lineNumber;
String errorCode = error.errorCode.name.toLowerCase();
- // Ignores can be on the line or just preceding the error.
- return ignoreInfo.ignoredAt(errorCode, errorLine) ||
- ignoreInfo.ignoredAt(errorCode, errorLine - 1);
+ return ignoreInfo.ignoredAt(errorCode, errorLine);
}
return errors.where((AnalysisError e) => !isIgnored(e)).toList();
@@ -3007,7 +3005,7 @@
* Resulting codes may be in a list ('error_code_1,error_code2').
*/
static final RegExp _IGNORE_MATCHER =
- new RegExp(r'//[ ]*ignore:(.*)$', multiLine: true);
+ new RegExp(r'//+[ ]*ignore:(.*)$', multiLine: true);
/**
* A regular expression for matching 'ignore_for_file' comments. Produces
@@ -3084,7 +3082,19 @@
.group(1)
.split(',')
.map((String code) => code.trim().toLowerCase());
- ignoreInfo.addAll(info.getLocation(match.start).lineNumber, codes);
+ LineInfo_Location location = info.getLocation(match.start);
+ int lineNumber = location.lineNumber;
+ String beforeMatch = content.substring(
+ info.getOffsetOfLine(lineNumber - 1),
+ info.getOffsetOfLine(lineNumber - 1) + location.columnNumber - 1);
+
+ if (beforeMatch.trim().isEmpty) {
+ // The comment is on its own line, so it refers to the next line.
+ ignoreInfo.addAll(lineNumber + 1, codes);
+ } else {
+ // The comment sits next to code, so it refers to its own line.
+ ignoreInfo.addAll(lineNumber, codes);
+ }
}
for (Match match in fileMatches) {
Iterable<String> codes = match
diff --git a/pkg/analyzer/test/generated/error_suppression_kernel_test.dart b/pkg/analyzer/test/generated/error_suppression_kernel_test.dart
index 87134ae..eefd86c 100644
--- a/pkg/analyzer/test/generated/error_suppression_kernel_test.dart
+++ b/pkg/analyzer/test/generated/error_suppression_kernel_test.dart
@@ -134,4 +134,11 @@
// 1 errors of type CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, found 0
await super.test_no_ignores();
}
+
+ @override
+ @failingTest
+ test_trailing_not_above() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0
+ await super.test_trailing_not_above();
+ }
}
diff --git a/pkg/analyzer/test/generated/error_suppression_test.dart b/pkg/analyzer/test/generated/error_suppression_test.dart
index bbed700..c89f04e 100644
--- a/pkg/analyzer/test/generated/error_suppression_test.dart
+++ b/pkg/analyzer/test/generated/error_suppression_test.dart
@@ -215,6 +215,17 @@
assertErrors(source, []);
}
+ test_trailing_not_above() async {
+ Source source = addSource('''
+int x = ''; // ignore: invalid_assignment
+int y = '';
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [
+ StaticTypeWarningCode.INVALID_ASSIGNMENT,
+ ]);
+ }
+
test_no_ignores() async {
Source source = addSource('''
int x = ''; //INVALID_ASSIGNMENT
diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart
index 1bc90f2..9e4bdb6 100644
--- a/pkg/analyzer/test/generated/parser_fasta_test.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_test.dart
@@ -163,23 +163,6 @@
@override
@failingTest
- void test_expectedCaseOrDefault() {
- // TODO(brianwilkerson) Does not recover.
- // Bad state: No element
- // dart:core List.last
- // package:analyzer/src/fasta/ast_builder.dart 951:13 AstBuilder.endSwitchCase
- // test/generated/parser_fasta_listener.dart 1010:14 ForwardingTestListener.endSwitchCase
- // package:front_end/src/fasta/parser/parser.dart 3991:14 Parser.parseSwitchCase
- // package:front_end/src/fasta/parser/parser.dart 3914:15 Parser.parseSwitchBlock
- // package:front_end/src/fasta/parser/parser.dart 3900:13 Parser.parseSwitchStatement
- // package:front_end/src/fasta/parser/parser.dart 2760:14 Parser.parseStatementX
- // package:front_end/src/fasta/parser/parser.dart 2722:20 Parser.parseStatement
- // test/generated/parser_fasta_test.dart 2903:39 ParserProxy._run
- super.test_expectedCaseOrDefault();
- }
-
- @override
- @failingTest
void test_expectedClassMember_inClass_afterType() {
// TODO(brianwilkerson) Does not recover.
// Expected: an object with length of <1>
@@ -1503,70 +1486,6 @@
@override
@failingTest
- void test_string_unterminated_interpolation_block() {
- // TODO(brianwilkerson) Does not recover.
- // RangeError: Value not in range: -1
- // dart:core _StringBase.substring
- // package:front_end/src/fasta/quote.dart 130:12 unescapeLastStringPart
- // package:analyzer/src/fasta/ast_builder.dart 181:17 AstBuilder.endLiteralString
- // package:front_end/src/fasta/parser/parser.dart 3497:14 Parser.parseSingleLiteralString
- // package:front_end/src/fasta/parser/parser.dart 3434:13 Parser.parseLiteralString
- // package:front_end/src/fasta/parser/parser.dart 3133:14 Parser.parsePrimary
- // package:front_end/src/fasta/parser/parser.dart 3097:14 Parser.parseUnaryExpression
- // package:front_end/src/fasta/parser/parser.dart 2968:13 Parser.parsePrecedenceExpression
- // package:front_end/src/fasta/parser/parser.dart 2942:11 Parser.parseExpression
- // package:front_end/src/fasta/parser/parser.dart 2862:13 Parser.parseExpressionStatement
- // package:front_end/src/fasta/parser/parser.dart 2790:14 Parser.parseStatementX
- // package:front_end/src/fasta/parser/parser.dart 2722:20 Parser.parseStatement
- // package:front_end/src/fasta/parser/parser.dart 3792:15 Parser.parseBlock
- // package:front_end/src/fasta/parser/parser.dart 2732:14 Parser.parseStatementX
- // package:front_end/src/fasta/parser/parser.dart 2722:20 Parser.parseStatement
- // package:front_end/src/fasta/parser/parser.dart 2652:15 Parser.parseFunctionBody
- // package:front_end/src/fasta/parser/parser.dart 1737:13 Parser.parseTopLevelMethod
- // package:front_end/src/fasta/parser/parser.dart 1646:11 Parser.parseTopLevelMember
- // package:front_end/src/fasta/parser/parser.dart 298:14 Parser._parseTopLevelDeclaration
- // package:front_end/src/fasta/parser/parser.dart 263:13 Parser.parseTopLevelDeclaration
- // package:front_end/src/fasta/parser/parser.dart 252:15 Parser.parseUnit
- // package:analyzer/src/generated/parser_fasta.dart 77:33 _Parser2.parseCompilationUnit2
- // package:analyzer/src/generated/parser_fasta.dart 72:12 _Parser2.parseCompilationUnit
- // test/generated/parser_fasta_test.dart 3272:35 FastaParserTestCase.parseCompilationUnit
- super.test_string_unterminated_interpolation_block();
- }
-
- @override
- @failingTest
- void test_switchHasCaseAfterDefaultCase() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE, found 0
- super.test_switchHasCaseAfterDefaultCase();
- }
-
- @override
- @failingTest
- void test_switchHasCaseAfterDefaultCase_repeated() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 2 errors of type ParserErrorCode.SWITCH_HAS_CASE_AFTER_DEFAULT_CASE, found 0
- super.test_switchHasCaseAfterDefaultCase_repeated();
- }
-
- @override
- @failingTest
- void test_switchHasMultipleDefaultCases() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES, found 0
- super.test_switchHasMultipleDefaultCases();
- }
-
- @override
- @failingTest
- void test_switchHasMultipleDefaultCases_repeated() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 2 errors of type ParserErrorCode.SWITCH_HAS_MULTIPLE_DEFAULT_CASES, found 0
- super.test_switchHasMultipleDefaultCases_repeated();
- }
-
- @override
- @failingTest
void test_topLevelVariable_withMetadata() {
// TODO(brianwilkerson) Wrong errors:
// Expected 1 errors of type ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, found 0;
@@ -2589,19 +2508,6 @@
@override
@failingTest
- void test_incomplete_conditionalExpression() {
- // TODO(brianwilkerson) reportUnrecoverableErrorWithToken
- super.test_incomplete_conditionalExpression();
- }
-
- // TODO(danrubel): Remove this test
- // once test_incomplete_conditionalExpression has been fixed.
- void test_incomplete_conditionalExpression_ignoreErrors() {
- parseExpression("x ? 0", codes: FastaParserTestCase.NO_ERROR_COMPARISON);
- }
-
- @override
- @failingTest
void test_incomplete_constructorInitializers_empty() {
// TODO(brianwilkerson) reportUnrecoverableErrorWithToken
super.test_incomplete_constructorInitializers_empty();
@@ -2641,48 +2547,6 @@
@override
@failingTest
- void test_incomplete_topLevelVariable() {
- // TODO(brianwilkerson) reportUnrecoverableErrorWithToken
- super.test_incomplete_topLevelVariable();
- }
-
- @override
- @failingTest
- void test_incomplete_topLevelVariable_const() {
- // TODO(brianwilkerson) reportUnrecoverableErrorWithToken
- super.test_incomplete_topLevelVariable_const();
- }
-
- @override
- @failingTest
- void test_incomplete_topLevelVariable_final() {
- // TODO(brianwilkerson) reportUnrecoverableErrorWithToken
- super.test_incomplete_topLevelVariable_final();
- }
-
- @override
- @failingTest
- void test_incomplete_topLevelVariable_var() {
- // TODO(brianwilkerson) reportUnrecoverableErrorWithToken
- super.test_incomplete_topLevelVariable_var();
- }
-
- @override
- @failingTest
- void test_incompleteField_const() {
- // TODO(brianwilkerson) reportUnrecoverableErrorWithToken
- super.test_incompleteField_const();
- }
-
- @override
- @failingTest
- void test_incompleteField_final() {
- // TODO(brianwilkerson) reportUnrecoverableErrorWithToken
- super.test_incompleteField_final();
- }
-
- @override
- @failingTest
void test_incompleteForEach() {
// TODO(brianwilkerson) reportUnrecoverableErrorWithToken
super.test_incompleteForEach();
@@ -2749,13 +2613,6 @@
@override
@failingTest
- void test_nonStringLiteralUri_import() {
- // TODO(brianwilkerson) reportUnrecoverableErrorWithToken
- super.test_nonStringLiteralUri_import();
- }
-
- @override
- @failingTest
void test_primaryExpression_argumentDefinitionTest() {
// TODO(brianwilkerson) reportUnrecoverableErrorWithToken
super.test_primaryExpression_argumentDefinitionTest();
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 62153fb..d0e036d 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -2781,8 +2781,9 @@
void test_expectedCaseOrDefault() {
SwitchStatement statement = parseStatement('switch (e) {break;}');
expectNotNullIfNoErrors(statement);
- listener.assertErrors(
- [expectedError(ParserErrorCode.EXPECTED_CASE_OR_DEFAULT, 12, 5)]);
+ listener.assertErrors(usingFastaParser
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 12, 5)]
+ : [expectedError(ParserErrorCode.EXPECTED_CASE_OR_DEFAULT, 12, 5)]);
}
void test_expectedClassMember_inClass_afterType() {
@@ -2899,7 +2900,7 @@
ArgumentList list = parser.parseArgumentList();
expectNotNullIfNoErrors(list);
listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 6, 1)]
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 6, 1)]
: [expectedError(ParserErrorCode.EXPECTED_TOKEN, 4, 1)]);
}
@@ -3174,7 +3175,7 @@
listener.assertErrors(usingFastaParser
? [
expectedError(ParserErrorCode.MISSING_IDENTIFIER, 8, 1),
- expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 10, 3)
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 10, 3)
]
: [
expectedError(ParserErrorCode.MISSING_IDENTIFIER, 8, 1),
@@ -3187,7 +3188,7 @@
FormalParameterList list = parser.parseFormalParameterList();
expectNotNullIfNoErrors(list);
listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 8, 1)]
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 8, 1)]
: [
expectedError(ParserErrorCode.MISSING_IDENTIFIER, 9, 1),
expectedError(
@@ -3200,7 +3201,7 @@
FormalParameterList list = parser.parseFormalParameterList();
expectNotNullIfNoErrors(list);
listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 8, 1)]
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 8, 1)]
: [
expectedError(ParserErrorCode.MISSING_IDENTIFIER, 9, 1),
expectedError(
@@ -3363,8 +3364,14 @@
}''');
CompilationUnit unit = parser.parseCompilationUnit2();
expectNotNullIfNoErrors(unit);
- listener
- .assertErrors([expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 30, 1)]);
+ listener.assertErrors([
+ expectedError(
+ usingFastaParser
+ ? ParserErrorCode.EXPECTED_TOKEN
+ : ParserErrorCode.UNEXPECTED_TOKEN,
+ 30,
+ 1)
+ ]);
}
void test_getterInFunction_block_noReturnType() {
@@ -3891,8 +3898,8 @@
FormalParameterList list = parser.parseFormalParameterList();
expectNotNullIfNoErrors(list);
if (usingFastaParser) {
- listener.assertErrors(
- [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 14, 1)]);
+ listener
+ .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 14, 1)]);
} else if (fe.Scanner.useFasta) {
listener.errors
.contains(expectedError(ParserErrorCode.EXPECTED_TOKEN, 14, 1));
@@ -4257,7 +4264,7 @@
FormalParameterList list = parser.parseFormalParameterList();
expectNotNullIfNoErrors(list);
listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 7, 1)]
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 1)]
: [expectedError(ParserErrorCode.MIXED_PARAMETER_GROUPS, 9, 3)]);
}
@@ -4266,7 +4273,7 @@
FormalParameterList list = parser.parseFormalParameterList();
expectNotNullIfNoErrors(list);
listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 7, 1)]
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 1)]
: [expectedError(ParserErrorCode.MIXED_PARAMETER_GROUPS, 9, 3)]);
}
@@ -4298,7 +4305,7 @@
FormalParameterList list = parser.parseFormalParameterList();
expectNotNullIfNoErrors(list);
listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 7, 1)]
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 1)]
: [
expectedError(ParserErrorCode.MULTIPLE_NAMED_PARAMETER_GROUPS, 9, 3)
]);
@@ -4315,7 +4322,7 @@
FormalParameterList list = parser.parseFormalParameterList();
expectNotNullIfNoErrors(list);
listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 7, 1)]
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 1)]
: [
expectedError(
ParserErrorCode.MULTIPLE_POSITIONAL_PARAMETER_GROUPS, 9, 3)
@@ -4410,7 +4417,7 @@
void test_optionalAfterNormalParameters_named() {
parseCompilationUnit("f({a}, b) {}",
errors: usingFastaParser
- ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 5, 1)]
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 5, 1)]
: [
expectedError(
ParserErrorCode.NORMAL_BEFORE_OPTIONAL_PARAMETERS, 7, 1)
@@ -4420,7 +4427,7 @@
void test_optionalAfterNormalParameters_positional() {
parseCompilationUnit("f([a], b) {}",
errors: usingFastaParser
- ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 5, 1)]
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 5, 1)]
: [
expectedError(
ParserErrorCode.NORMAL_BEFORE_OPTIONAL_PARAMETERS, 7, 1)
@@ -4618,7 +4625,7 @@
{
'${${
''',
- codes: fe.Scanner.useFasta
+ codes: usingFastaParser
? [
ScannerErrorCode.UNTERMINATED_STRING_LITERAL,
ScannerErrorCode.EXPECTED_TOKEN,
@@ -4626,20 +4633,30 @@
ScannerErrorCode.EXPECTED_TOKEN,
ScannerErrorCode.EXPECTED_TOKEN,
ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.UNEXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_EXECUTABLE,
+ ParserErrorCode.EXPECTED_TOKEN
]
- : [
- ScannerErrorCode.UNTERMINATED_STRING_LITERAL,
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_TOKEN,
- ParserErrorCode.EXPECTED_TOKEN,
- ]);
+ : fe.Scanner.useFasta
+ ? [
+ ScannerErrorCode.UNTERMINATED_STRING_LITERAL,
+ ScannerErrorCode.EXPECTED_TOKEN,
+ ScannerErrorCode.EXPECTED_TOKEN,
+ ScannerErrorCode.EXPECTED_TOKEN,
+ ScannerErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.UNEXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_EXECUTABLE,
+ ]
+ : [
+ ScannerErrorCode.UNTERMINATED_STRING_LITERAL,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ]);
}
void test_switchHasCaseAfterDefaultCase() {
@@ -4680,6 +4697,34 @@
]);
}
+ void test_switchCase_missingColon() {
+ SwitchStatement statement = parseStatement('switch (a) {case 1 return 0;}');
+ expect(statement, isNotNull);
+ listener
+ .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 19, 6)]);
+ }
+
+ void test_switchDefault_missingColon() {
+ SwitchStatement statement =
+ parseStatement('switch (a) {default return 0;}');
+ expect(statement, isNotNull);
+ listener
+ .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 20, 6)]);
+ }
+
+ void test_switchMissingBlock() {
+ SwitchStatement statement =
+ parseStatement('switch (a) return;', expectedEndOffset: 11);
+ expect(statement, isNotNull);
+ listener.assertErrors(usingFastaParser
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 11, 6)]
+ : [
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 11, 6),
+ expectedError(ParserErrorCode.EXPECTED_CASE_OR_DEFAULT, 11, 6),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 11, 6)
+ ]);
+ }
+
void test_topLevel_getter() {
createParser('get x => 7;');
CompilationUnitMember member = parseFullCompilationUnitMember();
@@ -4810,7 +4855,7 @@
FormalParameterList list = parser.parseFormalParameterList();
expectNotNullIfNoErrors(list);
listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 5, 1)]
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 5, 1)]
: [
expectedError(
ParserErrorCode.UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP, 5, 1)
@@ -10103,7 +10148,7 @@
void test_ifStatement_noElse_statement() {
parseStatement('if (x v) f(x);');
listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 6, 1)]
+ ? [expectedError(ParserErrorCode.EXPECTED_TOKEN, 6, 1)]
: [
expectedError(ParserErrorCode.EXPECTED_TOKEN, 6, 1),
expectedError(ParserErrorCode.EXPECTED_TOKEN, 6, 1)
@@ -10180,6 +10225,28 @@
]);
}
+ void test_incomplete_functionExpression() {
+ var expression = parseExpression("() a => null",
+ errors: usingFastaParser
+ ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 3, 1)]
+ : [expectedError(ParserErrorCode.MISSING_IDENTIFIER, 2, 1)]);
+ if (usingFastaParser) {
+ FunctionExpression functionExpression = expression;
+ expect(functionExpression.parameters.parameters, hasLength(0));
+ }
+ }
+
+ void test_incomplete_functionExpression2() {
+ var expression = parseExpression("() a {}",
+ errors: usingFastaParser
+ ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 3, 1)]
+ : [expectedError(ParserErrorCode.MISSING_IDENTIFIER, 2, 1)]);
+ if (usingFastaParser) {
+ FunctionExpression functionExpression = expression;
+ expect(functionExpression.parameters.parameters, hasLength(0));
+ }
+ }
+
@failingTest
void test_incomplete_returnType() {
parseCompilationUnit(r'''
@@ -10200,7 +10267,12 @@
void test_incomplete_topLevelVariable() {
CompilationUnit unit = parseCompilationUnit("String",
- codes: [ParserErrorCode.EXPECTED_EXECUTABLE]);
+ codes: usingFastaParser
+ ? [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN
+ ]
+ : [ParserErrorCode.EXPECTED_EXECUTABLE]);
NodeList<CompilationUnitMember> declarations = unit.declarations;
expect(declarations, hasLength(1));
CompilationUnitMember member = declarations[0];
@@ -10318,6 +10390,59 @@
expect(field.name.isSynthetic, isTrue);
}
+ void test_incompleteField_static() {
+ CompilationUnit unit = parseCompilationUnit(r'''
+class C {
+ static c
+}''', codes: [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN
+ ]);
+ NodeList<CompilationUnitMember> declarations = unit.declarations;
+ expect(declarations, hasLength(1));
+ CompilationUnitMember unitMember = declarations[0];
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is ClassDeclaration, ClassDeclaration, unitMember);
+ NodeList<ClassMember> members = (unitMember as ClassDeclaration).members;
+ expect(members, hasLength(1));
+ ClassMember classMember = members[0];
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is FieldDeclaration, FieldDeclaration, classMember);
+ FieldDeclaration declaration = classMember;
+ expect(declaration.staticKeyword.lexeme, 'static');
+ VariableDeclarationList fieldList = declaration.fields;
+ expect(fieldList.keyword, isNull);
+ NodeList<VariableDeclaration> fields = fieldList.variables;
+ expect(fields, hasLength(1));
+ VariableDeclaration field = fields[0];
+ expect(field.name.isSynthetic, isTrue);
+ }
+
+ void test_incompleteField_static2() {
+ CompilationUnit unit = parseCompilationUnit(r'''
+class C {
+ static c x
+}''', codes: [ParserErrorCode.EXPECTED_TOKEN]);
+ NodeList<CompilationUnitMember> declarations = unit.declarations;
+ expect(declarations, hasLength(1));
+ CompilationUnitMember unitMember = declarations[0];
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is ClassDeclaration, ClassDeclaration, unitMember);
+ NodeList<ClassMember> members = (unitMember as ClassDeclaration).members;
+ expect(members, hasLength(1));
+ ClassMember classMember = members[0];
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is FieldDeclaration, FieldDeclaration, classMember);
+ FieldDeclaration declaration = classMember;
+ expect(declaration.staticKeyword.lexeme, 'static');
+ VariableDeclarationList fieldList = declaration.fields;
+ expect(fieldList.keyword, isNull);
+ NodeList<VariableDeclaration> fields = fieldList.variables;
+ expect(fields, hasLength(1));
+ VariableDeclaration field = fields[0];
+ expect(field.name.isSynthetic, isFalse);
+ }
+
void test_incompleteField_type() {
CompilationUnit unit = parseCompilationUnit(r'''
class C {
@@ -10675,9 +10800,7 @@
void test_missing_commaInArgumentList() {
MethodInvocation expression = parseExpression("f(x: 1 y: 2)",
- codes: usingFastaParser
- ? [ParserErrorCode.UNEXPECTED_TOKEN]
- : [ParserErrorCode.EXPECTED_TOKEN]);
+ errors: ([expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 1)]));
NodeList<Expression> arguments = expression.argumentList.arguments;
expect(arguments, hasLength(2));
}
@@ -10686,14 +10809,8 @@
createParser('(a b: c)');
ArgumentList argumentList = parser.parseArgumentList();
expectNotNullIfNoErrors(argumentList);
- listener.assertErrors([
- expectedError(
- usingFastaParser
- ? ParserErrorCode.UNEXPECTED_TOKEN
- : ParserErrorCode.EXPECTED_TOKEN,
- 3,
- 1)
- ]);
+ listener
+ .assertErrors([expectedError(ParserErrorCode.EXPECTED_TOKEN, 3, 1)]);
expect(argumentList.arguments, hasLength(2));
}
@@ -10848,7 +10965,15 @@
void test_nonStringLiteralUri_import() {
parseCompilationUnit("import dart:io; class C {}",
- codes: [ParserErrorCode.NON_STRING_LITERAL_AS_URI]);
+ errors: usingFastaParser
+ ? [
+ expectedError(ParserErrorCode.EXPECTED_STRING_LITERAL, 7, 4),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 7, 4),
+ expectedError(
+ ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, 7, 4),
+ expectedError(ParserErrorCode.EXTRANEOUS_MODIFIER, 7, 4)
+ ]
+ : [expectedError(ParserErrorCode.NON_STRING_LITERAL_AS_URI, 7, 4)]);
}
void test_prefixExpression_missing_operand_minus() {
diff --git a/pkg/analyzer/test/generated/resolver_kernel_test.dart b/pkg/analyzer/test/generated/resolver_kernel_test.dart
index 9d1b053..fd664dc 100644
--- a/pkg/analyzer/test/generated/resolver_kernel_test.dart
+++ b/pkg/analyzer/test/generated/resolver_kernel_test.dart
@@ -211,13 +211,6 @@
@override
@failingTest
- test_invocation_target_prefixed() async {
- // Bad state: Expected element reference for analyzer offset 43; got one for kernel offset 50
- await super.test_invocation_target_prefixed();
- }
-
- @override
- @failingTest
test_is_conditional() async {
// Expected: same instance as InterfaceTypeImpl:<A>
await super.test_is_conditional();
@@ -344,13 +337,6 @@
@override
@failingTest
- test_objectAccessInference_disabled_for_library_prefix() async {
- // Bad state: Expected element reference for analyzer offset 43; got one for kernel offset 50
- await super.test_objectAccessInference_disabled_for_library_prefix();
- }
-
- @override
- @failingTest
test_objectAccessInference_enabled_for_cascades() async {
// Expected: DynamicTypeImpl:<dynamic>
await super.test_objectAccessInference_enabled_for_cascades();
@@ -358,13 +344,6 @@
@override
@failingTest
- test_objectMethodInference_disabled_for_library_prefix() async {
- // Bad state: Expected element reference for analyzer offset 43; got one for kernel offset 50
- await super.test_objectMethodInference_disabled_for_library_prefix();
- }
-
- @override
- @failingTest
test_objectMethodInference_enabled_for_cascades() async {
// Expected: DynamicTypeImpl:<dynamic>
await super.test_objectMethodInference_enabled_for_cascades();
diff --git a/pkg/analyzer/test/generated/strong_mode_kernel_test.dart b/pkg/analyzer/test/generated/strong_mode_kernel_test.dart
index 8112f42..8947061 100644
--- a/pkg/analyzer/test/generated/strong_mode_kernel_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_kernel_test.dart
@@ -245,6 +245,10 @@
test_generic_partial() async {
// AnalysisException: Element mismatch in /test.dart at class A<T>
await super.test_generic_partial();
+ // TODO(brianwilkerson) This test periodically fails (by not throwing an
+ // exception), so I am temporarily disabling it. The cause of the flaky
+ // behavior needs to be investigated.
+ fail('Flaky test');
}
@override
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index ac4e176..09dbb38 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -3569,6 +3569,101 @@
expect(identifier.staticType, typeProvider.intType);
}
+ test_prefixedIdentifier_importPrefix_className() async {
+ var libPath = _p('/test/lib/lib.dart');
+ provider.newFile(libPath, '''
+class MyClass {}
+typedef void MyFunctionTypeAlias();
+int myTopVariable;
+int myTopFunction() => 0;
+int get myGetter => 0;
+void set mySetter(int _) {}
+''');
+ addTestFile(r'''
+import 'lib.dart' as my;
+main() {
+ my.MyClass;
+ my.MyFunctionTypeAlias;
+ my.myTopVariable;
+ my.myTopFunction;
+ my.myTopFunction();
+ my.myGetter;
+ my.mySetter = 0;
+}
+''');
+ AnalysisResult result = await driver.getResult(testFile);
+ // TODO(scheglov) Uncomment and fix "unused imports" hint.
+// expect(result.errors, isEmpty);
+
+ var unitElement = result.unit.element;
+ ImportElement myImport = unitElement.library.imports[0];
+ PrefixElement myPrefix = myImport.prefix;
+ var typeProvider = unitElement.context.typeProvider;
+
+ var myLibrary = myImport.importedLibrary;
+ var myUnit = myLibrary.definingCompilationUnit;
+ var myClass = myUnit.types.single;
+ var myFunctionTypeAlias = myUnit.functionTypeAliases.single;
+ var myTopVariable = myUnit.topLevelVariables[0];
+ var myTopFunction = myUnit.functions.single;
+ var myGetter = myUnit.topLevelVariables[1].getter;
+ var mySetter = myUnit.topLevelVariables[2].setter;
+ expect(myTopVariable.name, 'myTopVariable');
+ expect(myGetter.displayName, 'myGetter');
+ expect(mySetter.displayName, 'mySetter');
+
+ List<Statement> statements = _getMainStatements(result);
+
+ void assertPrefix(SimpleIdentifier identifier) {
+ expect(identifier.staticElement, same(myPrefix));
+ expect(identifier.staticType, isNull);
+ }
+
+ void assertPrefixedIdentifier(
+ int statementIndex, Element expectedElement, DartType expectedType) {
+ ExpressionStatement statement = statements[statementIndex];
+ PrefixedIdentifier prefixed = statement.expression;
+ assertPrefix(prefixed.prefix);
+
+ expect(prefixed.identifier.staticElement, same(expectedElement));
+ expect(prefixed.identifier.staticType, expectedType);
+ }
+
+ assertPrefixedIdentifier(0, myClass, typeProvider.typeType);
+ assertPrefixedIdentifier(1, myFunctionTypeAlias, typeProvider.typeType);
+ assertPrefixedIdentifier(2, myTopVariable.getter, typeProvider.intType);
+
+ {
+ ExpressionStatement statement = statements[3];
+ PrefixedIdentifier prefixed = statement.expression;
+ assertPrefix(prefixed.prefix);
+
+ expect(prefixed.identifier.staticElement, same(myTopFunction));
+ expect(prefixed.identifier.staticType, isNotNull);
+ }
+
+ {
+ ExpressionStatement statement = statements[4];
+ MethodInvocation invocation = statement.expression;
+ assertPrefix(invocation.target);
+
+ expect(invocation.methodName.staticElement, same(myTopFunction));
+ expect(invocation.methodName.staticType, isNotNull);
+ }
+
+ assertPrefixedIdentifier(5, myGetter, typeProvider.intType);
+
+ {
+ ExpressionStatement statement = statements[6];
+ AssignmentExpression assignment = statement.expression;
+ PrefixedIdentifier left = assignment.leftHandSide;
+ assertPrefix(left.prefix);
+
+ expect(left.identifier.staticElement, same(mySetter));
+ expect(left.identifier.staticType, typeProvider.intType);
+ }
+ }
+
test_prefixExpression_local() async {
String content = r'''
main() {
@@ -5104,6 +5199,11 @@
fail('Not found main() in ${result.unit}');
return null;
}
+
+ /**
+ * Return the [provider] specific path for the given Posix [path].
+ */
+ String _p(String path) => provider.convertPath(path);
}
@reflectiveTest
diff --git a/pkg/analyzer/test/src/fasta/recovery/missing_code_test.dart b/pkg/analyzer/test/src/fasta/recovery/missing_code_test.dart
index 3bf15d4..29e2e53 100644
--- a/pkg/analyzer/test/src/fasta/recovery/missing_code_test.dart
+++ b/pkg/analyzer/test/src/fasta/recovery/missing_code_test.dart
@@ -44,30 +44,30 @@
*/
@reflectiveTest
class MapLiteralTest extends AbstractRecoveryTest {
- void test_missingColonAndValue_last() {
- testRecovery('''
-f() => {a };
-''', [ParserErrorCode.UNEXPECTED_TOKEN, ParserErrorCode.MISSING_IDENTIFIER], '''
-f() => {a: _s_};
-''');
- }
-
void test_extraComma() {
testRecovery('''
f() => {a: b, , c: d};
''', [
ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.UNEXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
ParserErrorCode.MISSING_IDENTIFIER
], '''
f() => {a: b, _s_: _s_, c: d};
''');
}
+ void test_missingColonAndValue_last() {
+ testRecovery('''
+f() => {a };
+''', [ParserErrorCode.EXPECTED_TOKEN, ParserErrorCode.MISSING_IDENTIFIER], '''
+f() => {a: _s_};
+''');
+ }
+
void test_missingComma() {
testRecovery('''
f() => {a: b, c: d e: f};
-''', [ParserErrorCode.UNEXPECTED_TOKEN], '''
+''', [ParserErrorCode.EXPECTED_TOKEN], '''
f() => {a: b, c: d, e: f};
''');
}
@@ -504,7 +504,7 @@
int f;
C(this);
}
-''', [ParserErrorCode.UNEXPECTED_TOKEN, ParserErrorCode.MISSING_IDENTIFIER], '''
+''', [ParserErrorCode.EXPECTED_TOKEN, ParserErrorCode.MISSING_IDENTIFIER], '''
class C {
int f;
C(this._s_);
@@ -518,7 +518,7 @@
int f;
C(this, p);
}
-''', [ParserErrorCode.UNEXPECTED_TOKEN, ParserErrorCode.MISSING_IDENTIFIER], '''
+''', [ParserErrorCode.EXPECTED_TOKEN, ParserErrorCode.MISSING_IDENTIFIER], '''
class C {
int f;
C(this._s_, p);
diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/forEach_statement_test.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/forEach_statement_test.dart
new file mode 100644
index 0000000..75a64f1
--- /dev/null
+++ b/pkg/analyzer/test/src/fasta/recovery/partial_code/forEach_statement_test.dart
@@ -0,0 +1,117 @@
+// Copyright (c) 2017, 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:analyzer/src/dart/error/syntactic_errors.dart';
+
+import 'partial_code_support.dart';
+
+main() {
+ new ForEachStatementTest().buildAll();
+}
+
+class ForEachStatementTest extends PartialCodeTest {
+ buildAll() {
+ //
+ // Without a preceding 'await', anything that doesn't contain the `in`
+ // keyword will be interpreted as a normal for statement.
+ //
+ buildTests(
+ 'forEach_statement',
+ [
+ new TestDescriptor(
+ 'in',
+ 'for (var a in',
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ScannerErrorCode.EXPECTED_TOKEN
+ ],
+ 'for (var a in _s_) {}',
+ allFailing: true),
+ new TestDescriptor(
+ 'iterator',
+ 'for (var a in b',
+ [ParserErrorCode.EXPECTED_TOKEN, ScannerErrorCode.EXPECTED_TOKEN],
+ 'for (var a in b) {}',
+ allFailing: true),
+ ],
+ PartialCodeTest.statementSuffixes,
+ head: 'f() { ',
+ tail: ' }');
+ //
+ // With a preceding 'await', everything should be interpreted as a
+ // for-each statement.
+ //
+ buildTests(
+ 'forEach_statement',
+ [
+ new TestDescriptor(
+ 'await_keyword',
+ 'await for',
+ [
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ScannerErrorCode.EXPECTED_TOKEN
+ ],
+ 'await for (_s_ in _s_) {}',
+ allFailing: true),
+ new TestDescriptor(
+ 'await_leftParen',
+ 'await for (',
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ScannerErrorCode.EXPECTED_TOKEN
+ ],
+ "await for (_s_ in _s_) {}",
+ allFailing: true),
+ new TestDescriptor(
+ 'await_variableName',
+ 'await for (a',
+ [
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ScannerErrorCode.EXPECTED_TOKEN
+ ],
+ "await for (a in _s_) {}",
+ allFailing: true),
+ new TestDescriptor(
+ 'await_typeAndVariableName',
+ 'await for (A a',
+ [
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ScannerErrorCode.EXPECTED_TOKEN
+ ],
+ "await for (a in _s_) {}",
+ allFailing: true),
+ new TestDescriptor(
+ 'await_in',
+ 'await for (A a in',
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ScannerErrorCode.EXPECTED_TOKEN
+ ],
+ "await for (a in _s_) {}",
+ allFailing: true),
+ new TestDescriptor(
+ 'await_stream',
+ 'await for (A a in b',
+ [ParserErrorCode.EXPECTED_TOKEN, ScannerErrorCode.EXPECTED_TOKEN],
+ "await for (a in b) {}",
+ allFailing: true),
+ ],
+ PartialCodeTest.statementSuffixes,
+ head: 'f() async { ',
+ tail: ' }');
+ }
+}
diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/for_statement_test.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/for_statement_test.dart
new file mode 100644
index 0000000..cebc90d
--- /dev/null
+++ b/pkg/analyzer/test/src/fasta/recovery/partial_code/for_statement_test.dart
@@ -0,0 +1,111 @@
+// Copyright (c) 2017, 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:analyzer/src/dart/error/syntactic_errors.dart';
+
+import 'partial_code_support.dart';
+
+main() {
+ new ForStatementTest().buildAll();
+}
+
+class ForStatementTest extends PartialCodeTest {
+ buildAll() {
+ buildTests(
+ 'for_statement',
+ [
+ new TestDescriptor(
+ 'keyword',
+ 'for',
+ [
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN
+ ],
+ 'for (;;) {}',
+ allFailing: true),
+ new TestDescriptor(
+ 'leftParen',
+ 'for (',
+ [
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN
+ ],
+ "for (;;) {}",
+ allFailing: true),
+ new TestDescriptor(
+ 'var',
+ 'for (var',
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN
+ ],
+ "for (var _s_;;) {}",
+ allFailing: true),
+ new TestDescriptor(
+ 'varAndIdentifier',
+ 'for (var i',
+ [
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN
+ ],
+ "for (var i;;) {}",
+ allFailing: true),
+ new TestDescriptor(
+ 'equals',
+ 'for (var i =',
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN
+ ],
+ "for (var i = _s_;;) {}",
+ allFailing: true),
+ new TestDescriptor(
+ 'initializer',
+ 'for (var i = 0',
+ [
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN
+ ],
+ "for (var i = 0;;) {}",
+ allFailing: true),
+ new TestDescriptor(
+ 'firstSemicolon',
+ 'for (var i = 0;',
+ [
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN
+ ],
+ "for (var i = 0;;) {}",
+ allFailing: true),
+ new TestDescriptor(
+ 'secondSemicolon',
+ 'for (var i = 0;;',
+ [ParserErrorCode.EXPECTED_TOKEN, ParserErrorCode.EXPECTED_TOKEN],
+ "for (var i = 0;;) {}",
+ allFailing: true),
+ new TestDescriptor('rightParen', 'for (var i = 0;;)',
+ [ParserErrorCode.EXPECTED_TOKEN], "for (var i = 0;;) {}",
+ allFailing: true),
+ ],
+ PartialCodeTest.statementSuffixes,
+ head: 'f() { ',
+ tail: ' }');
+ }
+}
diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/instance_creation_test.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/instance_creation_test.dart
index 0cb2e50..24dc9d9 100644
--- a/pkg/analyzer/test/src/fasta/recovery/partial_code/instance_creation_test.dart
+++ b/pkg/analyzer/test/src/fasta/recovery/partial_code/instance_creation_test.dart
@@ -38,14 +38,14 @@
'${keyword}_name_unnamed',
'$keyword A',
[
- ParserErrorCode.UNEXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
],
"$keyword A()"),
new TestDescriptor(
'${keyword}_name_named',
'$keyword A.b',
[
- ParserErrorCode.UNEXPECTED_TOKEN,
+ ParserErrorCode.EXPECTED_TOKEN,
],
"$keyword A.b()"),
new TestDescriptor(
diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/method_declaration_test.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/method_declaration_test.dart
new file mode 100644
index 0000000..6fc5af9
--- /dev/null
+++ b/pkg/analyzer/test/src/fasta/recovery/partial_code/method_declaration_test.dart
@@ -0,0 +1,71 @@
+// Copyright (c) 2017, 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:analyzer/src/dart/error/syntactic_errors.dart';
+
+import 'partial_code_support.dart';
+
+main() {
+ new MethodTest().buildAll();
+}
+
+class MethodTest extends PartialCodeTest {
+ buildAll() {
+ buildTests(
+ 'method_declaration',
+ [
+ new TestDescriptor('noType_leftParen', 'm(',
+ [ParserErrorCode.EXPECTED_TOKEN], "m();",
+ allFailing: true),
+ new TestDescriptor('noType_paramName', 'm(B',
+ [ParserErrorCode.EXPECTED_TOKEN], "m(B);",
+ allFailing: true),
+ new TestDescriptor('noType_paramTypeAndName', 'm(B b',
+ [ParserErrorCode.EXPECTED_TOKEN], "m(B b);",
+ allFailing: true),
+ new TestDescriptor(
+ 'noType_paramAndComma',
+ 'm(B b,',
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN
+ ],
+ "m(B b, _s_);",
+ allFailing: true),
+ new TestDescriptor('noType_noParams', 'm()',
+ [ParserErrorCode.EXPECTED_TOKEN], "m();",
+ allFailing: true),
+ new TestDescriptor('noType_params', 'm(b, c)',
+ [ParserErrorCode.EXPECTED_TOKEN], "m(b, c);",
+ allFailing: true),
+ new TestDescriptor('type_leftParen', 'A m(',
+ [ParserErrorCode.EXPECTED_TOKEN], "A m();",
+ allFailing: true),
+ new TestDescriptor('type_paramName', 'A m(B',
+ [ParserErrorCode.EXPECTED_TOKEN], "A m(B);",
+ allFailing: true),
+ new TestDescriptor('type_paramTypeAndName', 'A m(B b',
+ [ParserErrorCode.EXPECTED_TOKEN], "A m(B b);",
+ allFailing: true),
+ new TestDescriptor(
+ 'noType_paramAndComma',
+ 'A m(B b,',
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN
+ ],
+ "A m(B b, _s_);",
+ allFailing: true),
+ new TestDescriptor('type_noParams', 'A m()',
+ [ParserErrorCode.EXPECTED_TOKEN], "A m();",
+ allFailing: true),
+ new TestDescriptor('type_params', 'A m(b, c)',
+ [ParserErrorCode.EXPECTED_TOKEN], "A m(b, c);",
+ allFailing: true),
+ ],
+ PartialCodeTest.classMemberSuffixes,
+ head: 'class C { ',
+ tail: ' }');
+ }
+}
diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/method_test.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/method_test.dart
deleted file mode 100644
index f4403e0..0000000
--- a/pkg/analyzer/test/src/fasta/recovery/partial_code/method_test.dart
+++ /dev/null
@@ -1,35 +0,0 @@
-// Copyright (c) 2017, 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:analyzer/src/dart/error/syntactic_errors.dart';
-
-import 'partial_code_support.dart';
-
-main() {
- new MethodTest().buildAll();
-}
-
-class MethodTest extends PartialCodeTest {
- buildAll() {
- buildTests(
- 'method',
- [
- new TestDescriptor(
- 'noTypeLeftParen', 'm(', [ParserErrorCode.EXPECTED_TOKEN], "m();",
- allFailing: true),
- new TestDescriptor('noTypeRightParen', 'm()',
- [ParserErrorCode.EXPECTED_TOKEN], "m();",
- allFailing: true),
- new TestDescriptor('typeLeftParen', 'A m(',
- [ParserErrorCode.EXPECTED_TOKEN], "A m();",
- allFailing: true),
- new TestDescriptor('typeRightParen', 'A m()',
- [ParserErrorCode.EXPECTED_TOKEN], "A m();",
- allFailing: true),
- ],
- PartialCodeTest.classMemberSuffixes,
- head: 'class C { ',
- tail: ' }');
- }
-}
diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/test_all.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/test_all.dart
index 4344138..102cb02 100644
--- a/pkg/analyzer/test/src/fasta/recovery/partial_code/test_all.dart
+++ b/pkg/analyzer/test/src/fasta/recovery/partial_code/test_all.dart
@@ -4,40 +4,50 @@
import 'package:test/test.dart';
+import 'assert_statement_test.dart' as assert_statement;
import 'break_statement_test.dart' as break_statement;
import 'class_declaration_test.dart' as class_declaration;
import 'continue_statement_test.dart' as continue_statement;
import 'do_statement_test.dart' as do_statement;
import 'export_directive_test.dart' as export_directive;
+import 'forEach_statement_test.dart' as forEach_statement;
+import 'for_statement_test.dart' as for_statement;
import 'if_statement_test.dart' as if_statement;
import 'import_directive_test.dart' as import_directive;
import 'instance_creation_test.dart' as instance_creation;
import 'library_directive_test.dart' as library_directive;
import 'local_variable_test.dart' as local_variable;
+import 'method_declaration_test.dart' as method_declaration;
import 'part_directive_test.dart' as part_directive;
import 'part_of_directive_test.dart' as part_of_directive;
import 'return_statement_test.dart' as return_statement;
import 'switch_statement_test.dart' as switch_statement;
import 'top_level_variable_test.dart' as top_level_variable;
import 'while_statement_test.dart' as while_statement;
+import 'yield_statement_test.dart' as yield_statement;
main() {
group('partial_code', () {
+ assert_statement.main();
break_statement.main();
class_declaration.main();
continue_statement.main();
do_statement.main();
export_directive.main();
+ for_statement.main();
+ forEach_statement.main();
if_statement.main();
import_directive.main();
instance_creation.main();
library_directive.main();
local_variable.main();
+ method_declaration.main();
part_directive.main();
part_of_directive.main();
return_statement.main();
switch_statement.main();
top_level_variable.main();
while_statement.main();
+ yield_statement.main();
});
}
diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/top_level_variable_test.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/top_level_variable_test.dart
index 66276d4..1a4eddf 100644
--- a/pkg/analyzer/test/src/fasta/recovery/partial_code/top_level_variable_test.dart
+++ b/pkg/analyzer/test/src/fasta/recovery/partial_code/top_level_variable_test.dart
@@ -88,7 +88,7 @@
ParserErrorCode.EXPECTED_TOKEN
],
"int _s_;",
- allFailing: true),
+ failing: allExceptEof),
new TestDescriptor(
'typeName', 'int a', [ParserErrorCode.EXPECTED_TOKEN], "int a;",
allFailing: true),
@@ -100,7 +100,7 @@
ParserErrorCode.EXPECTED_TOKEN
],
"var _s_;",
- allFailing: true),
+ failing: allExceptEof),
new TestDescriptor(
'varName', 'var a', [ParserErrorCode.EXPECTED_TOKEN], "var a;",
allFailing: true),
diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/yield_statement_test.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/yield_statement_test.dart
new file mode 100644
index 0000000..0234d1f
--- /dev/null
+++ b/pkg/analyzer/test/src/fasta/recovery/partial_code/yield_statement_test.dart
@@ -0,0 +1,77 @@
+// Copyright (c) 2017, 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:analyzer/src/dart/error/syntactic_errors.dart';
+
+import 'partial_code_support.dart';
+
+main() {
+ new YieldStatementTest().buildAll();
+}
+
+class YieldStatementTest extends PartialCodeTest {
+ buildAll() {
+ buildTests(
+ 'yield_statement',
+ [
+ new TestDescriptor(
+ 'keyword',
+ 'yield',
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN
+ ],
+ "yield _s_;",
+ failing: [
+ 'assert',
+ 'block',
+ 'break',
+ 'continue',
+ 'do',
+ 'if',
+ 'for',
+ 'labeled',
+ 'localFunctionNonVoid',
+ 'localFunctionVoid',
+ 'localVariable',
+ 'switch',
+ 'try',
+ 'return',
+ 'while'
+ ]),
+ new TestDescriptor('expression', 'yield a',
+ [ParserErrorCode.EXPECTED_TOKEN], "yield a;"),
+ new TestDescriptor(
+ 'star',
+ 'yield *',
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN
+ ],
+ "yield * _s_;",
+ failing: [
+ 'assert',
+ 'block',
+ 'break',
+ 'continue',
+ 'do',
+ 'if',
+ 'for',
+ 'labeled',
+ 'localFunctionNonVoid',
+ 'localFunctionVoid',
+ 'localVariable',
+ 'switch',
+ 'try',
+ 'return',
+ 'while'
+ ]),
+ new TestDescriptor('star_expression', 'yield * a',
+ [ParserErrorCode.EXPECTED_TOKEN], "yield * a;"),
+ ],
+ PartialCodeTest.statementSuffixes,
+ head: 'f() sync* { ',
+ tail: ' }');
+ }
+}
diff --git a/pkg/analyzer/test/src/task/dart_test.dart b/pkg/analyzer/test/src/task/dart_test.dart
index 5314a83..c4b786b 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -4098,7 +4098,7 @@
IgnoreInfo info = outputs[IGNORE_INFO];
expect(info.ignores.keys, hasLength(3));
- expect(info.ignores[1].first, 'error_code');
+ expect(info.ignores[2].first, 'error_code');
expect(info.ignores[4].first, 'error_code_2');
expect(info.ignores[5], unorderedEquals(['error_code', 'error_code_2']));
expect(info.ignoreForFiles,
diff --git a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
index a7bc6ff..ae402c1 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -203,7 +203,7 @@
main() {
String f() => null;
var g = f;
- g = /*info:INFERRED_TYPE_CLOSURE*/() { return /*error:RETURN_OF_INVALID_TYPE*/1; };
+ g = /*info:INFERRED_TYPE_CLOSURE*/() { return /*error:RETURN_OF_INVALID_TYPE_FROM_CLOSURE*/1; };
}
''');
var g = findLocalVariable(unit, 'g');
@@ -1016,14 +1016,14 @@
Function2<int, String> l1 = (int x) => "hello";
Function2<int, String> l2 = /*error:INVALID_ASSIGNMENT*/(String x) => "hello";
Function2<int, String> l3 = /*error:INVALID_ASSIGNMENT*/(int x) => 3;
- Function2<int, String> l4 = /*info:INFERRED_TYPE_CLOSURE*/(int x) {return /*error:RETURN_OF_INVALID_TYPE*/3;};
+ Function2<int, String> l4 = /*info:INFERRED_TYPE_CLOSURE*/(int x) {return /*error:RETURN_OF_INVALID_TYPE_FROM_CLOSURE*/3;};
}
{
Function2<int, String> l0 = /*info:INFERRED_TYPE_CLOSURE*/(x) => null;
Function2<int, String> l1 = /*info:INFERRED_TYPE_CLOSURE*/(x) => "hello";
Function2<int, String> l2 = /*info:INFERRED_TYPE_CLOSURE, error:INVALID_ASSIGNMENT*/(x) => 3;
- Function2<int, String> l3 = /*info:INFERRED_TYPE_CLOSURE*/(x) {return /*error:RETURN_OF_INVALID_TYPE*/3;};
- Function2<int, String> l4 = /*info:INFERRED_TYPE_CLOSURE*/(x) {return /*error:RETURN_OF_INVALID_TYPE*/x;};
+ Function2<int, String> l3 = /*info:INFERRED_TYPE_CLOSURE*/(x) {return /*error:RETURN_OF_INVALID_TYPE_FROM_CLOSURE*/3;};
+ Function2<int, String> l4 = /*info:INFERRED_TYPE_CLOSURE*/(x) {return /*error:RETURN_OF_INVALID_TYPE_FROM_CLOSURE*/x;};
}
{
Function2<int, List<String>> l0 = /*info:INFERRED_TYPE_CLOSURE*/(int x) => null;
@@ -1151,7 +1151,7 @@
v = <T>(int x) => "hello";
v = /*error:INVALID_ASSIGNMENT*/<T>(String x) => "hello";
v = /*error:INVALID_ASSIGNMENT*/<T>(int x) => 3;
- v = /*info:INFERRED_TYPE_CLOSURE*/<T>(int x) {return /*error:RETURN_OF_INVALID_TYPE*/3;};
+ v = /*info:INFERRED_TYPE_CLOSURE*/<T>(int x) {return /*error:RETURN_OF_INVALID_TYPE_FROM_CLOSURE*/3;};
}
{
String f<S>(int x) => null;
@@ -1159,8 +1159,8 @@
v = /*info:INFERRED_TYPE_CLOSURE, info:INFERRED_TYPE_CLOSURE*/<T>(x) => null;
v = /*info:INFERRED_TYPE_CLOSURE*/<T>(x) => "hello";
v = /*info:INFERRED_TYPE_CLOSURE, error:INVALID_ASSIGNMENT*/<T>(x) => 3;
- v = /*info:INFERRED_TYPE_CLOSURE, info:INFERRED_TYPE_CLOSURE*/<T>(x) {return /*error:RETURN_OF_INVALID_TYPE*/3;};
- v = /*info:INFERRED_TYPE_CLOSURE, info:INFERRED_TYPE_CLOSURE*/<T>(x) {return /*error:RETURN_OF_INVALID_TYPE*/x;};
+ v = /*info:INFERRED_TYPE_CLOSURE, info:INFERRED_TYPE_CLOSURE*/<T>(x) {return /*error:RETURN_OF_INVALID_TYPE_FROM_CLOSURE*/3;};
+ v = /*info:INFERRED_TYPE_CLOSURE, info:INFERRED_TYPE_CLOSURE*/<T>(x) {return /*error:RETURN_OF_INVALID_TYPE_FROM_CLOSURE*/x;};
}
{
List<String> f<S>(int x) => null;
@@ -2135,7 +2135,7 @@
// TODO(jmesserly): we should change how this inference works.
// For now this test will cover what we use.
await checkFileElement('''
-/*error:IMPORT_INTERNAL_LIBRARY*/import 'dart:_foreign_helper' show JS;
+import /*error:IMPORT_INTERNAL_LIBRARY*/'dart:_foreign_helper' show JS;
main() {
String x = /*error:INVALID_ASSIGNMENT*/JS('int', '42');
var y = JS('String', '"hello"');
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index 853811c..d05ba4b 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -682,21 +682,26 @@
WorldImpact computeImpactForLibrary(LibraryEntity library) {
WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
- void registerStaticUse(Entity element) {
+ void registerStaticUse(MemberEntity element) {
impactBuilder.registerStaticUse(new StaticUse.directUse(element));
}
+ void registerStaticElementUse(Element element) {
+ MemberElement member = element;
+ impactBuilder.registerStaticUse(new StaticUse.directUse(member));
+ }
+
void registerElement(Element element) {
if (element.isClass) {
ClassElement cls = element;
cls.ensureResolved(resolution);
- cls.forEachLocalMember(registerStaticUse);
+ cls.forEachLocalMember(registerStaticElementUse);
impactBuilder.registerTypeUse(new TypeUse.instantiation(cls.rawType));
} else if (element.isTypedef) {
- TypedefElement typdef = element;
- typdef.ensureResolved(resolution);
+ TypedefElement typedef = element;
+ typedef.ensureResolved(resolution);
} else {
- registerStaticUse(element);
+ registerStaticElementUse(element);
}
}
diff --git a/pkg/compiler/lib/src/elements/elements.dart b/pkg/compiler/lib/src/elements/elements.dart
index 2018ada..ad1ca0d 100644
--- a/pkg/compiler/lib/src/elements/elements.dart
+++ b/pkg/compiler/lib/src/elements/elements.dart
@@ -645,37 +645,31 @@
return null;
}
- /// If `true`, injected members are sorted with their corresponding class or
- /// library.
+ /// If `true`, members are sorted using their implementation fileUri.
///
/// This is used for ensuring equivalent output order when testing against
- /// .dill using the patched_dart2js_sdk.
- // TODO(johnniwinther): Remove this when patching is implemented in
- // package:front_end.
- static bool usePatchedDart2jsSdkSorting = false;
+ /// .dill.
+ // TODO(johnniwinther): Remove this when patching correctly stores origin and
+ // patch file uris (issue 31579)
+ static bool useCFEOrder = false;
/// A `compareTo` function that places [Element]s in a consistent order based
/// on the source code order.
static int compareByPosition(Element a, Element b) {
if (identical(a, b)) return 0;
+ if (useCFEOrder) {
+ if (a is MethodElement) {
+ a = a.implementation;
+ }
+ if (b is MethodElement) {
+ b = b.implementation;
+ }
+ }
int r = utils.compareLibrariesUris(
a.library.canonicalUri, b.library.canonicalUri);
if (r != 0) return r;
Uri aUri = a.compilationUnit.script.readableUri;
Uri bUri = b.compilationUnit.script.readableUri;
- if (usePatchedDart2jsSdkSorting) {
- Uri computePatchedDart2jsUri(Element e, Uri uri) {
- if (!e.isInjected) return uri;
- if (e.enclosingClass != null) {
- return e.enclosingClass.compilationUnit.script.readableUri;
- } else {
- return e.library.compilationUnit.script.readableUri;
- }
- }
-
- aUri = computePatchedDart2jsUri(a, aUri);
- bUri = computePatchedDart2jsUri(b, bUri);
- }
r = utils.compareSourceUris(aUri, bUri);
if (r != 0) return r;
return utils.compareEntities(a, a.sourceOffset, -1, b, b.sourceOffset, -1);
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
index c77ab3b..13cfaef 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/fragment_emitter.dart
@@ -756,15 +756,15 @@
for (Field field in cls.fields) {
js.Parameter parameter = new js.Parameter('t${parameters.length}');
parameters.add(parameter);
- statements
- .add(js.js.statement('#.# = #', [thisRef, field.name, parameter]));
+ statements.add(
+ js.js.statement('#.# = #', [thisRef, field.name, parameter.name]));
}
if (cls.hasRtiField) {
js.Parameter parameter = new js.Parameter('t${parameters.length}');
parameters.add(parameter);
- statements.add(js.js
- .statement('#.# = #', [thisRef, namer.rtiFieldJsName, parameter]));
+ statements.add(js.js.statement(
+ '#.# = #', [thisRef, namer.rtiFieldJsName, parameter.name]));
}
return js.js('function #(#) { # }', [name, parameters, statements]);
diff --git a/pkg/compiler/lib/src/kernel/env.dart b/pkg/compiler/lib/src/kernel/env.dart
index c987acc..3083498 100644
--- a/pkg/compiler/lib/src/kernel/env.dart
+++ b/pkg/compiler/lib/src/kernel/env.dart
@@ -217,6 +217,12 @@
}
int orderByFileOffset(ir.TreeNode a, ir.TreeNode b) {
+ var aLoc = a.location;
+ var bLoc = b.location;
+ var aUri = '${aLoc.file}';
+ var bUri = '${bLoc.file}';
+ var uriCompare = aUri.compareTo(bUri);
+ if (uriCompare != 0) return uriCompare;
return a.fileOffset.compareTo(b.fileOffset);
}
diff --git a/pkg/compiler/lib/src/native/enqueue.dart b/pkg/compiler/lib/src/native/enqueue.dart
index 5ecffa9..c79894f 100644
--- a/pkg/compiler/lib/src/native/enqueue.dart
+++ b/pkg/compiler/lib/src/native/enqueue.dart
@@ -130,7 +130,7 @@
} else if (type.isDynamic) {
matchingClasses.addAll(_unusedClasses);
} else {
- assert(type is VoidType);
+ assert(type is VoidType, '$type was ${type.runtimeType}');
}
}
if (matchingClasses.isNotEmpty && _registeredClasses.isEmpty) {
diff --git a/pkg/compiler/lib/src/serialization/impact_serialization.dart b/pkg/compiler/lib/src/serialization/impact_serialization.dart
index 8d47953..1ebfae4 100644
--- a/pkg/compiler/lib/src/serialization/impact_serialization.dart
+++ b/pkg/compiler/lib/src/serialization/impact_serialization.dart
@@ -9,6 +9,7 @@
import '../elements/elements.dart';
import '../elements/entities.dart';
import '../elements/resolution_types.dart';
+import '../universe/call_structure.dart';
import '../universe/feature.dart';
import '../universe/selector.dart';
import '../universe/use.dart';
@@ -84,6 +85,10 @@
if (staticUse.type != null) {
object.setType(Key.TYPE, staticUse.type);
}
+ if (staticUse.callStructure != null) {
+ serializeCallStructure(
+ staticUse.callStructure, object.createObject(Key.CALL_STRUCTURE));
+ }
}
@override
@@ -148,7 +153,14 @@
Element usedElement =
deserializeElementReference(element, Key.ELEMENT, Key.NAME, object);
ResolutionDartType type = object.getType(Key.TYPE, isOptional: true);
- staticUses.add(new StaticUse.internal(usedElement, kind, type));
+ ObjectDecoder callStructureObject =
+ object.getObject(Key.CALL_STRUCTURE, isOptional: true);
+ CallStructure callStructure;
+ if (callStructureObject != null) {
+ callStructure = deserializeCallStructure(callStructureObject);
+ }
+ staticUses.add(new StaticUse.internal(usedElement, kind,
+ type: type, callStructure: callStructure));
}
ListDecoder dynamicUseDecoder = objectDecoder.getList(Key.DYNAMIC_USES);
diff --git a/pkg/compiler/lib/src/serialization/serialization_util.dart b/pkg/compiler/lib/src/serialization/serialization_util.dart
index f044f73..16e1e4e 100644
--- a/pkg/compiler/lib/src/serialization/serialization_util.dart
+++ b/pkg/compiler/lib/src/serialization/serialization_util.dart
@@ -37,24 +37,33 @@
return new Name(name, library, isSetter: isSetter);
}
+/// Serialize [callStructure] into [encoder].
+void serializeCallStructure(
+ CallStructure callStructure, ObjectEncoder encoder) {
+ encoder.setInt(Key.ARGUMENTS, callStructure.argumentCount);
+ encoder.setStrings(Key.NAMED_ARGUMENTS, callStructure.namedArguments);
+}
+
/// Serialize [selector] into [encoder].
void serializeSelector(Selector selector, ObjectEncoder encoder) {
encoder.setEnum(Key.KIND, selector.kind);
-
- encoder.setInt(Key.ARGUMENTS, selector.callStructure.argumentCount);
- encoder.setStrings(
- Key.NAMED_ARGUMENTS, selector.callStructure.namedArguments);
+ serializeCallStructure(selector.callStructure, encoder);
serializeName(selector.memberName, encoder);
}
+/// Deserialize a [CallStructure] from [decoder].
+CallStructure deserializeCallStructure(ObjectDecoder decoder) {
+ int argumentCount = decoder.getInt(Key.ARGUMENTS);
+ List<String> namedArguments =
+ decoder.getStrings(Key.NAMED_ARGUMENTS, isOptional: true);
+ return new CallStructure(argumentCount, namedArguments);
+}
+
/// Deserialize a [Selector] from [decoder].
Selector deserializeSelector(ObjectDecoder decoder) {
SelectorKind kind = decoder.getEnum(Key.KIND, SelectorKind.values);
- int argumentCount = decoder.getInt(Key.ARGUMENTS);
- List<String> namedArguments =
- decoder.getStrings(Key.NAMED_ARGUMENTS, isOptional: true);
- return new Selector(kind, deserializeName(decoder),
- new CallStructure(argumentCount, namedArguments));
+ CallStructure callStructure = deserializeCallStructure(decoder);
+ return new Selector(kind, deserializeName(decoder), callStructure);
}
/// Serialize [sendStructure] into [encoder].
diff --git a/pkg/compiler/lib/src/universe/codegen_world_builder.dart b/pkg/compiler/lib/src/universe/codegen_world_builder.dart
index cd2d9c4..2649f62 100644
--- a/pkg/compiler/lib/src/universe/codegen_world_builder.dart
+++ b/pkg/compiler/lib/src/universe/codegen_world_builder.dart
@@ -357,7 +357,6 @@
break;
case StaticUseKind.SUPER_FIELD_SET:
case StaticUseKind.FIELD_SET:
- case StaticUseKind.GENERAL:
case StaticUseKind.DIRECT_USE:
case StaticUseKind.CLOSURE:
case StaticUseKind.CALL_METHOD:
@@ -367,6 +366,11 @@
case StaticUseKind.REDIRECTION:
case StaticUseKind.DIRECT_INVOKE:
case StaticUseKind.INLINING:
+ case StaticUseKind.INVOKE:
+ case StaticUseKind.GET:
+ case StaticUseKind.SET:
+ case StaticUseKind.INIT:
+ case StaticUseKind.REFLECT:
break;
}
}
@@ -399,7 +403,11 @@
break;
case StaticUseKind.SUPER_FIELD_SET:
case StaticUseKind.SUPER_TEAR_OFF:
- case StaticUseKind.GENERAL:
+ case StaticUseKind.INVOKE:
+ case StaticUseKind.GET:
+ case StaticUseKind.SET:
+ case StaticUseKind.INIT:
+ case StaticUseKind.REFLECT:
case StaticUseKind.DIRECT_USE:
useSet.addAll(usage.normalUse());
break;
diff --git a/pkg/compiler/lib/src/universe/member_usage.dart b/pkg/compiler/lib/src/universe/member_usage.dart
index e7ff227..9248c0b 100644
--- a/pkg/compiler/lib/src/universe/member_usage.dart
+++ b/pkg/compiler/lib/src/universe/member_usage.dart
@@ -32,8 +32,7 @@
/// Registry for the observed use of a member [entity] in the open world.
abstract class _MemberUsage extends AbstractUsage<MemberUse> {
- // TODO(johnniwinther): Change [Entity] to [MemberEntity].
- final Entity entity;
+ final MemberEntity entity;
_MemberUsage.internal(this.entity);
@@ -48,6 +47,8 @@
return new _GetterUsage(member);
} else if (member.isSetter) {
return new _SetterUsage(member);
+ } else if (member.isConstructor) {
+ return new _ConstructorUsage(member);
} else {
assert(member.isFunction, failedAt(member, "Unexpected member: $member"));
return new _FunctionUsage(member);
@@ -69,6 +70,13 @@
/// `true` if [entity] has been used in all the ways possible.
bool get fullyUsed;
+ /// Registers the [entity] has been initialized and returns the new
+ /// [MemberUse]s that it caused.
+ ///
+ /// For a field this is the initial write access, for a function this is a
+ /// no-op.
+ EnumSet<MemberUse> init() => MemberUses.NONE;
+
/// Registers a read of the value of [entity] and returns the new [MemberUse]s
/// that it caused.
///
@@ -123,6 +131,9 @@
bool get fullyUsed => hasRead && hasWrite;
@override
+ EnumSet<MemberUse> init() => read();
+
+ @override
EnumSet<MemberUse> read() {
if (fullyUsed) {
return MemberUses.NONE;
@@ -170,6 +181,9 @@
bool get fullyUsed => hasRead;
@override
+ EnumSet<MemberUse> init() => read();
+
+ @override
EnumSet<MemberUse> read() {
if (hasRead) {
return MemberUses.NONE;
@@ -191,7 +205,8 @@
_FunctionUsage(FunctionEntity function) : super.internal(function);
- EnumSet<MemberUse> get _originalUse => MemberUses.ALL_INSTANCE;
+ EnumSet<MemberUse> get _originalUse =>
+ entity.isInstanceMember ? MemberUses.ALL_INSTANCE : MemberUses.ALL_STATIC;
@override
EnumSet<MemberUse> read() => fullyUse();
@@ -213,13 +228,17 @@
return MemberUses.NONE;
}
hasRead = true;
- return _pendingUse.removeAll(MemberUses.CLOSURIZE_INSTANCE_ONLY);
+ return _pendingUse.removeAll(entity.isInstanceMember
+ ? MemberUses.CLOSURIZE_INSTANCE_ONLY
+ : MemberUses.CLOSURIZE_STATIC_ONLY);
} else if (hasRead) {
hasInvoke = true;
return _pendingUse.removeAll(MemberUses.NORMAL_ONLY);
} else {
hasRead = hasInvoke = true;
- return _pendingUse.removeAll(MemberUses.ALL_INSTANCE);
+ return _pendingUse.removeAll(entity.isInstanceMember
+ ? MemberUses.ALL_INSTANCE
+ : MemberUses.ALL_STATIC);
}
}
@@ -272,6 +291,31 @@
EnumSet<MemberUse> fullyUse() => write();
}
+class _ConstructorUsage extends _MemberUsage {
+ bool hasInvoke = false;
+
+ _ConstructorUsage(ConstructorEntity constructor)
+ : super.internal(constructor);
+
+ EnumSet<MemberUse> get _originalUse => MemberUses.NORMAL_ONLY;
+
+ @override
+ EnumSet<MemberUse> invoke() {
+ if (hasInvoke) {
+ return MemberUses.NONE;
+ }
+ hasInvoke = true;
+ return _pendingUse
+ .removeAll(hasRead ? MemberUses.NONE : MemberUses.NORMAL_ONLY);
+ }
+
+ @override
+ EnumSet<MemberUse> fullyUse() => invoke();
+
+ @override
+ bool get fullyUsed => hasInvoke;
+}
+
/// Enum class for the possible kind of use of [MemberEntity] objects.
enum MemberUse { NORMAL, CLOSURIZE_INSTANCE, CLOSURIZE_STATIC }
@@ -340,8 +384,9 @@
typedef void ClassUsedCallback(ClassEntity cls, EnumSet<ClassUse> useSet);
// TODO(johnniwinther): Merge this with [_MemberUsage].
-abstract class _StaticMemberUsage extends AbstractUsage<MemberUse> {
- final Entity entity;
+abstract class _StaticMemberUsage extends AbstractUsage<MemberUse>
+ implements _MemberUsage {
+ final MemberEntity entity;
bool hasNormalUse = false;
bool get hasClosurization => false;
@@ -358,6 +403,16 @@
EnumSet<MemberUse> tearOff();
+ EnumSet<MemberUse> init() => normalUse();
+
+ EnumSet<MemberUse> read() => tearOff();
+
+ EnumSet<MemberUse> write() => normalUse();
+
+ EnumSet<MemberUse> invoke() => normalUse();
+
+ EnumSet<MemberUse> fullyUse() => normalUse();
+
@override
EnumSet<MemberUse> get _originalUse => MemberUses.NORMAL_ONLY;
@@ -365,15 +420,27 @@
}
class _GeneralStaticMemberUsage extends _StaticMemberUsage {
- _GeneralStaticMemberUsage(Entity entity) : super.internal(entity);
+ _GeneralStaticMemberUsage(MemberEntity entity) : super.internal(entity);
EnumSet<MemberUse> tearOff() => normalUse();
+
+ @override
+ bool get fullyUsed => hasNormalUse;
+
+ @override
+ bool get hasInvoke => hasNormalUse;
+
+ @override
+ bool get hasWrite => hasNormalUse;
+
+ @override
+ bool get hasRead => hasNormalUse;
}
class _StaticFunctionUsage extends _StaticMemberUsage {
bool hasClosurization = false;
- _StaticFunctionUsage(Entity entity) : super.internal(entity);
+ _StaticFunctionUsage(MemberEntity entity) : super.internal(entity);
EnumSet<MemberUse> tearOff() {
if (hasClosurization) {
@@ -385,4 +452,16 @@
@override
EnumSet<MemberUse> get _originalUse => MemberUses.ALL_STATIC;
+
+ @override
+ bool get fullyUsed => hasNormalUse && hasClosurization;
+
+ @override
+ bool get hasInvoke => hasNormalUse;
+
+ @override
+ bool get hasWrite => hasNormalUse;
+
+ @override
+ bool get hasRead => hasClosurization;
}
diff --git a/pkg/compiler/lib/src/universe/resolution_world_builder.dart b/pkg/compiler/lib/src/universe/resolution_world_builder.dart
index fd395ad..a8501fb 100644
--- a/pkg/compiler/lib/src/universe/resolution_world_builder.dart
+++ b/pkg/compiler/lib/src/universe/resolution_world_builder.dart
@@ -296,10 +296,9 @@
Map<ClassEntity, _ClassUsage> get classUsageForTesting => _processedClasses;
/// Map of registered usage of static members of live classes.
- final Map<Entity, _StaticMemberUsage> _staticMemberUsage =
- <Entity, _StaticMemberUsage>{};
+ final Map<Entity, _MemberUsage> _staticMemberUsage = <Entity, _MemberUsage>{};
- Map<Entity, _StaticMemberUsage> get staticMemberUsageForTesting =>
+ Map<Entity, _MemberUsage> get staticMemberUsageForTesting =>
_staticMemberUsage;
/// Map of registered usage of instance members of live classes.
@@ -616,14 +615,12 @@
}
MemberEntity element = staticUse.element;
- _StaticMemberUsage usage = _staticMemberUsage.putIfAbsent(element, () {
- if ((element.isStatic || element.isTopLevel) && element.isFunction) {
- return new _StaticFunctionUsage(element);
- } else {
- return new _GeneralStaticMemberUsage(element);
- }
- });
EnumSet<MemberUse> useSet = new EnumSet<MemberUse>();
+ _MemberUsage usage = _staticMemberUsage.putIfAbsent(element, () {
+ _MemberUsage usage = new _MemberUsage(element);
+ useSet.addAll(usage.appliedUse);
+ return usage;
+ });
if ((element.isStatic || element.isTopLevel) && element.isField) {
allReferencedStaticFields.add(staticUse.element);
@@ -642,22 +639,32 @@
// Already handled above.
break;
case StaticUseKind.SUPER_TEAR_OFF:
- useSet.addAll(usage.tearOff());
+ useSet.addAll(usage.read());
methodsNeedingSuperGetter.add(staticUse.element);
break;
case StaticUseKind.SUPER_FIELD_SET:
fieldSetters.add(staticUse.element);
- useSet.addAll(usage.normalUse());
+ useSet.addAll(usage.write());
break;
+ case StaticUseKind.GET:
case StaticUseKind.STATIC_TEAR_OFF:
- useSet.addAll(usage.tearOff());
+ useSet.addAll(usage.read());
break;
- case StaticUseKind.GENERAL:
+ case StaticUseKind.SET:
+ useSet.addAll(usage.write());
+ break;
case StaticUseKind.DIRECT_USE:
+ case StaticUseKind.REFLECT:
+ useSet.addAll(usage.fullyUse());
+ break;
+ case StaticUseKind.INIT:
+ useSet.addAll(usage.init());
+ break;
+ case StaticUseKind.INVOKE:
case StaticUseKind.CONSTRUCTOR_INVOKE:
case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
case StaticUseKind.REDIRECTION:
- useSet.addAll(usage.normalUse());
+ useSet.addAll(usage.invoke());
break;
case StaticUseKind.DIRECT_INVOKE:
failedAt(element, 'Direct static use is not supported for resolution.');
@@ -813,7 +820,7 @@
_MemberUsage usage = _instanceMemberUsage[member];
if (usage != null && usage.hasUse) return true;
}
- _StaticMemberUsage usage = _staticMemberUsage[member];
+ _MemberUsage usage = _staticMemberUsage[member];
return usage != null && usage.hasUse;
}
diff --git a/pkg/compiler/lib/src/universe/use.dart b/pkg/compiler/lib/src/universe/use.dart
index e172133..6d4b03b 100644
--- a/pkg/compiler/lib/src/universe/use.dart
+++ b/pkg/compiler/lib/src/universe/use.dart
@@ -71,7 +71,6 @@
}
enum StaticUseKind {
- GENERAL,
STATIC_TEAR_OFF,
SUPER_TEAR_OFF,
SUPER_FIELD_SET,
@@ -85,6 +84,11 @@
DIRECT_INVOKE,
DIRECT_USE,
INLINING,
+ INVOKE,
+ GET,
+ SET,
+ INIT,
+ REFLECT,
}
/// Statically known use of an [Entity].
@@ -95,12 +99,12 @@
final StaticUseKind kind;
final int hashCode;
final DartType type;
+ final CallStructure callStructure;
- StaticUse.internal(Entity element, StaticUseKind kind, [DartType type = null])
+ StaticUse.internal(Entity element, this.kind, {this.type, this.callStructure})
: this.element = element,
- this.kind = kind,
- this.type = type,
- this.hashCode = Hashing.objectsHash(element, kind, type) {
+ this.hashCode =
+ Hashing.objectsHash(element, kind, type, callStructure) {
assert(
!(element is Element && !element.isDeclaration),
failedAt(element,
@@ -111,14 +115,14 @@
/// [callStructure].
factory StaticUse.staticInvoke(
FunctionEntity element, CallStructure callStructure) {
- // TODO(johnniwinther): Use the [callStructure].
assert(
element.isStatic || element.isTopLevel,
failedAt(
element,
"Static invoke element $element must be a top-level "
"or static method."));
- return new StaticUse.internal(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.INVOKE,
+ callStructure: callStructure);
}
/// Closurization of a static or top-level function [element].
@@ -144,7 +148,7 @@
element.isField || element.isGetter,
failedAt(element,
"Static get element $element must be a field or a getter."));
- return new StaticUse.internal(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.GET);
}
/// Write access of a static or top-level field or setter [element].
@@ -159,7 +163,7 @@
element.isField || element.isSetter,
failedAt(element,
"Static set element $element must be a field or a setter."));
- return new StaticUse.internal(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.SET);
}
/// Invocation of the lazy initializer for a static or top-level field
@@ -173,18 +177,18 @@
"or static method."));
assert(element.isField,
failedAt(element, "Static init element $element must be a field."));
- return new StaticUse.internal(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.INIT);
}
/// Invocation of a super method [element] with the given [callStructure].
factory StaticUse.superInvoke(
FunctionEntity element, CallStructure callStructure) {
- // TODO(johnniwinther): Use the [callStructure].
assert(
element.isInstanceMember,
failedAt(element,
"Super invoke element $element must be an instance method."));
- return new StaticUse.internal(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.INVOKE,
+ callStructure: callStructure);
}
/// Read access of a super field or getter [element].
@@ -197,7 +201,7 @@
element.isField || element.isGetter,
failedAt(element,
"Super get element $element must be a field or a getter."));
- return new StaticUse.internal(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.GET);
}
/// Write access of a super field [element].
@@ -219,7 +223,7 @@
element, "Super set element $element must be an instance method."));
assert(element.isSetter,
failedAt(element, "Super set element $element must be a setter."));
- return new StaticUse.internal(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.SET);
}
/// Closurization of a super method [element].
@@ -235,35 +239,35 @@
/// constructor call with the given [callStructure].
factory StaticUse.superConstructorInvoke(
ConstructorEntity element, CallStructure callStructure) {
- // TODO(johnniwinther): Use the [callStructure].
assert(
element.isGenerativeConstructor,
failedAt(
element,
"Constructor invoke element $element must be a "
"generative constructor."));
- return new StaticUse.internal(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.INVOKE,
+ callStructure: callStructure);
}
/// Invocation of a constructor (body) [element] through a this or super
/// constructor call with the given [callStructure].
factory StaticUse.constructorBodyInvoke(
ConstructorBodyEntity element, CallStructure callStructure) {
- // TODO(johnniwinther): Use the [callStructure].
- return new StaticUse.internal(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.INVOKE,
+ callStructure: callStructure);
}
/// Direct invocation of a method [element] with the given [callStructure].
factory StaticUse.directInvoke(
FunctionEntity element, CallStructure callStructure) {
- // TODO(johnniwinther): Use the [callStructure].
assert(
element.isInstanceMember,
failedAt(element,
"Direct invoke element $element must be an instance member."));
assert(element.isFunction,
failedAt(element, "Direct invoke element $element must be a method."));
- return new StaticUse.internal(element, StaticUseKind.DIRECT_INVOKE);
+ return new StaticUse.internal(element, StaticUseKind.DIRECT_INVOKE,
+ callStructure: callStructure);
}
/// Direct read access of a field or getter [element].
@@ -276,7 +280,7 @@
element.isField || element.isGetter,
failedAt(element,
"Direct get element $element must be a field or a getter."));
- return new StaticUse.internal(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.GET);
}
/// Direct write access of a field [element].
@@ -287,7 +291,7 @@
"Direct set element $element must be an instance member."));
assert(element.isField,
failedAt(element, "Direct set element $element must be a field."));
- return new StaticUse.internal(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.SET);
}
/// Constructor invocation of [element] with the given [callStructure].
@@ -297,8 +301,8 @@
element.isConstructor,
failedAt(element,
"Constructor invocation element $element must be a constructor."));
- // TODO(johnniwinther): Use the [callStructure].
- return new StaticUse.internal(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.INVOKE,
+ callStructure: callStructure);
}
/// Constructor invocation of [element] with the given [callStructure] on
@@ -313,9 +317,8 @@
element,
"Typed constructor invocation element $element "
"must be a constructor."));
- // TODO(johnniwinther): Use the [callStructure].
- return new StaticUse.internal(
- element, StaticUseKind.CONSTRUCTOR_INVOKE, type);
+ return new StaticUse.internal(element, StaticUseKind.CONSTRUCTOR_INVOKE,
+ type: type, callStructure: callStructure);
}
/// Constant constructor invocation of [element] with the given
@@ -330,9 +333,9 @@
element,
"Const constructor invocation element $element "
"must be a constructor."));
- // TODO(johnniwinther): Use the [callStructure].
return new StaticUse.internal(
- element, StaticUseKind.CONST_CONSTRUCTOR_INVOKE, type);
+ element, StaticUseKind.CONST_CONSTRUCTOR_INVOKE,
+ type: type, callStructure: callStructure);
}
/// Constructor redirection to [element] on [type].
@@ -344,7 +347,8 @@
element.isConstructor,
failedAt(element,
"Constructor redirection element $element must be a constructor."));
- return new StaticUse.internal(element, StaticUseKind.REDIRECTION, type);
+ return new StaticUse.internal(element, StaticUseKind.REDIRECTION,
+ type: type);
}
/// Initialization of an instance field [element].
@@ -353,7 +357,7 @@
element.isInstanceMember,
failedAt(
element, "Field init element $element must be an instance field."));
- return new StaticUse.internal(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.INIT);
}
/// Read access of an instance field or boxed field [element].
@@ -390,34 +394,37 @@
/// Use of [element] through reflection.
factory StaticUse.mirrorUse(MemberEntity element) {
- return new StaticUse.internal(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.REFLECT);
}
/// Implicit method/constructor invocation of [element] created by the
/// backend.
factory StaticUse.implicitInvoke(FunctionEntity element) {
- return new StaticUse.internal(element, StaticUseKind.GENERAL);
+ return new StaticUse.internal(element, StaticUseKind.INVOKE);
}
/// Direct use of [element] as done with `--analyze-all` and `--analyze-main`.
- factory StaticUse.directUse(Entity element) {
+ factory StaticUse.directUse(MemberEntity element) {
return new StaticUse.internal(element, StaticUseKind.DIRECT_USE);
}
/// Inlining of [element].
factory StaticUse.inlining(
FunctionEntity element, InterfaceType instanceType) {
- return new StaticUse.internal(
- element, StaticUseKind.INLINING, instanceType);
+ return new StaticUse.internal(element, StaticUseKind.INLINING,
+ type: instanceType);
}
bool operator ==(other) {
if (identical(this, other)) return true;
if (other is! StaticUse) return false;
- return element == other.element && kind == other.kind && type == other.type;
+ return element == other.element &&
+ kind == other.kind &&
+ type == other.type &&
+ callStructure == other.callStructure;
}
- String toString() => 'StaticUse($element,$kind,$type)';
+ String toString() => 'StaticUse($element,$kind,$type,$callStructure)';
}
enum TypeUseKind {
diff --git a/pkg/compiler/lib/src/util/util.dart b/pkg/compiler/lib/src/util/util.dart
index d96c1e3..4bc30d3 100644
--- a/pkg/compiler/lib/src/util/util.dart
+++ b/pkg/compiler/lib/src/util/util.dart
@@ -43,8 +43,9 @@
}
/// Mix the bits of `.hashCode` all non-null objects.
- static int objectsHash(Object obj1, [Object obj2, Object obj3]) {
+ static int objectsHash(Object obj1, [Object obj2, Object obj3, Object obj4]) {
int hash = 0;
+ if (obj4 != null) hash = objectHash(obj4, hash);
if (obj3 != null) hash = objectHash(obj3, hash);
if (obj2 != null) hash = objectHash(obj2, hash);
return objectHash(obj1, hash);
diff --git a/pkg/dev_compiler/lib/src/kernel/command.dart b/pkg/dev_compiler/lib/src/kernel/command.dart
index 7c2f441..c25dd88 100644
--- a/pkg/dev_compiler/lib/src/kernel/command.dart
+++ b/pkg/dev_compiler/lib/src/kernel/command.dart
@@ -8,7 +8,9 @@
import 'package:args/args.dart';
import 'package:dev_compiler/src/kernel/target.dart';
+import 'package:front_end/src/api_prototype/physical_file_system.dart';
import 'package:front_end/src/api_unstable/ddc.dart' as fe;
+import 'package:front_end/src/multi_root_file_system.dart';
import 'package:kernel/core_types.dart';
import 'package:kernel/kernel.dart';
import 'package:path/path.dart' as path;
@@ -122,12 +124,24 @@
}
}
+ // To make the output .dill agnostic of the current working directory,
+ // we use a custom-uri scheme for all app URIs (these are files outside the
+ // lib folder). The following [FileSystem] will resolve those references to
+ // the correct location and keeps the real file location hidden from the
+ // front end.
+ // TODO(sigmund): technically we don't need a "multi-root" file system,
+ // because we are providing a single root, the alternative here is to
+ // implement a new file system with a single root instead.
+ var fileSystem = new MultiRootFileSystem(
+ 'org-dartlang-app', [Uri.base], PhysicalFileSystem.instance);
+
compilerState = await fe.initializeCompiler(
compilerState,
path.toUri(sdkSummaryPath),
path.toUri(packageFile),
summaryUris,
- new DevCompilerTarget());
+ new DevCompilerTarget(),
+ fileSystem: fileSystem);
fe.DdcResult result = await fe.compile(compilerState, inputs, errorHandler);
if (result == null || !succeeded) {
return new CompilerResult(compilerState, false);
diff --git a/pkg/dev_compiler/test/codegen/closure.dart b/pkg/dev_compiler/test/codegen/closure.dart
index 9e70097..0093013 100644
--- a/pkg/dev_compiler/test/codegen/closure.dart
+++ b/pkg/dev_compiler/test/codegen/closure.dart
@@ -3,7 +3,7 @@
import 'dart:js';
-List/*<T>*/ generic_function/*<T>*/(List/*<T>*/ items, dynamic/*=T*/ seed) {
+List<T> generic_function<T>(List<T> items, T seed) {
var strings = items.map((i) => "$i").toList();
return items;
}
diff --git a/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart b/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart
index a4f28fe..84479a9 100644
--- a/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart
+++ b/pkg/dev_compiler/tool/input_sdk/lib/js/dart2js/js_dart2js.dart
@@ -560,7 +560,7 @@
/// JavaScript. We may remove the need to call this method completely in the
/// future if Dart2Js is refactored so that its function calling conventions
/// are more compatible with JavaScript.
-Function/*=F*/ allowInterop/*<F extends Function>*/(Function/*=F*/ f) => f;
+F allowInterop<F extends Function>(F f) => f;
Expando<Function> _interopCaptureThisExpando = new Expando<Function>();
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 221b620..c750542 100644
--- a/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart
+++ b/pkg/dev_compiler/tool/input_sdk/patch/internal_patch.dart
@@ -36,13 +36,13 @@
}
@patch
-List/*<E>*/ makeListFixedLength/*<E>*/(List/*<E>*/ growableList) {
+List<E> makeListFixedLength<E>(List<E> growableList) {
JSArray.markFixedList(growableList);
return growableList;
}
@patch
-List/*<E>*/ makeFixedListUnmodifiable/*<E>*/(List/*<E>*/ fixedLengthList) {
+List<E> makeFixedListUnmodifiable<E>(List<E> fixedLengthList) {
JSArray.markUnmodifiableList(fixedLengthList);
return fixedLengthList;
}
diff --git a/pkg/dev_compiler/tool/input_sdk/private/native_helper.dart b/pkg/dev_compiler/tool/input_sdk/private/native_helper.dart
index 5481fed..063edc7 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/native_helper.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/native_helper.dart
@@ -19,7 +19,7 @@
// Obsolete in dart dev compiler. Added only so that the same version of
// dart:html can be used in dart2js an dev compiler.
-/*=F*/ convertDartClosureToJS/*<F>*/(/*=F*/ closure, int arity) {
+F convertDartClosureToJS<F>(F closure, int arity) {
return closure;
}
diff --git a/pkg/expect/pubspec.yaml b/pkg/expect/pubspec.yaml
index 63f6840..21ab22d 100644
--- a/pkg/expect/pubspec.yaml
+++ b/pkg/expect/pubspec.yaml
@@ -1,5 +1,4 @@
name: expect
-version: 0.9.1-dev
author: "Dart Team <misc@dartlang.org>"
homepage: http://www.dartlang.org
description: >
diff --git a/pkg/front_end/lib/src/api_prototype/compiler_options.dart b/pkg/front_end/lib/src/api_prototype/compiler_options.dart
index 6b66316..30eca21 100644
--- a/pkg/front_end/lib/src/api_prototype/compiler_options.dart
+++ b/pkg/front_end/lib/src/api_prototype/compiler_options.dart
@@ -8,6 +8,9 @@
import 'package:front_end/src/base/performance_logger.dart';
import 'package:kernel/target/targets.dart' show Target;
+import '../fasta/fasta_codes.dart' show LocatedMessage;
+import '../fasta/severity.dart' show Severity;
+
import 'compilation_message.dart';
import 'file_system.dart';
import 'physical_file_system.dart';
@@ -15,6 +18,9 @@
/// Callback used to report errors encountered during compilation.
typedef void ErrorHandler(CompilationMessage error);
+typedef void ProblemHandler(LocatedMessage problem, Severity severity,
+ String formatted, int line, int column);
+
/// Front-end options relevant to compiler back ends.
///
/// Not intended to be implemented or extended by clients.
@@ -43,6 +49,8 @@
/// messages on the console and will throw when fatal errors are discovered.
ErrorHandler onError;
+ ProblemHandler onProblem;
+
/// Whether messages should be reported using the compiler's internal
/// reporting mechanism.
///
diff --git a/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart b/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart
index d2eedd1..aae2ecf 100644
--- a/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart
+++ b/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart
@@ -15,6 +15,14 @@
import 'compiler_options.dart';
+/// Force using the Fasta incremental compiler [IncrementalCompiler]. This is
+/// useful for uploading patches to golem (benchmark service).
+const bool _forceFasta = false;
+
+/// When true, use the Fasta incremental compiler [IncrementalCompiler].
+const bool _useFasta =
+ const bool.fromEnvironment("ikg-use-fasta", defaultValue: _forceFasta);
+
/// The type of the function that clients can pass to track used files.
///
/// When a file is first used during compilation, this function is called with
@@ -143,13 +151,14 @@
CompilerOptions options, Uri entryPoint,
{WatchUsedFilesFn watch, bool useMinimalGenerator: false}) async {
var processedOptions = new ProcessedOptions(options, false, [entryPoint]);
+ if (_useFasta) {
+ return new IncrementalCompiler(new CompilerContext(processedOptions));
+ }
return await CompilerContext.runWithOptions(processedOptions,
(compilerContext) async {
var uriTranslator = await processedOptions.getUriTranslator();
var sdkOutlineBytes = await processedOptions.loadSdkSummaryBytes();
- if (const String.fromEnvironment("ikg-variant") == "fasta") {
- return new IncrementalCompiler(compilerContext);
- } else if (useMinimalGenerator) {
+ if (useMinimalGenerator) {
return new MinimalIncrementalKernelGenerator(
processedOptions, uriTranslator, sdkOutlineBytes, entryPoint,
watch: watch);
diff --git a/pkg/front_end/lib/src/api_unstable/ddc.dart b/pkg/front_end/lib/src/api_unstable/ddc.dart
index b50f8a1..14bc14c 100644
--- a/pkg/front_end/lib/src/api_unstable/ddc.dart
+++ b/pkg/front_end/lib/src/api_unstable/ddc.dart
@@ -4,10 +4,10 @@
import 'dart:async' show Future;
+import 'package:front_end/src/api_prototype/file_system.dart';
import 'package:front_end/src/api_prototype/physical_file_system.dart';
import 'package:front_end/src/base/processed_options.dart';
import 'package:front_end/src/kernel_generator_impl.dart';
-import 'package:front_end/src/multi_root_file_system.dart';
import 'package:kernel/kernel.dart' show Program;
import 'package:kernel/target/targets.dart' show Target;
@@ -30,7 +30,8 @@
Uri sdkSummary,
Uri packagesFile,
List<Uri> inputSummaries,
- Target target) async {
+ Target target,
+ {FileSystem fileSystem}) async {
inputSummaries.sort((a, b) => a.toString().compareTo(b.toString()));
bool listEqual(List<Uri> a, List<Uri> b) {
if (a.length != b.length) return false;
@@ -59,23 +60,12 @@
return oldState;
}
- // To make the output .dill agnostic of the current working directory,
- // we use a custom-uri scheme for all app URIs (these are files outside the
- // lib folder). The following [FileSystem] will resolve those references to
- // the correct location and keeps the real file location hidden from the
- // front end.
- // TODO(sigmund): technically we don't need a "multi-root" file system,
- // because we are providing a single root, the alternative here is to
- // implement a new file system with a single root instead.
- var fileSystem = new MultiRootFileSystem(
- 'org-dartlang-app', [Uri.base], PhysicalFileSystem.instance);
-
CompilerOptions options = new CompilerOptions()
..sdkSummary = sdkSummary
..packagesFileUri = packagesFile
..inputSummaries = inputSummaries
..target = target
- ..fileSystem = fileSystem
+ ..fileSystem = fileSystem ?? PhysicalFileSystem.instance
..chaseDependencies = true
..reportMessages = true;
diff --git a/pkg/front_end/lib/src/base/processed_options.dart b/pkg/front_end/lib/src/base/processed_options.dart
index 7c45480..59301ae 100644
--- a/pkg/front_end/lib/src/base/processed_options.dart
+++ b/pkg/front_end/lib/src/base/processed_options.dart
@@ -15,7 +15,7 @@
import 'package:front_end/src/fasta/ticker.dart';
import 'package:front_end/src/fasta/uri_translator.dart';
import 'package:front_end/src/fasta/uri_translator_impl.dart';
-import 'package:kernel/kernel.dart' show Program, CanonicalName;
+import 'package:kernel/kernel.dart' show CanonicalName, Location, Program;
import 'package:kernel/target/targets.dart';
import 'package:kernel/target/vm.dart';
import 'package:package_config/packages.dart' show Packages;
@@ -28,6 +28,10 @@
import 'package:kernel/binary/ast_from_binary.dart' show BinaryBuilder;
+import '../fasta/messages.dart' show getLocation;
+
+import '../fasta/deprecated_problems.dart' show deprecated_InputError;
+
import 'libraries_specification.dart';
/// All options needed for the front end implementation.
@@ -158,9 +162,32 @@
return _raw.byteStore;
}
- bool get _reportMessages => _raw.reportMessages ?? (_raw.onError == null);
+ bool get _reportMessages {
+ return _raw.onProblem == null &&
+ (_raw.reportMessages ?? (_raw.onError == null));
+ }
void report(LocatedMessage message, Severity severity) {
+ if (_raw.onProblem != null) {
+ int offset = message.charOffset;
+ Uri uri = message.uri;
+ Location location = offset == -1 ? null : getLocation(uri, offset);
+ _raw.onProblem(
+ message,
+ severity,
+ command_line_reporting.format(message, severity, location: location),
+ location?.line ?? -1,
+ location?.column ?? -1);
+ if (command_line_reporting.shouldThrowOn(severity)) {
+ if (verbose) print(StackTrace.current);
+ throw new deprecated_InputError(
+ uri,
+ offset,
+ "Compilation aborted due to fatal "
+ "${command_line_reporting.severityName(severity)}.");
+ }
+ return;
+ }
if (_raw.onError != null) {
_raw.onError(new _CompilationMessage(message, severity));
}
@@ -169,6 +196,23 @@
}
void reportWithoutLocation(Message message, Severity severity) {
+ if (_raw.onProblem != null) {
+ _raw.onProblem(
+ message.withLocation(null, -1),
+ severity,
+ command_line_reporting.formatWithoutLocation(message, severity),
+ -1,
+ -1);
+ if (command_line_reporting.shouldThrowOn(severity)) {
+ if (verbose) print(StackTrace.current);
+ throw new deprecated_InputError(
+ null,
+ -1,
+ "Compilation aborted due to fatal "
+ "${command_line_reporting.severityName(severity)}.");
+ }
+ return;
+ }
if (_raw.onError != null) {
_raw.onError(
new _CompilationMessage(message.withLocation(null, -1), severity));
diff --git a/pkg/front_end/lib/src/fasta/command_line_reporting.dart b/pkg/front_end/lib/src/fasta/command_line_reporting.dart
index 531debb..aeeaca7 100644
--- a/pkg/front_end/lib/src/fasta/command_line_reporting.dart
+++ b/pkg/front_end/lib/src/fasta/command_line_reporting.dart
@@ -37,7 +37,8 @@
///
/// This is shared implementation used by methods below, and isn't intended to
/// be called directly.
-String formatInternal(Message message, Severity severity, Uri uri, int offset) {
+String formatInternal(Message message, Severity severity, Uri uri, int offset,
+ {Location location}) {
try {
String text =
"${severityName(severity, capitalized: true)}: ${message.message}";
@@ -63,7 +64,7 @@
if (uri != null) {
String path = relativizeUri(uri);
- Location location = offset == -1 ? null : getLocation(uri, offset);
+ location ??= (offset == -1 ? null : getLocation(uri, offset));
String sourceLine = getSourceLine(location);
if (sourceLine == null) {
sourceLine = "";
@@ -191,9 +192,10 @@
///
/// This method isn't intended to be called directly. Use
/// [CompilerContext.format] instead.
-String format(LocatedMessage message, Severity severity) {
+String format(LocatedMessage message, Severity severity, {Location location}) {
return formatInternal(
- message.messageObject, severity, message.uri, message.charOffset);
+ message.messageObject, severity, message.uri, message.charOffset,
+ location: location);
}
/// Formats [message] as described in [formatInternal].
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
index e5e5b6e..0268c43 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -1193,7 +1193,7 @@
const Code<Message Function(String string)> codeExpectedButGot =
const Code<Message Function(String string)>(
"ExpectedButGot", templateExpectedButGot,
- analyzerCode: "UNEXPECTED_TOKEN",
+ analyzerCode: "EXPECTED_TOKEN",
dart2jsCode: "MISSING_TOKEN_BEFORE_THIS");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -4365,6 +4365,31 @@
message: r"""Switch case may fall through to the next case.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeSwitchHasCaseAfterDefault =
+ messageSwitchHasCaseAfterDefault;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageSwitchHasCaseAfterDefault = const MessageCode(
+ "SwitchHasCaseAfterDefault",
+ analyzerCode: "SWITCH_HAS_CASE_AFTER_DEFAULT_CASE",
+ dart2jsCode: "*fatal*",
+ message:
+ r"""The default case should be the last case in a switch statement.""",
+ tip: r"""Try moving the default case after the other case clauses.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeSwitchHasMultipleDefaults =
+ messageSwitchHasMultipleDefaults;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageSwitchHasMultipleDefaults = const MessageCode(
+ "SwitchHasMultipleDefaults",
+ analyzerCode: "SWITCH_HAS_MULTIPLE_DEFAULT_CASES",
+ dart2jsCode: "*fatal*",
+ message: r"""The 'default' case can only be declared once.""",
+ tip: r"""Try removing all but one default case.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name)>
templateThisAccessInFieldInitializer =
const Template<Message Function(String name)>(
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index 30ac413..e210ad2 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -71,13 +71,12 @@
KernelTarget userCode;
- IncrementalCompiler(this.context)
- : ticker = new Ticker(isVerbose: context.options.verbose);
+ IncrementalCompiler(this.context) : ticker = context.options.ticker;
@override
Future<FastaDelta> computeDelta({Uri entryPoint}) async {
+ ticker.reset();
return context.runInContext<Future<FastaDelta>>((CompilerContext c) async {
- ticker.reset();
if (platform == null) {
UriTranslator uriTranslator = await c.options.getUriTranslator();
ticker.logMs("Read packages file");
@@ -86,8 +85,10 @@
List<int> bytes = await c.options.loadSdkSummaryBytes();
if (bytes != null) {
ticker.logMs("Read ${c.options.sdkSummary}");
- platform.loader.appendLibraries(loadProgramFromBytes(bytes),
- byteCount: bytes.length);
+ Program program = loadProgramFromBytes(bytes);
+ ticker.logMs("Deserialized ${c.options.sdkSummary}");
+ platform.loader.appendLibraries(program, byteCount: bytes.length);
+ ticker.logMs("Appended libraries");
}
await platform.buildOutlines();
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index 9a47639..d960ce9 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -1236,7 +1236,7 @@
charOffset, "Not a constant expression.");
}
return new TypeDeclarationAccessor(
- this, charOffset, builder, name, token);
+ this, prefix, charOffset, builder, name, token);
} else if (builder.isLocal) {
if (constantExpressionRequired &&
!builder.isConst &&
@@ -1285,7 +1285,8 @@
return new ThisPropertyAccessor(this, token, n, getter, setter);
} else if (builder.isRegularMethod) {
assert(builder.isStatic || builder.isTopLevel);
- return new StaticAccessor(this, token, builder.target, null);
+ return new StaticAccessor(this, token, builder.target, null,
+ prefixName: prefix?.name);
} else if (builder is PrefixBuilder) {
if (constantExpressionRequired && builder.deferred) {
deprecated_addCompileTimeError(
@@ -1309,8 +1310,9 @@
} else if (builder.isField && !builder.isFinal) {
setter = builder;
}
- StaticAccessor accessor =
- new StaticAccessor.fromBuilder(this, builder, token, setter);
+ StaticAccessor accessor = new StaticAccessor.fromBuilder(
+ this, builder, token, setter,
+ prefix: prefix);
if (constantExpressionRequired) {
Member readTarget = accessor.readTarget;
if (!(readTarget is Field && readTarget.isConst ||
@@ -2343,6 +2345,7 @@
{bool isConst: false,
int charOffset: -1,
Member initialTarget,
+ String prefixName,
int targetOffset: -1,
Class targetClass}) {
initialTarget ??= target;
@@ -2376,7 +2379,7 @@
..fileOffset = charOffset;
} else {
return new ShadowStaticInvocation(
- targetOffset, targetClass, target, arguments,
+ prefixName, targetOffset, targetClass, target, arguments,
isConst: isConst)
..fileOffset = charOffset;
}
@@ -3070,16 +3073,8 @@
}
}
}
- // Check all but the last case for the following:
- // 1. That it isn't a default case (which should be last).
- // 2. That it doesn't fall through to the next case.
for (int i = 0; i < caseCount - 1; i++) {
SwitchCase current = cases[i];
- if (current.isDefault) {
- deprecated_addCompileTimeError(current.fileOffset,
- "'default' switch case should be the last case.");
- continue;
- }
Block block = current.body;
// [block] is a synthetic block that is added to handle variable
// declarations in the switch case.
@@ -3611,8 +3606,9 @@
@override
StaticGet makeStaticGet(Member readTarget, Token token,
- {int targetOffset: -1, Class targetClass}) {
- return new ShadowStaticGet(targetOffset, targetClass, readTarget)
+ {String prefixName, int targetOffset: -1, Class targetClass}) {
+ return new ShadowStaticGet(
+ prefixName, targetOffset, targetClass, readTarget)
..fileOffset = offsetForToken(token);
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart b/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
index 04b5bf2..7f5ddbf 100644
--- a/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
@@ -114,6 +114,7 @@
{bool isConst,
int charOffset,
Member initialTarget,
+ String prefixName,
int targetOffset: -1,
Class targetClass});
@@ -131,7 +132,7 @@
List<TypeParameter> typeParameters);
StaticGet makeStaticGet(Member readTarget, Token token,
- {int targetOffset: -1, Class targetClass});
+ {String prefixName, int targetOffset: -1, Class targetClass});
dynamic deprecated_addCompileTimeError(int charOffset, String message);
@@ -739,15 +740,15 @@
class StaticAccessor extends kernel.StaticAccessor with FastaAccessor {
StaticAccessor(
BuilderHelper helper, Token token, Member readTarget, Member writeTarget,
- {int targetOffset: -1, Class targetClass})
- : super(
- helper, targetOffset, targetClass, readTarget, writeTarget, token) {
+ {String prefixName, int targetOffset: -1, Class targetClass})
+ : super(helper, prefixName, targetOffset, targetClass, readTarget,
+ writeTarget, token) {
assert(readTarget != null || writeTarget != null);
}
factory StaticAccessor.fromBuilder(
BuilderHelper helper, Builder builder, Token token, Builder builderSetter,
- {int targetOffset: -1, Class targetClass}) {
+ {PrefixBuilder prefix, int targetOffset: -1, Class targetClass}) {
if (builder is AccessErrorBuilder) {
AccessErrorBuilder error = builder;
builder = error.builder;
@@ -766,7 +767,9 @@
}
}
return new StaticAccessor(helper, token, getter, setter,
- targetOffset: targetOffset, targetClass: targetClass);
+ prefixName: prefix?.name,
+ targetOffset: targetOffset,
+ targetClass: targetClass);
}
String get plainNameForRead => (readTarget ?? writeTarget).name.name;
@@ -786,6 +789,7 @@
} else {
return helper.buildStaticInvocation(readTarget, arguments,
charOffset: offset,
+ prefixName: prefixName,
targetOffset: targetOffset,
targetClass: targetClass);
}
@@ -795,7 +799,7 @@
@override
ShadowComplexAssignment startComplexAssignment(Expression rhs) =>
- new ShadowStaticAssignment(targetOffset, targetClass, rhs);
+ new ShadowStaticAssignment(prefixName, targetOffset, targetClass, rhs);
}
class LoadLibraryAccessor extends kernel.LoadLibraryAccessor
@@ -1013,14 +1017,23 @@
}
class TypeDeclarationAccessor extends ReadOnlyAccessor {
+ /// The import prefix preceding the [declaration] reference, or `null` if
+ /// the reference is not prefixed.
+ final PrefixBuilder prefix;
+
/// The offset at which the [declaration] is referenced by this accessor,
/// or `-1` if the reference is implicit.
final int declarationReferenceOffset;
final TypeDeclarationBuilder declaration;
- TypeDeclarationAccessor(BuilderHelper helper, this.declarationReferenceOffset,
- this.declaration, String plainNameForRead, Token token)
+ TypeDeclarationAccessor(
+ BuilderHelper helper,
+ this.prefix,
+ this.declarationReferenceOffset,
+ this.declaration,
+ String plainNameForRead,
+ Token token)
: super(helper, null, plainNameForRead, token);
Expression get expression {
@@ -1036,7 +1049,7 @@
..fileOffset = offset;
} else {
super.expression = new ShadowTypeLiteral(
- buildType(null, nonInstanceAccessIsError: true))
+ prefix?.name, buildType(null, nonInstanceAccessIsError: true))
..fileOffset = offsetForToken(token);
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart b/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart
index 758d701..d2920fa 100644
--- a/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart
@@ -669,6 +669,10 @@
}
class StaticAccessor extends Accessor {
+ /// The name of the import prefix preceding the [targetClass], [readTarget],
+ /// or [writeTarget], or `null` if the reference is not prefixed.
+ String prefixName;
+
/// If [targetClass] is not `null`, the offset at which the explicit
/// reference to it is; otherwise `-1`.
int targetOffset;
@@ -681,8 +685,8 @@
Member readTarget;
Member writeTarget;
- StaticAccessor(BuilderHelper helper, this.targetOffset, this.targetClass,
- this.readTarget, this.writeTarget, Token token)
+ StaticAccessor(BuilderHelper helper, this.prefixName, this.targetOffset,
+ this.targetClass, this.readTarget, this.writeTarget, Token token)
: super(helper, token);
Expression _makeRead(ShadowComplexAssignment complexAssignment) {
@@ -690,7 +694,9 @@
return makeInvalidRead();
} else {
var read = helper.makeStaticGet(readTarget, token,
- targetOffset: targetOffset, targetClass: targetClass);
+ prefixName: prefixName,
+ targetOffset: targetOffset,
+ targetClass: targetClass);
complexAssignment?.read = read;
return read;
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
index 846289e..3025f01 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
@@ -1734,15 +1734,20 @@
/// Concrete shadow object representing an assignment to a static variable.
class ShadowStaticAssignment extends ShadowComplexAssignment {
+ /// The name of the import prefix preceding the [_targetClass], or the target
+ /// [Procedure]; or `null` if the reference is not prefixed.
+ final String _prefixName;
+
/// If [_targetClass] is not `null`, the offset at which the explicit
/// reference to it is; otherwise `-1`.
- int _targetOffset;
+ final int _targetOffset;
/// The [Class] that was explicitly referenced to get the target [Procedure],
/// or `null` if the class is implicit.
- Class _targetClass;
+ final Class _targetClass;
- ShadowStaticAssignment(this._targetOffset, this._targetClass, Expression rhs)
+ ShadowStaticAssignment(
+ this._prefixName, this._targetOffset, this._targetClass, Expression rhs)
: super(rhs);
@override
@@ -1754,8 +1759,8 @@
@override
DartType _inferExpression(
ShadowTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
- typeNeeded = inferrer.listener.staticAssignEnter(
- desugared, _targetOffset, _targetClass, this.write, typeContext) ||
+ typeNeeded = inferrer.listener.staticAssignEnter(desugared, _prefixName,
+ _targetOffset, _targetClass, this.write, typeContext) ||
typeNeeded;
DartType readType;
var read = this.read;
@@ -1785,22 +1790,27 @@
/// Concrete shadow object representing a read of a static variable in kernel
/// form.
class ShadowStaticGet extends StaticGet implements ShadowExpression {
+ /// The name of the import prefix preceding the [_targetClass], or the target
+ /// [Procedure]; or `null` if the reference is not prefixed.
+ final String _prefixName;
+
/// If [_targetClass] is not `null`, the offset at which the explicit
/// reference to it is; otherwise `-1`.
- int _targetOffset;
+ final int _targetOffset;
/// The [Class] that was explicitly referenced to get the target [Procedure],
/// or `null` if the class is implicit.
- Class _targetClass;
+ final Class _targetClass;
- ShadowStaticGet(this._targetOffset, this._targetClass, Member target)
+ ShadowStaticGet(
+ this._prefixName, this._targetOffset, this._targetClass, Member target)
: super(target);
@override
DartType _inferExpression(
ShadowTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
- typeNeeded = inferrer.listener
- .staticGetEnter(this, _targetOffset, _targetClass, typeContext) ||
+ typeNeeded = inferrer.listener.staticGetEnter(
+ this, _prefixName, _targetOffset, _targetClass, typeContext) ||
typeNeeded;
var target = this.target;
if (target is ShadowField && target._inferenceNode != null) {
@@ -1820,16 +1830,20 @@
/// Shadow object for [StaticInvocation].
class ShadowStaticInvocation extends StaticInvocation
implements ShadowExpression {
+ /// The name of the import prefix preceding the [_targetClass], or the target
+ /// [Procedure]; or `null` if the reference is not prefixed.
+ final String _prefixName;
+
/// If [_targetClass] is not `null`, the offset at which the explicit
/// reference to it is; otherwise `-1`.
- int _targetOffset;
+ final int _targetOffset;
/// The [Class] that was explicitly referenced to get the target [Procedure],
/// or `null` if the class is implicit.
- Class _targetClass;
+ final Class _targetClass;
- ShadowStaticInvocation(this._targetOffset, this._targetClass,
- Procedure target, Arguments arguments,
+ ShadowStaticInvocation(this._prefixName, this._targetOffset,
+ this._targetClass, Procedure target, Arguments arguments,
{bool isConst: false})
: super(target, arguments, isConst: isConst);
@@ -1837,7 +1851,7 @@
DartType _inferExpression(
ShadowTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
typeNeeded = inferrer.listener.staticInvocationEnter(
- this, _targetOffset, _targetClass, typeContext) ||
+ this, _prefixName, _targetOffset, _targetClass, typeContext) ||
typeNeeded;
var calleeType = target.function.functionType;
var inferredType = inferrer.inferInvocation(typeContext, typeNeeded,
@@ -2243,13 +2257,18 @@
/// Shadow object for [TypeLiteral].
class ShadowTypeLiteral extends TypeLiteral implements ShadowExpression {
- ShadowTypeLiteral(DartType type) : super(type);
+ /// The name of the import prefix preceding the referenced type literal;
+ /// or `null` if the reference is not prefixed.
+ final String prefixName;
+
+ ShadowTypeLiteral(this.prefixName, DartType type) : super(type);
@override
DartType _inferExpression(
ShadowTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
typeNeeded =
- inferrer.listener.typeLiteralEnter(this, typeContext) || typeNeeded;
+ inferrer.listener.typeLiteralEnter(this, prefixName, typeContext) ||
+ typeNeeded;
var inferredType = typeNeeded ? inferrer.coreTypes.typeClass.rawType : null;
inferrer.listener.typeLiteralExit(this, inferredType);
return inferredType;
diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
index 9af160a..3548042 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -422,7 +422,7 @@
}
token = parseMetadataStar(token);
if (token.next.isTopLevelKeyword) {
- return parseTopLevelKeywordDeclaration(null, token, directiveState);
+ return parseTopLevelKeywordDeclaration(token, null, directiveState);
}
Token start = token;
// Skip modifiers to find a top level keyword or identifier
@@ -447,7 +447,7 @@
modifier = modifier.next;
}
return parseTopLevelKeywordDeclaration(
- beforeAbstractToken, token, directiveState);
+ token, beforeAbstractToken, directiveState);
} else if (next.isIdentifier || next.keyword != null) {
// TODO(danrubel): improve parseTopLevelMember
// so that we don't parse modifiers twice.
@@ -500,15 +500,14 @@
/// Parse any top-level declaration that begins with a keyword.
Token parseTopLevelKeywordDeclaration(
- Token beforeAbstractToken, Token token, DirectiveContext directiveState) {
- // TODO(brianwilkerson): Move `token` to be the first parameter.
+ Token token, Token beforeAbstractToken, DirectiveContext directiveState) {
Token previous = token;
token = token.next;
assert(token.isTopLevelKeyword);
final String value = token.stringValue;
if (identical(value, 'class')) {
directiveState?.checkDeclaration();
- return parseClassOrNamedMixinApplication(beforeAbstractToken, previous);
+ return parseClassOrNamedMixinApplication(previous, beforeAbstractToken);
} else if (identical(value, 'enum')) {
directiveState?.checkDeclaration();
return parseEnum(previous);
@@ -594,11 +593,11 @@
Token importKeyword = token.next;
assert(optional('import', importKeyword));
listener.beginImport(importKeyword);
- token = parseLiteralStringOrRecoverExpression(importKeyword);
+ token = ensureLiteralString(importKeyword);
Token uri = token;
- token = parseConditionalUris(token);
+ token = parseConditionalUriStar(token);
token = parseImportPrefixOpt(token);
- token = parseCombinators(token).next;
+ token = parseCombinatorStar(token).next;
if (optional(';', token)) {
listener.endImport(importKeyword, token);
return token;
@@ -619,9 +618,9 @@
// Reparse to determine which clauses have already been parsed
// but intercept the events so they are not sent to the primary listener
listener = recoveryListener;
- token = parseConditionalUris(token);
+ token = parseConditionalUriStar(token);
token = parseImportPrefixOpt(token);
- token = parseCombinators(token);
+ token = parseCombinatorStar(token);
Token firstDeferredKeyword = recoveryListener.deferredKeyword;
bool hasPrefix = recoveryListener.asKeyword != null;
@@ -643,7 +642,7 @@
// During recovery, clauses are parsed in the same order
// and generate the same events as in the parseImport method above.
recoveryListener.clear();
- token = parseConditionalUris(token);
+ token = parseConditionalUriStar(token);
if (recoveryListener.ifKeyword != null) {
if (firstDeferredKeyword != null) {
// TODO(danrubel): report error indicating conditional should
@@ -689,7 +688,7 @@
}
}
- token = parseCombinators(token);
+ token = parseCombinatorStar(token);
hasCombinator = hasCombinator || recoveryListener.hasCombinator;
if (optional(';', token.next)) {
@@ -714,8 +713,7 @@
/// conditionalUri*
/// ;
/// ```
- Token parseConditionalUris(Token token) {
- // TODO(brianwilkerson): Rename to `parseConditionalUriStar`?
+ Token parseConditionalUriStar(Token token) {
listener.beginConditionalUris(token.next);
int count = 0;
while (optional('if', token.next)) {
@@ -776,9 +774,9 @@
Token exportKeyword = token.next;
assert(optional('export', exportKeyword));
listener.beginExport(exportKeyword);
- token = ensureParseLiteralString(exportKeyword);
- token = parseConditionalUris(token);
- token = parseCombinators(token);
+ token = ensureLiteralString(exportKeyword);
+ token = parseConditionalUriStar(token);
+ token = parseCombinatorStar(token);
token = ensureSemicolon(token);
listener.endExport(exportKeyword, token);
return token;
@@ -789,8 +787,7 @@
/// (hideCombinator | showCombinator)*
/// ;
/// ```
- Token parseCombinators(Token token) {
- // TODO(brianwilkerson): Rename to `parseCombinatorsStar`?
+ Token parseCombinatorStar(Token token) {
Token next = token.next;
listener.beginCombinators(next);
int count = 0;
@@ -1347,11 +1344,7 @@
}
Token skipBlock(Token token) {
- Token previousToken = token;
- token = token.next;
- if (!optional('{', token)) {
- token = recoverFromMissingBlock(previousToken);
- }
+ token = ensureBlock(token, null);
Token closeBrace = closeBraceTokenFor(token);
if (closeBrace == null ||
!identical(closeBrace.kind, $CLOSE_CURLY_BRACKET)) {
@@ -1398,8 +1391,7 @@
}
Token parseClassOrNamedMixinApplication(
- Token beforeAbstractToken, Token token) {
- // TODO(brianwilkerson): Move `token` to be the first parameter.
+ Token token, Token beforeAbstractToken) {
token = token.next;
listener.beginClassOrNamedMixinApplication(token);
Token begin = beforeAbstractToken?.next ?? token;
@@ -1453,7 +1445,7 @@
/// ```
Token parseClass(Token token, Token begin, Token classKeyword) {
Token start = token;
- token = parseClassHeader(token, begin, classKeyword);
+ token = parseClassHeaderOpt(token, begin, classKeyword);
if (!optional('{', token.next)) {
// Recovery
token = parseClassHeaderRecovery(start, begin, classKeyword);
@@ -1463,8 +1455,7 @@
return token;
}
- Token parseClassHeader(Token token, Token begin, Token classKeyword) {
- // TODO(brianwilkerson): Rename to `parseClassHeaderOpt`?
+ Token parseClassHeaderOpt(Token token, Token begin, Token classKeyword) {
token = parseClassExtendsOpt(token);
token = parseClassImplementsOpt(token);
Token nativeToken;
@@ -1484,7 +1475,7 @@
// Reparse to determine which clauses have already been parsed
// but intercept the events so they are not sent to the primary listener.
listener = recoveryListener;
- token = parseClassHeader(token, begin, classKeyword);
+ token = parseClassHeaderOpt(token, begin, classKeyword);
bool hasExtends = recoveryListener.extendsKeyword != null;
bool hasImplements = recoveryListener.implementsKeyword != null;
Token withKeyword = recoveryListener.withKeyword;
@@ -1975,7 +1966,6 @@
}
bool notEofOrValue(String value, Token token) {
- // TODO(brianwilkerson): Move `token` to be the first parameter.
return !identical(token.kind, EOF_TOKEN) &&
!identical(value, token.stringValue);
}
@@ -2137,22 +2127,22 @@
// Push the non-existing return type first. The loop below will
// generate the full type.
listener.handleNoType(begin);
- token = begin;
+ token = beforeBegin;
} else if (functionTypes > 0 && voidToken != null) {
listener.handleVoidKeyword(voidToken);
- token = voidToken.next;
+ token = voidToken;
} else {
token = ensureIdentifier(beforeBegin, context);
token = parseQualifiedRestOpt(
token, IdentifierContext.typeReferenceContinuation);
assert(typeArguments == null || typeArguments == token.next);
- token = parseTypeArgumentsOpt(token).next;
- listener.handleType(begin, token);
+ token = parseTypeArgumentsOpt(token);
+ listener.handleType(begin, token.next);
}
{
- Token newBegin =
- listener.replaceTokenWithGenericCommentTypeAssign(begin, token);
+ Token newBegin = listener.replaceTokenWithGenericCommentTypeAssign(
+ begin, token.next);
if (!identical(newBegin, begin)) {
listener.discardTypeReplacedWithCommentTypeAssign();
// TODO(brianwilkerson): Remove the invocation of `previous` when
@@ -2163,25 +2153,23 @@
}
for (int i = 0; i < functionTypes; i++) {
- assert(optional('Function', token));
- Token functionToken = token;
- if (optional("<", token.next)) {
+ Token next = token.next;
+ assert(optional('Function', next));
+ Token functionToken = next;
+ if (optional("<", next.next)) {
// Skip type parameters, they were parsed above.
- token = closeBraceTokenFor(token.next);
+ next = closeBraceTokenFor(next.next);
}
token = parseFormalParametersRequiredOpt(
- token, MemberKind.GeneralizedFunctionType)
- .next;
- listener.endFunctionType(functionToken, token);
+ next, MemberKind.GeneralizedFunctionType);
+ listener.endFunctionType(functionToken, token.next);
}
if (hasVar) {
reportRecoverableError(begin, fasta.messageTypeAfterVar);
}
- // TODO(brianwilkerson): Remove the invocation of `previous` when
- // `commitType` accepts the last consumed token.
- return token.previous;
+ return token;
}
/// Returns true if [kind] could be the end of a variable declaration.
@@ -2300,7 +2288,7 @@
commitType();
}
return parseNamedFunctionRest(
- begin, beforeToken, beforeFormals, false);
+ beforeToken, begin, beforeFormals, false);
}
} else if (identical(afterIdKind, LT_TOKEN)) {
// We are looking at `type identifier '<'`.
@@ -2320,7 +2308,7 @@
commitType();
}
return parseNamedFunctionRest(
- begin, beforeToken, beforeFormals, false);
+ beforeToken, begin, beforeFormals, false);
}
}
}
@@ -2342,7 +2330,7 @@
listener.beginLocalFunctionDeclaration(token);
listener.handleModifiers(0);
listener.handleNoType(token);
- return parseNamedFunctionRest(begin, beforeToken, formals, false);
+ return parseNamedFunctionRest(beforeToken, begin, formals, false);
}
} else if (optional('<', token.next)) {
Token gt = closeBraceTokenFor(token.next);
@@ -2354,7 +2342,7 @@
listener.beginLocalFunctionDeclaration(token);
listener.handleModifiers(0);
listener.handleNoType(token);
- return parseNamedFunctionRest(begin, beforeToken, gt, false);
+ return parseNamedFunctionRest(beforeToken, begin, gt, false);
}
}
// Fall through to expression statement.
@@ -2417,7 +2405,7 @@
}
if (beforeName.next != name)
throw new StateError("beforeName.next != name");
- return parseNamedFunctionRest(begin, beforeName, formals, true);
+ return parseNamedFunctionRest(beforeName, begin, formals, true);
case TypeContinuation.VariablesDeclarationOrExpression:
if (looksLikeType &&
@@ -2632,7 +2620,7 @@
}
Token parseTypeArgumentsOpt(Token token) {
- return parseStuff(
+ return parseStuffOpt(
token,
(t) => listener.beginTypeArguments(t),
(t) => parseType(t),
@@ -2641,7 +2629,7 @@
}
Token parseTypeVariablesOpt(Token token) {
- return parseStuff(
+ return parseStuffOpt(
token,
(t) => listener.beginTypeVariables(t),
(t) => parseTypeVariable(t),
@@ -2650,10 +2638,8 @@
}
/// TODO(ahe): Clean this up.
- Token parseStuff(Token token, Function beginStuff, Function stuffParser,
+ Token parseStuffOpt(Token token, Function beginStuff, Function stuffParser,
Function endStuff, Function handleNoStuff) {
- // TODO(brianwilkerson): Rename to `parseStuffOpt`?
-
// TODO(brianwilkerson): Remove the invocation of `previous` when
// `injectGenericCommentTypeList` returns the last consumed token.
token = listener.injectGenericCommentTypeList(token.next).previous;
@@ -2682,8 +2668,21 @@
Link<Token> identifiers = findMemberName(beforeStart);
if (identifiers.isEmpty) {
- return reportUnrecoverableErrorWithToken(
- token, fasta.templateExpectedDeclaration);
+ if ((isValidTypeReference(token) ||
+ optional('const', token) ||
+ optional('final', token) ||
+ optional('var', token)) &&
+ isPostIdentifierForRecovery(
+ token.next, IdentifierContext.topLevelVariableDeclaration)) {
+ // Recovery: Looks like a top level variable declaration
+ // but missing a variable name.
+ insertSyntheticIdentifier(
+ token, IdentifierContext.topLevelVariableDeclaration);
+ return parseFields(beforeStart, const Link<Token>(), token, true);
+ } else {
+ return reportUnrecoverableErrorWithToken(
+ token, fasta.templateExpectedDeclaration);
+ }
}
Token afterName = identifiers.head.next;
identifiers = identifiers.tail;
@@ -2857,11 +2856,11 @@
token = name;
listener.handleNoTypeVariables(token.next);
}
- checkFormals(isGetter, name, token.next, MemberKind.TopLevelMethod);
+ checkFormals(name, isGetter, token.next, MemberKind.TopLevelMethod);
token = parseFormalParametersOpt(token, MemberKind.TopLevelMethod);
AsyncModifier savedAsyncModifier = asyncState;
Token asyncToken = token.next;
- token = parseAsyncModifier(token);
+ token = parseAsyncModifierOpt(token);
if (getOrSet != null && !inPlainSync && optional("set", getOrSet)) {
reportRecoverableError(asyncToken, fasta.messageSetterNotSync);
}
@@ -2871,8 +2870,7 @@
return token;
}
- void checkFormals(bool isGetter, Token name, Token token, MemberKind kind) {
- // TODO(brianwilkerson): Move `token` to be the first parameter?
+ void checkFormals(Token name, bool isGetter, Token token, MemberKind kind) {
if (optional("(", token)) {
if (isGetter) {
reportRecoverableError(token, fasta.messageGetterWithFormals);
@@ -3171,6 +3169,25 @@
return token;
}
+ /// If the next token is an opening curly brace, return it. Otherwise, use the
+ /// given [template] to report an error, insert an opening and a closing curly
+ /// brace, and return the newly inserted opening curly brace. If the
+ /// [template] is `null`, use a default error message instead.
+ Token ensureBlock(
+ Token token, Template<Message Function(Token token)> template) {
+ Token next = token.next;
+ if (optional('{', next)) return next;
+ Message message = template == null
+ ? fasta.templateExpectedButGot.withArguments('{')
+ : template.withArguments(token);
+ reportRecoverableError(next, message);
+ Token replacement = link(
+ new SyntheticBeginToken(TokenType.OPEN_CURLY_BRACKET, next.offset),
+ new SyntheticToken(TokenType.CLOSE_CURLY_BRACKET, next.offset));
+ rewriter.insertTokenAfter(token, replacement);
+ return replacement;
+ }
+
/// If the next token is a closing parenthesis, return it.
/// Otherwise, report an error and return the closing parenthesis
/// associated with the specified open parenthesis.
@@ -3200,18 +3217,6 @@
return rewriteAndRecover(token, message, newToken).next;
}
- Token ensureParseLiteralString(Token token) {
- // TODO(brianwilkerson): Rename to `ensureLiteralString`?
- Token next = token.next;
- if (!identical(next.kind, STRING_TOKEN)) {
- Message message = fasta.templateExpectedString.withArguments(next);
- Token newToken =
- new SyntheticStringToken(TokenType.STRING, '""', token.charOffset, 0);
- rewriteAndRecover(token, message, newToken);
- }
- return parseLiteralString(token);
- }
-
/// If the token after [token] is a '>', return it.
/// If the next token is a composite greater-than token such as '>>',
/// then replace that token with separate tokens, and return the first '>'.
@@ -3227,6 +3232,20 @@
return token.next;
}
+ /// If the token after [token] is a not literal string,
+ /// then insert a synthetic literal string.
+ /// Call `parseLiteralString` and return the result.
+ Token ensureLiteralString(Token token) {
+ Token next = token.next;
+ if (!identical(next.kind, STRING_TOKEN)) {
+ Message message = fasta.templateExpectedString.withArguments(next);
+ Token newToken =
+ new SyntheticStringToken(TokenType.STRING, '""', token.charOffset, 0);
+ rewriteAndRecover(token, message, newToken);
+ }
+ return parseLiteralString(token);
+ }
+
/// If the token after [token] is a semi-colon, return it.
/// Otherwise, report an error, insert a synthetic semi-colon,
/// and return the inserted semi-colon.
@@ -3404,7 +3423,7 @@
Token previousToken = token;
token = token.next;
if (!optional('{', token)) {
- token = recoverFromMissingClassBody(previousToken);
+ token = ensureBlock(previousToken, fasta.templateExpectedClassBody);
}
Token closeBrace = closeBraceTokenFor(token);
if (closeBrace == null ||
@@ -3429,7 +3448,8 @@
Token begin = token = token.next;
listener.beginClassBody(token);
if (!optional('{', token)) {
- token = begin = recoverFromMissingClassBody(previousToken);
+ token =
+ begin = ensureBlock(previousToken, fasta.templateExpectedClassBody);
}
int count = 0;
while (notEofOrValue('}', token.next)) {
@@ -3490,15 +3510,7 @@
Link<Token> identifiers = findMemberName(start);
if (identifiers.isEmpty) {
- if ((isValidTypeReference(token) || optional('var', token)) &&
- isPostIdentifierForRecovery(
- token.next, IdentifierContext.fieldDeclaration)) {
- // Recovery: Looks like a field declaration but missing a field name.
- insertSyntheticIdentifier(token, IdentifierContext.fieldDeclaration);
- return parseFields(start, const Link<Token>(), token, false);
- } else {
- return recoverFromInvalidClassMember(start);
- }
+ return recoverFromInvalidClassMember(start);
}
Token afterName = identifiers.head.next;
identifiers = identifiers.tail;
@@ -3674,14 +3686,14 @@
MemberKind kind = staticModifier != null
? MemberKind.StaticMethod
: MemberKind.NonStaticMethod;
- checkFormals(isGetter, name, token.next, kind);
+ checkFormals(name, isGetter, token.next, kind);
token = parseFormalParametersOpt(token, kind);
token = parseInitializersOpt(token);
bool allowAbstract = staticModifier == null;
AsyncModifier savedAsyncModifier = asyncState;
Token asyncToken = token.next;
- token = parseAsyncModifier(token);
+ token = parseAsyncModifierOpt(token);
if (getOrSet != null && !inPlainSync && optional("set", getOrSet)) {
reportRecoverableError(asyncToken, fasta.messageSetterNotSync);
}
@@ -3754,7 +3766,7 @@
token = parseConstructorReference(token);
token = parseFormalParametersRequiredOpt(token, MemberKind.Factory);
Token asyncToken = token.next;
- token = parseAsyncModifier(token);
+ token = parseAsyncModifierOpt(token);
next = token.next;
if (!inPlainSync) {
reportRecoverableError(asyncToken, fasta.messageFactoryNotSync);
@@ -3828,9 +3840,7 @@
/// - Modifiers.
/// - Return type.
Token parseNamedFunctionRest(
- Token begin, Token beforeName, Token formals, bool isFunctionExpression) {
- // TODO(brianwilkerson): Move `name` to be the first parameter (and consider
- // renaming it to `token`).
+ Token beforeName, Token begin, Token formals, bool isFunctionExpression) {
Token token = beforeName.next;
listener.beginFunctionName(token);
token =
@@ -3853,7 +3863,7 @@
}
/// Parses a function body optionally preceded by an async modifier (see
- /// [parseAsyncModifier]). This method is used in both expression context
+ /// [parseAsyncModifierOpt]). This method is used in both expression context
/// (when [ofFunctionExpression] is true) and statement context. In statement
/// context (when [ofFunctionExpression] is false), and if the function body
/// is on the form `=> expression`, a trailing semicolon is required.
@@ -3862,7 +3872,7 @@
Token parseAsyncOptBody(
Token token, bool ofFunctionExpression, bool allowAbstract) {
AsyncModifier savedAsyncModifier = asyncState;
- token = parseAsyncModifier(token);
+ token = parseAsyncModifierOpt(token);
token = parseFunctionBody(token, ofFunctionExpression, allowAbstract);
asyncState = savedAsyncModifier;
return token;
@@ -3979,19 +3989,7 @@
listener.handleEmptyFunctionBody(next);
return next;
} else if (optional('=>', next)) {
- Token begin = next;
- token = parseExpression(next);
- if (!ofFunctionExpression) {
- token = ensureSemicolon(token);
- listener.handleExpressionFunctionBody(begin, token);
- } else {
- listener.handleExpressionFunctionBody(begin, null);
- }
- if (inGenerator) {
- listener.handleInvalidStatement(
- begin, fasta.messageGeneratorReturnsValue);
- }
- return token;
+ return parseExpressionFunctionBody(next, ofFunctionExpression);
} else if (optional('=', next)) {
Token begin = next;
// Recover from a bad factory method.
@@ -4008,16 +4006,31 @@
Token begin = next;
int statementCount = 0;
if (!optional('{', next)) {
- token = recoverFromMissingFunctionBody(token);
- listener.handleInvalidFunctionBody(token);
- return token.endGroup;
+ // Recovery
+ // If there is a stray simple identifier in the function expression
+ // because the user is typing (e.g. `() asy => null;`)
+ // then report an error, skip the token, and continue parsing.
+ if (next.isKeywordOrIdentifier && optional('=>', next.next)) {
+ reportRecoverableErrorWithToken(next, fasta.templateUnexpectedToken);
+ return parseExpressionFunctionBody(next.next, ofFunctionExpression);
+ }
+ if (next.isKeywordOrIdentifier && optional('{', next.next)) {
+ reportRecoverableErrorWithToken(next, fasta.templateUnexpectedToken);
+ token = next;
+ begin = next = token.next;
+ // Fall through to parse the block.
+ } else {
+ token = ensureBlock(token, fasta.templateExpectedFunctionBody);
+ listener.handleInvalidFunctionBody(token);
+ return token.endGroup;
+ }
}
listener.beginBlockFunctionBody(begin);
token = next;
while (notEofOrValue('}', token.next)) {
Token startToken = token.next;
- token = parseStatementOpt(token);
+ token = parseStatement(token);
if (identical(token.next, startToken)) {
// No progress was made, so we report the current token as being invalid
// and move forward.
@@ -4033,6 +4046,23 @@
return token;
}
+ Token parseExpressionFunctionBody(Token token, bool ofFunctionExpression) {
+ assert(optional('=>', token));
+ Token begin = token;
+ token = parseExpression(token);
+ if (!ofFunctionExpression) {
+ token = ensureSemicolon(token);
+ listener.handleExpressionFunctionBody(begin, token);
+ } else {
+ listener.handleExpressionFunctionBody(begin, null);
+ }
+ if (inGenerator) {
+ listener.handleInvalidStatement(
+ begin, fasta.messageGeneratorReturnsValue);
+ }
+ return token;
+ }
+
Token skipAsyncModifier(Token token) {
String value = token.next.stringValue;
if (identical(value, 'async')) {
@@ -4053,8 +4083,7 @@
return token;
}
- Token parseAsyncModifier(Token token) {
- // TODO(brianwilkerson): Rename to `parseAsyncModifierOpt`?
+ Token parseAsyncModifierOpt(Token token) {
Token async;
Token star;
asyncState = AsyncModifier.Sync;
@@ -4088,8 +4117,7 @@
}
int statementDepth = 0;
- Token parseStatementOpt(Token token) {
- // TODO(brianwilkerson): Rename this to `parseStatement`?
+ Token parseStatement(Token token) {
if (statementDepth++ > 500) {
// This happens for degenerate programs, for example, a lot of nested
// if-statements. The language test deep_nesting2_negative_test, for
@@ -4257,7 +4285,7 @@
labelCount++;
} while (next.isIdentifier && optional(':', next.next));
listener.beginLabeledStatement(next, labelCount);
- token = parseStatementOpt(token);
+ token = parseStatement(token);
listener.endLabeledStatement(labelCount);
return token;
}
@@ -4690,21 +4718,34 @@
assert(optional('(', next));
Token nextToken = closeBraceTokenFor(next).next;
int kind = nextToken.kind;
- if (mayParseFunctionExpressions &&
- (identical(kind, FUNCTION_TOKEN) ||
- identical(kind, OPEN_CURLY_BRACKET_TOKEN) ||
- (identical(kind, KEYWORD_TOKEN) &&
- (optional('async', nextToken) ||
- optional('sync', nextToken))))) {
- listener.handleNoTypeVariables(next);
- return parseFunctionExpression(token);
- } else {
- bool old = mayParseFunctionExpressions;
- mayParseFunctionExpressions = true;
- token = parseParenthesizedExpression(token);
- mayParseFunctionExpressions = old;
- return token;
+ if (mayParseFunctionExpressions) {
+ if ((identical(kind, FUNCTION_TOKEN) ||
+ identical(kind, OPEN_CURLY_BRACKET_TOKEN))) {
+ listener.handleNoTypeVariables(next);
+ return parseFunctionExpression(token);
+ } else if (identical(kind, KEYWORD_TOKEN) ||
+ identical(kind, IDENTIFIER_TOKEN)) {
+ if (optional('async', nextToken) || optional('sync', nextToken)) {
+ listener.handleNoTypeVariables(next);
+ return parseFunctionExpression(token);
+ }
+ // Recovery
+ // If there is a stray simple identifier in the function expression
+ // because the user is typing (e.g. `() asy {}`) then continue parsing
+ // and allow parseFunctionExpression to report an unexpected token.
+ kind = nextToken.next.kind;
+ if ((identical(kind, FUNCTION_TOKEN) ||
+ identical(kind, OPEN_CURLY_BRACKET_TOKEN))) {
+ listener.handleNoTypeVariables(next);
+ return parseFunctionExpression(token);
+ }
+ }
}
+ bool old = mayParseFunctionExpressions;
+ mayParseFunctionExpressions = true;
+ token = parseParenthesizedExpression(token);
+ mayParseFunctionExpressions = old;
+ return token;
}
Token parseParenthesizedExpression(Token token) {
@@ -5109,7 +5150,11 @@
if (identical(kind, STRING_INTERPOLATION_TOKEN)) {
// Parsing ${expression}.
token = parseExpression(next).next;
- expect('}', token);
+ if (!optional('}', token)) {
+ reportRecoverableError(
+ token, fasta.templateExpectedButGot.withArguments('}'));
+ token = next.endGroup;
+ }
listener.handleInterpolationExpression(next, token);
} else if (identical(kind, STRING_INTERPOLATION_IDENTIFIER_TOKEN)) {
// Parsing $identifier.
@@ -5392,13 +5437,13 @@
listener.beginIfStatement(ifToken);
token = parseParenthesizedExpression(ifToken);
listener.beginThenStatement(token.next);
- token = parseStatementOpt(token);
+ token = parseStatement(token);
listener.endThenStatement(token);
Token elseToken = null;
if (optional('else', token.next)) {
elseToken = token.next;
listener.beginElseStatement(elseToken);
- token = parseStatementOpt(elseToken);
+ token = parseStatement(elseToken);
listener.endElseStatement(elseToken);
}
listener.endIfStatement(ifToken, elseToken);
@@ -5494,7 +5539,7 @@
}
expect(')', token);
listener.beginForStatementBody(token.next);
- token = parseStatementOpt(token);
+ token = parseStatement(token);
listener.endForStatementBody(token.next);
listener.endForStatement(
forToken, leftParenthesis, leftSeparator, expressionCount, token.next);
@@ -5521,7 +5566,7 @@
listener.endForInExpression(token);
expect(')', token);
listener.beginForInBody(token.next);
- token = parseStatementOpt(token);
+ token = parseStatement(token);
listener.endForInBody(token.next);
listener.endForIn(
awaitToken, forKeyword, leftParenthesis, inKeyword, token.next);
@@ -5539,7 +5584,7 @@
listener.beginWhileStatement(whileToken);
token = parseParenthesizedExpression(whileToken);
listener.beginWhileStatementBody(token.next);
- token = parseStatementOpt(token);
+ token = parseStatement(token);
listener.endWhileStatementBody(token.next);
listener.endWhileStatement(whileToken, token.next);
return token;
@@ -5555,7 +5600,7 @@
assert(optional('do', doToken));
listener.beginDoWhileStatement(doToken);
listener.beginDoWhileStatementBody(doToken.next);
- token = parseStatementOpt(doToken).next;
+ token = parseStatement(doToken).next;
listener.endDoWhileStatementBody(token);
Token whileToken = token;
expect('while', token);
@@ -5571,16 +5616,12 @@
/// ;
/// ```
Token parseBlock(Token token) {
- Token previousToken = token;
- Token begin = token = token.next;
+ Token begin = token = ensureBlock(token, null);
listener.beginBlock(begin);
int statementCount = 0;
- if (!optional('{', token)) {
- token = recoverFromMissingBlock(previousToken);
- }
while (notEofOrValue('}', token.next)) {
Token startToken = token.next;
- token = parseStatementOpt(token);
+ token = parseStatement(token);
if (identical(token.next, startToken)) {
// No progress was made, so we report the current token as being invalid
// and move forward.
@@ -5763,20 +5804,70 @@
/// ;
/// ```
Token parseSwitchBlock(Token token) {
- Token begin = token = token.next;
- listener.beginSwitchBlock(begin);
- expect('{', token);
+ Token beginSwitch = token = ensureBlock(token, null);
+ listener.beginSwitchBlock(beginSwitch);
int caseCount = 0;
- while (!identical(token.next.kind, EOF_TOKEN)) {
- if (optional('}', token.next)) {
- break;
+ Token defaultKeyword = null;
+ Token colonAfterDefault = null;
+ while (notEofOrValue('}', token.next)) {
+ Token beginCase = token.next;
+ int expressionCount = 0;
+ int labelCount = 0;
+ Token peek = peekPastLabels(beginCase);
+ while (true) {
+ // Loop until we find something that can't be part of a switch case.
+ String value = peek.stringValue;
+ if (identical(value, 'default')) {
+ while (!identical(token.next, peek)) {
+ token = parseLabel(token);
+ labelCount++;
+ }
+ if (defaultKeyword != null) {
+ reportRecoverableError(
+ token.next, fasta.messageSwitchHasMultipleDefaults);
+ }
+ defaultKeyword = token.next;
+ colonAfterDefault = token = ensureColon(defaultKeyword);
+ peek = token.next;
+ break;
+ } else if (identical(value, 'case')) {
+ while (!identical(token.next, peek)) {
+ token = parseLabel(token);
+ labelCount++;
+ }
+ Token caseKeyword = token.next;
+ if (defaultKeyword != null) {
+ reportRecoverableError(
+ caseKeyword, fasta.messageSwitchHasCaseAfterDefault);
+ }
+ listener.beginCaseExpression(caseKeyword);
+ token = parseExpression(caseKeyword);
+ token = ensureColon(token);
+ listener.endCaseExpression(token);
+ listener.handleCaseMatch(caseKeyword, token);
+ expressionCount++;
+ peek = peekPastLabels(token.next);
+ } else if (expressionCount > 0) {
+ break;
+ } else {
+ // Recovery
+ reportRecoverableError(
+ peek, fasta.templateExpectedToken.withArguments("case"));
+ Token endGroup = beginSwitch.endGroup;
+ while (token.next != endGroup) {
+ token = token.next;
+ }
+ peek = peekPastLabels(token.next);
+ break;
+ }
}
- token = parseSwitchCase(token);
+ token = parseStatementsInSwitchCase(token, peek, beginCase, labelCount,
+ expressionCount, defaultKeyword, colonAfterDefault);
++caseCount;
}
token = token.next;
- listener.endSwitchBlock(caseCount, begin, token);
- expect('}', token);
+ listener.endSwitchBlock(caseCount, beginSwitch, token);
+ assert(optional('}', token));
return token;
}
@@ -5790,60 +5881,15 @@
return token;
}
- /// Parse a group of labels, cases and possibly a default keyword and the
- /// statements that they select.
- ///
- /// ```
- /// switchCase:
- /// label* 'case' expression ‘:’ statements
- /// ;
- ///
- /// defaultCase:
- /// label* 'default' ‘:’ statements
- /// ;
- /// ```
- Token parseSwitchCase(Token token) {
- Token begin = token.next;
- Token defaultKeyword = null;
- Token colonAfterDefault = null;
- int expressionCount = 0;
- int labelCount = 0;
- Token peek = peekPastLabels(begin);
- while (true) {
- // Loop until we find something that can't be part of a switch case.
- String value = peek.stringValue;
- if (identical(value, 'default')) {
- while (!identical(token.next, peek)) {
- token = parseLabel(token);
- labelCount++;
- }
- defaultKeyword = token.next;
- colonAfterDefault = token = defaultKeyword.next;
- peek = expect(':', colonAfterDefault);
- break;
- } else if (identical(value, 'case')) {
- while (!identical(token.next, peek)) {
- token = parseLabel(token);
- labelCount++;
- }
- Token caseKeyword = token.next;
- listener.beginCaseExpression(caseKeyword);
- token = parseExpression(caseKeyword).next;
- listener.endCaseExpression(token);
- Token colonToken = token;
- expect(':', colonToken);
- listener.handleCaseMatch(caseKeyword, colonToken);
- expressionCount++;
- peek = peekPastLabels(token.next);
- } else {
- if (expressionCount == 0) {
- // TODO(ahe): This is probably easy to recover from.
- reportUnrecoverableError(
- token.next, fasta.templateExpectedButGot.withArguments("case"));
- }
- break;
- }
- }
+ /// Parse statements after a switch `case:` or `default:`.
+ Token parseStatementsInSwitchCase(
+ Token token,
+ Token peek,
+ Token begin,
+ int labelCount,
+ int expressionCount,
+ Token defaultKeyword,
+ Token colonAfterDefault) {
listener.beginSwitchCase(labelCount, expressionCount, begin);
// Finally zero or more statements.
int statementCount = 0;
@@ -5856,7 +5902,7 @@
break;
} else {
Token startToken = token.next;
- token = parseStatementOpt(token);
+ token = parseStatement(token);
Token next = token.next;
if (identical(next, startToken)) {
// No progress was made, so we report the current token as being
@@ -5995,9 +6041,10 @@
/// Recover from finding an invalid class member. The metadata for the member,
/// if any, has already been parsed (and events have already been generated).
- /// The member was expected to start with the token after [beforeMember].
- Token recoverFromInvalidClassMember(Token beforeMember) {
- Token next = beforeMember.next;
+ /// The member was expected to start with the token after [token].
+ Token recoverFromInvalidClassMember(Token token) {
+ Token start = token;
+ Token next = token.next;
if (optional(';', next)) {
// Report and skip extra semicolons that appear between members.
// TODO(brianwilkerson) Provide a more specific error message.
@@ -6007,52 +6054,33 @@
listener.endMember();
return next;
}
+ // Skip modifiers
+ while (isModifier(next)) {
+ token = next;
+ next = token.next;
+ }
+ if (isValidTypeReference(next) || optional('var', next)) {
+ if (isPostIdentifierForRecovery(
+ next.next, IdentifierContext.fieldDeclaration)) {
+ // Looks like a field declaration but missing a field name.
+ insertSyntheticIdentifier(next, IdentifierContext.fieldDeclaration);
+ return parseFields(start, const Link<Token>(), next, false);
+ } else if (next.next.isKeywordOrIdentifier &&
+ isPostIdentifierForRecovery(
+ next.next.next, IdentifierContext.fieldDeclaration)) {
+ // Looks like a field declaration but missing a semicolon
+ // which parseFields will insert.
+ return parseFields(start, const Link<Token>(), next, false);
+ }
+ } else if (token != start &&
+ isPostIdentifierForRecovery(next, IdentifierContext.fieldDeclaration)) {
+ // If there is at least one modifier, then
+ // looks like the start of a field but missing field name.
+ insertSyntheticIdentifier(token, IdentifierContext.fieldDeclaration);
+ return parseFields(start, const Link<Token>(), token, false);
+ }
return reportUnrecoverableErrorWithToken(
- next, fasta.templateExpectedClassMember);
- }
-
- /// Report that the token after [previousToken] was expected to be the
- /// beginning of a block but isn't, insert a synthetic pair of curly braces,
- /// and return the opening curly brace.
- Token recoverFromMissingBlock(Token previousToken) {
- // TODO(brianwilkerson): Add context information (as a parameter) so that we
- // can (a) generate a better error and (b) unify this method with
- // `recoverFromMissingClassBody` and `recoverFromMissingFunctionBody`.
- Token token = previousToken.next;
- reportRecoverableError(token, fasta.messageExpectedBlock);
- BeginToken replacement = link(
- new SyntheticBeginToken(TokenType.OPEN_CURLY_BRACKET, token.offset),
- new SyntheticToken(TokenType.CLOSE_CURLY_BRACKET, token.offset));
- rewriter.insertTokenAfter(previousToken, replacement);
- return replacement;
- }
-
- /// Report that the token after [previousToken] was expected to be the
- /// beginning of a class body but isn't, insert a synthetic pair of curly
- /// braces, and return the opening curly brace.
- Token recoverFromMissingClassBody(Token previousToken) {
- Token token = previousToken.next;
- reportRecoverableError(
- token, fasta.templateExpectedClassBody.withArguments(token));
- BeginToken replacement = link(
- new SyntheticBeginToken(TokenType.OPEN_CURLY_BRACKET, token.offset),
- new SyntheticToken(TokenType.CLOSE_CURLY_BRACKET, token.offset));
- rewriter.insertTokenAfter(previousToken, replacement);
- return replacement;
- }
-
- /// Report that the token after [previousToken] was expected to be the
- /// beginning of a block function body but isn't, insert a synthetic pair of
- /// curly braces, and return the opening curly brace.
- Token recoverFromMissingFunctionBody(Token previousToken) {
- Token token = previousToken.next;
- reportRecoverableError(
- token, fasta.templateExpectedFunctionBody.withArguments(token));
- BeginToken replacement = link(
- new SyntheticBeginToken(TokenType.OPEN_CURLY_BRACKET, token.offset),
- new SyntheticToken(TokenType.CLOSE_CURLY_BRACKET, token.offset));
- rewriter.insertTokenAfter(previousToken, replacement);
- return replacement;
+ start, fasta.templateExpectedClassMember);
}
/// Report that the nesting depth of the code being parsed is too large for
diff --git a/pkg/front_end/lib/src/fasta/source/diet_listener.dart b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
index 6b3b16b..607dc45 100644
--- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
@@ -693,7 +693,7 @@
var formals = listener.pop();
listener.checkEmpty(token.next.charOffset);
token = parser.parseInitializersOpt(token);
- token = parser.parseAsyncModifier(token);
+ token = parser.parseAsyncModifierOpt(token);
AsyncMarker asyncModifier = getAsyncMarker(listener) ?? AsyncMarker.Sync;
bool isExpression = false;
bool allowAbstract = asyncModifier == AsyncMarker.Sync;
diff --git a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
index f159350..161b0b4 100644
--- a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
@@ -50,7 +50,7 @@
int charOffset,
int charEndOffset) {
cls ??= new ShadowClass(name: name);
- cls.fileUri ??= parent.library.fileUri;
+ cls.fileUri ??= parent.fileUri;
if (cls.fileOffset == TreeNode.noOffset) {
cls.fileOffset = charOffset;
}
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.dart
index 4a42bac..51f8484 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.dart
@@ -394,8 +394,13 @@
void returnStatementExit(ReturnStatement statement) =>
genericStatementExit('returnStatement', statement);
- bool staticAssignEnter(Expression expression, int targetOffset,
- Class targetClass, Expression write, DartType typeContext) =>
+ bool staticAssignEnter(
+ Expression expression,
+ String prefixName,
+ int targetOffset,
+ Class targetClass,
+ Expression write,
+ DartType typeContext) =>
genericExpressionEnter("staticAssign", expression, typeContext);
void staticAssignExit(
@@ -407,15 +412,15 @@
DartType inferredType) =>
genericExpressionExit("staticAssign", expression, inferredType);
- bool staticGetEnter(StaticGet expression, int targetOffset, Class targetClass,
- DartType typeContext) =>
+ bool staticGetEnter(StaticGet expression, String prefixName, int targetOffset,
+ Class targetClass, DartType typeContext) =>
genericExpressionEnter("staticGet", expression, typeContext);
void staticGetExit(StaticGet expression, DartType inferredType) =>
genericExpressionExit("staticGet", expression, inferredType);
- bool staticInvocationEnter(StaticInvocation expression, int targetOffset,
- Class targetClass, DartType typeContext) =>
+ bool staticInvocationEnter(StaticInvocation expression, String prefixName,
+ int targetOffset, Class targetClass, DartType typeContext) =>
genericExpressionEnter("staticInvocation", expression, typeContext);
void staticInvocationExit(
@@ -481,7 +486,8 @@
void tryFinallyExit(TryFinally statement) =>
genericStatementExit('tryFinally', statement);
- bool typeLiteralEnter(TypeLiteral expression, DartType typeContext) =>
+ bool typeLiteralEnter(
+ TypeLiteral expression, String prefixName, DartType typeContext) =>
genericExpressionEnter("typeLiteral", expression, typeContext);
void typeLiteralExit(TypeLiteral expression, DartType inferredType) =>
diff --git a/pkg/front_end/lib/src/minimal_incremental_kernel_generator.dart b/pkg/front_end/lib/src/minimal_incremental_kernel_generator.dart
index 0029ef2..3325ca9 100644
--- a/pkg/front_end/lib/src/minimal_incremental_kernel_generator.dart
+++ b/pkg/front_end/lib/src/minimal_incremental_kernel_generator.dart
@@ -11,7 +11,6 @@
import 'package:front_end/src/fasta/compiler_context.dart';
import 'package:front_end/src/fasta/dill/dill_target.dart';
import 'package:front_end/src/fasta/kernel/kernel_target.dart';
-import 'package:front_end/src/fasta/ticker.dart';
import 'package:front_end/src/fasta/uri_translator.dart';
import 'package:kernel/kernel.dart';
import 'package:meta/meta.dart';
@@ -116,6 +115,7 @@
@override
Future<DeltaProgram> computeDelta() {
+ _options.ticker.reset();
if (_isComputeDeltaExecuting) {
throw new StateError(MSG_PENDING_COMPUTE);
}
@@ -129,8 +129,8 @@
return _runWithFrontEndContext('Compute delta', () async {
try {
- var dillTarget = new DillTarget(new Ticker(isVerbose: _options.verbose),
- uriTranslator, _options.target);
+ var dillTarget =
+ new DillTarget(_options.ticker, uriTranslator, _options.target);
// Append all libraries what we still have in the current program.
await _logger.runAsync('Load dill libraries', () async {
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 32caeb0..494ec4e 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -140,7 +140,7 @@
# Consider the second example below: the parser expects a ')' before 'y', but
# a ',' would also have worked. We don't have enough information to give a
# good suggestion.
- analyzerCode: UNEXPECTED_TOKEN
+ analyzerCode: EXPECTED_TOKEN
dart2jsCode: MISSING_TOKEN_BEFORE_THIS
script:
- "main() => true ? 1;"
@@ -1449,6 +1449,22 @@
template: "Super calls can't be used as expressions."
tip: "To delegate a constructor to a super constructor, put the super call as an initializer."
+SwitchHasCaseAfterDefault:
+ template: "The default case should be the last case in a switch statement."
+ tip: "Try moving the default case after the other case clauses."
+ analyzerCode: SWITCH_HAS_CASE_AFTER_DEFAULT_CASE
+ dart2jsCode: "*fatal*"
+ script:
+ - "class C { foo(int a) {switch (a) {default: return 0; case 1: return 1;}} }"
+
+SwitchHasMultipleDefaults:
+ template: "The 'default' case can only be declared once."
+ tip: "Try removing all but one default case."
+ analyzerCode: SWITCH_HAS_MULTIPLE_DEFAULT_CASES
+ dart2jsCode: "*fatal*"
+ script:
+ - "class C { foo(int a) {switch (a) {default: return 0; default: return 1;}} }"
+
SwitchCaseFallThrough:
template: "Switch case may fall through to the next case."
diff --git a/pkg/front_end/test/fasta/testing/analyzer_diet_listener.dart b/pkg/front_end/test/fasta/testing/analyzer_diet_listener.dart
index 4721579..5b94c6a 100644
--- a/pkg/front_end/test/fasta/testing/analyzer_diet_listener.dart
+++ b/pkg/front_end/test/fasta/testing/analyzer_diet_listener.dart
@@ -228,7 +228,7 @@
// Parse the modifier so that the parser's `asyncState` will be set
// correctly, but remove the `AsyncModifier` from the listener's stack
// because the listener doesn't expect it to be there.
- token = parser.parseAsyncModifier(token);
+ token = parser.parseAsyncModifierOpt(token);
_bodyBuilder.pop();
bool isExpression = false;
diff --git a/pkg/front_end/testcases/ast_builder.status b/pkg/front_end/testcases/ast_builder.status
index 60e5a87..98b16fc 100644
--- a/pkg/front_end/testcases/ast_builder.status
+++ b/pkg/front_end/testcases/ast_builder.status
@@ -52,9 +52,7 @@
inference/generic_functions_return_typedef: Fail
inference/generic_methods_basic_downward_inference: Crash
inference/generic_methods_downwards_inference_fold: Crash
-inference/generic_methods_infer_generic_instantiation: Crash
inference/generic_methods_infer_js_builtin: Fail
-inference/generic_methods_nested_generic_instantiation: Crash
inference/infer_correctly_on_multiple_variables_declared_together: Crash
inference/infer_from_complex_expressions_if_outer_most_value_is_precise: Crash
inference/infer_local_function_referenced_before_declaration: Crash
@@ -112,7 +110,6 @@
rasta/malformed_function: Crash
rasta/mandatory_parameter_initializer: Crash
rasta/parser_error: Crash
-rasta/previsit_deferred: Crash
rasta/static: Crash
rasta/super: Crash
rasta/super_initializer: Crash
@@ -149,5 +146,4 @@
statements: Crash
super_rasta_copy: Crash
type_variable_as_super: Crash
-type_variable_prefix: Crash
uninitialized_fields: Crash
diff --git a/pkg/front_end/testcases/regress/issue_29976.dart.direct.expect b/pkg/front_end/testcases/regress/issue_29976.dart.direct.expect
index bc30103..f9931fb 100644
--- a/pkg/front_end/testcases/regress/issue_29976.dart.direct.expect
+++ b/pkg/front_end/testcases/regress/issue_29976.dart.direct.expect
@@ -2,5 +2,5 @@
import self as self;
static method #main() → dynamic {
- throw "pkg/front_end/testcases/regress/issue_29976.dart:7:14: Error: Expected '}' before this.\n \"x\${x*\"'\"\u0233'}x\n ^";
+ throw "pkg/front_end/testcases/regress/issue_29976.dart:8:3: Error: Expected a String, but got ')'.\n )\n ^";
}
diff --git a/pkg/front_end/testcases/regress/issue_29976.dart.strong.expect b/pkg/front_end/testcases/regress/issue_29976.dart.strong.expect
index bc30103..f9931fb 100644
--- a/pkg/front_end/testcases/regress/issue_29976.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_29976.dart.strong.expect
@@ -2,5 +2,5 @@
import self as self;
static method #main() → dynamic {
- throw "pkg/front_end/testcases/regress/issue_29976.dart:7:14: Error: Expected '}' before this.\n \"x\${x*\"'\"\u0233'}x\n ^";
+ throw "pkg/front_end/testcases/regress/issue_29976.dart:8:3: Error: Expected a String, but got ')'.\n )\n ^";
}
diff --git a/pkg/front_end/tool/incremental_perf.dart b/pkg/front_end/tool/incremental_perf.dart
index b9ef4a2..9584a54 100644
--- a/pkg/front_end/tool/incremental_perf.dart
+++ b/pkg/front_end/tool/incremental_perf.dart
@@ -63,63 +63,101 @@
main(List<String> args) async {
var options = argParser.parse(args);
if (options.rest.length != 2) {
- print('usage: incremental_perf.dart [options] <entry.dart> <edits.json>');
- print(argParser.usage);
- exit(1);
+ throw """
+usage: incremental_perf.dart [options] <entry.dart> <edits.json>
+${argParser.usage}""";
}
var entryUri = _resolveOverlayUri(options.rest[0]);
var editsUri = Uri.base.resolve(options.rest[1]);
var changeSets =
parse(JSON.decode(new File.fromUri(editsUri).readAsStringSync()));
+ bool verbose = options["verbose"];
+ bool verboseCompilation = options["verbose-compilation"];
+ bool strongMode = options["mode"] == "strong";
+ bool isFlutter = options["target"] == "flutter";
+ bool useMinimalGenerator = options["implementation"] == "minimal";
+ TimingsCollector collector = new TimingsCollector(verbose);
+ for (int i = 0; i < 8; i++) {
+ await benchmark(
+ collector,
+ entryUri,
+ strongMode,
+ isFlutter,
+ useMinimalGenerator,
+ verbose,
+ verboseCompilation,
+ changeSets,
+ options["sdk-summary"],
+ options["sdk-library-specification"],
+ options["cache"]);
+ if (!options["loop"]) break;
+ }
+ collector.printTimings();
+}
+
+Future benchmark(
+ TimingsCollector collector,
+ Uri entryUri,
+ bool strongMode,
+ bool isFlutter,
+ bool useMinimalGenerator,
+ bool verbose,
+ bool verboseCompilation,
+ List<ChangeSet> changeSets,
+ String sdkSummary,
+ String sdkLibrarySpecification,
+ String cache) async {
var overlayFs = new OverlayFileSystem();
- bool strongMode = options['mode'] == 'strong';
var compilerOptions = new CompilerOptions()
+ ..verbose = verboseCompilation
..fileSystem = overlayFs
..strongMode = strongMode
..onError = onErrorHandler(strongMode)
- ..target = createTarget(
- isFlutter: options['target'] == 'flutter', strongMode: strongMode);
- if (options['sdk-summary'] != null) {
- compilerOptions.sdkSummary = _resolveOverlayUri(options["sdk-summary"]);
+ ..target = createTarget(isFlutter: isFlutter, strongMode: strongMode);
+ if (sdkSummary != null) {
+ compilerOptions.sdkSummary = _resolveOverlayUri(sdkSummary);
}
- if (options['sdk-library-specification'] != null) {
+ if (sdkLibrarySpecification != null) {
compilerOptions.librariesSpecificationUri =
- _resolveOverlayUri(options["sdk-library-specification"]);
+ _resolveOverlayUri(sdkLibrarySpecification);
}
- var dir = Directory.systemTemp.createTempSync('ikg-cache');
- compilerOptions.byteStore = createByteStore(options['cache'], dir.path);
+ var dir = Directory.systemTemp.createTempSync("ikg-cache");
+ compilerOptions.byteStore = createByteStore(cache, dir.path);
final processedOptions =
new ProcessedOptions(compilerOptions, false, [entryUri]);
final UriTranslator uriTranslator = await processedOptions.getUriTranslator();
- var timer1 = new Stopwatch()..start();
+ collector.start("Initial compilation");
var generator = await IncrementalKernelGenerator.newInstance(
compilerOptions, entryUri,
- useMinimalGenerator: options['implementation'] == 'minimal');
+ useMinimalGenerator: useMinimalGenerator);
var delta = await generator.computeDelta();
generator.acceptLastDelta();
- timer1.stop();
- print("Libraries changed: ${delta.newProgram.libraries.length}");
- print("Initial compilation took: ${timer1.elapsedMilliseconds}ms");
+ collector.stop("Initial compilation");
+ if (verbose) {
+ print("Libraries changed: ${delta.newProgram.libraries.length}");
+ }
if (delta.newProgram.libraries.length < 1) {
throw "No libraries were changed";
}
for (final ChangeSet changeSet in changeSets) {
- await applyEdits(changeSet.edits, overlayFs, generator, uriTranslator);
- var iterTimer = new Stopwatch()..start();
+ String name = "Change '${changeSet.name}' - Incremental compilation";
+ await applyEdits(
+ changeSet.edits, overlayFs, generator, uriTranslator, verbose);
+ collector.start(name);
delta = await generator.computeDelta();
generator.acceptLastDelta();
- iterTimer.stop();
- print("Change '${changeSet.name}' - "
- "Libraries changed: ${delta.newProgram.libraries.length}");
- print("Change '${changeSet.name}' - "
- "Incremental compilation took: ${iterTimer.elapsedMilliseconds}ms");
+ collector.stop(name);
+ if (verbose) {
+ print("Change '${changeSet.name}' - "
+ "Libraries changed: ${delta.newProgram.libraries.length}");
+ }
if (delta.newProgram.libraries.length < 1) {
throw "No libraries were changed";
}
@@ -130,10 +168,16 @@
/// Apply all edits of a single iteration by updating the copy of the file in
/// the memory file system.
-applyEdits(List<Edit> edits, OverlayFileSystem fs,
- IncrementalKernelGenerator generator, UriTranslator uriTranslator) async {
+applyEdits(
+ List<Edit> edits,
+ OverlayFileSystem fs,
+ IncrementalKernelGenerator generator,
+ UriTranslator uriTranslator,
+ bool verbose) async {
for (var edit in edits) {
- print('edit $edit');
+ if (verbose) {
+ print('edit $edit');
+ }
var uri = edit.uri;
if (uri.scheme == 'package') uri = uriTranslator.translate(uri);
generator.invalidate(uri);
@@ -268,6 +312,10 @@
}
ArgParser argParser = new ArgParser()
+ ..addFlag('verbose-compilation',
+ help: 'make the compiler verbose', defaultsTo: false)
+ ..addFlag('verbose', help: 'print additional information', defaultsTo: false)
+ ..addFlag('loop', help: 'run benchmark 8 times', defaultsTo: true)
..addOption('target',
help: 'target platform', defaultsTo: 'vm', allowed: ['vm', 'flutter'])
..addOption('cache',
diff --git a/pkg/front_end/tool/incremental_perf_test.dart b/pkg/front_end/tool/incremental_perf_test.dart
index 177af2f..5da9ee5 100644
--- a/pkg/front_end/tool/incremental_perf_test.dart
+++ b/pkg/front_end/tool/incremental_perf_test.dart
@@ -17,8 +17,15 @@
final ikgBenchmarks = Platform.script.resolve('../benchmarks/ikg/');
final helloEntry = ikgBenchmarks.resolve('hello.dart');
final helloEdits = ikgBenchmarks.resolve('hello.edits.json');
- await m.main(['--sdk-summary', '$sdkOutline', '$helloEntry', '$helloEdits']);
await m.main([
+ '--no-loop',
+ '--sdk-summary',
+ '$sdkOutline',
+ '$helloEntry',
+ '$helloEdits'
+ ]);
+ await m.main([
+ '--no-loop',
'--sdk-summary',
'$sdkOutline',
'--mode=legacy',
@@ -26,6 +33,7 @@
'$helloEdits'
]);
await m.main([
+ '--no-loop',
'--sdk-summary',
'$sdkOutline',
'--implementation=minimal',
@@ -35,9 +43,15 @@
final dart2jsEntry = ikgBenchmarks.resolve('dart2js.dart');
final dart2jsEdits = ikgBenchmarks.resolve('dart2js.edits.json');
- await m
- .main(['--sdk-summary', '$sdkOutline', '$dart2jsEntry', '$dart2jsEdits']);
await m.main([
+ '--no-loop',
+ '--sdk-summary',
+ '$sdkOutline',
+ '$dart2jsEntry',
+ '$dart2jsEdits'
+ ]);
+ await m.main([
+ '--no-loop',
'--sdk-summary',
'$sdkOutline',
'--mode=legacy',
@@ -46,6 +60,7 @@
'$dart2jsEdits'
]);
await m.main([
+ '--no-loop',
'--sdk-summary',
'$sdkOutline',
'--mode=legacy',
diff --git a/pkg/front_end/tool/perf_common.dart b/pkg/front_end/tool/perf_common.dart
index fa3fb5f..e55fcf7 100644
--- a/pkg/front_end/tool/perf_common.dart
+++ b/pkg/front_end/tool/perf_common.dart
@@ -85,3 +85,53 @@
@override
bool get disableTypeInference => true;
}
+
+class TimingsCollector {
+ final Stopwatch stopwatch = new Stopwatch();
+
+ final Map<String, List<double>> timings = <String, List<double>>{};
+
+ final bool verbose;
+
+ TimingsCollector(this.verbose);
+
+ String currentKey;
+
+ void start(String key) {
+ if (currentKey != null) {
+ throw "Attempt to time '$key' while '$currentKey' is running.";
+ }
+ currentKey = key;
+ stopwatch
+ ..reset()
+ ..start();
+ }
+
+ void stop(String key) {
+ stopwatch.stop();
+ if (currentKey == null) {
+ throw "Need to call 'start' before calling 'stop'.";
+ }
+ if (currentKey != key) {
+ throw "Can't stop timing '$key' because '$currentKey' is running.";
+ }
+ currentKey = null;
+ double duration =
+ stopwatch.elapsedMicroseconds / Duration.microsecondsPerMillisecond;
+ List<double> durations = (timings[key] ??= <double>[]);
+ durations.add(duration);
+ if (verbose) {
+ print("$key took: ${duration}ms");
+ }
+ }
+
+ void printTimings() {
+ timings.forEach((String key, List<double> durations) {
+ double total = 0.0;
+ for (double duration in durations.skip(3)) {
+ total += duration;
+ }
+ print("$key took: ${total/(durations.length - 3)}ms");
+ });
+ }
+}
diff --git a/pkg/js_ast/lib/src/template.dart b/pkg/js_ast/lib/src/template.dart
index 2c04ce9..e85f33a 100644
--- a/pkg/js_ast/lib/src/template.dart
+++ b/pkg/js_ast/lib/src/template.dart
@@ -287,7 +287,6 @@
Statement toStatement(item) {
if (item is Statement) return item;
if (item is Expression) return item.toStatement();
- ;
return error('Interpolated value #$nameOrPosition is not '
'a Statement or List of Statements: $value');
}
@@ -368,7 +367,6 @@
if (value is bool) return value;
if (value is Expression) return value;
if (value is String) return convertStringToVariableUse(value);
- ;
error('Interpolated value #$nameOrPosition '
'is not an Expression: $value');
};
diff --git a/pkg/js_ast/pubspec.yaml b/pkg/js_ast/pubspec.yaml
index ce29268..accf876 100644
--- a/pkg/js_ast/pubspec.yaml
+++ b/pkg/js_ast/pubspec.yaml
@@ -1,5 +1,4 @@
name: js_ast
-version: 0.0.0
author: Dart Team <misc@dartlang.org>
description: Library creating and printing JavaScript ASTs.
homepage: http://www.dartlang.org
diff --git a/pkg/kernel/binary.md b/pkg/kernel/binary.md
index 5d9b1e3..b014ea7 100644
--- a/pkg/kernel/binary.md
+++ b/pkg/kernel/binary.md
@@ -349,7 +349,7 @@
FileOffset fileEndOffset;
Byte kind; // Index into the ProcedureKind enum above.
Byte flags (isStatic, isAbstract, isExternal, isConst, isForwardingStub,
- isGenericContravariant);
+ isGenericContravariant, isForwardingSemiStub);
Name name;
// An absolute path URI to the .dart file from which the class was created.
UriReference fileUri;
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index e443158..4e5135b 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -1496,6 +1496,7 @@
bool isExternal: false,
bool isConst: false,
bool isForwardingStub: false,
+ bool isForwardingSemiStub: false,
int transformerFlags: 0,
this.fileUri,
Reference reference})
@@ -1515,6 +1516,7 @@
static const int FlagConst = 1 << 3; // Only for external const factories.
static const int FlagForwardingStub = 1 << 4;
static const int FlagGenericContravariant = 1 << 5;
+ static const int FlagForwardingSemiStub = 1 << 6;
bool get isStatic => flags & FlagStatic != 0;
bool get isAbstract => flags & FlagAbstract != 0;
@@ -1534,6 +1536,10 @@
/// front end computational overhead.
bool get isGenericContravariant => flags & FlagGenericContravariant != 0;
+ /// If set, this flag indicates that although this function is a forwarding
+ /// stub, it was present in the original source as an abstract method.
+ bool get isForwardingSemiStub => flags & FlagForwardingSemiStub != 0;
+
void set isStatic(bool value) {
flags = value ? (flags | FlagStatic) : (flags & ~FlagStatic);
}
@@ -1561,6 +1567,12 @@
: (flags & ~FlagGenericContravariant);
}
+ void set isForwardingSemiStub(bool value) {
+ flags = value
+ ? (flags | FlagForwardingSemiStub)
+ : (flags & ~FlagForwardingSemiStub);
+ }
+
bool get isInstanceMember => !isStatic;
bool get isGetter => kind == ProcedureKind.Getter;
bool get isSetter => kind == ProcedureKind.Setter;
diff --git a/pkg/kernel/lib/clone.dart b/pkg/kernel/lib/clone.dart
index db4fd45..d54f44a 100644
--- a/pkg/kernel/lib/clone.dart
+++ b/pkg/kernel/lib/clone.dart
@@ -401,9 +401,11 @@
isExternal: node.isExternal,
isConst: node.isConst,
isForwardingStub: node.isForwardingStub,
+ isForwardingSemiStub: node.isForwardingSemiStub,
transformerFlags: node.transformerFlags,
fileUri: node.fileUri)
- ..fileEndOffset = node.fileEndOffset;
+ ..fileEndOffset = node.fileEndOffset
+ ..isGenericContravariant = node.isGenericContravariant;
}
visitField(Field node) {
diff --git a/pkg/kernel/lib/text/ast_to_text.dart b/pkg/kernel/lib/text/ast_to_text.dart
index 24e7ea2..449301e 100644
--- a/pkg/kernel/lib/text/ast_to_text.dart
+++ b/pkg/kernel/lib/text/ast_to_text.dart
@@ -904,6 +904,7 @@
writeModifier(node.isStatic, 'static');
writeModifier(node.isAbstract, 'abstract');
writeModifier(node.isForwardingStub, 'forwarding-stub');
+ writeModifier(node.isForwardingSemiStub, 'forwarding-semi-stub');
writeModifier(node.isGenericContravariant, 'generic-contravariant');
writeWord(procedureKindToString(node.kind));
if ((node.enclosingClass == null &&
diff --git a/pkg/meta/CHANGELOG.md b/pkg/meta/CHANGELOG.md
index 1c4c256..12ec383 100644
--- a/pkg/meta/CHANGELOG.md
+++ b/pkg/meta/CHANGELOG.md
@@ -32,6 +32,14 @@
}
```
+## 1.0.5
+* Introduce `@experimental` to annotate a library, or any declaration that is
+ part of the public interface of a library (such as top-level members, class
+ members, and function parameters) to indicate that the annotated API is
+ experimental and may be removed or changed at any-time without updating the
+ version of the containing package, despite the fact that it would otherwise
+ be a breaking change.
+
## 1.0.4
* Introduce `@virtual` to allow field overrides in strong mode
(SDK issue [27384](https://github.com/dart-lang/sdk/issues/27384)).
diff --git a/pkg/meta/README.md b/pkg/meta/README.md
new file mode 100644
index 0000000..c6c710d
--- /dev/null
+++ b/pkg/meta/README.md
@@ -0,0 +1,34 @@
+# Annotations for Static Analysis
+
+This package defines annotations that can be used by the tools that are shipped
+with the Dart SDK.
+
+## Library Structure
+
+The annotations in this package are defined in two libraries.
+
+The library in `meta.dart` defines annotations that can be used by static
+analysis tools to provide a more complete analysis of the code that uses them.
+Within the SDK, these tools include the command-line analyzer (`dartanalyzer`)
+and the analysis server that is used to power many of the Dart-enabled
+development tools.
+
+The library in `dart2js.dart` defines annotations that provide hints to dart2js
+to improve the quality of the JavaScript code that it produces. These
+annotations are currently experimental and might be removed in a future version
+of this package.
+
+## Support
+
+Post issues and feature requests on the GitHub [issue tracker][issues].
+
+Questions and discussions are welcome at the
+[Dart Analyzer Discussion Group][list].
+
+## License
+
+See the [LICENSE][license] file.
+
+[issues]: https://github.com/dart-lang/sdk/issues
+[license]: https://github.com/dart-lang/sdk/blob/master/pkg/analyzer/LICENSE
+[list]: https://groups.google.com/a/dartlang.org/forum/#!forum/analyzer-discuss
diff --git a/pkg/meta/lib/dart2js.dart b/pkg/meta/lib/dart2js.dart
index 71e6d33..4dc1ba7 100644
--- a/pkg/meta/lib/dart2js.dart
+++ b/pkg/meta/lib/dart2js.dart
@@ -5,7 +5,7 @@
/// Constants for use in metadata annotations to provide hints to dart2js.
///
/// This is an experimental feature and not expected to be useful except for low
-/// level framwork authors.
+/// level framework authors.
///
/// Added at sdk version 2.0.0-dev.6.0
library meta_dart2js;
diff --git a/pkg/pkg.status b/pkg/pkg.status
index 57f6916..461add4 100644
--- a/pkg/pkg.status
+++ b/pkg/pkg.status
@@ -50,8 +50,9 @@
front_end/test/fasta/strong_test: Pass, Slow
front_end/test/fasta/outline_test: Pass, Slow
front_end/test/fasta/ast_builder_test: Pass, Slow
-front_end/tool/incremental_perf_test: Slow, Pass
+front_end/test/minimal_incremental_kernel_generator_test: Slow, Pass
front_end/test/whole_program_test: Slow, Pass
+front_end/tool/incremental_perf_test: Slow, Pass
# These are not tests but input for tests.
kernel/testcases/*: Skip
diff --git a/pkg/vm/bin/gen_kernel.dart b/pkg/vm/bin/gen_kernel.dart
index 93d1114..6f1ff40 100644
--- a/pkg/vm/bin/gen_kernel.dart
+++ b/pkg/vm/bin/gen_kernel.dart
@@ -37,13 +37,6 @@
const int _badUsageExitCode = 1;
const int _compileTimeErrorExitCode = 254;
-const _severityCaptions = const <Severity, String>{
- Severity.error: 'Error: ',
- Severity.internalProblem: 'Internal problem: ',
- Severity.nit: 'Nit: ',
- Severity.warning: 'Warning: ',
-};
-
main(List<String> arguments) async {
if (arguments.isNotEmpty && arguments.last == '--batch') {
await runBatchModeCompiler();
@@ -76,11 +69,6 @@
..packagesFileUri = packages != null ? Uri.base.resolve(packages) : null
..reportMessages = true
..onError = (CompilationMessage message) {
- final severity = _severityCaptions[message.severity] ?? '';
- final text = message.span?.message(message.message) ?? message.message;
- final tip = message.tip != null ? "\n${message.tip}" : '';
- print("$severity$text$tip");
-
if ((message.severity != Severity.nit) &&
(message.severity != Severity.warning)) {
++errors;
diff --git a/pkg/vm/bin/kernel_service.dart b/pkg/vm/bin/kernel_service.dart
index 0776a9f..5ec3890 100644
--- a/pkg/vm/bin/kernel_service.dart
+++ b/pkg/vm/bin/kernel_service.dart
@@ -67,12 +67,21 @@
..packagesFileUri = packagesUri
..sdkSummary = platformKernel
..verbose = verbose
- ..reportMessages = true
- ..onError = (CompilationMessage e) {
- if (e.severity == Severity.error) {
- // TODO(sigmund): support emitting code with errors as long as they
- // are handled in the generated code (issue #30194).
- errors.add(e.message);
+ ..onProblem =
+ (message, Severity severity, String formatted, int line, int column) {
+ switch (severity) {
+ case Severity.error:
+ case Severity.internalProblem:
+ // TODO(sigmund): support emitting code with errors as long as they
+ // are handled in the generated code (issue #30194).
+ errors.add(formatted);
+ stderr.writeln(formatted);
+ break;
+ case Severity.nit:
+ break;
+ case Severity.warning:
+ stderr.writeln(formatted);
+ break;
}
};
}
diff --git a/runtime/bin/platform.cc b/runtime/bin/platform.cc
index 20c7ff0..eff6dfb 100644
--- a/runtime/bin/platform.cc
+++ b/runtime/bin/platform.cc
@@ -63,7 +63,7 @@
void FUNCTION_NAME(Platform_ExecutableArguments)(Dart_NativeArguments args) {
int end = Platform::GetScriptIndex();
char** argv = Platform::GetArgv();
- Dart_Handle result = Dart_NewList(end - 1);
+ Dart_Handle result = Dart_NewListOf(Dart_CoreType_String, end - 1);
for (intptr_t i = 1; i < end; i++) {
Dart_Handle str = DartUtils::NewString(argv[i]);
Dart_Handle error = Dart_ListSetAt(result, i - 1, str);
diff --git a/runtime/bin/process_patch.dart b/runtime/bin/process_patch.dart
index 5ebe8b5..515b66d 100644
--- a/runtime/bin/process_patch.dart
+++ b/runtime/bin/process_patch.dart
@@ -389,7 +389,7 @@
}
Future<Process> _start() {
- var completer = new Completer();
+ var completer = new Completer<Process>();
if (_mode == ProcessStartMode.NORMAL) {
_exitCode = new Completer<int>();
}
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
index 2dfdefa..2db739a 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -1165,7 +1165,7 @@
InternetAddress get address => _socket.address;
Future<RawServerSocket> close() {
- return _socket.close().then((_) {
+ return _socket.close().then<RawServerSocket>((_) {
if (_referencePort != null) {
_referencePort.close();
_referencePort = null;
@@ -1293,7 +1293,7 @@
int write(List<int> buffer, [int offset, int count]) =>
_socket.write(buffer, offset, count);
- Future<RawSocket> close() => _socket.close().then((_) => this);
+ Future<RawSocket> close() => _socket.close().then<RawSocket>((_) => this);
void shutdown(SocketDirection direction) => _socket.shutdown(direction);
@@ -1387,7 +1387,8 @@
InternetAddress get address => _socket.address;
- Future<ServerSocket> close() => _socket.close().then((_) => this);
+ Future<ServerSocket> close() =>
+ _socket.close().then<ServerSocket>((_) => this);
void set _owner(owner) {
_socket._owner = owner;
@@ -1765,7 +1766,7 @@
onError: onError, onDone: onDone, cancelOnError: cancelOnError);
}
- Future close() => _socket.close().then((_) => this);
+ Future close() => _socket.close().then<RawDatagramSocket>((_) => this);
int send(List<int> buffer, InternetAddress address, int port) =>
_socket.send(buffer, 0, buffer.length, address, port);
diff --git a/runtime/bin/vmservice/server.dart b/runtime/bin/vmservice/server.dart
index 57cb5f7..366ee58 100644
--- a/runtime/bin/vmservice/server.dart
+++ b/runtime/bin/vmservice/server.dart
@@ -66,19 +66,20 @@
}
}
- void post(dynamic result) {
+ void post(Response result) {
if (result == null) {
// Do nothing.
return;
}
try {
- if (result is String || result is Uint8List) {
- socket.add(result); // String or binary message.
- } else {
- // String message as external Uint8List.
- assert(result is List);
- Uint8List cstring = result[0];
- socket.addUtf8Text(cstring);
+ switch (result.kind) {
+ case ResponsePayloadKind.String:
+ case ResponsePayloadKind.Binary:
+ socket.add(result.payload);
+ break;
+ case ResponsePayloadKind.Utf8String:
+ socket.addUtf8Text(result.payload);
+ break;
}
} catch (e, st) {
serverPrint("Ignoring error posting over WebSocket.");
@@ -108,7 +109,7 @@
close();
}
- void post(dynamic result) {
+ void post(Response result) {
if (result == null) {
close();
return;
@@ -117,12 +118,15 @@
// We closed the connection for bad origins earlier.
response.headers.add('Access-Control-Allow-Origin', '*');
response.headers.contentType = jsonContentType;
- if (result is String) {
- response.write(result);
- } else {
- assert(result is List);
- Uint8List cstring = result[0]; // Already in UTF-8.
- response.add(cstring);
+ switch (result.kind) {
+ case ResponsePayloadKind.String:
+ response.write(result.payload);
+ break;
+ case ResponsePayloadKind.Utf8String:
+ response.add(result.payload);
+ break;
+ case ResponsePayloadKind.Binary:
+ throw 'Can not handle binary responses';
}
response.close();
close();
diff --git a/runtime/bin/vmservice/vmservice_io.dart b/runtime/bin/vmservice/vmservice_io.dart
index 7cec446..14f6cb6 100644
--- a/runtime/bin/vmservice/vmservice_io.dart
+++ b/runtime/bin/vmservice/vmservice_io.dart
@@ -146,17 +146,17 @@
return await file.readAsBytes();
}
-Future<List<Map<String, String>>> listFilesCallback(Uri dirPath) async {
+Future<List<Map<String, dynamic>>> listFilesCallback(Uri dirPath) async {
var dir = new Directory.fromUri(dirPath);
var dirPathStr = dirPath.path;
var stream = dir.list(recursive: true);
- var result = <Map<String, String>>[];
+ var result = <Map<String, dynamic>>[];
await for (var fileEntity in stream) {
var filePath = new Uri.file(fileEntity.path).path;
var stat = await fileEntity.stat();
if (stat.type == FileSystemEntityType.FILE &&
filePath.startsWith(dirPathStr)) {
- var map = {};
+ var map = <String, dynamic>{};
map['name'] = '/' + filePath.substring(dirPathStr.length);
map['size'] = stat.size;
map['modified'] = stat.modified.millisecondsSinceEpoch;
diff --git a/runtime/include/dart_api.h b/runtime/include/dart_api.h
index f14e08b..c5e0999 100644
--- a/runtime/include/dart_api.h
+++ b/runtime/include/dart_api.h
@@ -486,11 +486,12 @@
* calling Dart_DeleteWeakPersistentHandle.
*
* If the object becomes unreachable the callback is invoked with the weak
- * persistent handle and the peer as arguments. This gives the native code the
- * ability to cleanup data associated with the object and clear out any cached
- * references to the handle. All references to this handle after the callback
- * will be invalid. It is illegal to call into the VM from the callback.
- * If the handle is deleted before the object becomes unreachable,
+ * persistent handle and the peer as arguments. The callback is invoked on the
+ * thread that has entered the isolate at the time of garbage collection. This
+ * gives the embedder the ability to cleanup data associated with the object and
+ * clear out any cached references to the handle. All references to this handle
+ * after the callback will be invalid. It is illegal to call into the VM from
+ * the callback. If the handle is deleted before the object becomes unreachable,
* the callback is never invoked.
*
* Requires there to be a current isolate.
@@ -571,34 +572,32 @@
/**
* An isolate creation and initialization callback function.
*
- * This callback, provided by the embedder, is called when the vm
+ * This callback, provided by the embedder, is called when the VM
* needs to create an isolate. The callback should create an isolate
* by calling Dart_CreateIsolate and load any scripts required for
* execution.
*
- * When the function returns false, it is the responsibility of this
+ * This callback may be called on a different thread than the one
+ * running the parent isolate.
+ *
+ * When the function returns NULL, it is the responsibility of this
* function to ensure that Dart_ShutdownIsolate has been called if
* required (for example, if the isolate was created successfully by
* Dart_CreateIsolate() but the root library fails to load
* successfully, then the function should call Dart_ShutdownIsolate
* before returning).
*
- * When the function returns false, the function should set *error to
+ * When the function returns NULL, the function should set *error to
* a malloc-allocated buffer containing a useful error message. The
- * caller of this function (the vm) will make sure that the buffer is
+ * caller of this function (the VM) will make sure that the buffer is
* freed.
*
- * \param script_uri The uri of the script to load.
- * This uri is non NULL if the isolate is being created using the
- * spawnUri isolate API. This uri has been canonicalized by the
- * library tag handler from the parent isolate.
- * The callback is responsible for loading this script by a call to
+ * \param script_uri The uri of the main source file or snapshot to load.
+ * Either the URI of the parent isolate set in Dart_CreateIsolate for
+ * Isolate.spawn, or the argument to Isolate.spawnUri canonicalized by the
+ * library tag handler of the parent isolate.
+ * The callback is responsible for loading the program by a call to
* Dart_LoadScript or Dart_LoadScriptFromSnapshot.
- * This uri will be NULL if the isolate is being created using the
- * spawnFunction isolate API.
- * The callback is responsible for loading the script used in the
- * parent isolate by a call to Dart_LoadScript or
- * Dart_LoadScriptFromSnapshot.
* \param main The name of the main entry point this isolate will
* eventually run. This is provided for advisory purposes only to
* improve debugging messages. The main function is not invoked by
@@ -825,10 +824,13 @@
*
* Requires there to be no current isolate.
*
- * \param script_uri The name of the script this isolate will load.
- * Provided only for advisory purposes to improve debugging messages.
- * \param main The name of the main entry point this isolate will run.
- * Provided only for advisory purposes to improve debugging messages.
+ * \param script_uri The main source file or snapshot this isolate will load.
+ * The VM will provide this URI to the Dart_IsolateCreateCallback when a child
+ * isolate is created by Isolate.spawn. The embedder should use a URI that
+ * allows it to load the same program into such a child isolate.
+ * \param main The name of the main entry point this isolate will run. Provided
+ * only for advisory purposes to improve debugging messages. Typically either
+ * 'main' or the name of the function passed to Isolate.spawn.
* \param isolate_snapshot_data
* \param isolate_snapshot_instructions Buffers containing a snapshot of the
* isolate or NULL if no snapshot is provided.
@@ -862,10 +864,13 @@
* After this call, the `kernel_program` needs to be supplied to a call to
* `Dart_LoadKernel()` which will then take ownership of the memory.
*
- * \param script_uri The name of the script this isolate will load.
- * Provided only for advisory purposes to improve debugging messages.
- * \param main The name of the main entry point this isolate will run.
- * Provided only for advisory purposes to improve debugging messages.
+ * \param script_uri The main source file or snapshot this isolate will load.
+ * The VM will provide this URI to the Dart_IsolateCreateCallback when a child
+ * isolate is created by Isolate.spawn. The embedder should use a URI that
+ * allows it to load the same program into such a child isolate.
+ * \param main The name of the main entry point this isolate will run. Provided
+ * only for advisory purposes to improve debugging messages. Typically either
+ * 'main' or the name of the function passed to Isolate.spawn.
* \param kernel_program The `dart::kernel::Program` object.
* \param flags Pointer to VM specific flags or NULL for default flags.
* \param callback_data Embedder data. This data will be passed to
diff --git a/runtime/observatory/lib/object_graph.dart b/runtime/observatory/lib/object_graph.dart
index 036d8f5..39dc5b5 100644
--- a/runtime/observatory/lib/object_graph.dart
+++ b/runtime/observatory/lib/object_graph.dart
@@ -730,7 +730,7 @@
assert(parent[v] != SENTINEL);
}
return true;
- });
+ }());
if (dfsNumber != N) {
// Remove successors of unconnected nodes
diff --git a/runtime/observatory/lib/service_common.dart b/runtime/observatory/lib/service_common.dart
index 3a47f20..892ebee 100644
--- a/runtime/observatory/lib/service_common.dart
+++ b/runtime/observatory/lib/service_common.dart
@@ -137,10 +137,10 @@
try {
_webSocket.connect(
target.networkAddress, _onOpen, _onMessage, _onError, _onClose);
- } catch (_) {
+ } catch (_, stack) {
_webSocket = null;
var exception = new NetworkRpcException('WebSocket closed');
- return new Future.error(exception);
+ return new Future.error(exception, stack);
}
}
if (_disconnected.isCompleted) {
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index 539ac4b..5379315 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -620,10 +620,10 @@
return new Future.value(null);
}
- Future<Stream> addStream() async {
+ Future<Stream<ServiceEvent>> addStream() async {
var controller;
- controller =
- new StreamController(onCancel: () => _cancelController(controller));
+ controller = new StreamController<ServiceEvent>(
+ onCancel: () => _cancelController(controller));
_controllers.add(controller);
if (_cancelFuture != null) {
try {
@@ -934,12 +934,12 @@
static const kServiceStream = '_Service';
/// Returns a single-subscription Stream object for a VM event stream.
- Future<Stream> getEventStream(String streamId) async {
+ Future<Stream<ServiceEvent>> getEventStream(String streamId) async {
var eventStream = _eventStreams.putIfAbsent(
streamId,
() => new _EventStreamState(
this, streamId, () => _eventStreams.remove(streamId)));
- Stream stream = await eventStream.addStream();
+ Stream<ServiceEvent> stream = await eventStream.addStream();
return stream;
}
diff --git a/runtime/observatory/lib/utils.dart b/runtime/observatory/lib/utils.dart
index 0639e49..f65c1a1 100644
--- a/runtime/observatory/lib/utils.dart
+++ b/runtime/observatory/lib/utils.dart
@@ -249,7 +249,7 @@
static bool runningInJavaScript() => identical(1.0, 1);
static formatStringAsLiteral(String value, [bool wasTruncated = false]) {
- var result = new List();
+ var result = new List<int>();
result.add("'".codeUnitAt(0));
for (int codeUnit in value.codeUnits) {
if (codeUnit == '\n'.codeUnitAt(0))
diff --git a/runtime/observatory/tests/service/add_breakpoint_rpc_kernel_test.dart b/runtime/observatory/tests/service/add_breakpoint_rpc_kernel_test.dart
index 39f3dcb..5c645b5 100644
--- a/runtime/observatory/tests/service/add_breakpoint_rpc_kernel_test.dart
+++ b/runtime/observatory/tests/service/add_breakpoint_rpc_kernel_test.dart
@@ -26,7 +26,7 @@
incValue(incValue(1)); // line B.
}
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
// Test future breakpoints.
diff --git a/runtime/observatory/tests/service/add_breakpoint_rpc_test.dart b/runtime/observatory/tests/service/add_breakpoint_rpc_test.dart
index 4df6b37..4d917e1 100644
--- a/runtime/observatory/tests/service/add_breakpoint_rpc_test.dart
+++ b/runtime/observatory/tests/service/add_breakpoint_rpc_test.dart
@@ -29,7 +29,7 @@
deferredLib.deferredTest();
}
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
// Test future breakpoints.
@@ -62,7 +62,7 @@
}
if (event.kind == ServiceEvent.kPauseBreakpoint) {
subscription.cancel();
- completer.complete(null);
+ completer.complete();
}
});
await isolate.resume();
@@ -85,7 +85,7 @@
subscription = stream.listen((ServiceEvent event) async {
if (event.kind == ServiceEvent.kPauseBreakpoint) {
subscription.cancel();
- completer.complete(null);
+ completer.complete();
}
});
await isolate.resume();
@@ -132,7 +132,7 @@
}
if (event.kind == ServiceEvent.kPauseBreakpoint) {
subscription.cancel();
- completer.complete(null);
+ completer.complete();
}
});
await isolate.resume();
@@ -156,7 +156,7 @@
subscription = stream.listen((ServiceEvent event) async {
if (event.kind == ServiceEvent.kPauseBreakpoint) {
subscription.cancel();
- completer.complete(null);
+ completer.complete();
}
});
await isolate.resume();
diff --git a/runtime/observatory/tests/service/allocations_test.dart b/runtime/observatory/tests/service/allocations_test.dart
index 31358e4..e36bc97 100644
--- a/runtime/observatory/tests/service/allocations_test.dart
+++ b/runtime/observatory/tests/service/allocations_test.dart
@@ -17,7 +17,7 @@
foos = [new Foo(), new Foo(), new Foo()];
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) => isolate.rootLibrary.load().then((Library lib) {
expect(lib.uri.endsWith('allocations_test.dart'), isTrue);
expect(lib.classes.length, equals(1));
diff --git a/runtime/observatory/tests/service/async_generator_breakpoint_test.dart b/runtime/observatory/tests/service/async_generator_breakpoint_test.dart
index 5581e47..00c1268 100644
--- a/runtime/observatory/tests/service/async_generator_breakpoint_test.dart
+++ b/runtime/observatory/tests/service/async_generator_breakpoint_test.dart
@@ -87,6 +87,6 @@
expect(hits, equals([bp1, bp5, bp4, bp2, bp3]));
}
-var tests = [testAsync];
+var tests = <IsolateTest>[testAsync];
main(args) => runIsolateTests(args, tests, testeeConcurrent: testeeDo);
diff --git a/runtime/observatory/tests/service/async_next_test.dart b/runtime/observatory/tests/service/async_next_test.dart
index 5afefd1..e5c7c41 100644
--- a/runtime/observatory/tests/service/async_next_test.dart
+++ b/runtime/observatory/tests/service/async_next_test.dart
@@ -28,7 +28,7 @@
doAsync(true);
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_A),
stepOver, // foo()
diff --git a/runtime/observatory/tests/service/async_scope_test.dart b/runtime/observatory/tests/service/async_scope_test.dart
index d7525dd..0a2f816 100644
--- a/runtime/observatory/tests/service/async_scope_test.dart
+++ b/runtime/observatory/tests/service/async_scope_test.dart
@@ -52,7 +52,7 @@
expect(vars, equals('param2 local2')); // no :async_op et al
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint, // debugger()
setBreakpointAtLine(LINE_A),
setBreakpointAtLine(LINE_B),
diff --git a/runtime/observatory/tests/service/async_single_step_exception_test.dart b/runtime/observatory/tests/service/async_single_step_exception_test.dart
index e73af28..6794fb9 100644
--- a/runtime/observatory/tests/service/async_single_step_exception_test.dart
+++ b/runtime/observatory/tests/service/async_single_step_exception_test.dart
@@ -36,7 +36,7 @@
print('z'); // LINE_G.
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_C),
stepOver, // print.
diff --git a/runtime/observatory/tests/service/async_single_step_into_test.dart b/runtime/observatory/tests/service/async_single_step_into_test.dart
index 3821890..352f787 100644
--- a/runtime/observatory/tests/service/async_single_step_into_test.dart
+++ b/runtime/observatory/tests/service/async_single_step_into_test.dart
@@ -24,7 +24,7 @@
print('z');
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_C),
stepOver, // print.
diff --git a/runtime/observatory/tests/service/async_single_step_out_test.dart b/runtime/observatory/tests/service/async_single_step_out_test.dart
index 6671083..5f0777f 100644
--- a/runtime/observatory/tests/service/async_single_step_out_test.dart
+++ b/runtime/observatory/tests/service/async_single_step_out_test.dart
@@ -25,7 +25,7 @@
print('z'); // LINE_E.
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_C),
stepOver, // print.
diff --git a/runtime/observatory/tests/service/async_star_single_step_into_test.dart b/runtime/observatory/tests/service/async_star_single_step_into_test.dart
index 0ff41ec..c13947f 100644
--- a/runtime/observatory/tests/service/async_star_single_step_into_test.dart
+++ b/runtime/observatory/tests/service/async_star_single_step_into_test.dart
@@ -34,7 +34,7 @@
print('z');
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_E),
stepOver, // print.
diff --git a/runtime/observatory/tests/service/async_star_step_out_test.dart b/runtime/observatory/tests/service/async_star_step_out_test.dart
index 72795da..818c6ef 100644
--- a/runtime/observatory/tests/service/async_star_step_out_test.dart
+++ b/runtime/observatory/tests/service/async_star_step_out_test.dart
@@ -38,7 +38,7 @@
print('z'); // LINE_G.
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_E),
stepOver, // print.
diff --git a/runtime/observatory/tests/service/async_step_out_test.dart b/runtime/observatory/tests/service/async_step_out_test.dart
index 3f59c2d..13949c9 100644
--- a/runtime/observatory/tests/service/async_step_out_test.dart
+++ b/runtime/observatory/tests/service/async_step_out_test.dart
@@ -25,7 +25,7 @@
print('z'); // LINE_E.
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_C),
stepOver, // print.
diff --git a/runtime/observatory/tests/service/auth_token1_test.dart b/runtime/observatory/tests/service/auth_token1_test.dart
index 73359fd..16cecd5 100644
--- a/runtime/observatory/tests/service/auth_token1_test.dart
+++ b/runtime/observatory/tests/service/auth_token1_test.dart
@@ -31,7 +31,7 @@
}
}
-var tests = [
+var tests = <IsolateTest>[
(S.Isolate isolate) async {
await isolate.reload();
// Just getting here means that the testee enabled the service protocol
diff --git a/runtime/observatory/tests/service/auth_token_test.dart b/runtime/observatory/tests/service/auth_token_test.dart
index 757478f..d1d06f9 100644
--- a/runtime/observatory/tests/service/auth_token_test.dart
+++ b/runtime/observatory/tests/service/auth_token_test.dart
@@ -42,7 +42,7 @@
}
}
-var tests = [
+var tests = <IsolateTest>[
(S.Isolate isolate) async {
await isolate.reload();
// Just getting here means that the testee enabled the service protocol
diff --git a/runtime/observatory/tests/service/awaiter_async_stack_contents_test.dart b/runtime/observatory/tests/service/awaiter_async_stack_contents_test.dart
index d5a6686..1f562cd 100644
--- a/runtime/observatory/tests/service/awaiter_async_stack_contents_test.dart
+++ b/runtime/observatory/tests/service/awaiter_async_stack_contents_test.dart
@@ -30,7 +30,7 @@
helper(); // LINE_B.
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_B),
(Isolate isolate) async {
diff --git a/runtime/observatory/tests/service/bad_reload_test.dart b/runtime/observatory/tests/service/bad_reload_test.dart
index a07381e..00665f7 100644
--- a/runtime/observatory/tests/service/bad_reload_test.dart
+++ b/runtime/observatory/tests/service/bad_reload_test.dart
@@ -38,7 +38,7 @@
return result.valueAsString;
}
-var tests = [
+var tests = <IsolateTest>[
// Stopped at 'debugger' statement.
hasStoppedAtBreakpoint,
// Resume the isolate into the while loop.
diff --git a/runtime/observatory/tests/service/break_on_activation_test.dart b/runtime/observatory/tests/service/break_on_activation_test.dart
index 7169ad4..4cc8503 100644
--- a/runtime/observatory/tests/service/break_on_activation_test.dart
+++ b/runtime/observatory/tests/service/break_on_activation_test.dart
@@ -47,7 +47,7 @@
r3_named(y: 'Not a closure', x: 'Not a closure');
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
var rootLib = await isolate.rootLibrary.load();
diff --git a/runtime/observatory/tests/service/break_on_function_test.dart b/runtime/observatory/tests/service/break_on_function_test.dart
index 128322c..3886aef 100644
--- a/runtime/observatory/tests/service/break_on_function_test.dart
+++ b/runtime/observatory/tests/service/break_on_function_test.dart
@@ -27,7 +27,7 @@
print("Done");
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
// Add breakpoint
diff --git a/runtime/observatory/tests/service/breakpoint_in_parts_class_test.dart b/runtime/observatory/tests/service/breakpoint_in_parts_class_test.dart
index af38693..77786a2 100644
--- a/runtime/observatory/tests/service/breakpoint_in_parts_class_test.dart
+++ b/runtime/observatory/tests/service/breakpoint_in_parts_class_test.dart
@@ -24,7 +24,7 @@
"$file:${LINE+1}:3" // on class ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtUriAndLine(file, LINE),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/breakpoint_two_args_checked_test.dart b/runtime/observatory/tests/service/breakpoint_two_args_checked_test.dart
index 3586eb4..52e452c 100644
--- a/runtime/observatory/tests/service/breakpoint_two_args_checked_test.dart
+++ b/runtime/observatory/tests/service/breakpoint_two_args_checked_test.dart
@@ -28,7 +28,7 @@
y & 4; // Line C.
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
// Add breakpoints.
diff --git a/runtime/observatory/tests/service/caching_test.dart b/runtime/observatory/tests/service/caching_test.dart
index a95dd3d..1bead33 100644
--- a/runtime/observatory/tests/service/caching_test.dart
+++ b/runtime/observatory/tests/service/caching_test.dart
@@ -13,7 +13,7 @@
import 'package:unittest/unittest.dart';
import 'test_helper.dart';
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
Library lib = await isolate.rootLibrary.load();
Script script = await lib.scripts.single.load();
diff --git a/runtime/observatory/tests/service/capture_stdio_test.dart b/runtime/observatory/tests/service/capture_stdio_test.dart
index 616fbb6..102b1e8 100644
--- a/runtime/observatory/tests/service/capture_stdio_test.dart
+++ b/runtime/observatory/tests/service/capture_stdio_test.dart
@@ -22,7 +22,7 @@
stderr.write('stderr');
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
(Isolate isolate) async {
Completer completer = new Completer();
diff --git a/runtime/observatory/tests/service/causal_async_stack_contents_test.dart b/runtime/observatory/tests/service/causal_async_stack_contents_test.dart
index 99b10b2..087aebe 100644
--- a/runtime/observatory/tests/service/causal_async_stack_contents_test.dart
+++ b/runtime/observatory/tests/service/causal_async_stack_contents_test.dart
@@ -30,7 +30,7 @@
helper(); // LINE_B.
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_B),
(Isolate isolate) async {
diff --git a/runtime/observatory/tests/service/causal_async_stack_presence_test.dart b/runtime/observatory/tests/service/causal_async_stack_presence_test.dart
index eb00b2e..67b4e36 100644
--- a/runtime/observatory/tests/service/causal_async_stack_presence_test.dart
+++ b/runtime/observatory/tests/service/causal_async_stack_presence_test.dart
@@ -29,7 +29,7 @@
helper(); // LINE_B.
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_B),
(Isolate isolate) async {
diff --git a/runtime/observatory/tests/service/causal_async_star_stack_contents_test.dart b/runtime/observatory/tests/service/causal_async_star_stack_contents_test.dart
index b859ca7..04ac599 100644
--- a/runtime/observatory/tests/service/causal_async_star_stack_contents_test.dart
+++ b/runtime/observatory/tests/service/causal_async_star_stack_contents_test.dart
@@ -33,7 +33,7 @@
helper();
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_A),
(Isolate isolate) async {
diff --git a/runtime/observatory/tests/service/causal_async_star_stack_presence_test.dart b/runtime/observatory/tests/service/causal_async_star_stack_presence_test.dart
index aef64eb..ae880a3 100644
--- a/runtime/observatory/tests/service/causal_async_star_stack_presence_test.dart
+++ b/runtime/observatory/tests/service/causal_async_star_stack_presence_test.dart
@@ -32,7 +32,7 @@
helper();
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_A),
(Isolate isolate) async {
diff --git a/runtime/observatory/tests/service/code_test.dart b/runtime/observatory/tests/service/code_test.dart
index d14c397..bf9462b 100644
--- a/runtime/observatory/tests/service/code_test.dart
+++ b/runtime/observatory/tests/service/code_test.dart
@@ -27,63 +27,56 @@
}
}
-var tests = [
+var tests = <IsolateTest>[
// Go to breakpoint at line 13.
- (Isolate isolate) {
- return isolate.rootLibrary.load().then((_) {
- // Set up a listener to wait for breakpoint events.
- Completer completer = new Completer();
- isolate.vm.getEventStream(VM.kDebugStream).then((stream) {
- var subscription;
- subscription = stream.listen((ServiceEvent event) {
- if (event.kind == ServiceEvent.kPauseBreakpoint) {
- print('Breakpoint reached');
- subscription.cancel();
- completer.complete();
- }
- });
- });
-
- // Add the breakpoint.
- var script = isolate.rootLibrary.scripts[0];
- var line = 13;
- return isolate.addBreakpoint(script, line).then((ServiceObject bpt) {
- return completer.future; // Wait for breakpoint reached.
+ (Isolate isolate) async {
+ await isolate.rootLibrary.load();
+ // Set up a listener to wait for breakpoint events.
+ Completer completer = new Completer();
+ isolate.vm.getEventStream(VM.kDebugStream).then((stream) {
+ var subscription;
+ subscription = stream.listen((ServiceEvent event) {
+ if (event.kind == ServiceEvent.kPauseBreakpoint) {
+ print('Breakpoint reached');
+ subscription.cancel();
+ completer.complete();
+ }
});
});
+
+ // Add the breakpoint.
+ var script = isolate.rootLibrary.scripts[0];
+ var line = 13;
+ isolate.addBreakpoint(script, line);
+ await completer.future; // Wait for breakpoint reached.
},
// Inspect code objects for top two frames.
- (Isolate isolate) {
- return isolate.getStack().then((ServiceMap stack) {
- // Make sure we are in the right place.
- expect(stack.type, equals('Stack'));
- expect(stack['frames'].length, greaterThanOrEqualTo(3));
- var frame0 = stack['frames'][0];
- var frame1 = stack['frames'][1];
- print(frame0);
- expect(frame0.function.name, equals('funcB'));
- expect(frame1.function.name, equals('funcA'));
- var codeId0 = frame0.code.id;
- var codeId1 = frame1.code.id;
+ (Isolate isolate) async {
+ ServiceMap stack = await isolate.getStack();
+ // Make sure we are in the right place.
+ expect(stack.type, equals('Stack'));
+ expect(stack['frames'].length, greaterThanOrEqualTo(3));
+ var frame0 = stack['frames'][0];
+ var frame1 = stack['frames'][1];
+ print(frame0);
+ expect(frame0.function.name, equals('funcB'));
+ expect(frame1.function.name, equals('funcA'));
+ var codeId0 = frame0.code.id;
+ var codeId1 = frame1.code.id;
- List tests = [];
- // Load code from frame 0.
- tests.add(isolate.getObject(codeId0)
- ..then((Code code) {
- expect(code.type, equals('Code'));
- expect(code.function.name, equals('funcB'));
- expect(code.hasDisassembly, equals(true));
- }));
- // Load code from frame 0.
- tests.add(isolate.getObject(codeId1)
- ..then((Code code) {
- expect(code.type, equals('Code'));
- expect(code.function.name, equals('funcA'));
- expect(code.hasDisassembly, equals(true));
- }));
- return Future.wait(tests);
- });
+ List tests = <IsolateTest>[];
+ // Load code from frame 0.
+ Code code = await isolate.getObject(codeId0);
+ expect(code.type, equals('Code'));
+ expect(code.function.name, equals('funcB'));
+ expect(code.hasDisassembly, equals(true));
+
+ // Load code from frame 0.
+ code = await isolate.getObject(codeId1);
+ expect(code.type, equals('Code'));
+ expect(code.function.name, equals('funcA'));
+ expect(code.hasDisassembly, equals(true));
},
];
diff --git a/runtime/observatory/tests/service/collect_all_garbage_test.dart b/runtime/observatory/tests/service/collect_all_garbage_test.dart
index 538dcad6..855d8be 100644
--- a/runtime/observatory/tests/service/collect_all_garbage_test.dart
+++ b/runtime/observatory/tests/service/collect_all_garbage_test.dart
@@ -8,7 +8,7 @@
import 'test_helper.dart';
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
var result = await isolate.invokeRpcNoUpgrade('_collectAllGarbage', {});
expect(result['type'], equals('Success'));
diff --git a/runtime/observatory/tests/service/complex_reload_test.dart b/runtime/observatory/tests/service/complex_reload_test.dart
index 7602df0..45d6f72 100644
--- a/runtime/observatory/tests/service/complex_reload_test.dart
+++ b/runtime/observatory/tests/service/complex_reload_test.dart
@@ -40,7 +40,7 @@
return result.valueAsString;
}
-var tests = [
+var tests = <IsolateTest>[
// Stopped at 'debugger' statement.
hasStoppedAtBreakpoint,
// Resume the isolate into the while loop.
diff --git a/runtime/observatory/tests/service/contexts_test.dart b/runtime/observatory/tests/service/contexts_test.dart
index a5fc6eb..680d8a4 100644
--- a/runtime/observatory/tests/service/contexts_test.dart
+++ b/runtime/observatory/tests/service/contexts_test.dart
@@ -49,7 +49,7 @@
fullBlockWithChain = genFullBlockWithChain();
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) => isolate.rootLibrary.load().then((Library lib) {
Field field = lib.variables.singleWhere((v) => v.name == 'cleanBlock');
return field.load().then((_) {
diff --git a/runtime/observatory/tests/service/coverage_leaf_function_test.dart b/runtime/observatory/tests/service/coverage_leaf_function_test.dart
index 39561b9..51df112 100644
--- a/runtime/observatory/tests/service/coverage_leaf_function_test.dart
+++ b/runtime/observatory/tests/service/coverage_leaf_function_test.dart
@@ -28,7 +28,7 @@
return true;
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
(Isolate isolate) async {
var stack = await isolate.getStack();
diff --git a/runtime/observatory/tests/service/coverage_optimized_function_test.dart b/runtime/observatory/tests/service/coverage_optimized_function_test.dart
index 46d1717..f883e9a 100644
--- a/runtime/observatory/tests/service/coverage_optimized_function_test.dart
+++ b/runtime/observatory/tests/service/coverage_optimized_function_test.dart
@@ -20,7 +20,7 @@
debugger();
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
(Isolate isolate) async {
var stack = await isolate.getStack();
diff --git a/runtime/observatory/tests/service/crash_dump_test.dart b/runtime/observatory/tests/service/crash_dump_test.dart
index 3351354..4d56ccc 100644
--- a/runtime/observatory/tests/service/crash_dump_test.dart
+++ b/runtime/observatory/tests/service/crash_dump_test.dart
@@ -15,7 +15,7 @@
print('hi');
}
-var tests = [
+var tests = <VMTest>[
(VM vm) async {
HttpClient client = new HttpClient();
print('Requesting uri ${serviceHttpAddress}/_getCrashDump');
@@ -23,7 +23,7 @@
await client.getUrl(Uri.parse('$serviceHttpAddress/_getCrashDump'));
var response = await request.close();
print('Received response');
- Completer completer = new Completer();
+ Completer completer = new Completer<String>();
StringBuffer sb = new StringBuffer();
response.transform(UTF8.decoder).listen((chunk) {
sb.write(chunk);
diff --git a/runtime/observatory/tests/service/debugger_inspect_test.dart b/runtime/observatory/tests/service/debugger_inspect_test.dart
index a70fe48..c52c42f 100644
--- a/runtime/observatory/tests/service/debugger_inspect_test.dart
+++ b/runtime/observatory/tests/service/debugger_inspect_test.dart
@@ -18,7 +18,7 @@
inspect(new Point(3, 4));
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
Completer completer = new Completer();
var stream = await isolate.vm.getEventStream(VM.kDebugStream);
diff --git a/runtime/observatory/tests/service/debugger_location_second_test.dart b/runtime/observatory/tests/service/debugger_location_second_test.dart
index 48ac916..7586c98 100644
--- a/runtime/observatory/tests/service/debugger_location_second_test.dart
+++ b/runtime/observatory/tests/service/debugger_location_second_test.dart
@@ -53,7 +53,7 @@
});
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
// Load the isolate's libraries
diff --git a/runtime/observatory/tests/service/debugger_location_test.dart b/runtime/observatory/tests/service/debugger_location_test.dart
index f7aae4a..0484fcf 100644
--- a/runtime/observatory/tests/service/debugger_location_test.dart
+++ b/runtime/observatory/tests/service/debugger_location_test.dart
@@ -53,7 +53,7 @@
});
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
// Parse '' => current position
diff --git a/runtime/observatory/tests/service/debugging_inlined_finally_test.dart b/runtime/observatory/tests/service/debugging_inlined_finally_test.dart
index 46d0089..f30e25c 100644
--- a/runtime/observatory/tests/service/debugging_inlined_finally_test.dart
+++ b/runtime/observatory/tests/service/debugging_inlined_finally_test.dart
@@ -36,7 +36,7 @@
expect(f(), equals(11));
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
// Add breakpoint
diff --git a/runtime/observatory/tests/service/debugging_test.dart b/runtime/observatory/tests/service/debugging_test.dart
index 837a924..a75a341 100644
--- a/runtime/observatory/tests/service/debugging_test.dart
+++ b/runtime/observatory/tests/service/debugging_test.dart
@@ -23,7 +23,7 @@
new Timer.periodic(const Duration(milliseconds: 10), periodicTask);
}
-var tests = [
+var tests = <IsolateTest>[
// Pause
(Isolate isolate) async {
Completer completer = new Completer();
diff --git a/runtime/observatory/tests/service/dev_fs_http_put_test.dart b/runtime/observatory/tests/service/dev_fs_http_put_test.dart
index cbc25d2..9d7a45b 100644
--- a/runtime/observatory/tests/service/dev_fs_http_put_test.dart
+++ b/runtime/observatory/tests/service/dev_fs_http_put_test.dart
@@ -11,7 +11,7 @@
import 'test_helper.dart';
Future<String> readResponse(HttpClientResponse response) {
- var completer = new Completer();
+ var completer = new Completer<String>();
var contents = new StringBuffer();
response.transform(UTF8.decoder).listen((String data) {
contents.write(data);
@@ -19,7 +19,7 @@
return completer.future;
}
-var tests = [
+var tests = <VMTest>[
// Write a file with the ? character in the filename.
(VM vm) async {
var fsId = 'test';
diff --git a/runtime/observatory/tests/service/dev_fs_http_put_weird_char_test.dart b/runtime/observatory/tests/service/dev_fs_http_put_weird_char_test.dart
index 8e27a98..ea8c92f 100644
--- a/runtime/observatory/tests/service/dev_fs_http_put_weird_char_test.dart
+++ b/runtime/observatory/tests/service/dev_fs_http_put_weird_char_test.dart
@@ -11,7 +11,7 @@
import 'test_helper.dart';
Future<String> readResponse(HttpClientResponse response) {
- var completer = new Completer();
+ var completer = new Completer<String>();
var contents = new StringBuffer();
response.transform(UTF8.decoder).listen((String data) {
contents.write(data);
@@ -19,7 +19,7 @@
return completer.future;
}
-var tests = [
+var tests = <VMTest>[
// Write a file with the \r character in the filename.
(VM vm) async {
var fsId = 'test';
diff --git a/runtime/observatory/tests/service/dev_fs_spawn_test.dart b/runtime/observatory/tests/service/dev_fs_spawn_test.dart
index c2cf90a..79f2ba5 100644
--- a/runtime/observatory/tests/service/dev_fs_spawn_test.dart
+++ b/runtime/observatory/tests/service/dev_fs_spawn_test.dart
@@ -11,7 +11,7 @@
import 'service_test_common.dart';
import 'test_helper.dart';
-var tests = [
+var tests = <VMTest>[
(VM vm) async {
// Create a new fs.
var fsName = 'scratch';
@@ -136,10 +136,11 @@
await hasStoppedAtBreakpoint(spawnedIsolate);
// Make sure that we are running code from the spawned isolate.
- result = await spawnedIsolate.rootLibrary.evaluate('proofOfLife()');
- expect(result.type, equals('Instance'));
- expect(result.kind, equals(M.InstanceKind.string));
- expect(result.valueAsString, equals('I live!'));
+ var instance = (await spawnedIsolate.rootLibrary.evaluate('proofOfLife()'))
+ as Instance;
+ expect(instance.type, equals('Instance'));
+ expect(instance.kind, equals(M.InstanceKind.string));
+ expect(instance.valueAsString, equals('I live!'));
// Spawn the script with arguments.
completer = new Completer();
@@ -165,10 +166,11 @@
await hasStoppedAtBreakpoint(spawnedIsolate);
// Make sure that we are running code from the spawned isolate.
- result = await spawnedIsolate.rootLibrary.evaluate('proofOfLife()');
- expect(result.type, equals('Instance'));
- expect(result.kind, equals(M.InstanceKind.string));
- expect(result.valueAsString, equals('I live, [one, two, three]!'));
+ instance = (await spawnedIsolate.rootLibrary.evaluate('proofOfLife()'))
+ as Instance;
+ expect(instance.type, equals('Instance'));
+ expect(instance.kind, equals(M.InstanceKind.string));
+ expect(instance.valueAsString, equals('I live, [one, two, three]!'));
// Spawn the script with arguments and message
completer = new Completer();
@@ -195,10 +197,11 @@
await hasStoppedAtBreakpoint(spawnedIsolate);
// Make sure that we are running code from the spawned isolate.
- result = await spawnedIsolate.rootLibrary.evaluate('proofOfLife()');
- expect(result.type, equals('Instance'));
- expect(result.kind, equals(M.InstanceKind.string));
- expect(result.valueAsString, equals('I live, [A, B, C], test!'));
+ instance = (await spawnedIsolate.rootLibrary.evaluate('proofOfLife()'))
+ as Instance;
+ expect(instance.type, equals('Instance'));
+ expect(instance.kind, equals(M.InstanceKind.string));
+ expect(instance.valueAsString, equals('I live, [A, B, C], test!'));
// Delete the fs.
result = await vm.invokeRpcNoUpgrade('_deleteDevFS', {
diff --git a/runtime/observatory/tests/service/dev_fs_test.dart b/runtime/observatory/tests/service/dev_fs_test.dart
index 81cf98d..2349977 100644
--- a/runtime/observatory/tests/service/dev_fs_test.dart
+++ b/runtime/observatory/tests/service/dev_fs_test.dart
@@ -8,7 +8,7 @@
import 'package:unittest/unittest.dart';
import 'test_helper.dart';
-var tests = [
+var tests = <VMTest>[
(VM vm) async {
var result = await vm.invokeRpcNoUpgrade('_listDevFS', {});
expect(result['type'], equals('FileSystemList'));
diff --git a/runtime/observatory/tests/service/dev_fs_uri_test.dart b/runtime/observatory/tests/service/dev_fs_uri_test.dart
index 3094284..201ea14 100644
--- a/runtime/observatory/tests/service/dev_fs_uri_test.dart
+++ b/runtime/observatory/tests/service/dev_fs_uri_test.dart
@@ -11,7 +11,7 @@
import 'test_helper.dart';
Future<String> readResponse(HttpClientResponse response) {
- var completer = new Completer();
+ var completer = new Completer<String>();
var contents = new StringBuffer();
response.transform(UTF8.decoder).listen((String data) {
contents.write(data);
@@ -19,7 +19,7 @@
return completer.future;
}
-var tests = [
+var tests = <VMTest>[
// Write a file with the ? character in the filename.
(VM vm) async {
var fsId = 'test';
diff --git a/runtime/observatory/tests/service/dev_fs_weird_char_test.dart b/runtime/observatory/tests/service/dev_fs_weird_char_test.dart
index a5c9ef7..48c15c3 100644
--- a/runtime/observatory/tests/service/dev_fs_weird_char_test.dart
+++ b/runtime/observatory/tests/service/dev_fs_weird_char_test.dart
@@ -8,7 +8,7 @@
import 'package:unittest/unittest.dart';
import 'test_helper.dart';
-var tests = [
+var tests = <VMTest>[
// Write a file with the ? character in the filename.
(VM vm) async {
var fsId = 'test';
diff --git a/runtime/observatory/tests/service/developer_extension_test.dart b/runtime/observatory/tests/service/developer_extension_test.dart
index a05c3dc..072378e 100644
--- a/runtime/observatory/tests/service/developer_extension_test.dart
+++ b/runtime/observatory/tests/service/developer_extension_test.dart
@@ -75,7 +75,7 @@
registerExtension('ext..languageError', LanguageErrorHandler);
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
(Isolate isolate) async {
await isolate.load();
diff --git a/runtime/observatory/tests/service/developer_server_control_test.dart b/runtime/observatory/tests/service/developer_server_control_test.dart
index 2d005eb..452b3e8 100644
--- a/runtime/observatory/tests/service/developer_server_control_test.dart
+++ b/runtime/observatory/tests/service/developer_server_control_test.dart
@@ -68,7 +68,7 @@
}
}
-var tests = [
+var tests = <IsolateTest>[
(S.Isolate isolate) async {
await isolate.reload();
// Just getting here means that the testee enabled the service protocol
diff --git a/runtime/observatory/tests/service/developer_service_get_isolate_id_test.dart b/runtime/observatory/tests/service/developer_service_get_isolate_id_test.dart
index f808a0a..cc4bbbe 100644
--- a/runtime/observatory/tests/service/developer_service_get_isolate_id_test.dart
+++ b/runtime/observatory/tests/service/developer_service_get_isolate_id_test.dart
@@ -36,7 +36,7 @@
Service.Isolate initialIsolate;
Service.Isolate localChildIsolate;
-var tests = [
+var tests = <VMTest>[
(Service.VM vm) async {
// Sanity check.
expect(vm.isolates.length, 1);
diff --git a/runtime/observatory/tests/service/dominator_tree_user_test.dart b/runtime/observatory/tests/service/dominator_tree_user_test.dart
index 14572bc..b0a4f35 100644
--- a/runtime/observatory/tests/service/dominator_tree_user_test.dart
+++ b/runtime/observatory/tests/service/dominator_tree_user_test.dart
@@ -111,7 +111,7 @@
l.x = h;
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
final rootLib = await isolate.rootLibrary.load();
final raw =
diff --git a/runtime/observatory/tests/service/dominator_tree_vm_test.dart b/runtime/observatory/tests/service/dominator_tree_vm_test.dart
index c04759c..1c59f2a 100644
--- a/runtime/observatory/tests/service/dominator_tree_vm_test.dart
+++ b/runtime/observatory/tests/service/dominator_tree_vm_test.dart
@@ -111,7 +111,7 @@
l.x = h;
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
final rootLib = await isolate.rootLibrary.load();
final raw =
diff --git a/runtime/observatory/tests/service/echo_test.dart b/runtime/observatory/tests/service/echo_test.dart
index d86b1f2..402c080 100644
--- a/runtime/observatory/tests/service/echo_test.dart
+++ b/runtime/observatory/tests/service/echo_test.dart
@@ -8,14 +8,14 @@
import 'package:unittest/unittest.dart';
import 'test_helper.dart';
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) =>
- isolate.vm.invokeRpc('_echo', {'text': 'hello'}).then((result) {
+ isolate.vm.invokeRpcNoUpgrade('_echo', {'text': 'hello'}).then((result) {
expect(result['type'], equals('_EchoResponse'));
expect(result['text'], equals('hello'));
}),
(Isolate isolate) =>
- isolate.invokeRpc('_echo', {'text': 'hello'}).then((result) {
+ isolate.invokeRpcNoUpgrade('_echo', {'text': 'hello'}).then((result) {
expect(result['type'], equals('_EchoResponse'));
expect(result['text'], equals('hello'));
}),
diff --git a/runtime/observatory/tests/service/eval_internal_class_test.dart b/runtime/observatory/tests/service/eval_internal_class_test.dart
index 85bd4a9..fc0b2b8 100644
--- a/runtime/observatory/tests/service/eval_internal_class_test.dart
+++ b/runtime/observatory/tests/service/eval_internal_class_test.dart
@@ -6,7 +6,7 @@
import 'package:unittest/unittest.dart';
import 'test_helper.dart';
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
Library root = await isolate.rootLibrary.load();
diff --git a/runtime/observatory/tests/service/eval_test.dart b/runtime/observatory/tests/service/eval_test.dart
index 86598f9..77e48b2 100644
--- a/runtime/observatory/tests/service/eval_test.dart
+++ b/runtime/observatory/tests/service/eval_test.dart
@@ -29,7 +29,7 @@
}
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
// Evaluate against library, class, and instance.
diff --git a/runtime/observatory/tests/service/evaluate_activation_test.dart b/runtime/observatory/tests/service/evaluate_activation_test.dart
index eb24a0e..c326cea 100644
--- a/runtime/observatory/tests/service/evaluate_activation_test.dart
+++ b/runtime/observatory/tests/service/evaluate_activation_test.dart
@@ -259,7 +259,7 @@
expect(hitBreakpoint, isTrue);
}
-var tests = [
+var tests = <IsolateTest>[
testMethod,
testMethod2,
testMethod3,
diff --git a/runtime/observatory/tests/service/evaluate_in_async_activation_test.dart b/runtime/observatory/tests/service/evaluate_in_async_activation_test.dart
index c114902..dcf1002 100644
--- a/runtime/observatory/tests/service/evaluate_in_async_activation_test.dart
+++ b/runtime/observatory/tests/service/evaluate_in_async_activation_test.dart
@@ -18,7 +18,7 @@
return z;
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
(Isolate isolate) async {
// Make sure we are in the right place.
diff --git a/runtime/observatory/tests/service/evaluate_in_async_star_activation_test.dart b/runtime/observatory/tests/service/evaluate_in_async_star_activation_test.dart
index 4257d83..0c76684 100644
--- a/runtime/observatory/tests/service/evaluate_in_async_star_activation_test.dart
+++ b/runtime/observatory/tests/service/evaluate_in_async_star_activation_test.dart
@@ -22,7 +22,7 @@
await for (var ignored in generator());
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
(Isolate isolate) async {
// Make sure we are in the right place.
diff --git a/runtime/observatory/tests/service/evaluate_in_frame_rpc_test.dart b/runtime/observatory/tests/service/evaluate_in_frame_rpc_test.dart
index cebc15b..11549b4 100644
--- a/runtime/observatory/tests/service/evaluate_in_frame_rpc_test.dart
+++ b/runtime/observatory/tests/service/evaluate_in_frame_rpc_test.dart
@@ -22,7 +22,7 @@
}
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
// Evaluate against library, class, and instance.
diff --git a/runtime/observatory/tests/service/evaluate_in_frame_with_scope_test.dart b/runtime/observatory/tests/service/evaluate_in_frame_with_scope_test.dart
index 23693be..3b8c7ce 100644
--- a/runtime/observatory/tests/service/evaluate_in_frame_with_scope_test.dart
+++ b/runtime/observatory/tests/service/evaluate_in_frame_with_scope_test.dart
@@ -26,7 +26,7 @@
return local;
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
(Isolate isolate) async {
// Make sure we are in the right place.
diff --git a/runtime/observatory/tests/service/evaluate_in_sync_star_activation_test.dart b/runtime/observatory/tests/service/evaluate_in_sync_star_activation_test.dart
index 93e7522..04c3385 100644
--- a/runtime/observatory/tests/service/evaluate_in_sync_star_activation_test.dart
+++ b/runtime/observatory/tests/service/evaluate_in_sync_star_activation_test.dart
@@ -22,7 +22,7 @@
for (var ignored in generator());
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
(Isolate isolate) async {
// Make sure we are in the right place.
diff --git a/runtime/observatory/tests/service/evaluate_with_scope_test.dart b/runtime/observatory/tests/service/evaluate_with_scope_test.dart
index 73e1e1f..702cb66 100644
--- a/runtime/observatory/tests/service/evaluate_with_scope_test.dart
+++ b/runtime/observatory/tests/service/evaluate_with_scope_test.dart
@@ -15,7 +15,7 @@
thing2 = 4;
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
var lib = await isolate.rootLibrary.load();
var thing1 =
diff --git a/runtime/observatory/tests/service/external_service_asynchronous_invocation_test.dart b/runtime/observatory/tests/service/external_service_asynchronous_invocation_test.dart
index 597bf35..3bb764c 100644
--- a/runtime/observatory/tests/service/external_service_asynchronous_invocation_test.dart
+++ b/runtime/observatory/tests/service/external_service_asynchronous_invocation_test.dart
@@ -10,7 +10,7 @@
import 'dart:convert' show JSON;
import 'dart:async' show Future, StreamController;
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
VM vm = isolate.owner;
diff --git a/runtime/observatory/tests/service/external_service_disappear_test.dart b/runtime/observatory/tests/service/external_service_disappear_test.dart
index f43a891..c30ea64 100644
--- a/runtime/observatory/tests/service/external_service_disappear_test.dart
+++ b/runtime/observatory/tests/service/external_service_disappear_test.dart
@@ -10,7 +10,7 @@
import 'dart:convert' show JSON;
import 'dart:async' show Future, StreamController;
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
VM vm = isolate.owner;
diff --git a/runtime/observatory/tests/service/external_service_notification_invocation_test.dart b/runtime/observatory/tests/service/external_service_notification_invocation_test.dart
index 0112d27..3eec32a 100644
--- a/runtime/observatory/tests/service/external_service_notification_invocation_test.dart
+++ b/runtime/observatory/tests/service/external_service_notification_invocation_test.dart
@@ -10,7 +10,7 @@
import 'dart:convert' show JSON;
import 'dart:async' show Future, StreamController;
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
VM vm = isolate.owner;
@@ -22,8 +22,8 @@
WebSocket _socket_invoker =
await WebSocket.connect((vm as WebSocketVM).target.networkAddress);
- final socket = new StreamController();
- final socket_invoker = new StreamController();
+ final socket = new StreamController<Map>();
+ final socket_invoker = new StreamController<Map>();
// Avoid to manually encode and decode messages from the stream
socket.stream.map(JSON.encode).pipe(_socket);
diff --git a/runtime/observatory/tests/service/external_service_registration_test.dart b/runtime/observatory/tests/service/external_service_registration_test.dart
index b643f38..b66563b 100644
--- a/runtime/observatory/tests/service/external_service_registration_test.dart
+++ b/runtime/observatory/tests/service/external_service_registration_test.dart
@@ -10,7 +10,7 @@
import 'dart:convert' show JSON;
import 'dart:async' show Future, StreamController;
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
VM vm = isolate.owner;
diff --git a/runtime/observatory/tests/service/external_service_registration_via_notification_test.dart b/runtime/observatory/tests/service/external_service_registration_via_notification_test.dart
index 9f134bd..37027f8 100644
--- a/runtime/observatory/tests/service/external_service_registration_via_notification_test.dart
+++ b/runtime/observatory/tests/service/external_service_registration_via_notification_test.dart
@@ -10,7 +10,7 @@
import 'dart:convert' show JSON;
import 'dart:async' show Future, StreamController;
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
VM vm = isolate.owner;
diff --git a/runtime/observatory/tests/service/external_service_synchronous_invocation_test.dart b/runtime/observatory/tests/service/external_service_synchronous_invocation_test.dart
index b582159..372ce1a 100644
--- a/runtime/observatory/tests/service/external_service_synchronous_invocation_test.dart
+++ b/runtime/observatory/tests/service/external_service_synchronous_invocation_test.dart
@@ -10,7 +10,7 @@
import 'dart:convert' show JSON;
import 'dart:async' show Future, StreamController;
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
VM vm = isolate.owner;
diff --git a/runtime/observatory/tests/service/field_script_test.dart b/runtime/observatory/tests/service/field_script_test.dart
index 458a69b..1267101 100644
--- a/runtime/observatory/tests/service/field_script_test.dart
+++ b/runtime/observatory/tests/service/field_script_test.dart
@@ -15,7 +15,7 @@
print(otherField);
}
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
(Isolate isolate) async {
Library lib = await isolate.rootLibrary.load();
diff --git a/runtime/observatory/tests/service/file_service_test.dart b/runtime/observatory/tests/service/file_service_test.dart
index 2b455e6..7f372c0 100644
--- a/runtime/observatory/tests/service/file_service_test.dart
+++ b/runtime/observatory/tests/service/file_service_test.dart
@@ -68,7 +68,7 @@
registerExtension('ext.dart.io.setup', setup);
}
-var fileTests = [
+var fileTests = <IsolateTest>[
(Isolate isolate) async {
await isolate.invokeRpcNoUpgrade('ext.dart.io.setup', {});
try {
diff --git a/runtime/observatory/tests/service/gc_test.dart b/runtime/observatory/tests/service/gc_test.dart
index 7f1c402..5fd03ea 100644
--- a/runtime/observatory/tests/service/gc_test.dart
+++ b/runtime/observatory/tests/service/gc_test.dart
@@ -20,7 +20,7 @@
grow(100, 1 << 24, new Duration(seconds: 1));
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) {
Completer completer = new Completer();
// Expect at least this many GC events.
diff --git a/runtime/observatory/tests/service/get_allocation_profile_rpc_test.dart b/runtime/observatory/tests/service/get_allocation_profile_rpc_test.dart
index 742ee49..ea2d270 100644
--- a/runtime/observatory/tests/service/get_allocation_profile_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_allocation_profile_rpc_test.dart
@@ -16,7 +16,7 @@
return completer.future;
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
var params = {};
var result =
diff --git a/runtime/observatory/tests/service/get_allocation_samples_test.dart b/runtime/observatory/tests/service/get_allocation_samples_test.dart
index 239fab5..26da1e1 100644
--- a/runtime/observatory/tests/service/get_allocation_samples_test.dart
+++ b/runtime/observatory/tests/service/get_allocation_samples_test.dart
@@ -27,7 +27,7 @@
debugger();
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
// Initial.
diff --git a/runtime/observatory/tests/service/get_cpu_profile_timeline_rpc_test.dart b/runtime/observatory/tests/service/get_cpu_profile_timeline_rpc_test.dart
index 8a00fbe..b900f51 100644
--- a/runtime/observatory/tests/service/get_cpu_profile_timeline_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_cpu_profile_timeline_rpc_test.dart
@@ -20,7 +20,7 @@
print("Testee did something.");
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
var params = {'tags': 'VMUser'};
var result =
diff --git a/runtime/observatory/tests/service/get_flag_list_rpc_test.dart b/runtime/observatory/tests/service/get_flag_list_rpc_test.dart
index 2ea82099..c44b017 100644
--- a/runtime/observatory/tests/service/get_flag_list_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_flag_list_rpc_test.dart
@@ -8,7 +8,7 @@
import 'test_helper.dart';
-var tests = [
+var tests = <VMTest>[
(VM vm) async {
var result = await vm.invokeRpcNoUpgrade('getFlagList', {});
expect(result['type'], equals('FlagList'));
diff --git a/runtime/observatory/tests/service/get_heap_map_rpc_test.dart b/runtime/observatory/tests/service/get_heap_map_rpc_test.dart
index f60135a..bff044c 100644
--- a/runtime/observatory/tests/service/get_heap_map_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_heap_map_rpc_test.dart
@@ -8,7 +8,7 @@
import 'test_helper.dart';
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
var params = {};
var result = await isolate.invokeRpcNoUpgrade('_getHeapMap', params);
diff --git a/runtime/observatory/tests/service/get_instances_rpc_test.dart b/runtime/observatory/tests/service/get_instances_rpc_test.dart
index 66bea4d..39e4524 100644
--- a/runtime/observatory/tests/service/get_instances_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_instances_rpc_test.dart
@@ -28,7 +28,7 @@
return await isolate.invokeRpcNoUpgrade('evaluate', params);
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
var obj = await eval(isolate, 'global');
var params = {
diff --git a/runtime/observatory/tests/service/get_isolate_after_async_error_test.dart b/runtime/observatory/tests/service/get_isolate_after_async_error_test.dart
index 1e5ef88..af7b54c 100644
--- a/runtime/observatory/tests/service/get_isolate_after_async_error_test.dart
+++ b/runtime/observatory/tests/service/get_isolate_after_async_error_test.dart
@@ -12,7 +12,7 @@
throw "oh no"; // Line 13.
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtExit,
(Isolate isolate) async {
await isolate.reload();
diff --git a/runtime/observatory/tests/service/get_isolate_after_language_error_test.dart b/runtime/observatory/tests/service/get_isolate_after_language_error_test.dart
index ccb00fe..95200f5 100644
--- a/runtime/observatory/tests/service/get_isolate_after_language_error_test.dart
+++ b/runtime/observatory/tests/service/get_isolate_after_language_error_test.dart
@@ -15,7 +15,7 @@
};
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtExit,
(Isolate isolate) async {
diff --git a/runtime/observatory/tests/service/get_isolate_after_stack_overflow_error_test.dart b/runtime/observatory/tests/service/get_isolate_after_stack_overflow_error_test.dart
index 6588ee0..4488170 100644
--- a/runtime/observatory/tests/service/get_isolate_after_stack_overflow_error_test.dart
+++ b/runtime/observatory/tests/service/get_isolate_after_stack_overflow_error_test.dart
@@ -17,7 +17,7 @@
factorialGrowth();
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtExit,
(Isolate isolate) async {
await isolate.reload();
diff --git a/runtime/observatory/tests/service/get_isolate_after_sync_error_test.dart b/runtime/observatory/tests/service/get_isolate_after_sync_error_test.dart
index 73da50b..87851f8 100644
--- a/runtime/observatory/tests/service/get_isolate_after_sync_error_test.dart
+++ b/runtime/observatory/tests/service/get_isolate_after_sync_error_test.dart
@@ -12,7 +12,7 @@
throw "oh no"; // Line 13.
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtExit,
(Isolate isolate) async {
await isolate.reload();
diff --git a/runtime/observatory/tests/service/get_isolate_rpc_test.dart b/runtime/observatory/tests/service/get_isolate_rpc_test.dart
index f932342..8ed6c91 100644
--- a/runtime/observatory/tests/service/get_isolate_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_isolate_rpc_test.dart
@@ -8,7 +8,7 @@
import 'test_helper.dart';
-var tests = [
+var tests = <VMTest>[
(VM vm) async {
var params = {
'isolateId': vm.isolates.first.id,
diff --git a/runtime/observatory/tests/service/get_native_allocation_samples_test.dart b/runtime/observatory/tests/service/get_native_allocation_samples_test.dart
index 10bb7f2..b197a29 100644
--- a/runtime/observatory/tests/service/get_native_allocation_samples_test.dart
+++ b/runtime/observatory/tests/service/get_native_allocation_samples_test.dart
@@ -52,7 +52,7 @@
}
}
-var tests = [
+var tests = <VMTest>[
// Verify inclusive tries.
(VM vm) async {
var response =
diff --git a/runtime/observatory/tests/service/get_object_rpc_test.dart b/runtime/observatory/tests/service/get_object_rpc_test.dart
index a4fc483..8ac90d2 100644
--- a/runtime/observatory/tests/service/get_object_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_object_rpc_test.dart
@@ -36,7 +36,7 @@
var uint8List = new Uint8List.fromList([3, 2, 1]);
var uint64List = new Uint64List.fromList([3, 2, 1]);
-var tests = [
+var tests = <IsolateTest>[
// null object.
(Isolate isolate) async {
var params = {
diff --git a/runtime/observatory/tests/service/get_object_store_rpc_test.dart b/runtime/observatory/tests/service/get_object_store_rpc_test.dart
index 5582895..65ee17f 100644
--- a/runtime/observatory/tests/service/get_object_store_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_object_store_rpc_test.dart
@@ -18,7 +18,7 @@
return field.name == 'closure_functions_';
}
-var tests = [
+var tests = <IsolateTest>[
// Initial data fetch and verify we've hit the breakpoint.
(Isolate isolate) async {
await isolate.rootLibrary.load();
diff --git a/runtime/observatory/tests/service/get_ports_rpc_test.dart b/runtime/observatory/tests/service/get_ports_rpc_test.dart
index 0feac56..36685b8 100644
--- a/runtime/observatory/tests/service/get_ports_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_ports_rpc_test.dart
@@ -37,7 +37,7 @@
return handler.isClosure;
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
var result = await isolate.invokeRpc('_getPorts', {});
expect(result['type'], equals('_Ports'));
diff --git a/runtime/observatory/tests/service/get_retained_size_rpc_test.dart b/runtime/observatory/tests/service/get_retained_size_rpc_test.dart
index d28b518..b86c91f 100644
--- a/runtime/observatory/tests/service/get_retained_size_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_retained_size_rpc_test.dart
@@ -26,7 +26,7 @@
return await isolate.invokeRpcNoUpgrade('evaluate', params);
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
// One instance of _TestClass retained.
var evalResult = await eval(isolate, 'myVar = new _TestClass(null, null)');
diff --git a/runtime/observatory/tests/service/get_retaining_path_rpc_test.dart b/runtime/observatory/tests/service/get_retaining_path_rpc_test.dart
index aa0c328..840fd15 100644
--- a/runtime/observatory/tests/service/get_retaining_path_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_retaining_path_rpc_test.dart
@@ -40,7 +40,7 @@
return await isolate.invokeRpcNoUpgrade('evaluate', params);
}
-var tests = [
+var tests = <IsolateTest>[
// simple path
(Isolate isolate) async {
var obj = await eval(isolate, 'globalObject');
diff --git a/runtime/observatory/tests/service/get_source_report_test.dart b/runtime/observatory/tests/service/get_source_report_test.dart
index cf47768..75f1e06 100644
--- a/runtime/observatory/tests/service/get_source_report_test.dart
+++ b/runtime/observatory/tests/service/get_source_report_test.dart
@@ -44,7 +44,7 @@
return true;
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
(Isolate isolate) async {
var stack = await isolate.getStack();
diff --git a/runtime/observatory/tests/service/get_stack_rpc_test.dart b/runtime/observatory/tests/service/get_stack_rpc_test.dart
index 4840e76..297b219 100644
--- a/runtime/observatory/tests/service/get_stack_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_stack_rpc_test.dart
@@ -32,7 +32,7 @@
new Timer.periodic(const Duration(milliseconds: 10), periodicTask);
}
-var tests = [
+var tests = <IsolateTest>[
// Initial data fetch and verify we've hit the breakpoint.
(Isolate isolate) async {
await isolate.rootLibrary.load();
diff --git a/runtime/observatory/tests/service/get_user_level_retaining_path_rpc_test.dart b/runtime/observatory/tests/service/get_user_level_retaining_path_rpc_test.dart
index dc6473e..c458396 100644
--- a/runtime/observatory/tests/service/get_user_level_retaining_path_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_user_level_retaining_path_rpc_test.dart
@@ -36,7 +36,7 @@
return await isolate.invokeRpcNoUpgrade('evaluate', params);
}
-var tests = [
+var tests = <IsolateTest>[
// Expect a simple path through variable x instead of long path filled
// with VM objects
(Isolate isolate) async {
diff --git a/runtime/observatory/tests/service/get_version_rpc_test.dart b/runtime/observatory/tests/service/get_version_rpc_test.dart
index 9283031..c12b767 100644
--- a/runtime/observatory/tests/service/get_version_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_version_rpc_test.dart
@@ -8,7 +8,7 @@
import 'test_helper.dart';
-var tests = [
+var tests = <VMTest>[
(VM vm) async {
var result = await vm.invokeRpcNoUpgrade('getVersion', {});
expect(result['type'], equals('Version'));
diff --git a/runtime/observatory/tests/service/get_vm_rpc_test.dart b/runtime/observatory/tests/service/get_vm_rpc_test.dart
index f16c2b7..1fb21b4 100644
--- a/runtime/observatory/tests/service/get_vm_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_vm_rpc_test.dart
@@ -8,7 +8,7 @@
import 'test_helper.dart';
-var tests = [
+var tests = <VMTest>[
(VM vm) async {
var result = await vm.invokeRpcNoUpgrade('getVM', {});
expect(result['type'], equals('VM'));
diff --git a/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart b/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
index 147eedb..8ffb61b 100644
--- a/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_vm_timeline_rpc_test.dart
@@ -93,7 +93,7 @@
}
}
-var tests = [
+var tests = <VMTest>[
(VM vm) async {
Map result = await vm.invokeRpcNoUpgrade('_getVMTimeline', {});
expect(result['type'], equals('_Timeline'));
diff --git a/runtime/observatory/tests/service/get_zone_memory_info_rpc_test.dart b/runtime/observatory/tests/service/get_zone_memory_info_rpc_test.dart
index 3da9607..c9dd717 100644
--- a/runtime/observatory/tests/service/get_zone_memory_info_rpc_test.dart
+++ b/runtime/observatory/tests/service/get_zone_memory_info_rpc_test.dart
@@ -8,7 +8,7 @@
import 'test_helper.dart';
-var tests = [
+var tests = <VMTest>[
(VM vm) async {
isInstanceOf<int> isInt = new isInstanceOf<int>();
// Just iterate over all the isolates to confirm they have
diff --git a/runtime/observatory/tests/service/implicit_getter_setter_test.dart b/runtime/observatory/tests/service/implicit_getter_setter_test.dart
index 700ef28..f3b8d8c 100644
--- a/runtime/observatory/tests/service/implicit_getter_setter_test.dart
+++ b/runtime/observatory/tests/service/implicit_getter_setter_test.dart
@@ -62,6 +62,6 @@
expect(classDouble.name, equals('_Double'));
}
-var tests = [testGetter, testSetter];
+var tests = <IsolateTest>[testGetter, testSetter];
main(args) => runIsolateTests(args, tests, testeeBefore: script);
diff --git a/runtime/observatory/tests/service/inbound_references_test.dart b/runtime/observatory/tests/service/inbound_references_test.dart
index a08f866..2df380f 100644
--- a/runtime/observatory/tests/service/inbound_references_test.dart
+++ b/runtime/observatory/tests/service/inbound_references_test.dart
@@ -26,7 +26,7 @@
array[1] = e;
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
var lib = await isolate.rootLibrary.load();
var field = lib.variables.where((v) => v.name == 'e').single;
diff --git a/runtime/observatory/tests/service/instance_field_order_rpc_test.dart b/runtime/observatory/tests/service/instance_field_order_rpc_test.dart
index 5502bd3d..023f832 100644
--- a/runtime/observatory/tests/service/instance_field_order_rpc_test.dart
+++ b/runtime/observatory/tests/service/instance_field_order_rpc_test.dart
@@ -27,7 +27,7 @@
return await isolate.invokeRpcNoUpgrade('evaluate', params);
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
// Call eval to get a Dart list.
var evalResult = await eval(isolate, 'new Sub()');
diff --git a/runtime/observatory/tests/service/isolate_lifecycle_test.dart b/runtime/observatory/tests/service/isolate_lifecycle_test.dart
index eb8b018..345b90d 100644
--- a/runtime/observatory/tests/service/isolate_lifecycle_test.dart
+++ b/runtime/observatory/tests/service/isolate_lifecycle_test.dart
@@ -38,7 +38,7 @@
return paused;
}
-var tests = [
+var tests = <VMTest>[
(VM vm) async {
expect(vm.isolates.length, 1);
await hasStoppedAtBreakpoint(vm.isolates[0]);
diff --git a/runtime/observatory/tests/service/issue_25465_test.dart b/runtime/observatory/tests/service/issue_25465_test.dart
index 501ad33..3ffb543 100644
--- a/runtime/observatory/tests/service/issue_25465_test.dart
+++ b/runtime/observatory/tests/service/issue_25465_test.dart
@@ -18,7 +18,7 @@
print(foo);
}
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
// Add breakpoints at line 11 and line 12.
diff --git a/runtime/observatory/tests/service/issue_27238_test.dart b/runtime/observatory/tests/service/issue_27238_test.dart
index 01945a6..0fa2c44 100644
--- a/runtime/observatory/tests/service/issue_27238_test.dart
+++ b/runtime/observatory/tests/service/issue_27238_test.dart
@@ -26,7 +26,7 @@
print('foo2'); // LINE_E.
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_A),
smartNext,
diff --git a/runtime/observatory/tests/service/issue_27287_test.dart b/runtime/observatory/tests/service/issue_27287_test.dart
index f5dfe062..a1075d3 100644
--- a/runtime/observatory/tests/service/issue_27287_test.dart
+++ b/runtime/observatory/tests/service/issue_27287_test.dart
@@ -19,7 +19,7 @@
print("and after");
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_A),
stepOver,
diff --git a/runtime/observatory/tests/service/issue_30555_test.dart b/runtime/observatory/tests/service/issue_30555_test.dart
index 0fc8876..03f7def 100644
--- a/runtime/observatory/tests/service/issue_30555_test.dart
+++ b/runtime/observatory/tests/service/issue_30555_test.dart
@@ -31,7 +31,7 @@
dart.Isolate.spawn(isolate, receive.sendPort);
}
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
(Isolate isolate) async {
int step = 0;
diff --git a/runtime/observatory/tests/service/library_dependency_test.dart b/runtime/observatory/tests/service/library_dependency_test.dart
index 4b3fea5..1998ef1 100644
--- a/runtime/observatory/tests/service/library_dependency_test.dart
+++ b/runtime/observatory/tests/service/library_dependency_test.dart
@@ -11,7 +11,7 @@
import 'dart:mirrors' as mirrors;
import 'dart:convert' deferred as convert;
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
var lib = await isolate.rootLibrary.load();
// Use mirrors to shutup the analyzer.
diff --git a/runtime/observatory/tests/service/local_variable_declaration_test.dart b/runtime/observatory/tests/service/local_variable_declaration_test.dart
index 058a948..0177518 100644
--- a/runtime/observatory/tests/service/local_variable_declaration_test.dart
+++ b/runtime/observatory/tests/service/local_variable_declaration_test.dart
@@ -28,7 +28,7 @@
testParameters(0, 0);
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedInFunction('testMain'),
(Isolate isolate) async {
diff --git a/runtime/observatory/tests/service/logging_test.dart b/runtime/observatory/tests/service/logging_test.dart
index 1ec0a9a..5e24f01 100644
--- a/runtime/observatory/tests/service/logging_test.dart
+++ b/runtime/observatory/tests/service/logging_test.dart
@@ -30,7 +30,7 @@
Logger.root.info('YES');
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
resumeIsolateAndAwaitEvent(Isolate.kLoggingStream, (ServiceEvent event) {
expect(event.kind, equals(ServiceEvent.kLogging));
diff --git a/runtime/observatory/tests/service/malformed_test.dart b/runtime/observatory/tests/service/malformed_test.dart
index ca9d5a2..28a1a04 100644
--- a/runtime/observatory/tests/service/malformed_test.dart
+++ b/runtime/observatory/tests/service/malformed_test.dart
@@ -7,7 +7,7 @@
import 'package:unittest/unittest.dart';
import 'test_helper.dart';
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
bool caughtException;
try {
diff --git a/runtime/observatory/tests/service/metrics_test.dart b/runtime/observatory/tests/service/metrics_test.dart
index 9e96a93..d690972 100644
--- a/runtime/observatory/tests/service/metrics_test.dart
+++ b/runtime/observatory/tests/service/metrics_test.dart
@@ -15,7 +15,7 @@
counter.value = 1234.5;
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
Map metrics = await isolate.refreshDartMetrics();
expect(metrics.length, equals(1));
diff --git a/runtime/observatory/tests/service/mirror_references_test.dart b/runtime/observatory/tests/service/mirror_references_test.dart
index cdcd70c..9b9b155 100644
--- a/runtime/observatory/tests/service/mirror_references_test.dart
+++ b/runtime/observatory/tests/service/mirror_references_test.dart
@@ -25,7 +25,7 @@
.reflectee;
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
var lib = await isolate.rootLibrary.load();
Field fooField = lib.variables.singleWhere((v) => v.name == 'foo');
diff --git a/runtime/observatory/tests/service/mixin_break_test.dart b/runtime/observatory/tests/service/mixin_break_test.dart
index 09dcd05..f32e87a 100644
--- a/runtime/observatory/tests/service/mixin_break_test.dart
+++ b/runtime/observatory/tests/service/mixin_break_test.dart
@@ -34,7 +34,7 @@
"$file:5:5 (mixin_break_class2.dart:7:5)",
];
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
setBreakpointAtUriAndLine(file, 5),
resumeProgramRecordingStops(stops, true),
diff --git a/runtime/observatory/tests/service/native_metrics_test.dart b/runtime/observatory/tests/service/native_metrics_test.dart
index 0803fab..532a736 100644
--- a/runtime/observatory/tests/service/native_metrics_test.dart
+++ b/runtime/observatory/tests/service/native_metrics_test.dart
@@ -15,7 +15,7 @@
counter.value = 1234.5;
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
Map metrics = await isolate.refreshNativeMetrics();
expect(metrics.length, greaterThan(1));
diff --git a/runtime/observatory/tests/service/next_through_assign_call_test.dart b/runtime/observatory/tests/service/next_through_assign_call_test.dart
index cc45913..3b815d2 100644
--- a/runtime/observatory/tests/service/next_through_assign_call_test.dart
+++ b/runtime/observatory/tests/service/next_through_assign_call_test.dart
@@ -48,7 +48,7 @@
"$file:${LINE_A+13}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE_A),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_assign_int_test.dart b/runtime/observatory/tests/service/next_through_assign_int_test.dart
index 8de5078..c57fd84 100644
--- a/runtime/observatory/tests/service/next_through_assign_int_test.dart
+++ b/runtime/observatory/tests/service/next_through_assign_int_test.dart
@@ -44,7 +44,7 @@
"$file:${LINE_A+13}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE_A),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_call_on_field_in_class_test.dart b/runtime/observatory/tests/service/next_through_call_on_field_in_class_test.dart
index 5e3d20d..8f5eef8 100644
--- a/runtime/observatory/tests/service/next_through_call_on_field_in_class_test.dart
+++ b/runtime/observatory/tests/service/next_through_call_on_field_in_class_test.dart
@@ -34,7 +34,7 @@
"$file:${LINE_A+5}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE_A),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_call_on_field_test.dart b/runtime/observatory/tests/service/next_through_call_on_field_test.dart
index a9f9f32..c47cd82 100644
--- a/runtime/observatory/tests/service/next_through_call_on_field_test.dart
+++ b/runtime/observatory/tests/service/next_through_call_on_field_test.dart
@@ -29,7 +29,7 @@
"$file:${LINE_A+4}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE_A),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_call_on_static_field_in_class_test.dart b/runtime/observatory/tests/service/next_through_call_on_static_field_in_class_test.dart
index ef03214..d4b351f 100644
--- a/runtime/observatory/tests/service/next_through_call_on_static_field_in_class_test.dart
+++ b/runtime/observatory/tests/service/next_through_call_on_static_field_in_class_test.dart
@@ -31,7 +31,7 @@
"$file:${LINE_A+4}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE_A),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_catch_test.dart b/runtime/observatory/tests/service/next_through_catch_test.dart
index b38bc4f..3942e0f 100644
--- a/runtime/observatory/tests/service/next_through_catch_test.dart
+++ b/runtime/observatory/tests/service/next_through_catch_test.dart
@@ -36,7 +36,7 @@
"$file:${LINE_A+13}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE_A),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_closure_test.dart b/runtime/observatory/tests/service/next_through_closure_test.dart
index f7295a7..0c7d8ae 100644
--- a/runtime/observatory/tests/service/next_through_closure_test.dart
+++ b/runtime/observatory/tests/service/next_through_closure_test.dart
@@ -27,7 +27,7 @@
"$file:${LINE_A+6}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE_A),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_create_list_and_map_test.dart b/runtime/observatory/tests/service/next_through_create_list_and_map_test.dart
index 9513858..523ef13 100644
--- a/runtime/observatory/tests/service/next_through_create_list_and_map_test.dart
+++ b/runtime/observatory/tests/service/next_through_create_list_and_map_test.dart
@@ -78,7 +78,7 @@
"$file:${LINE_A+33}:1"
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE_A),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_for_each_loop_test.dart b/runtime/observatory/tests/service/next_through_for_each_loop_test.dart
index 2b06723..5a0072d 100644
--- a/runtime/observatory/tests/service/next_through_for_each_loop_test.dart
+++ b/runtime/observatory/tests/service/next_through_for_each_loop_test.dart
@@ -50,7 +50,7 @@
"$file:${LINE+4}:1"
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_for_loop_with_break_and_continue_test.dart b/runtime/observatory/tests/service/next_through_for_loop_with_break_and_continue_test.dart
index 5c378b1..f794803 100644
--- a/runtime/observatory/tests/service/next_through_for_loop_with_break_and_continue_test.dart
+++ b/runtime/observatory/tests/service/next_through_for_loop_with_break_and_continue_test.dart
@@ -61,7 +61,7 @@
"$file:${LINE_A+11}:1"
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE_A),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_function_expression_test.dart b/runtime/observatory/tests/service/next_through_function_expression_test.dart
index 87740f5..ef33331 100644
--- a/runtime/observatory/tests/service/next_through_function_expression_test.dart
+++ b/runtime/observatory/tests/service/next_through_function_expression_test.dart
@@ -28,7 +28,7 @@
"$file:${LINE_A+5}:3" // on 'return'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE_A),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_is_and_as_test.dart b/runtime/observatory/tests/service/next_through_is_and_as_test.dart
index 5018dcc..be80432 100644
--- a/runtime/observatory/tests/service/next_through_is_and_as_test.dart
+++ b/runtime/observatory/tests/service/next_through_is_and_as_test.dart
@@ -53,7 +53,7 @@
"$file:${LINE_A+26}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE_A),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_multi_catch_test.dart b/runtime/observatory/tests/service/next_through_multi_catch_test.dart
index ba326f8..855d6b6 100644
--- a/runtime/observatory/tests/service/next_through_multi_catch_test.dart
+++ b/runtime/observatory/tests/service/next_through_multi_catch_test.dart
@@ -29,7 +29,7 @@
"$file:${LINE+9}:1", // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_new_test.dart b/runtime/observatory/tests/service/next_through_new_test.dart
index 552b4e6..115f707 100644
--- a/runtime/observatory/tests/service/next_through_new_test.dart
+++ b/runtime/observatory/tests/service/next_through_new_test.dart
@@ -24,7 +24,7 @@
"$file:${LINE_A+2}:3" // on 'return'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE_A),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_operator_bracket_on_super_test.dart b/runtime/observatory/tests/service/next_through_operator_bracket_on_super_test.dart
index a1e7501..b67ae51 100644
--- a/runtime/observatory/tests/service/next_through_operator_bracket_on_super_test.dart
+++ b/runtime/observatory/tests/service/next_through_operator_bracket_on_super_test.dart
@@ -37,7 +37,7 @@
"$file:${LINE+1}:5", // on 'return'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_operator_bracket_on_this_test.dart b/runtime/observatory/tests/service/next_through_operator_bracket_on_this_test.dart
index e9d8752..acd3082 100644
--- a/runtime/observatory/tests/service/next_through_operator_bracket_on_this_test.dart
+++ b/runtime/observatory/tests/service/next_through_operator_bracket_on_this_test.dart
@@ -30,7 +30,7 @@
"$file:${LINE+1}:5", // on 'return'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_operator_bracket_test.dart b/runtime/observatory/tests/service/next_through_operator_bracket_test.dart
index 73f3948..164479b 100644
--- a/runtime/observatory/tests/service/next_through_operator_bracket_test.dart
+++ b/runtime/observatory/tests/service/next_through_operator_bracket_test.dart
@@ -31,7 +31,7 @@
"$file:${LINE+3}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_simple_async_test.dart b/runtime/observatory/tests/service/next_through_simple_async_test.dart
index 8e948d3..9ed99ed 100644
--- a/runtime/observatory/tests/service/next_through_simple_async_test.dart
+++ b/runtime/observatory/tests/service/next_through_simple_async_test.dart
@@ -38,7 +38,7 @@
"$file:${LINE_A+6}:1" // ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE_A),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_simple_async_with_returns_test.dart b/runtime/observatory/tests/service/next_through_simple_async_with_returns_test.dart
index e137345..c112a29 100644
--- a/runtime/observatory/tests/service/next_through_simple_async_with_returns_test.dart
+++ b/runtime/observatory/tests/service/next_through_simple_async_with_returns_test.dart
@@ -34,7 +34,7 @@
"$file:${LINE_A+4}:5" // on 'return'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE_A),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_simple_linear_2_test.dart b/runtime/observatory/tests/service/next_through_simple_linear_2_test.dart
index cda8f6e..25bfbd9 100644
--- a/runtime/observatory/tests/service/next_through_simple_linear_2_test.dart
+++ b/runtime/observatory/tests/service/next_through_simple_linear_2_test.dart
@@ -29,7 +29,7 @@
"$file:${LINE_A+3}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE_A),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/next_through_simple_linear_test.dart b/runtime/observatory/tests/service/next_through_simple_linear_test.dart
index 278458e..ae4943e 100644
--- a/runtime/observatory/tests/service/next_through_simple_linear_test.dart
+++ b/runtime/observatory/tests/service/next_through_simple_linear_test.dart
@@ -22,7 +22,7 @@
"$file:${LINE_A+3}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE_A),
runStepThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/object_graph_stack_reference_test.dart b/runtime/observatory/tests/service/object_graph_stack_reference_test.dart
index 1f45eb2..44828c9 100644
--- a/runtime/observatory/tests/service/object_graph_stack_reference_test.dart
+++ b/runtime/observatory/tests/service/object_graph_stack_reference_test.dart
@@ -51,7 +51,7 @@
}
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
checkForStackReferent,
resumeIsolate,
diff --git a/runtime/observatory/tests/service/object_graph_user_test.dart b/runtime/observatory/tests/service/object_graph_user_test.dart
index 886436b..c9b1f76 100644
--- a/runtime/observatory/tests/service/object_graph_user_test.dart
+++ b/runtime/observatory/tests/service/object_graph_user_test.dart
@@ -11,8 +11,8 @@
import 'test_helper.dart';
class Foo {
- Object left;
- Object right;
+ dynamic left;
+ dynamic right;
}
Foo r;
@@ -37,7 +37,7 @@
int fooId;
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
Library lib = await isolate.rootLibrary.load();
expect(lib.classes.length, equals(1));
diff --git a/runtime/observatory/tests/service/object_graph_vm_test.dart b/runtime/observatory/tests/service/object_graph_vm_test.dart
index 65c8466..8461620 100644
--- a/runtime/observatory/tests/service/object_graph_vm_test.dart
+++ b/runtime/observatory/tests/service/object_graph_vm_test.dart
@@ -11,8 +11,8 @@
import 'test_helper.dart';
class Foo {
- Object left;
- Object right;
+ dynamic left;
+ dynamic right;
}
Foo r;
@@ -37,7 +37,7 @@
int fooId;
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
Library lib = await isolate.rootLibrary.load();
expect(lib.classes.length, equals(1));
diff --git a/runtime/observatory/tests/service/observatory_assets_test.dart b/runtime/observatory/tests/service/observatory_assets_test.dart
index bd3befb..43054f6 100644
--- a/runtime/observatory/tests/service/observatory_assets_test.dart
+++ b/runtime/observatory/tests/service/observatory_assets_test.dart
@@ -8,7 +8,7 @@
import 'test_helper.dart';
-var tests = [
+var tests = <VMTest>[
(VM vm) async {
// Simple heartbeat test to ensure we can fetch Observatory resources.
var heartBeatUrl =
diff --git a/runtime/observatory/tests/service/parameters_in_scope_at_entry_test.dart b/runtime/observatory/tests/service/parameters_in_scope_at_entry_test.dart
index 184f311..3ed7a43 100644
--- a/runtime/observatory/tests/service/parameters_in_scope_at_entry_test.dart
+++ b/runtime/observatory/tests/service/parameters_in_scope_at_entry_test.dart
@@ -34,7 +34,7 @@
f("in-scope"); // Line B.
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_A),
(isolate) => isolate.stepInto(),
diff --git a/runtime/observatory/tests/service/pause_idle_isolate_test.dart b/runtime/observatory/tests/service/pause_idle_isolate_test.dart
index 61de8d7..d43e192 100644
--- a/runtime/observatory/tests/service/pause_idle_isolate_test.dart
+++ b/runtime/observatory/tests/service/pause_idle_isolate_test.dart
@@ -19,7 +19,7 @@
debugger();
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
(Isolate isolate) async {
print('Resuming...');
diff --git a/runtime/observatory/tests/service/pause_on_exceptions_test.dart b/runtime/observatory/tests/service/pause_on_exceptions_test.dart
index 61668d7..34bc53b 100644
--- a/runtime/observatory/tests/service/pause_on_exceptions_test.dart
+++ b/runtime/observatory/tests/service/pause_on_exceptions_test.dart
@@ -24,7 +24,7 @@
return "end of doUncaught";
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
var lib = await isolate.rootLibrary.reload();
diff --git a/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart b/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart
index 0ccd29d..617465b 100644
--- a/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart
+++ b/runtime/observatory/tests/service/pause_on_start_and_exit_test.dart
@@ -13,7 +13,7 @@
print('Hello');
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
print('Getting stream...');
Completer completer = new Completer();
diff --git a/runtime/observatory/tests/service/pause_on_start_then_step_test.dart b/runtime/observatory/tests/service/pause_on_start_then_step_test.dart
index 8274a8c..6fafed3 100644
--- a/runtime/observatory/tests/service/pause_on_start_then_step_test.dart
+++ b/runtime/observatory/tests/service/pause_on_start_then_step_test.dart
@@ -13,7 +13,7 @@
print('Hello');
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
print('Getting stream...');
Completer completer = new Completer();
diff --git a/runtime/observatory/tests/service/pause_on_unhandled_async_exceptions2_test.dart b/runtime/observatory/tests/service/pause_on_unhandled_async_exceptions2_test.dart
index bdc7d7e..6550be5 100644
--- a/runtime/observatory/tests/service/pause_on_unhandled_async_exceptions2_test.dart
+++ b/runtime/observatory/tests/service/pause_on_unhandled_async_exceptions2_test.dart
@@ -34,7 +34,7 @@
await asyncThrower(); // LINE_A
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedWithUnhandledException,
(Isolate isolate) async {
print("We stopped!");
diff --git a/runtime/observatory/tests/service/pause_on_unhandled_async_exceptions_test.dart b/runtime/observatory/tests/service/pause_on_unhandled_async_exceptions_test.dart
index 7f35d4c..cebbcd2 100644
--- a/runtime/observatory/tests/service/pause_on_unhandled_async_exceptions_test.dart
+++ b/runtime/observatory/tests/service/pause_on_unhandled_async_exceptions_test.dart
@@ -36,7 +36,7 @@
} on Foo catch (e) {}
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedWithUnhandledException,
(Isolate isolate) async {
print("We stopped!");
diff --git a/runtime/observatory/tests/service/pause_on_unhandled_exceptions_test.dart b/runtime/observatory/tests/service/pause_on_unhandled_exceptions_test.dart
index ca01ecf..de1b5e9 100644
--- a/runtime/observatory/tests/service/pause_on_unhandled_exceptions_test.dart
+++ b/runtime/observatory/tests/service/pause_on_unhandled_exceptions_test.dart
@@ -13,7 +13,7 @@
return "end of doThrow";
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedWithUnhandledException,
(Isolate isolate) async {
print("We stopped!");
diff --git a/runtime/observatory/tests/service/positive_token_pos_test.dart b/runtime/observatory/tests/service/positive_token_pos_test.dart
index 05ef175..ceb42fc 100644
--- a/runtime/observatory/tests/service/positive_token_pos_test.dart
+++ b/runtime/observatory/tests/service/positive_token_pos_test.dart
@@ -18,7 +18,7 @@
helper(); // Line 18, Col 3 is the position of the function call.
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
markDartColonLibrariesDebuggable,
stoppedAtLine(18),
diff --git a/runtime/observatory/tests/service/process_service_test.dart b/runtime/observatory/tests/service/process_service_test.dart
index 5edf99a..233e4b0 100644
--- a/runtime/observatory/tests/service/process_service_test.dart
+++ b/runtime/observatory/tests/service/process_service_test.dart
@@ -77,7 +77,7 @@
registerExtension('ext.dart.io.closeStdin', closeStdin);
}
-var processTests = [
+var processTests = <IsolateTest>[
// Initial.
(Isolate isolate) async {
var setup = await isolate.invokeRpcNoUpgrade('ext.dart.io.setup', {});
diff --git a/runtime/observatory/tests/service/reachable_size_test.dart b/runtime/observatory/tests/service/reachable_size_test.dart
index 6ef94e6..b53a1fb 100644
--- a/runtime/observatory/tests/service/reachable_size_test.dart
+++ b/runtime/observatory/tests/service/reachable_size_test.dart
@@ -39,7 +39,7 @@
});
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
Instance p1 = await rootLibraryFieldValue(isolate, "p1");
Instance p2 = await rootLibraryFieldValue(isolate, "p2");
diff --git a/runtime/observatory/tests/service/regexp_function_test.dart b/runtime/observatory/tests/service/regexp_function_test.dart
index d599972..6fb09bc 100644
--- a/runtime/observatory/tests/service/regexp_function_test.dart
+++ b/runtime/observatory/tests/service/regexp_function_test.dart
@@ -20,7 +20,7 @@
expect(matches.length, equals(3));
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
Library lib = isolate.rootLibrary;
await lib.load();
diff --git a/runtime/observatory/tests/service/regress_28443_test.dart b/runtime/observatory/tests/service/regress_28443_test.dart
index da09bca..3590e51 100644
--- a/runtime/observatory/tests/service/regress_28443_test.dart
+++ b/runtime/observatory/tests/service/regress_28443_test.dart
@@ -38,7 +38,7 @@
}
}
-Future<Isolate> stepThroughProgram(Isolate isolate) async {
+Future stepThroughProgram(Isolate isolate) async {
Completer completer = new Completer();
int pauseEventsSeen = 0;
@@ -60,7 +60,7 @@
return completer.future;
}
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
markDartColonLibrariesDebuggable,
setBreakpointAtLine(LINE_B),
diff --git a/runtime/observatory/tests/service/regress_28980_test.dart b/runtime/observatory/tests/service/regress_28980_test.dart
index 2131225..65a59ae 100644
--- a/runtime/observatory/tests/service/regress_28980_test.dart
+++ b/runtime/observatory/tests/service/regress_28980_test.dart
@@ -47,7 +47,7 @@
}
}
-Future<Isolate> stepThroughProgram(Isolate isolate) async {
+Future stepThroughProgram(Isolate isolate) async {
Completer completer = new Completer();
int pauseEventsSeen = 0;
@@ -69,7 +69,7 @@
return completer.future;
}
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
markDartColonLibrariesDebuggable,
setBreakpointAtLine(LINE_A),
diff --git a/runtime/observatory/tests/service/reload_sources_test.dart b/runtime/observatory/tests/service/reload_sources_test.dart
index bbcdf85..1ca814b 100644
--- a/runtime/observatory/tests/service/reload_sources_test.dart
+++ b/runtime/observatory/tests/service/reload_sources_test.dart
@@ -13,7 +13,7 @@
while (true) {}
}
-var tests = [
+var tests = <IsolateTest>[
// Stopped at 'debugger' statement.
hasStoppedAtBreakpoint,
// Reload sources and request to pause post reload. The pause request will be
diff --git a/runtime/observatory/tests/service/rewind_optimized_out_test.dart b/runtime/observatory/tests/service/rewind_optimized_out_test.dart
index 653b92e..d41a09d 100644
--- a/runtime/observatory/tests/service/rewind_optimized_out_test.dart
+++ b/runtime/observatory/tests/service/rewind_optimized_out_test.dart
@@ -48,7 +48,7 @@
}
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_A),
(Isolate isolate) async {
diff --git a/runtime/observatory/tests/service/rewind_test.dart b/runtime/observatory/tests/service/rewind_test.dart
index a9563eb..812febd 100644
--- a/runtime/observatory/tests/service/rewind_test.dart
+++ b/runtime/observatory/tests/service/rewind_test.dart
@@ -48,7 +48,7 @@
}
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_A),
(Isolate isolate) async {
diff --git a/runtime/observatory/tests/service/service.status b/runtime/observatory/tests/service/service.status
index 15f20e2..48773d6 100644
--- a/runtime/observatory/tests/service/service.status
+++ b/runtime/observatory/tests/service/service.status
@@ -66,8 +66,9 @@
# batch mode.
[ $arch == simdbc64 && $compiler == dartk ]
coverage_optimized_function_test: Crash # Please triage
-rewind_optimized_out_test: RuntimeError # Please triage
-rewind_test: RuntimeError # Please triage
+
+[ $arch == simdbc64 && $compiler == dartk && $mode == debug ]
+eval_test: Pass, Slow
[ $builder_tag == strong && $compiler == dart2analyzer ]
*: Skip # Issue 28649
diff --git a/runtime/observatory/tests/service/service_kernel.status b/runtime/observatory/tests/service/service_kernel.status
index 584b24f..64236ee 100644
--- a/runtime/observatory/tests/service/service_kernel.status
+++ b/runtime/observatory/tests/service/service_kernel.status
@@ -168,7 +168,6 @@
positive_token_pos_test: CompileTimeError
process_service_test: CompileTimeError
reachable_size_test: CompileTimeError
-read_stream_test: CompileTimeError
regexp_function_test: CompileTimeError
regress_28443_test: CompileTimeError
regress_28980_test: CompileTimeError
diff --git a/runtime/observatory/tests/service/service_test_common.dart b/runtime/observatory/tests/service/service_test_common.dart
index a011901..4a739e5 100644
--- a/runtime/observatory/tests/service/service_test_common.dart
+++ b/runtime/observatory/tests/service/service_test_common.dart
@@ -12,13 +12,15 @@
typedef Future IsolateTest(Isolate isolate);
typedef Future VMTest(VM vm);
+typedef void ServiceEventHandler(ServiceEvent event);
Map<String, StreamSubscription> streamSubscriptions = {};
-Future subscribeToStream(VM vm, String streamName, onEvent) async {
+Future subscribeToStream(
+ VM vm, String streamName, ServiceEventHandler onEvent) async {
assert(streamSubscriptions[streamName] == null);
- Stream stream = await vm.getEventStream(streamName);
+ Stream<ServiceEvent> stream = await vm.getEventStream(streamName);
StreamSubscription subscription = stream.listen(onEvent);
streamSubscriptions[streamName] = subscription;
}
@@ -32,7 +34,7 @@
Future smartNext(Isolate isolate) async {
print('smartNext');
if (isolate.status == M.IsolateStatus.paused) {
- var event = isolate.pauseEvent;
+ dynamic event = isolate.pauseEvent;
if (event.atAsyncSuspension) {
return asyncNext(isolate);
} else {
@@ -46,7 +48,7 @@
Future asyncNext(Isolate isolate) async {
print('asyncNext');
if (isolate.status == M.IsolateStatus.paused) {
- var event = isolate.pauseEvent;
+ dynamic event = isolate.pauseEvent;
if (!event.atAsyncSuspension) {
throw 'No async continuation at this location';
} else {
@@ -86,7 +88,7 @@
}
// Subscribe to the debugger event stream.
- Stream stream;
+ Stream<ServiceEvent> stream;
try {
stream = await isolate.vm.getEventStream(VM.kDebugStream);
} catch (e) {
@@ -151,7 +153,7 @@
}
}
-Future<Isolate> hasPausedFor(Isolate isolate, String kind) {
+Future hasPausedFor(Isolate isolate, String kind) {
// Set up a listener to wait for breakpoint events.
Completer completer = new Completer();
isolate.vm.getEventStream(VM.kDebugStream).then((stream) {
@@ -186,27 +188,27 @@
return completer.future; // Will complete when breakpoint hit.
}
-Future<Isolate> hasStoppedAtBreakpoint(Isolate isolate) {
+Future hasStoppedAtBreakpoint(Isolate isolate) {
return hasPausedFor(isolate, ServiceEvent.kPauseBreakpoint);
}
-Future<Isolate> hasStoppedPostRequest(Isolate isolate) {
+Future hasStoppedPostRequest(Isolate isolate) {
return hasPausedFor(isolate, ServiceEvent.kPausePostRequest);
}
-Future<Isolate> hasStoppedWithUnhandledException(Isolate isolate) {
+Future hasStoppedWithUnhandledException(Isolate isolate) {
return hasPausedFor(isolate, ServiceEvent.kPauseException);
}
-Future<Isolate> hasStoppedAtExit(Isolate isolate) {
+Future hasStoppedAtExit(Isolate isolate) {
return hasPausedFor(isolate, ServiceEvent.kPauseExit);
}
-Future<Isolate> hasPausedAtStart(Isolate isolate) {
+Future hasPausedAtStart(Isolate isolate) {
return hasPausedFor(isolate, ServiceEvent.kPauseStart);
}
-Future<Isolate> markDartColonLibrariesDebuggable(Isolate isolate) async {
+Future markDartColonLibrariesDebuggable(Isolate isolate) async {
await isolate.reload();
for (Library lib in isolate.libraries) {
await lib.load();
@@ -327,7 +329,7 @@
};
}
-Future<Isolate> resumeIsolate(Isolate isolate) {
+Future resumeIsolate(Isolate isolate) {
Completer completer = new Completer();
isolate.vm.getEventStream(VM.kDebugStream).then((stream) {
var subscription;
@@ -363,17 +365,17 @@
resumeAndAwaitEvent(isolate, stream, onEvent);
}
-Future<Isolate> stepOver(Isolate isolate) async {
+Future stepOver(Isolate isolate) async {
await isolate.stepOver();
return hasStoppedAtBreakpoint(isolate);
}
-Future<Isolate> stepInto(Isolate isolate) async {
+Future stepInto(Isolate isolate) async {
await isolate.stepInto();
return hasStoppedAtBreakpoint(isolate);
}
-Future<Isolate> stepOut(Isolate isolate) async {
+Future stepOut(Isolate isolate) async {
await isolate.stepOut();
return hasStoppedAtBreakpoint(isolate);
}
diff --git a/runtime/observatory/tests/service/set_library_debuggable_rpc_test.dart b/runtime/observatory/tests/service/set_library_debuggable_rpc_test.dart
index 9877f63..92450d3 100644
--- a/runtime/observatory/tests/service/set_library_debuggable_rpc_test.dart
+++ b/runtime/observatory/tests/service/set_library_debuggable_rpc_test.dart
@@ -10,7 +10,7 @@
import 'test_helper.dart';
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
var result;
diff --git a/runtime/observatory/tests/service/set_library_debuggable_test.dart b/runtime/observatory/tests/service/set_library_debuggable_test.dart
index 71c9a81..50573a2 100644
--- a/runtime/observatory/tests/service/set_library_debuggable_test.dart
+++ b/runtime/observatory/tests/service/set_library_debuggable_test.dart
@@ -22,7 +22,7 @@
print('zoo'); // LINE_C.
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
markDartColonLibrariesDebuggable,
(Isolate isolate) async {
diff --git a/runtime/observatory/tests/service/set_name_rpc_test.dart b/runtime/observatory/tests/service/set_name_rpc_test.dart
index f2b41d1..3dacd73 100644
--- a/runtime/observatory/tests/service/set_name_rpc_test.dart
+++ b/runtime/observatory/tests/service/set_name_rpc_test.dart
@@ -8,7 +8,7 @@
import 'test_helper.dart';
import 'dart:async';
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
expect(isolate.name, equals('set_name_rpc_test.dart:main()'));
diff --git a/runtime/observatory/tests/service/set_vm_name_rpc_test.dart b/runtime/observatory/tests/service/set_vm_name_rpc_test.dart
index 72d4026..2532efd 100644
--- a/runtime/observatory/tests/service/set_vm_name_rpc_test.dart
+++ b/runtime/observatory/tests/service/set_vm_name_rpc_test.dart
@@ -8,7 +8,7 @@
import 'package:unittest/unittest.dart';
import 'test_helper.dart';
-var tests = [
+var tests = <VMTest>[
(VM vm) async {
expect(vm.name, equals('Walter'));
diff --git a/runtime/observatory/tests/service/steal_breakpoint_test.dart b/runtime/observatory/tests/service/steal_breakpoint_test.dart
index 63514dd..b861aea 100644
--- a/runtime/observatory/tests/service/steal_breakpoint_test.dart
+++ b/runtime/observatory/tests/service/steal_breakpoint_test.dart
@@ -21,7 +21,7 @@
new Timer.periodic(const Duration(milliseconds: 10), periodicTask);
}
-var tests = [
+var tests = <IsolateTest>[
// Add a breakpoint and wait for it to be reached.
(Isolate isolate) async {
await isolate.rootLibrary.load();
diff --git a/runtime/observatory/tests/service/step_into_async_no_await_test.dart b/runtime/observatory/tests/service/step_into_async_no_await_test.dart
index 70715ae..fffe5b0 100644
--- a/runtime/observatory/tests/service/step_into_async_no_await_test.dart
+++ b/runtime/observatory/tests/service/step_into_async_no_await_test.dart
@@ -20,7 +20,7 @@
asyncWithoutAwait(); // Line A.
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_A),
(isolate) => isolate.stepInto(),
diff --git a/runtime/observatory/tests/service/step_over_await_test.dart b/runtime/observatory/tests/service/step_over_await_test.dart
index c00cc91..f2db331 100644
--- a/runtime/observatory/tests/service/step_over_await_test.dart
+++ b/runtime/observatory/tests/service/step_over_await_test.dart
@@ -28,7 +28,7 @@
asyncFunction();
}
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
stoppedAtLine(LINE_A),
stepOver, // At new Duration().
diff --git a/runtime/observatory/tests/service/step_test.dart b/runtime/observatory/tests/service/step_test.dart
index add7e78..973a208 100644
--- a/runtime/observatory/tests/service/step_test.dart
+++ b/runtime/observatory/tests/service/step_test.dart
@@ -14,7 +14,7 @@
var x = {}; // LINE_A
}
-Future<Isolate> stepThroughProgram(Isolate isolate) async {
+Future stepThroughProgram(Isolate isolate) async {
Completer completer = new Completer();
int pauseEventsSeen = 0;
@@ -36,7 +36,7 @@
return completer.future;
}
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
markDartColonLibrariesDebuggable,
setBreakpointAtLine(LINE_A),
diff --git a/runtime/observatory/tests/service/step_through_arithmetic_test.dart b/runtime/observatory/tests/service/step_through_arithmetic_test.dart
index 30df076..6c2c1d8 100644
--- a/runtime/observatory/tests/service/step_through_arithmetic_test.dart
+++ b/runtime/observatory/tests/service/step_through_arithmetic_test.dart
@@ -37,7 +37,7 @@
"$file:${LINE+5}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE),
runStepIntoThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/step_through_constructor_calls_test.dart b/runtime/observatory/tests/service/step_through_constructor_calls_test.dart
index 50661b4..a78fb57 100644
--- a/runtime/observatory/tests/service/step_through_constructor_calls_test.dart
+++ b/runtime/observatory/tests/service/step_through_constructor_calls_test.dart
@@ -60,7 +60,7 @@
"$file:${LINE+10}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE),
runStepIntoThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/step_through_function_2_test.dart b/runtime/observatory/tests/service/step_through_function_2_test.dart
index 9fd64d4..d5df807 100644
--- a/runtime/observatory/tests/service/step_through_function_2_test.dart
+++ b/runtime/observatory/tests/service/step_through_function_2_test.dart
@@ -69,7 +69,7 @@
"$file:${LINE+6}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE),
runStepIntoThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/step_through_function_test.dart b/runtime/observatory/tests/service/step_through_function_test.dart
index 47a2a46..d206c3a 100644
--- a/runtime/observatory/tests/service/step_through_function_test.dart
+++ b/runtime/observatory/tests/service/step_through_function_test.dart
@@ -94,7 +94,7 @@
"$file:${LINE+10}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE),
runStepIntoThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/step_through_getter_test.dart b/runtime/observatory/tests/service/step_through_getter_test.dart
index 9b63e3a..f0160c2 100644
--- a/runtime/observatory/tests/service/step_through_getter_test.dart
+++ b/runtime/observatory/tests/service/step_through_getter_test.dart
@@ -64,7 +64,7 @@
"$file:${LINE+6}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE),
runStepIntoThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/step_through_property_get_test.dart b/runtime/observatory/tests/service/step_through_property_get_test.dart
index 9eadc18..e312723 100644
--- a/runtime/observatory/tests/service/step_through_property_get_test.dart
+++ b/runtime/observatory/tests/service/step_through_property_get_test.dart
@@ -64,7 +64,7 @@
"$file:${LINE+8}:3" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE),
runStepIntoThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/step_through_property_set_test.dart b/runtime/observatory/tests/service/step_through_property_set_test.dart
index 317fb29..fab872b 100644
--- a/runtime/observatory/tests/service/step_through_property_set_test.dart
+++ b/runtime/observatory/tests/service/step_through_property_set_test.dart
@@ -64,7 +64,7 @@
"$file:${LINE+8}:3" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE),
runStepIntoThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/step_through_setter_test.dart b/runtime/observatory/tests/service/step_through_setter_test.dart
index bc51746..1274c2f 100644
--- a/runtime/observatory/tests/service/step_through_setter_test.dart
+++ b/runtime/observatory/tests/service/step_through_setter_test.dart
@@ -49,7 +49,7 @@
"$file:${LINE+4}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE),
runStepIntoThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/step_through_switch_test.dart b/runtime/observatory/tests/service/step_through_switch_test.dart
index cf3fbef..bd65fe7 100644
--- a/runtime/observatory/tests/service/step_through_switch_test.dart
+++ b/runtime/observatory/tests/service/step_through_switch_test.dart
@@ -68,7 +68,7 @@
"$file:${LINE+5}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE),
runStepIntoThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/step_through_switch_with_continue_test.dart b/runtime/observatory/tests/service/step_through_switch_with_continue_test.dart
index 0c7c63e..cfcce49 100644
--- a/runtime/observatory/tests/service/step_through_switch_with_continue_test.dart
+++ b/runtime/observatory/tests/service/step_through_switch_with_continue_test.dart
@@ -43,7 +43,7 @@
"$file:${LINE+15}:1" // on ending '}'
];
-var tests = [
+var tests = <IsolateTest>[
hasPausedAtStart,
setBreakpointAtLine(LINE),
runStepIntoThroughProgramRecordingStops(stops),
diff --git a/runtime/observatory/tests/service/string_escaping_test.dart b/runtime/observatory/tests/service/string_escaping_test.dart
index d9611a9..7d1b358 100644
--- a/runtime/observatory/tests/service/string_escaping_test.dart
+++ b/runtime/observatory/tests/service/string_escaping_test.dart
@@ -5,6 +5,7 @@
library string_escaping_test;
+import 'dart:async';
import 'package:observatory/service_io.dart';
import 'package:unittest/unittest.dart';
import 'test_helper.dart';
@@ -48,7 +49,7 @@
malformedWithTrailSurrogate = "before" + "𝄞"[1] + "after";
}
-testStrings(Isolate isolate) async {
+Future testStrings(Isolate isolate) async {
Library lib = isolate.rootLibrary;
await lib.load();
for (var variable in lib.variables) {
@@ -87,7 +88,7 @@
expectFullString('malformedWithTrailSurrogate', malformedWithTrailSurrogate);
}
-var tests = [
+var tests = <IsolateTest>[
testStrings,
];
diff --git a/runtime/observatory/tests/service/tcp_socket_closing_service_test.dart b/runtime/observatory/tests/service/tcp_socket_closing_service_test.dart
index 970bca8..c22794e 100644
--- a/runtime/observatory/tests/service/tcp_socket_closing_service_test.dart
+++ b/runtime/observatory/tests/service/tcp_socket_closing_service_test.dart
@@ -50,7 +50,7 @@
await io.ServerSocket.bind('127.0.0.1', 0);
}
-var tests = [
+var tests = <IsolateTest>[
// Initial.
(Isolate isolate) async {
var result =
diff --git a/runtime/observatory/tests/service/tcp_socket_service_test.dart b/runtime/observatory/tests/service/tcp_socket_service_test.dart
index ef1c37d..aef552a 100644
--- a/runtime/observatory/tests/service/tcp_socket_service_test.dart
+++ b/runtime/observatory/tests/service/tcp_socket_service_test.dart
@@ -27,7 +27,7 @@
await socket2.flush();
}
-var tcpTests = [
+var tcpTests = <IsolateTest>[
// Initial.
(Isolate isolate) async {
var result =
diff --git a/runtime/observatory/tests/service/test_helper.dart b/runtime/observatory/tests/service/test_helper.dart
index 51cce59..13da4d1 100644
--- a/runtime/observatory/tests/service/test_helper.dart
+++ b/runtime/observatory/tests/service/test_helper.dart
@@ -9,6 +9,7 @@
import 'dart:io';
import 'package:observatory/service_io.dart';
import 'service_test_common.dart';
+export 'service_test_common.dart' show IsolateTest, VMTest;
/// Will be set to the http address of the VM's service protocol before
/// any tests are invoked.
@@ -124,7 +125,7 @@
String dartExecutable = Platform.executable;
- var fullArgs = [];
+ var fullArgs = <String>[];
if (pause_on_start) {
fullArgs.add('--pause-isolates-on-start');
}
@@ -159,8 +160,8 @@
String dartExecutable = _skyShellPath();
- var dartFlags = [];
- var fullArgs = [];
+ var dartFlags = <String>[];
+ var fullArgs = <String>[];
if (pause_on_start) {
dartFlags.add('--pause_isolates_on_start');
fullArgs.add('--start-paused');
@@ -258,9 +259,11 @@
}
void requestExit() {
- print('** Killing script');
- if (process.kill()) {
- killedByTester = true;
+ if (process != null) {
+ print('** Killing script');
+ if (process.kill()) {
+ killedByTester = true;
+ }
}
}
}
@@ -333,12 +336,12 @@
testsDone = true;
await process.requestExit();
});
- }, onError: (error, stackTrace) async {
+ }, onError: (error, stackTrace) {
if (testsDone) {
print('Ignoring late exception during process exit:\n'
'$error\n#stackTrace');
} else {
- await process.requestExit();
+ process.requestExit();
print('Unexpected exception in service tests: $error\n$stackTrace');
throw error;
}
diff --git a/runtime/observatory/tests/service/type_arguments_test.dart b/runtime/observatory/tests/service/type_arguments_test.dart
index 28d00a5..d8ce2c9 100644
--- a/runtime/observatory/tests/service/type_arguments_test.dart
+++ b/runtime/observatory/tests/service/type_arguments_test.dart
@@ -7,7 +7,7 @@
import 'package:unittest/unittest.dart';
import 'test_helper.dart';
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) =>
isolate.getTypeArgumentsList(false).then((ServiceMap allTypeArgs) {
var allTypeArgsTableSize =
diff --git a/runtime/observatory/tests/service/typed_data_test.dart b/runtime/observatory/tests/service/typed_data_test.dart
index abb7d53..2265045 100644
--- a/runtime/observatory/tests/service/typed_data_test.dart
+++ b/runtime/observatory/tests/service/typed_data_test.dart
@@ -76,7 +76,7 @@
float64x2List = new Float64x2List(2);
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
script();
var lib = await isolate.rootLibrary.load();
diff --git a/runtime/observatory/tests/service/udp_socket_service_test.dart b/runtime/observatory/tests/service/udp_socket_service_test.dart
index 6dda36b..d51ca6a 100644
--- a/runtime/observatory/tests/service/udp_socket_service_test.dart
+++ b/runtime/observatory/tests/service/udp_socket_service_test.dart
@@ -22,7 +22,7 @@
new io.InternetAddress('127.0.0.1'), server.port);
}
-var udpTests = [
+var udpTests = <IsolateTest>[
// Initial.
(Isolate isolate) async {
var result =
diff --git a/runtime/observatory/tests/service/unused_changes_in_last_reload_test.dart b/runtime/observatory/tests/service/unused_changes_in_last_reload_test.dart
index 1325b28..35f548a 100644
--- a/runtime/observatory/tests/service/unused_changes_in_last_reload_test.dart
+++ b/runtime/observatory/tests/service/unused_changes_in_last_reload_test.dart
@@ -28,7 +28,7 @@
debugger();
}
-var tests = [
+var tests = <IsolateTest>[
// Stopped at 'debugger' statement.
hasStoppedAtBreakpoint,
// Resume the isolate into the while loop.
diff --git a/runtime/observatory/tests/service/vm_test.dart b/runtime/observatory/tests/service/vm_test.dart
index 0f3c7d3..5428bdf 100644
--- a/runtime/observatory/tests/service/vm_test.dart
+++ b/runtime/observatory/tests/service/vm_test.dart
@@ -7,7 +7,7 @@
import 'package:unittest/unittest.dart';
import 'test_helper.dart';
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) {
VM vm = isolate.owner;
expect(vm.targetCPU, isNotNull);
diff --git a/runtime/observatory/tests/service/vm_timeline_events_test.dart b/runtime/observatory/tests/service/vm_timeline_events_test.dart
index b2e701b..ffe6368 100644
--- a/runtime/observatory/tests/service/vm_timeline_events_test.dart
+++ b/runtime/observatory/tests/service/vm_timeline_events_test.dart
@@ -34,7 +34,7 @@
}
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
// Subscribe to the Timeline stream.
await subscribeToStream(isolate.vm, VM.kTimelineStream, onTimelineEvent);
diff --git a/runtime/observatory/tests/service/vm_timeline_flags_test.dart b/runtime/observatory/tests/service/vm_timeline_flags_test.dart
index 9a1cee6..0d93ac7 100644
--- a/runtime/observatory/tests/service/vm_timeline_flags_test.dart
+++ b/runtime/observatory/tests/service/vm_timeline_flags_test.dart
@@ -28,7 +28,7 @@
int dartEventCount;
-var tests = [
+var tests = <IsolateTest>[
hasStoppedAtBreakpoint,
(Isolate isolate) async {
// Get the flags.
diff --git a/runtime/observatory/tests/service/weak_properties_test.dart b/runtime/observatory/tests/service/weak_properties_test.dart
index 72325d3..2bd9c95 100644
--- a/runtime/observatory/tests/service/weak_properties_test.dart
+++ b/runtime/observatory/tests/service/weak_properties_test.dart
@@ -35,7 +35,7 @@
print(weak_property);
}
-var tests = [
+var tests = <IsolateTest>[
(Isolate isolate) async {
var lib = await isolate.rootLibrary.load();
Field keyField = lib.variables.singleWhere((v) => v.name == 'key');
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index 9a6a62e..407b338 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -139,9 +139,6 @@
# are to be triaged. Isolate tests are skipped on purpose due to the usage of
# batch mode.
[ $arch == simdbc64 && $compiler == dartk ]
-cc/*: Pass, Crash # Please triage (flaky crashes in kernel-isolate?).
-dart/regress29620_test: RuntimeError # Please triage.
-dart/regress30853_test: Crash # Please triage.
dart/truncating_ints_test: RuntimeError # Please triage.
[ $arch == x64 && $system == windows ]
@@ -251,7 +248,6 @@
cc/IsolateReload_RunNewFieldInitializers: Skip
cc/IsolateReload_RunNewFieldInitializersMutateStaticField: Skip
cc/IsolateReload_RunNewFieldInitializersReferenceStaticField: Skip
-cc/IsolateReload_RunNewFieldInitializersSyntaxError3: Fail
cc/IsolateReload_RunNewFieldInitializersThrows: Skip
cc/IsolateReload_RunNewFieldInitializersWithConsts: Skip
cc/IsolateReload_ShapeChangeRetainsHash: Skip
@@ -345,7 +341,6 @@
[ $compiler == dartk && $strong ]
dart/data_uri_spawn_test: CompileTimeError # Issue 31586
-dart/hello_fuchsia_test: RuntimeError
dart/optimized_stacktrace_line_and_column_test: CompileTimeError # Issue 31586
dart/optimized_stacktrace_line_test: CompileTimeError # Issue 31586
diff --git a/runtime/vm/compiler/aot/aot_call_specializer.cc b/runtime/vm/compiler/aot/aot_call_specializer.cc
index ac997a2..2db84f6 100644
--- a/runtime/vm/compiler/aot/aot_call_specializer.cc
+++ b/runtime/vm/compiler/aot/aot_call_specializer.cc
@@ -254,7 +254,7 @@
Value* AotCallSpecializer::PrepareStaticOpInput(Value* input,
intptr_t cid,
Instruction* call) {
- ASSERT(FLAG_experimental_strong_mode);
+ ASSERT(I->strong() && FLAG_use_strong_mode_types);
ASSERT((cid == kDoubleCid) ||
(FLAG_limit_ints_to_64_bits && (cid == kMintCid)));
@@ -265,7 +265,7 @@
if ((cid == kDoubleCid) && (input->Type()->ToNullableCid() == kSmiCid)) {
Definition* conversion = new (Z) SmiToDoubleInstr(input, call->token_pos());
- if (FLAG_trace_experimental_strong_mode) {
+ if (FLAG_trace_strong_mode_types) {
THR_Print("[Strong mode] Inserted %s\n", conversion->ToCString());
}
InsertBefore(call, conversion, /* env = */ NULL, FlowGraph::kValue);
@@ -277,7 +277,7 @@
Value* AotCallSpecializer::PrepareReceiverOfDevirtualizedCall(Value* input,
intptr_t cid) {
- ASSERT(FLAG_experimental_strong_mode);
+ ASSERT(I->strong() && FLAG_use_strong_mode_types);
ASSERT(cid == kDoubleCid);
// Can't assert !input->Type()->is_nullable() here as PushArgument receives
@@ -299,7 +299,7 @@
bool AotCallSpecializer::TryOptimizeInstanceCallUsingStaticTypes(
InstanceCallInstr* instr) {
- ASSERT(FLAG_experimental_strong_mode);
+ ASSERT(I->strong() && FLAG_use_strong_mode_types);
const intptr_t receiver_index = instr->FirstArgIndex();
const Token::Kind op_kind = instr->token_kind();
@@ -419,9 +419,10 @@
(right_type->ToNullableCid() == kSmiCid))) {
// TODO(dartbug.com/30480): Extend double/int mixed cases from Smi to
// AbstractInt (it requires corresponding conversions).
- ASSERT(left_type->IsNullableDouble() || right_type->IsNullableDouble());
if ((op_kind == Token::kADD) || (op_kind == Token::kSUB) ||
(op_kind == Token::kMUL) || (op_kind == Token::kDIV)) {
+ ASSERT(left_type->IsNullableDouble() ||
+ right_type->IsNullableDouble() || (op_kind == Token::kDIV));
left_value = PrepareStaticOpInput(left_value, kDoubleCid, instr);
right_value = PrepareStaticOpInput(right_value, kDoubleCid, instr);
replacement = new (Z) BinaryDoubleOpInstr(
@@ -437,7 +438,7 @@
}
if (replacement != NULL) {
- if (FLAG_trace_experimental_strong_mode) {
+ if (FLAG_trace_strong_mode_types) {
THR_Print("[Strong mode] Optimization: replacing %s with %s\n",
instr->ToCString(), replacement->ToCString());
}
@@ -450,7 +451,7 @@
bool AotCallSpecializer::TryOptimizeStaticCallUsingStaticTypes(
StaticCallInstr* call) {
- ASSERT(FLAG_experimental_strong_mode);
+ ASSERT(I->strong() && FLAG_use_strong_mode_types);
Definition* replacement = NULL;
if (FlowGraphCompiler::SupportsUnboxedDoubles()) {
@@ -501,7 +502,7 @@
}
if (replacement != NULL) {
- if (FLAG_trace_experimental_strong_mode) {
+ if (FLAG_trace_strong_mode_types) {
THR_Print("[Strong mode] Optimization: replacing %s with %s\n",
call->ToCString(), replacement->ToCString());
}
@@ -512,6 +513,20 @@
return false;
}
+static void EnsureICData(Zone* zone,
+ const Function& function,
+ InstanceCallInstr* call) {
+ if (!call->HasICData()) {
+ const Array& arguments_descriptor =
+ Array::Handle(zone, call->GetArgumentsDescriptor());
+ const ICData& ic_data = ICData::ZoneHandle(
+ zone, ICData::New(function, call->function_name(), arguments_descriptor,
+ call->deopt_id(), call->checked_argument_count(),
+ ICData::kInstance));
+ call->set_ic_data(&ic_data);
+ }
+}
+
// Tries to optimize instance call by replacing it with a faster instruction
// (e.g, binary op, field load, ..).
// TODO(dartbug.com/30635) Evaluate how much this can be shared with
@@ -579,7 +594,7 @@
}
}
- if (FLAG_experimental_strong_mode &&
+ if (I->strong() && FLAG_use_strong_mode_types &&
TryOptimizeInstanceCallUsingStaticTypes(instr)) {
return;
}
@@ -779,6 +794,12 @@
return;
}
}
+
+ // Detect if o.m(...) is a call through a getter and expand it
+ // into o.get:m().call(...).
+ if (TryExpandCallThroughGetter(receiver_class, instr)) {
+ return;
+ }
}
// More than one target. Generate generic polymorphic call without
@@ -796,6 +817,104 @@
}
}
+bool AotCallSpecializer::TryExpandCallThroughGetter(const Class& receiver_class,
+ InstanceCallInstr* call) {
+ // If it's an accessor call it can't be a call through getter.
+ if (call->token_kind() == Token::kGET || call->token_kind() == Token::kSET) {
+ return false;
+ }
+
+ // Ignore callsites like f.call() for now. Those need to be handled
+ // specially if f is a closure.
+ if (call->function_name().raw() == Symbols::Call().raw()) {
+ return false;
+ }
+
+ Function& target = Function::Handle(Z);
+
+ const String& getter_name = String::ZoneHandle(
+ Z, Symbols::LookupFromGet(thread(), call->function_name()));
+ if (getter_name.IsNull()) {
+ return false;
+ }
+
+ const Array& args_desc_array = Array::Handle(
+ Z, ArgumentsDescriptor::New(/*type_args_len=*/0, /*num_arguments=*/1));
+ ArgumentsDescriptor args_desc(args_desc_array);
+ target = Resolver::ResolveDynamicForReceiverClass(
+ receiver_class, getter_name, args_desc, /*allow_add=*/false);
+ if (target.raw() == Function::null() || target.IsMethodExtractor()) {
+ return false;
+ }
+
+ // We found a getter with the same name as the method this
+ // call tries to invoke. This implies call through getter
+ // because methods can't override getters. Build
+ // o.get:m().call(...) sequence and replace o.m(...) invocation.
+
+ const intptr_t receiver_idx = call->type_args_len() > 0 ? 1 : 0;
+
+ PushArgumentsArray* get_arguments = new (Z) PushArgumentsArray(1);
+ get_arguments->Add(new (Z) PushArgumentInstr(
+ call->PushArgumentAt(receiver_idx)->value()->CopyWithType()));
+ InstanceCallInstr* invoke_get = new (Z) InstanceCallInstr(
+ call->token_pos(), getter_name, Token::kGET, get_arguments,
+ /*type_args_len=*/0,
+ /*argument_names=*/Object::empty_array(),
+ /*checked_argument_count=*/1, thread()->GetNextDeoptId());
+
+ // Arguments to the .call() are the same as arguments to the
+ // original call (including type arguments), but receiver
+ // is replaced with the result of the get.
+ PushArgumentsArray* call_arguments =
+ new (Z) PushArgumentsArray(call->ArgumentCount());
+ if (call->type_args_len() > 0) {
+ call_arguments->Add(new (Z) PushArgumentInstr(
+ call->PushArgumentAt(0)->value()->CopyWithType()));
+ }
+ call_arguments->Add(new (Z) PushArgumentInstr(new (Z) Value(invoke_get)));
+ for (intptr_t i = receiver_idx + 1; i < call->ArgumentCount(); i++) {
+ call_arguments->Add(new (Z) PushArgumentInstr(
+ call->PushArgumentAt(i)->value()->CopyWithType()));
+ }
+
+ InstanceCallInstr* invoke_call = new (Z) InstanceCallInstr(
+ call->token_pos(), Symbols::Call(), Token::kILLEGAL, call_arguments,
+ call->type_args_len(), call->argument_names(),
+ /*checked_argument_count=*/1, thread()->GetNextDeoptId());
+
+ // Insert all new instructions, except .call() invocation into the
+ // graph.
+ for (intptr_t i = 0; i < invoke_get->ArgumentCount(); i++) {
+ InsertBefore(call, invoke_get->PushArgumentAt(i), NULL, FlowGraph::kEffect);
+ }
+ InsertBefore(call, invoke_get, call->env(), FlowGraph::kValue);
+ for (intptr_t i = 0; i < invoke_call->ArgumentCount(); i++) {
+ InsertBefore(call, invoke_call->PushArgumentAt(i), NULL,
+ FlowGraph::kEffect);
+ }
+ // Remove original PushArguments from the graph.
+ for (intptr_t i = 0; i < call->ArgumentCount(); i++) {
+ call->PushArgumentAt(i)->RemoveFromGraph();
+ }
+
+ // Replace original call with .call(...) invocation.
+ call->ReplaceWith(invoke_call, current_iterator());
+
+ // AOT compiler expects all calls to have an ICData.
+ EnsureICData(Z, flow_graph()->function(), invoke_get);
+ EnsureICData(Z, flow_graph()->function(), invoke_call);
+
+ // Specialize newly inserted calls.
+ TryCreateICData(invoke_get);
+ VisitInstanceCall(invoke_get);
+ TryCreateICData(invoke_call);
+ VisitInstanceCall(invoke_call);
+
+ // Success.
+ return true;
+}
+
void AotCallSpecializer::VisitPolymorphicInstanceCall(
PolymorphicInstanceCallInstr* call) {
const intptr_t receiver_idx = call->type_args_len() > 0 ? 1 : 0;
diff --git a/runtime/vm/compiler/aot/aot_call_specializer.h b/runtime/vm/compiler/aot/aot_call_specializer.h
index e9de84c..aba4766 100644
--- a/runtime/vm/compiler/aot/aot_call_specializer.h
+++ b/runtime/vm/compiler/aot/aot_call_specializer.h
@@ -53,6 +53,13 @@
virtual bool TryOptimizeStaticCallUsingStaticTypes(StaticCallInstr* call);
+ // Check if o.m(...) [call] is actually an invocation through a getter
+ // o.get:m().call(...) given that the receiver of the call is a subclass
+ // of the [receiver_class]. If it is - then expand it into
+ // o.get:m.call(...) to avoid hitting dispatch through noSuchMethod.
+ bool TryExpandCallThroughGetter(const Class& receiver_class,
+ InstanceCallInstr* call);
+
Precompiler* precompiler_;
bool has_unique_no_such_method_;
diff --git a/runtime/vm/compiler/backend/flow_graph.cc b/runtime/vm/compiler/backend/flow_graph.cc
index b718238..51d2903 100644
--- a/runtime/vm/compiler/backend/flow_graph.cc
+++ b/runtime/vm/compiler/backend/flow_graph.cc
@@ -1188,7 +1188,8 @@
captured_parameters_->Add(index);
}
- if (FLAG_experimental_strong_mode && (phi != NULL)) {
+ if ((phi != NULL) && isolate()->strong() &&
+ FLAG_use_strong_mode_types) {
phi->UpdateType(
CompileType::FromAbstractType(load->local().type()));
}
diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc
index ddf48d7..7f5c613 100644
--- a/runtime/vm/compiler/backend/il.cc
+++ b/runtime/vm/compiler/backend/il.cc
@@ -1228,6 +1228,9 @@
}
bool UnboxInt32Instr::ComputeCanDeoptimize() const {
+ if (speculative_mode() == kNotSpeculative) {
+ return false;
+ }
const intptr_t value_cid = value()->Type()->ToCid();
if (value_cid == kSmiCid) {
return (kSmiBits > 32) && !is_truncating() &&
@@ -1243,9 +1246,6 @@
// Note: we don't support truncation of Bigint values.
return !RangeUtils::Fits(value()->definition()->range(),
RangeBoundary::kRangeBoundaryInt32);
- } else if (FLAG_experimental_strong_mode && FLAG_limit_ints_to_64_bits &&
- value()->Type()->IsNullableInt()) {
- return false;
} else {
return true;
}
@@ -1253,10 +1253,11 @@
bool UnboxUint32Instr::ComputeCanDeoptimize() const {
ASSERT(is_truncating());
+ if (speculative_mode() == kNotSpeculative) {
+ return false;
+ }
if ((value()->Type()->ToCid() == kSmiCid) ||
- (value()->Type()->ToCid() == kMintCid) ||
- (FLAG_experimental_strong_mode && FLAG_limit_ints_to_64_bits &&
- value()->Type()->IsNullableInt())) {
+ (value()->Type()->ToCid() == kMintCid)) {
return false;
}
// Check input value's range.
@@ -1735,15 +1736,18 @@
CompileType* left_type = left()->Type();
CompileType* right_type = right()->Type();
intptr_t op_cid = kIllegalCid;
+ SpeculativeMode speculative_mode = kGuardInputs;
if ((left_type->ToCid() == kSmiCid) && (right_type->ToCid() == kSmiCid)) {
op_cid = kSmiCid;
- } else if (FLAG_experimental_strong_mode && FLAG_limit_ints_to_64_bits &&
+ } else if (Isolate::Current()->strong() && FLAG_use_strong_mode_types &&
+ FLAG_limit_ints_to_64_bits &&
FlowGraphCompiler::SupportsUnboxedMints() &&
// TODO(dartbug.com/30480): handle nullable types here
left_type->IsNullableInt() && !left_type->is_nullable() &&
right_type->IsNullableInt() && !right_type->is_nullable()) {
op_cid = kMintCid;
+ speculative_mode = kNotSpeculative;
}
if (op_cid != kIllegalCid) {
@@ -1751,14 +1755,14 @@
if (Token::IsRelationalOperator(kind())) {
replacement = new RelationalOpInstr(
token_pos(), kind(), left()->CopyWithType(), right()->CopyWithType(),
- op_cid, Thread::kNoDeoptId);
+ op_cid, Thread::kNoDeoptId, speculative_mode);
} else if (Token::IsEqualityOperator(kind())) {
replacement = new EqualityCompareInstr(
token_pos(), kind(), left()->CopyWithType(), right()->CopyWithType(),
- op_cid, Thread::kNoDeoptId);
+ op_cid, Thread::kNoDeoptId, speculative_mode);
}
if (replacement != NULL) {
- if (FLAG_trace_experimental_strong_mode && (op_cid == kMintCid)) {
+ if (FLAG_trace_strong_mode_types && (op_cid == kMintCid)) {
THR_Print("[Strong mode] Optimization: replacing %s with %s\n",
ToCString(), replacement->ToCString());
}
@@ -3527,10 +3531,10 @@
ASSERT(sub_type().IsFinalized());
ASSERT(super_type().IsFinalized());
- __ PushObject(sub_type());
- __ PushObject(super_type());
__ PushRegister(locs()->in(0).reg());
__ PushRegister(locs()->in(1).reg());
+ __ PushObject(sub_type());
+ __ PushObject(super_type());
__ PushObject(dst_name());
compiler->GenerateRuntimeCall(token_pos(), deopt_id(),
@@ -3538,8 +3542,17 @@
__ Drop(5);
#else
- // TODO(sjindel): Support strong mode in DBC
- UNREACHABLE();
+ if (compiler->is_optimizing()) {
+ __ Push(locs()->in(0).reg()); // Instantiator type arguments.
+ __ Push(locs()->in(1).reg()); // Function type arguments.
+ } else {
+ // The 2 inputs are already on the expression stack.
+ }
+ __ PushConstant(sub_type());
+ __ PushConstant(super_type());
+ __ PushConstant(dst_name());
+ __ AssertSubtype();
+
#endif
}
@@ -3774,14 +3787,6 @@
EmitLoadFromBox(compiler);
} else if (CanConvertSmi() && (value_cid == kSmiCid)) {
EmitSmiConversion(compiler);
- } else if (FLAG_experimental_strong_mode &&
- (representation() == kUnboxedDouble) &&
- value()->Type()->IsNullableDouble()) {
- EmitLoadFromBox(compiler);
- } else if (FLAG_experimental_strong_mode && FLAG_limit_ints_to_64_bits &&
- (representation() == kUnboxedInt64) &&
- value()->Type()->IsNullableInt()) {
- EmitLoadInt64FromBoxOrSmi(compiler);
} else {
ASSERT(CanDeoptimize());
EmitLoadFromBoxWithDeopt(compiler);
diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h
index 8fc4b58..4a72d27 100644
--- a/runtime/vm/compiler/backend/il.h
+++ b/runtime/vm/compiler/backend/il.h
@@ -2954,13 +2954,15 @@
const Array& argument_names;
};
+typedef ZoneGrowableArray<PushArgumentInstr*> PushArgumentsArray;
+
template <intptr_t kInputCount>
class TemplateDartCall : public TemplateDefinition<kInputCount, Throws> {
public:
TemplateDartCall(intptr_t deopt_id,
intptr_t type_args_len,
const Array& argument_names,
- ZoneGrowableArray<PushArgumentInstr*>* arguments,
+ PushArgumentsArray* arguments,
TokenPosition token_pos,
intptr_t argument_check_bits = 0,
intptr_t type_argument_check_bits = 0)
@@ -3001,7 +3003,7 @@
private:
intptr_t type_args_len_;
const Array& argument_names_;
- ZoneGrowableArray<PushArgumentInstr*>* arguments_;
+ PushArgumentsArray* arguments_;
TokenPosition token_pos_;
// One bit per argument (up to word size) which helps the callee decide which
@@ -3017,7 +3019,7 @@
public:
ClosureCallInstr(Value* function,
ClosureCallNode* node,
- ZoneGrowableArray<PushArgumentInstr*>* arguments,
+ PushArgumentsArray* arguments,
intptr_t deopt_id)
: TemplateDartCall(deopt_id,
node->arguments()->type_args_len(),
@@ -3029,7 +3031,7 @@
}
ClosureCallInstr(Value* function,
- ZoneGrowableArray<PushArgumentInstr*>* arguments,
+ PushArgumentsArray* arguments,
intptr_t type_args_len,
const Array& argument_names,
TokenPosition token_pos,
@@ -3064,7 +3066,7 @@
TokenPosition token_pos,
const String& function_name,
Token::Kind token_kind,
- ZoneGrowableArray<PushArgumentInstr*>* arguments,
+ PushArgumentsArray* arguments,
intptr_t type_args_len,
const Array& argument_names,
intptr_t checked_argument_count,
@@ -3100,6 +3102,44 @@
token_kind == Token::kSET || token_kind == Token::kILLEGAL);
}
+ InstanceCallInstr(
+ TokenPosition token_pos,
+ const String& function_name,
+ Token::Kind token_kind,
+ PushArgumentsArray* arguments,
+ intptr_t type_args_len,
+ const Array& argument_names,
+ intptr_t checked_argument_count,
+ intptr_t deopt_id,
+ const Function& interface_target = Function::null_function(),
+ intptr_t argument_check_bits = 0,
+ intptr_t type_argument_check_bits = 0)
+ : TemplateDartCall(deopt_id,
+ type_args_len,
+ argument_names,
+ arguments,
+ token_pos,
+ argument_check_bits,
+ type_argument_check_bits),
+ ic_data_(NULL),
+ function_name_(function_name),
+ token_kind_(token_kind),
+ checked_argument_count_(checked_argument_count),
+ interface_target_(interface_target),
+ has_unique_selector_(false) {
+ ASSERT(function_name.IsNotTemporaryScopedHandle());
+ ASSERT(interface_target_.IsNotTemporaryScopedHandle());
+ ASSERT(!arguments->is_empty());
+ ASSERT(Token::IsBinaryOperator(token_kind) ||
+ Token::IsEqualityOperator(token_kind) ||
+ Token::IsRelationalOperator(token_kind) ||
+ Token::IsUnaryOperator(token_kind) ||
+ Token::IsIndexOperator(token_kind) ||
+ Token::IsTypeTestOperator(token_kind) ||
+ Token::IsTypeCastOperator(token_kind) || token_kind == Token::kGET ||
+ token_kind == Token::kSET || token_kind == Token::kILLEGAL);
+ }
+
DECLARE_INSTRUCTION(InstanceCall)
const ICData* ic_data() const { return ic_data_; }
@@ -3349,8 +3389,10 @@
Value* left,
Value* right,
intptr_t cid,
- intptr_t deopt_id)
- : TemplateComparison(token_pos, kind, deopt_id) {
+ intptr_t deopt_id,
+ SpeculativeMode speculative_mode = kGuardInputs)
+ : TemplateComparison(token_pos, kind, deopt_id),
+ speculative_mode_(speculative_mode) {
ASSERT(Token::IsEqualityOperator(kind));
SetInputAt(0, left);
SetInputAt(1, right);
@@ -3372,9 +3414,18 @@
return kTagged;
}
+ virtual SpeculativeMode speculative_mode() const { return speculative_mode_; }
+
+ virtual bool AttributesEqual(Instruction* other) const {
+ return ComparisonInstr::AttributesEqual(other) &&
+ (speculative_mode() ==
+ other->AsEqualityCompare()->speculative_mode());
+ }
+
PRINT_OPERANDS_TO_SUPPORT
private:
+ const SpeculativeMode speculative_mode_;
DISALLOW_COPY_AND_ASSIGN(EqualityCompareInstr);
};
@@ -3512,7 +3563,7 @@
const Function& function,
intptr_t type_args_len,
const Array& argument_names,
- ZoneGrowableArray<PushArgumentInstr*>* arguments,
+ PushArgumentsArray* arguments,
const ZoneGrowableArray<const ICData*>& ic_data_array,
intptr_t deopt_id,
ICData::RebindRule rebind_rule,
@@ -3541,7 +3592,7 @@
const Function& function,
intptr_t type_args_len,
const Array& argument_names,
- ZoneGrowableArray<PushArgumentInstr*>* arguments,
+ PushArgumentsArray* arguments,
intptr_t deopt_id,
intptr_t call_count,
ICData::RebindRule rebind_rule,
@@ -3569,8 +3620,8 @@
static StaticCallInstr* FromCall(Zone* zone,
const C* call,
const Function& target) {
- ZoneGrowableArray<PushArgumentInstr*>* args =
- new (zone) ZoneGrowableArray<PushArgumentInstr*>(call->ArgumentCount());
+ PushArgumentsArray* args =
+ new (zone) PushArgumentsArray(call->ArgumentCount());
for (intptr_t i = 0; i < call->ArgumentCount(); i++) {
args->Add(call->PushArgumentAt(i));
}
@@ -3763,7 +3814,7 @@
const Function* function,
bool link_lazily,
TokenPosition position,
- ZoneGrowableArray<PushArgumentInstr*>* args)
+ PushArgumentsArray* args)
: TemplateDartCall(Thread::kNoDeoptId,
0,
Array::null_array(),
@@ -4386,7 +4437,7 @@
public:
AllocateObjectInstr(TokenPosition token_pos,
const Class& cls,
- ZoneGrowableArray<PushArgumentInstr*>* arguments)
+ PushArgumentsArray* arguments)
: token_pos_(token_pos),
cls_(cls),
arguments_(arguments),
@@ -4424,7 +4475,7 @@
private:
const TokenPosition token_pos_;
const Class& cls_;
- ZoneGrowableArray<PushArgumentInstr*>* const arguments_;
+ PushArgumentsArray* const arguments_;
AliasIdentity identity_;
Function& closure_function_;
diff --git a/runtime/vm/compiler/backend/il_dbc.cc b/runtime/vm/compiler/backend/il_dbc.cc
index 68024e0..0cdde47 100644
--- a/runtime/vm/compiler/backend/il_dbc.cc
+++ b/runtime/vm/compiler/backend/il_dbc.cc
@@ -255,11 +255,10 @@
EMIT_NATIVE_CODE(LoadIndexedUnsafe, 1, Location::RegisterLocation(0)) {
ASSERT(base_reg() == FPREG);
- ASSERT(Utils::IsInt(8, offset_));
ASSERT(offset_ % kWordSize == 0);
const intptr_t slot_offset = offset_ / kWordSize;
- ASSERT(-128 <= slot_offset && slot_offset < 128);
+ ASSERT(Utils::IsInt(8, slot_offset));
if (compiler->is_optimizing()) {
const Register index = locs()->in(0).reg();
@@ -272,14 +271,17 @@
EMIT_NATIVE_CODE(StoreIndexedUnsafe, 2, Location::RegisterLocation(0)) {
ASSERT(base_reg() == FPREG);
- ASSERT(Utils::IsInt(8, offset_));
+
+ ASSERT(offset_ % kWordSize == 0);
+ const intptr_t slot_offset = offset_ / kWordSize;
+ ASSERT(Utils::IsInt(8, slot_offset));
if (compiler->is_optimizing()) {
const Register index = locs()->in(kIndexPos).reg();
const Register value = locs()->in(kValuePos).reg();
- __ StoreFpRelativeSlotOpt(value, index, offset_ / kWordSize);
+ __ StoreFpRelativeSlotOpt(value, index, slot_offset);
} else {
- __ StoreFpRelativeSlot(offset_ / kWordSize);
+ __ StoreFpRelativeSlot(slot_offset);
}
}
@@ -1606,6 +1608,9 @@
case Token::kMUL:
__ SmiMulTOS();
break;
+ case Token::kBIT_AND:
+ __ SmiBitAndTOS();
+ break;
default:
UNIMPLEMENTED();
}
diff --git a/runtime/vm/compiler/backend/range_analysis.cc b/runtime/vm/compiler/backend/range_analysis.cc
index a9b4bce..6a2aa26 100644
--- a/runtime/vm/compiler/backend/range_analysis.cc
+++ b/runtime/vm/compiler/backend/range_analysis.cc
@@ -1733,7 +1733,7 @@
UnboxInstr* unbox = def->AsUnboxInt64();
Value* value = unbox->value()->CopyWithType();
intptr_t deopt_id = unbox->DeoptimizationTarget();
- return new (Z) UnboxUint32Instr(value, deopt_id);
+ return new (Z) UnboxUint32Instr(value, deopt_id, def->speculative_mode());
} else if (def->IsUnaryInt64Op()) {
UnaryInt64OpInstr* op = def->AsUnaryInt64Op();
Token::Kind op_kind = op->op_kind();
diff --git a/runtime/vm/compiler/backend/type_propagator.cc b/runtime/vm/compiler/backend/type_propagator.cc
index 18cdd45..ffff777 100644
--- a/runtime/vm/compiler/backend/type_propagator.cc
+++ b/runtime/vm/compiler/backend/type_propagator.cc
@@ -23,7 +23,7 @@
static void TraceStrongModeType(const Instruction* instr,
const AbstractType& type) {
- if (FLAG_trace_experimental_strong_mode) {
+ if (FLAG_trace_strong_mode_types) {
THR_Print("[Strong mode] Type of %s - %s\n", instr->ToCString(),
type.ToCString());
}
@@ -31,7 +31,7 @@
static void TraceStrongModeType(const Instruction* instr,
CompileType* compileType) {
- if (FLAG_trace_experimental_strong_mode) {
+ if (FLAG_trace_strong_mode_types) {
const AbstractType* type = compileType->ToAbstractType();
if ((type != NULL) && !type->IsDynamicType()) {
TraceStrongModeType(instr, *type);
@@ -1044,7 +1044,7 @@
}
CompileType InstanceCallInstr::ComputeType() const {
- if (FLAG_experimental_strong_mode) {
+ if (Isolate::Current()->strong() && FLAG_use_strong_mode_types) {
const Function& target = interface_target();
if (!target.IsNull()) {
const AbstractType& result_type =
@@ -1075,7 +1075,7 @@
}
}
- if (FLAG_experimental_strong_mode) {
+ if (Isolate::Current()->strong() && FLAG_use_strong_mode_types) {
CompileType* type = instance_call()->Type();
TraceStrongModeType(this, type);
return *type;
@@ -1093,18 +1093,27 @@
return CompileType::FromCid(MethodRecognizer::ResultCid(function_));
}
- if (FLAG_experimental_strong_mode || Isolate::Current()->type_checks()) {
+ const Isolate* isolate = Isolate::Current();
+ if ((isolate->strong() && FLAG_use_strong_mode_types) ||
+ isolate->type_checks()) {
const AbstractType& result_type =
AbstractType::ZoneHandle(function().result_type());
- TraceStrongModeType(this, result_type);
- return CompileType::FromAbstractType(result_type);
+ // TODO(dartbug.com/30480): instantiate generic result_type if possible.
+ // Also, consider fixing AbstractType::IsMoreSpecificThan to handle
+ // non-instantiated types properly.
+ if (result_type.IsInstantiated()) {
+ TraceStrongModeType(this, result_type);
+ return CompileType::FromAbstractType(result_type);
+ }
}
return CompileType::Dynamic();
}
CompileType LoadLocalInstr::ComputeType() const {
- if (FLAG_experimental_strong_mode || Isolate::Current()->type_checks()) {
+ const Isolate* isolate = Isolate::Current();
+ if ((isolate->strong() && FLAG_use_strong_mode_types) ||
+ isolate->type_checks()) {
const AbstractType& local_type = local().type();
TraceStrongModeType(this, local_type);
return CompileType::FromAbstractType(local_type);
@@ -1139,7 +1148,9 @@
intptr_t cid = kDynamicCid;
AbstractType* abstract_type = NULL;
const Field& field = this->StaticField();
- if (FLAG_experimental_strong_mode || Isolate::Current()->type_checks()) {
+ const Isolate* isolate = Isolate::Current();
+ if ((isolate->strong() && FLAG_use_strong_mode_types) ||
+ isolate->type_checks()) {
cid = kIllegalCid;
abstract_type = &AbstractType::ZoneHandle(field.type());
TraceStrongModeType(this, *abstract_type);
@@ -1192,9 +1203,10 @@
return CompileType::Dynamic();
}
+ const Isolate* isolate = Isolate::Current();
const AbstractType* abstract_type = NULL;
- if (FLAG_experimental_strong_mode ||
- (Isolate::Current()->type_checks() &&
+ if ((isolate->strong() && FLAG_use_strong_mode_types) ||
+ (isolate->type_checks() &&
(type().IsFunctionType() || type().HasResolvedTypeClass()))) {
abstract_type = &type();
TraceStrongModeType(this, *abstract_type);
@@ -1263,7 +1275,7 @@
}
CompileType CheckedSmiOpInstr::ComputeType() const {
- if (FLAG_experimental_strong_mode) {
+ if (Isolate::Current()->strong() && FLAG_use_strong_mode_types) {
if (left()->Type()->IsNullableInt() && right()->Type()->IsNullableInt()) {
const AbstractType& abstract_type =
AbstractType::ZoneHandle(Type::IntType());
@@ -1280,7 +1292,7 @@
}
CompileType CheckedSmiComparisonInstr::ComputeType() const {
- if (FLAG_experimental_strong_mode) {
+ if (Isolate::Current()->strong() && FLAG_use_strong_mode_types) {
CompileType* type = call()->Type();
TraceStrongModeType(this, type);
return *type;
diff --git a/runtime/vm/compiler/call_specializer.cc b/runtime/vm/compiler/call_specializer.cc
index ba9568e..89d05fc 100644
--- a/runtime/vm/compiler/call_specializer.cc
+++ b/runtime/vm/compiler/call_specializer.cc
@@ -352,11 +352,11 @@
intptr_t deopt_id,
Environment* deopt_environment,
Instruction* insert_before) {
- ASSERT(FLAG_experimental_strong_mode);
+ ASSERT(I->strong() && FLAG_use_strong_mode_types);
if (to_check->Type()->is_nullable()) {
CheckNullInstr* check_null = new (Z) CheckNullInstr(
to_check->CopyWithType(Z), deopt_id, insert_before->token_pos());
- if (FLAG_trace_experimental_strong_mode) {
+ if (FLAG_trace_strong_mode_types) {
THR_Print("[Strong mode] Inserted %s\n", check_null->ToCString());
}
InsertBefore(insert_before, check_null, deopt_environment,
@@ -1246,7 +1246,7 @@
bool CallSpecializer::TryOptimizeInstanceOfUsingStaticTypes(
InstanceCallInstr* call,
const AbstractType& type) {
- ASSERT(FLAG_experimental_strong_mode);
+ ASSERT(I->strong() && FLAG_use_strong_mode_types);
ASSERT(Token::IsTypeTestOperator(call->token_kind()));
if (type.IsDynamicType() || type.IsObjectType() || !type.IsInstantiated()) {
@@ -1263,7 +1263,7 @@
left_value->CopyWithType(Z),
new (Z) Value(flow_graph()->constant_null()),
/* number_check = */ false, Thread::kNoDeoptId);
- if (FLAG_trace_experimental_strong_mode) {
+ if (FLAG_trace_strong_mode_types) {
THR_Print("[Strong mode] replacing %s with %s (%s < %s)\n",
call->ToCString(), replacement->ToCString(),
left_value->Type()->ToAbstractType()->ToCString(),
@@ -1294,7 +1294,7 @@
type = AbstractType::Cast(call->ArgumentAt(3)->AsConstant()->value()).raw();
}
- if (FLAG_experimental_strong_mode &&
+ if (I->strong() && FLAG_use_strong_mode_types &&
TryOptimizeInstanceOfUsingStaticTypes(call, type)) {
return;
}
@@ -1546,7 +1546,7 @@
}
}
- if (FLAG_experimental_strong_mode &&
+ if (I->strong() && FLAG_use_strong_mode_types &&
TryOptimizeStaticCallUsingStaticTypes(call)) {
return;
}
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
index 86cf18f..d30b351 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
@@ -7530,12 +7530,15 @@
// The type argument for the factory call.
Fragment instructions = TranslateInstantiatedTypeArguments(type_arguments);
+ LocalVariable* type = MakeTemporary();
+
+ instructions += LoadLocal(type);
instructions += PushArgument();
if (length == 0) {
instructions += Constant(Object::empty_array());
} else {
// The type arguments for CreateArray.
- instructions += Constant(type_arguments);
+ instructions += LoadLocal(type);
instructions += IntConstant(length);
instructions += CreateArray();
AbstractType& list_type = AbstractType::ZoneHandle(Z);
@@ -7567,8 +7570,9 @@
Z, factory_class.LookupFactory(
Library::PrivateCoreLibName(Symbols::ListLiteralFactory())));
- return instructions +
- StaticCall(position, factory_method, 2, ICData::kStatic);
+ instructions += StaticCall(position, factory_method, 2, ICData::kStatic);
+ instructions += DropTempsPreserveTop(1); // Instantiated type_arguments.
+ return instructions;
}
Fragment StreamingFlowGraphBuilder::BuildMapLiteral(bool is_const,
diff --git a/runtime/vm/compiler/frontend/prologue_builder.cc b/runtime/vm/compiler/frontend/prologue_builder.cc
index 38e2f9c..b467adf 100644
--- a/runtime/vm/compiler/frontend/prologue_builder.cc
+++ b/runtime/vm/compiler/frontend/prologue_builder.cc
@@ -310,6 +310,12 @@
good += LoadLocal(tuple_diff);
good += SmiBinaryOp(Token::kADD, /* truncate= */ true);
good += LoadIndexed(/* index_scale = */ kWordSize);
+ if (strong) {
+ ASSERT(ArgumentsDescriptor::NamedPositionField::shift() == 0);
+ good +=
+ IntConstant(ArgumentsDescriptor::NamedPositionField::mask());
+ good += SmiBinaryOp(Token::kBIT_AND, /* truncate= */ true);
+ }
}
good += SmiBinaryOp(Token::kSUB, /* truncate= */ true);
good += LoadFpRelativeSlot(kWordSize * kParamEndSlotFromFp);
diff --git a/runtime/vm/constants_dbc.h b/runtime/vm/constants_dbc.h
index 4ad1020..97ee072 100644
--- a/runtime/vm/constants_dbc.h
+++ b/runtime/vm/constants_dbc.h
@@ -595,6 +595,19 @@
// arguments SP[-2] using SubtypeTestCache PP[D].
// If A is 1, then the instance may be a Smi.
//
+// - AssertSubtype
+//
+// Assers that one type is a subtype of another. Throws a TypeError
+// otherwise. The stack has the following arguments on it:
+//
+// SP[-4] instantiator type args
+// SP[-3] function type args
+// SP[-2] sub_type
+// SP[-1] super_type
+// SP[-0] dst_name
+//
+// All 5 arguments are consumed from the stack and no results is pushed.
+//
// - BadTypeError
//
// If SP[-4] is non-null, throws a BadType error by calling into the runtime.
@@ -770,6 +783,7 @@
V(SmiAddTOS, 0, ___, ___, ___) \
V(SmiSubTOS, 0, ___, ___, ___) \
V(SmiMulTOS, 0, ___, ___, ___) \
+ V(SmiBitAndTOS, 0, ___, ___, ___) \
V(Add, A_B_C, reg, reg, reg) \
V(Sub, A_B_C, reg, reg, reg) \
V(Mul, A_B_C, reg, reg, reg) \
@@ -905,6 +919,7 @@
V(InstanceOf, 0, ___, ___, ___) \
V(BadTypeError, 0, ___, ___, ___) \
V(AssertAssignable, A_D, num, lit, ___) \
+ V(AssertSubtype, 0, ___, ___, ___) \
V(AssertBoolean, A, num, ___, ___) \
V(TestSmi, A_D, reg, reg, ___) \
V(TestCids, A_D, reg, num, ___) \
diff --git a/runtime/vm/dart.cc b/runtime/vm/dart.cc
index 4f6873a..94f0dd9 100644
--- a/runtime/vm/dart.cc
+++ b/runtime/vm/dart.cc
@@ -654,6 +654,7 @@
} while (0);
ADD_FLAG(type_checks, enable_type_checks, FLAG_enable_type_checks);
ADD_FLAG(asserts, enable_asserts, FLAG_enable_asserts);
+ ADD_FLAG(strong, strong, FLAG_strong);
ADD_FLAG(error_on_bad_type, enable_error_on_bad_type,
FLAG_error_on_bad_type);
ADD_FLAG(error_on_bad_override, enable_error_on_bad_override,
diff --git a/runtime/vm/dart_api_impl_test.cc b/runtime/vm/dart_api_impl_test.cc
index 5fcd3ba..16e5074 100644
--- a/runtime/vm/dart_api_impl_test.cc
+++ b/runtime/vm/dart_api_impl_test.cc
@@ -1240,7 +1240,7 @@
Thread* thread = Thread::Current();
PageSpace* old_space = thread->isolate()->heap()->old_space();
MonitorLocker ml(old_space->tasks_lock());
- while (old_space->sweeper_tasks() > 0) {
+ while (old_space->tasks() > 0) {
ml.WaitWithSafepointCheck(thread);
}
}
diff --git a/runtime/vm/flag_list.h b/runtime/vm/flag_list.h
index 1f164e7..5e71c4f 100644
--- a/runtime/vm/flag_list.h
+++ b/runtime/vm/flag_list.h
@@ -83,9 +83,6 @@
"Report error for bad overrides.") \
R(error_on_bad_type, false, bool, false, \
"Report error for malformed types.") \
- P(experimental_strong_mode, bool, false, "Enable experimental strong mode.") \
- P(trace_experimental_strong_mode, bool, false, \
- "Trace experimental strong mode.") \
P(external_max_size, int, (kWordSize <= 4) ? 512 : 1024, \
"Max total size of external allocations in MB, or 0 for unlimited," \
"e.g: --external_max_size=1024 allows up to 1024MB of externals") \
@@ -155,7 +152,7 @@
P(reorder_basic_blocks, bool, true, "Reorder basic blocks") \
C(stress_async_stacks, false, false, bool, false, \
"Stress test async stack traces") \
- P(strong, bool, false, "Use strong mode in type checks.") \
+ P(strong, bool, false, "Enable strong mode.") \
R(support_ast_printer, false, bool, true, "Support the AST printer.") \
R(support_compiler_stats, false, bool, true, "Support compiler stats.") \
R(support_disassembler, false, bool, true, "Support the disassembler.") \
@@ -173,6 +170,8 @@
R(trace_profiler, false, bool, false, "Profiler trace") \
D(trace_profiler_verbose, bool, false, "Verbose profiler trace") \
D(trace_ssa_allocator, bool, false, "Trace register allocation over SSA.") \
+ P(trace_strong_mode_types, bool, false, \
+ "Trace optimizations based on strong mode types.") \
D(trace_zones, bool, false, "Traces allocation sizes in the zone.") \
P(truncating_left_shift, bool, true, \
"Optimize left shift to truncate if possible") \
@@ -182,6 +181,7 @@
P(use_field_guards, bool, !USING_DBC, \
"Use field guards and track field types") \
C(use_osr, false, true, bool, true, "Use OSR") \
+ P(use_strong_mode_types, bool, true, "Optimize based on strong mode types.") \
R(verbose_gc, false, bool, false, "Enables verbose GC.") \
R(verbose_gc_hdr, 40, int, 40, "Print verbose GC header interval.") \
R(verify_after_gc, false, bool, false, \
diff --git a/runtime/vm/gc_sweeper.cc b/runtime/vm/gc_sweeper.cc
index 57e5463..a064f2d 100644
--- a/runtime/vm/gc_sweeper.cc
+++ b/runtime/vm/gc_sweeper.cc
@@ -115,7 +115,7 @@
ASSERT(last_ != NULL);
ASSERT(freelist_ != NULL);
MonitorLocker ml(old_space_->tasks_lock());
- old_space_->set_sweeper_tasks(old_space_->sweeper_tasks() + 1);
+ old_space_->set_tasks(old_space_->tasks() + 1);
}
virtual void Run() {
@@ -155,7 +155,7 @@
// This sweeper task is done. Notify the original isolate.
{
MonitorLocker ml(old_space_->tasks_lock());
- old_space_->set_sweeper_tasks(old_space_->sweeper_tasks() - 1);
+ old_space_->set_tasks(old_space_->tasks() - 1);
ml.NotifyAll();
}
}
diff --git a/runtime/vm/heap.cc b/runtime/vm/heap.cc
index cb10990f..5fe75f3 100644
--- a/runtime/vm/heap.cc
+++ b/runtime/vm/heap.cc
@@ -205,14 +205,14 @@
// We currently don't support nesting of HeapIterationScopes.
ASSERT(old_space_->iterating_thread_ != thread);
#endif
- while (old_space_->sweeper_tasks() > 0) {
+ while (old_space_->tasks() > 0) {
ml.WaitWithSafepointCheck(thread);
}
#if defined(DEBUG)
ASSERT(old_space_->iterating_thread_ == NULL);
old_space_->iterating_thread_ = thread;
#endif
- old_space_->set_sweeper_tasks(1);
+ old_space_->set_tasks(1);
}
isolate()->safepoint_handler()->SafepointThreads(thread);
@@ -234,8 +234,8 @@
ASSERT(old_space_->iterating_thread_ == thread());
old_space_->iterating_thread_ = NULL;
#endif
- ASSERT(old_space_->sweeper_tasks() == 1);
- old_space_->set_sweeper_tasks(0);
+ ASSERT(old_space_->tasks() == 1);
+ old_space_->set_tasks(0);
ml.NotifyAll();
}
@@ -365,49 +365,8 @@
}
}
-class LowMemoryTask : public ThreadPool::Task {
- public:
- explicit LowMemoryTask(Isolate* isolate) : task_isolate_(isolate) {}
-
- virtual void Run() {
- bool result =
- Thread::EnterIsolateAsHelper(task_isolate_, Thread::kLowMemoryTask);
- ASSERT(result);
- Heap* heap = task_isolate_->heap();
- {
- TIMELINE_FUNCTION_GC_DURATION(Thread::Current(), "LowMemoryTask");
- heap->CollectAllGarbage(Heap::kLowMemory);
- }
- // Exit isolate cleanly *before* notifying it, to avoid shutdown race.
- Thread::ExitIsolateAsHelper();
- // This compactor task is done. Notify the original isolate.
- {
- MonitorLocker ml(heap->old_space()->tasks_lock());
- heap->old_space()->set_low_memory_tasks(
- heap->old_space()->low_memory_tasks() - 1);
- ml.NotifyAll();
- }
- }
-
- private:
- Isolate* task_isolate_;
-};
-
void Heap::NotifyLowMemory() {
- {
- MonitorLocker ml(old_space_.tasks_lock());
- if (old_space_.low_memory_tasks() > 0) {
- return;
- }
- old_space_.set_low_memory_tasks(old_space_.low_memory_tasks() + 1);
- }
-
- bool success = Dart::thread_pool()->Run(new LowMemoryTask(isolate()));
- if (!success) {
- MonitorLocker ml(old_space_.tasks_lock());
- old_space_.set_low_memory_tasks(old_space_.low_memory_tasks() - 1);
- ml.NotifyAll();
- }
+ CollectAllGarbage(kLowMemory);
}
void Heap::EvacuateNewSpace(Thread* thread, GCReason reason) {
@@ -503,7 +462,7 @@
void Heap::WaitForSweeperTasks(Thread* thread) {
MonitorLocker ml(old_space_.tasks_lock());
- while (old_space_.sweeper_tasks() > 0) {
+ while (old_space_.tasks() > 0) {
ml.WaitWithSafepointCheck(thread);
}
}
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 0c98b61..42dffff 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -418,6 +418,10 @@
#endif
break;
}
+ case Isolate::kLowMemoryMsg: {
+ I->heap()->NotifyLowMemory();
+ break;
+ }
case Isolate::kAddExitMsg:
case Isolate::kDelExitMsg:
@@ -1700,21 +1704,7 @@
// static
void Isolate::NotifyLowMemory() {
- MonitorLocker ml(isolates_list_monitor_);
- if (!creation_enabled_) {
- return; // VM is shutting down
- }
- for (Isolate* isolate = isolates_list_head_; isolate != NULL;
- isolate = isolate->next_) {
- if (isolate == Dart::vm_isolate()) {
- // Nothing to compact / isolate structure not completely initialized.
- } else if (isolate == Isolate::Current()) {
- isolate->heap()->NotifyLowMemory();
- } else {
- MutexLocker ml(isolate->mutex_);
- isolate->heap()->NotifyLowMemory();
- }
- }
+ Isolate::KillAllIsolates(Isolate::kLowMemoryMsg);
}
void Isolate::LowLevelShutdown() {
@@ -1846,9 +1836,8 @@
// TODO(koda): Support faster sweeper shutdown (e.g., after current page).
PageSpace* old_space = heap_->old_space();
MonitorLocker ml(old_space->tasks_lock());
- while (old_space->sweeper_tasks() > 0 ||
- old_space->low_memory_tasks() > 0) {
- ml.WaitWithSafepointCheck(thread);
+ while (old_space->tasks() > 0) {
+ ml.Wait();
}
}
@@ -1871,8 +1860,7 @@
if (heap_ != NULL) {
PageSpace* old_space = heap_->old_space();
MonitorLocker ml(old_space->tasks_lock());
- ASSERT(old_space->sweeper_tasks() == 0);
- ASSERT(old_space->low_memory_tasks() == 0);
+ ASSERT(old_space->tasks() == 0);
}
#endif
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index e87a521..4016ff9 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -166,6 +166,7 @@
// Internal message ids.
kInterruptMsg = 10, // Break in the debugger.
kInternalKillMsg = 11, // Like kill, but does not run exit listeners, etc.
+ kLowMemoryMsg = 12, // Run compactor, etc.
};
// The different Isolate API message priorities for ping and kill messages.
enum LibMsgPriority {
diff --git a/runtime/vm/kernel_isolate.cc b/runtime/vm/kernel_isolate.cc
index dbe30d1..f74e67a 100644
--- a/runtime/vm/kernel_isolate.cc
+++ b/runtime/vm/kernel_isolate.cc
@@ -70,8 +70,10 @@
api_flags.enable_error_on_bad_override = false;
api_flags.reify_generic_functions = false;
api_flags.strong = false;
-#if !defined(DART_PRECOMPILER)
+#if !defined(DART_PRECOMPILER) && !defined(TARGET_ARCH_DBC)
api_flags.use_field_guards = true;
+#endif
+#if !defined(DART_PRECOMPILER)
api_flags.use_osr = true;
#endif
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 6a3d0f6..1e98057 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -4003,6 +4003,10 @@
}
const AbstractType& other_type_arg =
AbstractType::Handle(zone, other_type_arguments.TypeAt(0));
+ if (other_type_arg.IsObjectType() || other_type_arg.IsDynamicType() ||
+ other_type_arg.IsVoidType()) {
+ return true;
+ }
if (!type_arguments.IsNull() && IsFutureClass()) {
const AbstractType& type_arg =
AbstractType::Handle(zone, type_arguments.TypeAt(0));
@@ -6570,8 +6574,9 @@
// If test_kind == kIsMoreSpecificThan, checks if the type of the specified
// parameter of this function is more specific than the type of the specified
// parameter of the other function.
-// Note that for kIsMoreSpecificThan, we do not apply contravariance of
-// parameter types, but covariance of both parameter types and result type.
+// Note that for kIsMoreSpecificThan (non-strong mode only), we do not apply
+// contravariance of parameter types, but covariance of both parameter types and
+// result type.
bool Function::TestParameterType(TypeTestKind test_kind,
intptr_t parameter_position,
intptr_t other_parameter_position,
@@ -6579,10 +6584,20 @@
Error* bound_error,
TrailPtr bound_trail,
Heap::Space space) const {
- Isolate* isolate = Isolate::Current();
+ if (Isolate::Current()->strong()) {
+ const AbstractType& param_type =
+ AbstractType::Handle(ParameterTypeAt(parameter_position));
+ if (param_type.IsDynamicType()) {
+ return true;
+ }
+ const AbstractType& other_param_type =
+ AbstractType::Handle(other.ParameterTypeAt(other_parameter_position));
+ return other_param_type.IsSubtypeOf(param_type, bound_error, bound_trail,
+ space);
+ }
const AbstractType& other_param_type =
AbstractType::Handle(other.ParameterTypeAt(other_parameter_position));
- if (!isolate->strong() && other_param_type.IsDynamicType()) {
+ if (other_param_type.IsDynamicType()) {
return true;
}
const AbstractType& param_type =
@@ -6591,21 +6606,14 @@
return test_kind == kIsSubtypeOf;
}
if (test_kind == kIsSubtypeOf) {
- if (!((!isolate->strong() &&
- param_type.IsSubtypeOf(other_param_type, bound_error, bound_trail,
- space)) ||
- other_param_type.IsSubtypeOf(param_type, bound_error, bound_trail,
- space))) {
- return false;
- }
- } else {
- ASSERT(test_kind == kIsMoreSpecificThan);
- if (!param_type.IsMoreSpecificThan(other_param_type, bound_error,
- bound_trail, space)) {
- return false;
- }
+ return param_type.IsSubtypeOf(other_param_type, bound_error, bound_trail,
+ space) ||
+ other_param_type.IsSubtypeOf(param_type, bound_error, bound_trail,
+ space);
}
- return true;
+ ASSERT(test_kind == kIsMoreSpecificThan);
+ return param_type.IsMoreSpecificThan(other_param_type, bound_error,
+ bound_trail, space);
}
bool Function::HasSameTypeParametersAndBounds(const Function& other) const {
@@ -6681,30 +6689,29 @@
AbstractType::Handle(zone, other.result_type());
if (!other_res_type.IsDynamicType() && !other_res_type.IsVoidType()) {
const AbstractType& res_type = AbstractType::Handle(zone, result_type());
- if (res_type.IsVoidType()) {
- // In strong mode, check if 'other' is 'FutureOr'.
- // If so, apply additional subtyping rules.
- if (isolate->strong() &&
- res_type.FutureOrTypeTest(zone, other_res_type, bound_error,
- bound_trail, space)) {
- return true;
- }
- return false;
- }
- if (test_kind == kIsSubtypeOf) {
- if (!(res_type.IsSubtypeOf(other_res_type, bound_error, bound_trail,
- space) ||
- (!isolate->strong() &&
- other_res_type.IsSubtypeOf(res_type, bound_error, bound_trail,
- space)))) {
+ if (isolate->strong()) {
+ if (!res_type.IsSubtypeOf(other_res_type, bound_error, bound_trail,
+ space)) {
return false;
}
} else {
- ASSERT(test_kind == kIsMoreSpecificThan);
- if (!res_type.IsMoreSpecificThan(other_res_type, bound_error, bound_trail,
- space)) {
+ if (res_type.IsVoidType()) {
return false;
}
+ if (test_kind == kIsSubtypeOf) {
+ if (!res_type.IsSubtypeOf(other_res_type, bound_error, bound_trail,
+ space) &&
+ !other_res_type.IsSubtypeOf(res_type, bound_error, bound_trail,
+ space)) {
+ return false;
+ }
+ } else {
+ ASSERT(test_kind == kIsMoreSpecificThan);
+ if (!res_type.IsMoreSpecificThan(other_res_type, bound_error,
+ bound_trail, space)) {
+ return false;
+ }
+ }
}
}
// Check the types of fixed and optional positional parameters.
@@ -15870,6 +15877,10 @@
TypeArguments::Handle(zone, other.arguments());
const AbstractType& other_type_arg =
AbstractType::Handle(zone, other_type_arguments.TypeAt(0));
+ if (other_type_arg.IsObjectType() || other_type_arg.IsDynamicType() ||
+ other_type_arg.IsVoidType()) {
+ return true;
+ }
if (Class::Handle(zone, clazz()).IsFutureClass()) {
const TypeArguments& type_arguments =
TypeArguments::Handle(zone, GetTypeArguments());
@@ -16713,6 +16724,10 @@
TypeArguments::Handle(zone, other.arguments());
const AbstractType& other_type_arg =
AbstractType::Handle(zone, other_type_arguments.TypeAt(0));
+ if (other_type_arg.IsObjectType() || other_type_arg.IsDynamicType() ||
+ other_type_arg.IsVoidType()) {
+ return true;
+ }
// Retry the TypeTest function after unwrapping type arg of FutureOr.
if (TypeTest(Class::kIsSubtypeOf, other_type_arg, bound_error, bound_trail,
space)) {
diff --git a/runtime/vm/pages.cc b/runtime/vm/pages.cc
index 1587348..55e90f3 100644
--- a/runtime/vm/pages.cc
+++ b/runtime/vm/pages.cc
@@ -183,8 +183,7 @@
max_capacity_in_words_(max_capacity_in_words),
max_external_in_words_(max_external_in_words),
tasks_lock_(new Monitor()),
- sweeper_tasks_(0),
- low_memory_tasks_(0),
+ tasks_(0),
#if defined(DEBUG)
iterating_thread_(NULL),
#endif
@@ -203,7 +202,7 @@
PageSpace::~PageSpace() {
{
MonitorLocker ml(tasks_lock());
- while (sweeper_tasks() > 0) {
+ while (tasks() > 0) {
ml.Wait();
}
}
@@ -851,7 +850,7 @@
{
MonitorLocker locker(tasks_lock());
- if (sweeper_tasks() > 0) {
+ if (tasks() > 0) {
// A concurrent sweeper is running. If we start a mark sweep now
// we'll have to wait for it, and this wait time is not included in
// mark_sweep_words_per_micro_.
@@ -875,10 +874,10 @@
// Wait for pending tasks to complete and then account for the driver task.
{
MonitorLocker locker(tasks_lock());
- while (sweeper_tasks() > 0) {
+ while (tasks() > 0) {
locker.WaitWithSafepointCheck(thread);
}
- set_sweeper_tasks(1);
+ set_tasks(1);
}
const int64_t pre_safe_point = OS::GetCurrentMonotonicMicros();
@@ -1036,7 +1035,7 @@
// Done, reset the task count.
{
MonitorLocker ml(tasks_lock());
- set_sweeper_tasks(sweeper_tasks() - 1);
+ set_tasks(tasks() - 1);
ml.NotifyAll();
}
diff --git a/runtime/vm/pages.h b/runtime/vm/pages.h
index 6ff35c8..d7a76a5 100644
--- a/runtime/vm/pages.h
+++ b/runtime/vm/pages.h
@@ -330,15 +330,10 @@
}
Monitor* tasks_lock() const { return tasks_lock_; }
- intptr_t sweeper_tasks() const { return sweeper_tasks_; }
- void set_sweeper_tasks(intptr_t val) {
+ intptr_t tasks() const { return tasks_; }
+ void set_tasks(intptr_t val) {
ASSERT(val >= 0);
- sweeper_tasks_ = val;
- }
- intptr_t low_memory_tasks() const { return low_memory_tasks_; }
- void set_low_memory_tasks(intptr_t val) {
- ASSERT(val >= 0);
- low_memory_tasks_ = val;
+ tasks_ = val;
}
// Attempt to allocate from bump block rather than normal freelist.
@@ -439,8 +434,7 @@
// Keep track of running MarkSweep tasks.
Monitor* tasks_lock_;
- int32_t sweeper_tasks_;
- int32_t low_memory_tasks_;
+ intptr_t tasks_;
#if defined(DEBUG)
Thread* iterating_thread_;
#endif
diff --git a/runtime/vm/runtime_entry.cc b/runtime/vm/runtime_entry.cc
index b1c853e..616a253 100644
--- a/runtime/vm/runtime_entry.cc
+++ b/runtime/vm/runtime_entry.cc
@@ -357,20 +357,20 @@
}
// Instantiate type.
-// Arg0: type to be a subtype of the other
-// Arg1: type to be a supertype of the other
-// Arg2: instantiator type arguments
-// Arg3: function type arguments
+// Arg0: instantiator type arguments
+// Arg1: function type arguments
+// Arg2: type to be a subtype of the other
+// Arg3: type to be a supertype of the other
// Arg4: variable name of the subtype parameter
// No return value.
DEFINE_RUNTIME_ENTRY(SubtypeCheck, 5) {
- AbstractType& subtype = AbstractType::CheckedHandle(zone, arguments.ArgAt(0));
- AbstractType& supertype =
- AbstractType::CheckedHandle(zone, arguments.ArgAt(1));
const TypeArguments& instantiator_type_args =
- TypeArguments::CheckedHandle(zone, arguments.ArgAt(2));
+ TypeArguments::CheckedHandle(zone, arguments.ArgAt(0));
const TypeArguments& function_type_args =
- TypeArguments::CheckedHandle(zone, arguments.ArgAt(3));
+ TypeArguments::CheckedHandle(zone, arguments.ArgAt(1));
+ AbstractType& subtype = AbstractType::CheckedHandle(zone, arguments.ArgAt(2));
+ AbstractType& supertype =
+ AbstractType::CheckedHandle(zone, arguments.ArgAt(3));
const String& dst_name = String::CheckedHandle(zone, arguments.ArgAt(4));
ASSERT(!subtype.IsNull() && !subtype.IsMalformedOrMalbounded());
diff --git a/runtime/vm/scavenger.cc b/runtime/vm/scavenger.cc
index 1a16fd4..723c071 100644
--- a/runtime/vm/scavenger.cc
+++ b/runtime/vm/scavenger.cc
@@ -498,7 +498,7 @@
{
PageSpace* page_space = heap_->old_space();
MonitorLocker ml(page_space->tasks_lock());
- if (page_space->sweeper_tasks() == 0) {
+ if (page_space->tasks() == 0) {
VerifyStoreBufferPointerVisitor verify_store_buffer_visitor(isolate, to_);
heap_->old_space()->VisitObjectPointers(&verify_store_buffer_visitor);
}
diff --git a/runtime/vm/simulator_dbc.cc b/runtime/vm/simulator_dbc.cc
index d7ddb93..6776065 100644
--- a/runtime/vm/simulator_dbc.cc
+++ b/runtime/vm/simulator_dbc.cc
@@ -1422,6 +1422,9 @@
FP[0] = f;
FP[1] = 0;
+ // Save the args desriptor which came in.
+ FP[2] = argdesc_;
+
// Make the DRT_OptimizeInvokedFunction see a stub as its caller for
// consistency with the other architectures, and to avoid needing to
// generate a stackmap for the HotCheck pc.
@@ -1429,8 +1432,8 @@
FP[kPcMarkerSlotFromFp] = stub->code();
pc = reinterpret_cast<uint32_t*>(stub->EntryPoint());
- Exit(thread, FP, FP + 2, pc);
- NativeArguments args(thread, 1, FP, FP + 1);
+ Exit(thread, FP, FP + 3, pc);
+ NativeArguments args(thread, 1, /*argv=*/FP, /*retval=*/FP + 1);
INVOKE_RUNTIME(DRT_OptimizeInvokedFunction, args);
{
// DRT_OptimizeInvokedFunction returns the code object to execute.
@@ -1438,6 +1441,10 @@
RawFunction* function = static_cast<RawFunction*>(FP[1]);
RawCode* code = function->ptr()->code_;
SimulatorHelpers::SetFrameCode(FP, code);
+
+ // Restore args descriptor which came in.
+ argdesc_ = Array::RawCast(FP[2]);
+
pp_ = code->ptr()->object_pool_;
pc = reinterpret_cast<uint32_t*>(function->ptr()->entry_point_);
pc_ = reinterpret_cast<uword>(pc); // For the profiler.
@@ -1992,6 +1999,14 @@
DISPATCH();
}
{
+ BYTECODE(SmiBitAndTOS, 0);
+ RawSmi* left = Smi::RawCast(SP[-1]);
+ RawSmi* right = Smi::RawCast(SP[-0]);
+ SP--;
+ SP[0] = Smi::New(Smi::Value(left) & Smi::Value(right));
+ DISPATCH();
+ }
+ {
BYTECODE(Add, A_B_C);
SMI_OP_CHECK(intptr_t, SignedAddWithOverflow);
DISPATCH();
@@ -3143,6 +3158,36 @@
}
{
+ BYTECODE(AssertSubtype, A);
+ RawObject** args = SP - 4;
+
+ // TODO(kustermann): Implement fast case for common arguments.
+
+ // The arguments on the stack look like:
+ // args[0] instantiator type args
+ // args[1] function type args
+ // args[2] sub_type
+ // args[3] super_type
+ // args[4] name
+
+ // This is unused, since the negative case throws an exception.
+ SP++;
+ RawObject** result_slot = SP;
+
+ Exit(thread, FP, SP + 1, pc);
+ NativeArguments native_args(thread, 5, args, result_slot);
+ INVOKE_RUNTIME(DRT_SubtypeCheck, native_args);
+
+ // Result slot not used anymore.
+ SP--;
+
+ // Drop all arguments.
+ SP -= 5;
+
+ DISPATCH();
+ }
+
+ {
BYTECODE(AssertBoolean, A);
RawObject* value = SP[0];
if (rA) { // Should we perform type check?
diff --git a/runtime/vm/stub_code_arm.cc b/runtime/vm/stub_code_arm.cc
index 8e38412..4ded309 100644
--- a/runtime/vm/stub_code_arm.cc
+++ b/runtime/vm/stub_code_arm.cc
@@ -356,7 +356,7 @@
// Input parameters:
// R2: smi-tagged argument count, may be zero.
// FP[kParamEndSlotFromFp + 1]: last argument.
-static void PushArgumentsArray(Assembler* assembler) {
+static void PushArrayOfArguments(Assembler* assembler) {
// Allocate array to store arguments of caller.
__ LoadObject(R1, Object::null_object());
// R1: null element type for raw Array.
@@ -592,7 +592,7 @@
__ AddImmediate(R2, R2, Smi::RawValue(1), NE); // Include the type arguments.
// R2: Smi-tagged arguments array length.
- PushArgumentsArray(assembler);
+ PushArrayOfArguments(assembler);
const intptr_t kNumArgs = 4;
__ CallRuntime(kInvokeNoSuchMethodDispatcherRuntimeEntry, kNumArgs);
__ Drop(4);
@@ -1234,7 +1234,7 @@
__ AddImmediate(R2, R2, Smi::RawValue(1), NE); // Include the type arguments.
// R2: Smi-tagged arguments array length.
- PushArgumentsArray(assembler);
+ PushArrayOfArguments(assembler);
const intptr_t kNumArgs = 3;
__ CallRuntime(kInvokeClosureNoSuchMethodRuntimeEntry, kNumArgs);
diff --git a/runtime/vm/stub_code_arm64.cc b/runtime/vm/stub_code_arm64.cc
index 918a1a9..a071130 100644
--- a/runtime/vm/stub_code_arm64.cc
+++ b/runtime/vm/stub_code_arm64.cc
@@ -391,7 +391,7 @@
// Input parameters:
// R2: smi-tagged argument count, may be zero.
// FP[kParamEndSlotFromFp + 1]: last argument.
-static void PushArgumentsArray(Assembler* assembler) {
+static void PushArrayOfArguments(Assembler* assembler) {
// Allocate array to store arguments of caller.
__ LoadObject(R1, Object::null_object());
// R1: null element type for raw Array.
@@ -614,7 +614,7 @@
__ csinc(R2, R2, TMP, EQ); // R2 <- (R3 == 0) ? R2 : TMP + 1 (R2 : R2 + 2).
// R2: Smi-tagged arguments array length.
- PushArgumentsArray(assembler);
+ PushArrayOfArguments(assembler);
const intptr_t kNumArgs = 4;
__ CallRuntime(kInvokeNoSuchMethodDispatcherRuntimeEntry, kNumArgs);
__ Drop(4);
@@ -1268,7 +1268,7 @@
__ csinc(R2, R2, TMP, EQ); // R2 <- (R3 == 0) ? R2 : TMP + 1 (R2 : R2 + 2).
// R2: Smi-tagged arguments array length.
- PushArgumentsArray(assembler);
+ PushArrayOfArguments(assembler);
const intptr_t kNumArgs = 3;
__ CallRuntime(kInvokeClosureNoSuchMethodRuntimeEntry, kNumArgs);
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc
index 14ac31a..2707fc7 100644
--- a/runtime/vm/stub_code_ia32.cc
+++ b/runtime/vm/stub_code_ia32.cc
@@ -298,7 +298,7 @@
// EDX: smi-tagged argument count, may be zero.
// EBP[kParamEndSlotFromFp + 1]: last argument.
// Uses EAX, EBX, ECX, EDX, EDI.
-static void PushArgumentsArray(Assembler* assembler) {
+static void PushArrayOfArguments(Assembler* assembler) {
// Allocate array to store arguments of caller.
const Immediate& raw_null =
Immediate(reinterpret_cast<intptr_t>(Object::null()));
@@ -507,7 +507,7 @@
__ Bind(&args_count_ok);
// EDX: Smi-tagged arguments array length.
- PushArgumentsArray(assembler);
+ PushArrayOfArguments(assembler);
const intptr_t kNumArgs = 4;
__ CallRuntime(kInvokeNoSuchMethodDispatcherRuntimeEntry, kNumArgs);
__ Drop(4);
@@ -1146,7 +1146,7 @@
__ Bind(&args_count_ok);
// EDX: Smi-tagged arguments array length.
- PushArgumentsArray(assembler);
+ PushArrayOfArguments(assembler);
const intptr_t kNumArgs = 3;
__ CallRuntime(kInvokeClosureNoSuchMethodRuntimeEntry, kNumArgs);
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index 879603e..0363b27 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -321,7 +321,7 @@
// Input parameters:
// R10: smi-tagged argument count, may be zero.
// RBP[kParamEndSlotFromFp + 1]: last argument.
-static void PushArgumentsArray(Assembler* assembler) {
+static void PushArrayOfArguments(Assembler* assembler) {
__ LoadObject(R12, Object::null_object());
// Allocate array to store arguments of caller.
__ movq(RBX, R12); // Null element type for raw Array.
@@ -554,7 +554,7 @@
__ Bind(&args_count_ok);
// R10: Smi-tagged arguments array length.
- PushArgumentsArray(assembler);
+ PushArrayOfArguments(assembler);
const intptr_t kNumArgs = 4;
__ CallRuntime(kInvokeNoSuchMethodDispatcherRuntimeEntry, kNumArgs);
__ Drop(4);
@@ -1205,7 +1205,7 @@
__ Bind(&args_count_ok);
// R10: Smi-tagged arguments array length.
- PushArgumentsArray(assembler);
+ PushArrayOfArguments(assembler);
const intptr_t kNumArgs = 3;
__ CallRuntime(kInvokeClosureNoSuchMethodRuntimeEntry, kNumArgs);
diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h
index 3a8fd38..7d5d50b 100644
--- a/runtime/vm/thread.h
+++ b/runtime/vm/thread.h
@@ -169,7 +169,6 @@
kMarkerTask = 0x4,
kSweeperTask = 0x8,
kCompactorTask = 0x10,
- kLowMemoryTask = 0x20,
};
// Converts a TaskKind to its corresponding C-String name.
static const char* TaskKindToCString(TaskKind kind);
diff --git a/runtime/vm/virtual_memory.cc b/runtime/vm/virtual_memory.cc
index 7ebf00d..ab89a53 100644
--- a/runtime/vm/virtual_memory.cc
+++ b/runtime/vm/virtual_memory.cc
@@ -20,7 +20,7 @@
if (try_unmap &&
(reserved_.size() ==
region_.size()) && /* Don't create holes in reservation. */
- FreeSubSegment(handle(), reinterpret_cast<void*>(start() + new_size),
+ FreeSubSegment(reinterpret_cast<void*>(start() + new_size),
size() - new_size)) {
reserved_.set_size(new_size);
}
diff --git a/runtime/vm/virtual_memory.h b/runtime/vm/virtual_memory.h
index 8bbaeb1..6e23292 100644
--- a/runtime/vm/virtual_memory.h
+++ b/runtime/vm/virtual_memory.h
@@ -24,7 +24,6 @@
// The reserved memory is unmapped on destruction.
~VirtualMemory();
- int32_t handle() const { return handle_; }
uword start() const { return region_.start(); }
uword end() const { return region_.end(); }
void* address() const { return region_.pointer(); }
@@ -71,14 +70,13 @@
private:
// Free a sub segment. On operating systems that support it this
// can give back the virtual memory to the system. Returns true on success.
- static bool FreeSubSegment(int32_t handle, void* address, intptr_t size);
+ static bool FreeSubSegment(void* address, intptr_t size);
// This constructor is only used internally when reserving new virtual spaces.
// It does not reserve any virtual address space on its own.
VirtualMemory(const MemoryRegion& region,
- const MemoryRegion& reserved,
- int32_t handle = 0)
- : region_(region), reserved_(reserved), handle_(handle) {}
+ const MemoryRegion& reserved)
+ : region_(region), reserved_(reserved) {}
MemoryRegion region_;
@@ -87,8 +85,6 @@
// Its size might disagree with region_ due to Truncate.
MemoryRegion reserved_;
- int32_t handle_;
-
static uword page_size_;
DISALLOW_IMPLICIT_CONSTRUCTORS(VirtualMemory);
diff --git a/runtime/vm/virtual_memory_android.cc b/runtime/vm/virtual_memory_android.cc
index 4ed9dab..06989ea 100644
--- a/runtime/vm/virtual_memory_android.cc
+++ b/runtime/vm/virtual_memory_android.cc
@@ -90,8 +90,7 @@
}
}
-bool VirtualMemory::FreeSubSegment(int32_t handle,
- void* address,
+bool VirtualMemory::FreeSubSegment(void* address,
intptr_t size) {
unmap(address, size);
return true;
diff --git a/runtime/vm/virtual_memory_fuchsia.cc b/runtime/vm/virtual_memory_fuchsia.cc
index a1804c7..bd7a486 100644
--- a/runtime/vm/virtual_memory_fuchsia.cc
+++ b/runtime/vm/virtual_memory_fuchsia.cc
@@ -35,132 +35,41 @@
namespace dart {
-// The Zircon system call to protect memory regions (zx_vmar_protect) takes a
-// VM area (vmar) handle as first argument. We call VirtualMemory::Protect()
-// from the memory freelist code in vm/freelist.cc where the vmar handle is not
-// available. Additionally, there is no zx_vmar system call to retrieve a handle
-// for the leaf vmar given an address. Thus, when memory protections are
-// enabled, we maintain a sorted list of our leaf vmar handles that we can
-// query by address in calls to VirtualMemory::Protect().
-class VmarList : public AllStatic {
- public:
- static void AddVmar(zx_handle_t vmar, uword addr, intptr_t size);
- static void RemoveVmar(uword addr);
- static zx_handle_t LookupVmar(uword addr);
-
- private:
- static intptr_t LookupVmarIndexLocked(uword addr);
-
- struct VmarListElement {
- zx_handle_t vmar;
- uword addr;
- intptr_t size;
- };
-
- static Mutex* vmar_array_lock_;
- static MallocGrowableArray<VmarListElement> vmar_array_;
-};
-
-Mutex* VmarList::vmar_array_lock_ = new Mutex();
-MallocGrowableArray<VmarList::VmarListElement> VmarList::vmar_array_;
-
-void VmarList::AddVmar(zx_handle_t vmar, uword addr, intptr_t size) {
- MutexLocker ml(vmar_array_lock_);
- LOG_INFO("AddVmar(%d, %lx, %ld)\n", vmar, addr, size);
- // Sorted insert in increasing order.
- const intptr_t length = vmar_array_.length();
- intptr_t idx;
- for (idx = 0; idx < length; idx++) {
- const VmarListElement& m = vmar_array_.At(idx);
- if (m.addr >= addr) {
- break;
- }
- }
-#if defined(DEBUG)
- if ((length > 0) && (idx < (length - 1))) {
- const VmarListElement& m = vmar_array_.At(idx);
- ASSERT(m.addr != addr);
- }
-#endif
- LOG_INFO("AddVmar(%d, %lx, %ld) at index = %ld\n", vmar, addr, size, idx);
- VmarListElement new_mapping;
- new_mapping.vmar = vmar;
- new_mapping.addr = addr;
- new_mapping.size = size;
- vmar_array_.InsertAt(idx, new_mapping);
-}
-
-intptr_t VmarList::LookupVmarIndexLocked(uword addr) {
- // Binary search for the vmar containing addr.
- intptr_t imin = 0;
- intptr_t imax = vmar_array_.length();
- while (imax >= imin) {
- const intptr_t imid = ((imax - imin) / 2) + imin;
- const VmarListElement& mapping = vmar_array_.At(imid);
- if ((mapping.addr + mapping.size) <= addr) {
- imin = imid + 1;
- } else if (mapping.addr > addr) {
- imax = imid - 1;
- } else {
- return imid;
- }
- }
- return -1;
-}
-
-zx_handle_t VmarList::LookupVmar(uword addr) {
- MutexLocker ml(vmar_array_lock_);
- LOG_INFO("LookupVmar(%lx)\n", addr);
- const intptr_t idx = LookupVmarIndexLocked(addr);
- if (idx == -1) {
- LOG_ERR("LookupVmar(%lx) NOT FOUND\n", addr);
- return ZX_HANDLE_INVALID;
- }
- LOG_INFO("LookupVmar(%lx) found at %ld\n", addr, idx);
- return vmar_array_[idx].vmar;
-}
-
-void VmarList::RemoveVmar(uword addr) {
- MutexLocker ml(vmar_array_lock_);
- LOG_INFO("RemoveVmar(%lx)\n", addr);
- const intptr_t idx = LookupVmarIndexLocked(addr);
- ASSERT(idx != -1);
-#if defined(DEBUG)
- zx_handle_t vmar = vmar_array_[idx].vmar;
-#endif
- // Swap idx to the end, and then RemoveLast()
- const intptr_t length = vmar_array_.length();
- for (intptr_t i = idx; i < length - 1; i++) {
- vmar_array_.Swap(i, i + 1);
- }
-#if defined(DEBUG)
- const VmarListElement& mapping = vmar_array_.Last();
- ASSERT(mapping.vmar == vmar);
-#endif
- vmar_array_.RemoveLast();
-}
-
uword VirtualMemory::page_size_ = 0;
void VirtualMemory::InitOnce() {
page_size_ = getpagesize();
}
-static void CloseVmar(zx_handle_t vmar) {
- zx_status_t status = zx_vmar_destroy(vmar);
- if (status != ZX_OK) {
- LOG_ERR("zx_vmar_destroy failed: %s\n", zx_status_get_string(status));
- }
- status = zx_handle_close(vmar);
- if (status != ZX_OK) {
- LOG_ERR("zx_handle_close failed: %s\n", zx_status_get_string(status));
- }
-}
-
VirtualMemory* VirtualMemory::Allocate(intptr_t size,
bool is_executable,
const char* name) {
- return AllocateAligned(size, 0, is_executable, name);
+ ASSERT(Utils::IsAligned(size, page_size_));
+ zx_handle_t vmo = ZX_HANDLE_INVALID;
+ zx_status_t status = zx_vmo_create(size, 0u, &vmo);
+ if (status != ZX_OK) {
+ LOG_ERR("zx_vmo_create(%ld) failed: %s\n", size,
+ zx_status_get_string(status));
+ return NULL;
+ }
+
+ if (name != NULL) {
+ zx_object_set_property(vmo, ZX_PROP_NAME, name, strlen(name));
+ }
+
+ const uint32_t flags = ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE |
+ (is_executable ? ZX_VM_FLAG_PERM_EXECUTE : 0);
+ uword address;
+ status = zx_vmar_map(zx_vmar_root_self(), 0, vmo, 0, size, flags, &address);
+ zx_handle_close(vmo);
+ if (status != ZX_OK) {
+ LOG_ERR("zx_vmar_map(%ld, %ld, %u) failed: %s\n", offset, size, flags,
+ zx_status_get_string(status));
+ return NULL;
+ }
+
+ MemoryRegion region(reinterpret_cast<void*>(address), size);
+ return new VirtualMemory(region, region);
}
VirtualMemory* VirtualMemory::AllocateAligned(intptr_t size,
@@ -170,26 +79,13 @@
ASSERT(Utils::IsAligned(size, page_size_));
ASSERT(Utils::IsAligned(alignment, page_size_));
intptr_t allocated_size = size + alignment;
- zx_handle_t vmar = ZX_HANDLE_INVALID;
- uword addr = 0;
- const uint32_t alloc_flags =
- ZX_VM_FLAG_COMPACT | ZX_VM_FLAG_CAN_MAP_SPECIFIC |
- ZX_VM_FLAG_CAN_MAP_READ | ZX_VM_FLAG_CAN_MAP_WRITE |
- ZX_VM_FLAG_CAN_MAP_EXECUTE;
- zx_status_t status = zx_vmar_allocate(zx_vmar_root_self(), 0, allocated_size,
- alloc_flags, &vmar, &addr);
- if (status != ZX_OK) {
- LOG_ERR("zx_vmar_allocate(size = %ld) failed: %s\n", size,
- zx_status_get_string(status));
- return NULL;
- }
+ zx_handle_t vmar = zx_vmar_root_self();
zx_handle_t vmo = ZX_HANDLE_INVALID;
- status = zx_vmo_create(size, 0u, &vmo);
+ zx_status_t status = zx_vmo_create(allocated_size, 0u, &vmo);
if (status != ZX_OK) {
LOG_ERR("zx_vmo_create(%ld) failed: %s\n", size,
zx_status_get_string(status));
- CloseVmar(vmar);
return NULL;
}
@@ -197,49 +93,54 @@
zx_object_set_property(vmo, ZX_PROP_NAME, name, strlen(name));
}
- uword aligned_addr = alignment == 0 ? addr : Utils::RoundUp(addr, alignment);
- const size_t offset = aligned_addr - addr;
- const uint32_t map_flags = ZX_VM_FLAG_SPECIFIC | ZX_VM_FLAG_PERM_READ |
- ZX_VM_FLAG_PERM_WRITE |
- (is_executable ? ZX_VM_FLAG_PERM_EXECUTE : 0);
- uintptr_t mapped_addr;
- status = zx_vmar_map(vmar, offset, vmo, 0, size, map_flags, &mapped_addr);
+ const uint32_t flags = ZX_VM_FLAG_PERM_READ | ZX_VM_FLAG_PERM_WRITE |
+ (is_executable ? ZX_VM_FLAG_PERM_EXECUTE : 0);
+ uword base;
+ status = zx_vmar_map(vmar, 0u, vmo, 0u, allocated_size, flags, &base);
zx_handle_close(vmo);
if (status != ZX_OK) {
LOG_ERR("zx_vmar_map(%ld, %ld, %u) failed: %s\n", offset, size, flags,
zx_status_get_string(status));
- CloseVmar(vmar);
return NULL;
}
- if (mapped_addr != aligned_addr) {
- LOG_ERR("zx_vmar_map: mapped_addr != aligned_addr: %lx != %lx\n",
- mapped_addr, aligned_addr);
- CloseVmar(vmar);
- return NULL;
- }
- LOG_INFO("Commit(%lx, %ld, %s): success\n", addr, size,
- executable ? "executable" : "");
- VmarList::AddVmar(vmar, aligned_addr, size);
- MemoryRegion region(reinterpret_cast<void*>(aligned_addr), size);
- MemoryRegion reserved(reinterpret_cast<void*>(addr), allocated_size);
- return new VirtualMemory(region, reserved, vmar);
+ uword aligned_base = Utils::RoundUp(base, alignment);
+ ASSERT(base <= aligned_base);
+
+ if (base != aligned_base) {
+ uword extra_leading_size = aligned_base - base;
+ status = zx_vmar_unmap(vmar, base, extra_leading_size);
+ if (status != ZX_OK) {
+ FATAL1("zx_vmar_unmap failed: %s\n", zx_status_get_string(status));
+ }
+ allocated_size -= extra_leading_size;
+ }
+
+ if (allocated_size != size) {
+ uword extra_trailing_size = allocated_size - size;
+ status = zx_vmar_unmap(vmar, aligned_base + size, extra_trailing_size);
+ if (status != ZX_OK) {
+ FATAL1("zx_vmar_unmap failed: %s\n", zx_status_get_string(status));
+ }
+ }
+
+ MemoryRegion region(reinterpret_cast<void*>(aligned_base), size);
+ return new VirtualMemory(region, region);
}
VirtualMemory::~VirtualMemory() {
if (vm_owns_region()) {
- zx_handle_t vmar = static_cast<zx_handle_t>(handle());
- CloseVmar(vmar);
- VmarList::RemoveVmar(start());
+ zx_status_t status =
+ zx_vmar_unmap(zx_vmar_root_self(), reserved_.start(), reserved_.size());
+ if (status != ZX_OK) {
+ FATAL1("zx_vmar_unmap failed: %s\n", zx_status_get_string(status));
+ }
}
}
-bool VirtualMemory::FreeSubSegment(int32_t handle,
- void* address,
- intptr_t size) {
- zx_handle_t vmar = static_cast<zx_handle_t>(handle);
- zx_status_t status =
- zx_vmar_unmap(vmar, reinterpret_cast<uintptr_t>(address), size);
+bool VirtualMemory::FreeSubSegment(void* address, intptr_t size) {
+ zx_status_t status = zx_vmar_unmap(
+ zx_vmar_root_self(), reinterpret_cast<uintptr_t>(address), size);
if (status != ZX_OK) {
LOG_ERR("zx_vmar_unmap failed: %s\n", zx_status_get_string(status));
return false;
@@ -253,13 +154,10 @@
const uword start_address = reinterpret_cast<uword>(address);
const uword end_address = start_address + size;
const uword page_address = Utils::RoundDown(start_address, PageSize());
- zx_handle_t vmar = VmarList::LookupVmar(page_address);
- ASSERT(vmar != ZX_HANDLE_INVALID);
uint32_t prot = 0;
switch (mode) {
case kNoAccess:
- // ZX-426: zx_vmar_protect() requires at least on permission.
- prot = ZX_VM_FLAG_PERM_READ;
+ prot = 0;
break;
case kReadOnly:
prot = ZX_VM_FLAG_PERM_READ;
@@ -275,8 +173,8 @@
ZX_VM_FLAG_PERM_EXECUTE;
break;
}
- zx_status_t status =
- zx_vmar_protect(vmar, page_address, end_address - page_address, prot);
+ zx_status_t status = zx_vmar_protect(zx_vmar_root_self(), page_address,
+ end_address - page_address, prot);
if (status != ZX_OK) {
LOG_ERR("zx_vmar_protect(%lx, %lx, %x) success: %s\n", page_address,
end_address - page_address, prot, zx_status_get_string(status));
diff --git a/runtime/vm/virtual_memory_linux.cc b/runtime/vm/virtual_memory_linux.cc
index ff20824..17def9c 100644
--- a/runtime/vm/virtual_memory_linux.cc
+++ b/runtime/vm/virtual_memory_linux.cc
@@ -90,8 +90,7 @@
}
}
-bool VirtualMemory::FreeSubSegment(int32_t handle,
- void* address,
+bool VirtualMemory::FreeSubSegment(void* address,
intptr_t size) {
unmap(address, size);
return true;
diff --git a/runtime/vm/virtual_memory_macos.cc b/runtime/vm/virtual_memory_macos.cc
index 60048cd..8b8fc3f 100644
--- a/runtime/vm/virtual_memory_macos.cc
+++ b/runtime/vm/virtual_memory_macos.cc
@@ -90,8 +90,7 @@
}
}
-bool VirtualMemory::FreeSubSegment(int32_t handle,
- void* address,
+bool VirtualMemory::FreeSubSegment(void* address,
intptr_t size) {
unmap(address, size);
return true;
diff --git a/runtime/vm/virtual_memory_win.cc b/runtime/vm/virtual_memory_win.cc
index 5e25f1a..81f7ff4 100644
--- a/runtime/vm/virtual_memory_win.cc
+++ b/runtime/vm/virtual_memory_win.cc
@@ -70,8 +70,7 @@
}
}
-bool VirtualMemory::FreeSubSegment(int32_t handle,
- void* address,
+bool VirtualMemory::FreeSubSegment(void* address,
intptr_t size) {
// On Windows only the entire segment returned by VirtualAlloc
// can be freed. Therefore we will have to waste these unused
diff --git a/sdk/lib/_http/http.dart b/sdk/lib/_http/http.dart
index ad55396..1cb1b53 100644
--- a/sdk/lib/_http/http.dart
+++ b/sdk/lib/_http/http.dart
@@ -182,7 +182,7 @@
*/
abstract class HttpServer implements Stream<HttpRequest> {
/**
- * Get and set the default value of the `Server` header for all responses
+ * Gets and sets the default value of the `Server` header for all responses
* generated by this [HttpServer].
*
* If [serverHeader] is `null`, no `Server` header will be added to each
@@ -220,8 +220,8 @@
bool autoCompress;
/**
- * Get or set the timeout used for idle keep-alive connections. If no further
- * request is seen within [idleTimeout] after the previous request was
+ * Gets or sets the timeout used for idle keep-alive connections. If no
+ * further request is seen within [idleTimeout] after the previous request was
* completed, the connection is dropped.
*
* Default is 120 seconds.
@@ -721,7 +721,7 @@
/**
* Gets the map of parameters.
*
- * This map cannot be modified. invoking any operation which would
+ * This map cannot be modified. Invoking any operation which would
* modify the map will throw [UnsupportedError].
*/
Map<String, String> get parameters;
@@ -1158,7 +1158,7 @@
Duration deadline;
/**
- * Get or set if the [HttpResponse] should buffer output.
+ * Gets or sets if the [HttpResponse] should buffer output.
*
* Default value is `true`.
*
@@ -1308,14 +1308,14 @@
static const int DEFAULT_HTTP_PORT = 80;
static const int DEFAULT_HTTPS_PORT = 443;
- /**
- * Get and set the idle timeout of non-active persistent (keep-alive)
- * connections. The default value is 15 seconds.
- */
+ /// Gets and sets the idle timeout of non-active persistent (keep-alive)
+ /// connections.
+ ///
+ /// The default value is 15 seconds.
Duration idleTimeout;
/**
- * Get and set the maximum number of live connections, to a single host.
+ * Gets and sets the maximum number of live connections, to a single host.
*
* Increasing this number may lower performance and take up unwanted
* system resources.
@@ -1327,7 +1327,7 @@
int maxConnectionsPerHost;
/**
- * Get and set whether the body of a response will be automatically
+ * Gets and sets whether the body of a response will be automatically
* uncompressed.
*
* The body of an HTTP response can be compressed. In most
@@ -1336,7 +1336,7 @@
* body. However in some situations (e.g. implementing a transparent
* proxy) keeping the uncompressed stream is required.
*
- * NOTE: Headers in from the response is never modified. This means
+ * NOTE: Headers in the response are never modified. This means
* that when automatic un-compression is turned on the value of the
* header `Content-Length` will reflect the length of the original
* compressed body. Likewise the header `Content-Encoding` will also
@@ -1354,14 +1354,13 @@
*/
bool autoUncompress;
- /**
- * Set and get the default value of the `User-Agent` header for all requests
- * generated by this [HttpClient]. The default value is
- * `Dart/<version> (dart:io)`.
- *
- * If the userAgent is set to `null`, no default `User-Agent` header will be
- * added to each request.
- */
+ /// Gets and sets the default value of the `User-Agent` header for all requests
+ /// generated by this [HttpClient].
+ ///
+ /// The default value is `Dart/<version> (dart:io)`.
+ ///
+ /// If the userAgent is set to `null`, no default `User-Agent` header will be
+ /// added to each request.
String userAgent;
factory HttpClient({SecurityContext context}) {
@@ -1474,7 +1473,7 @@
* Opens a HTTP connection using the DELETE method.
*
* The server is specified using [host] and [port], and the path
- * (including s possible query) is specified using [path].
+ * (including a possible query) is specified using [path].
*
* See [open] for details.
*/
@@ -1619,7 +1618,7 @@
* HttpClient client = new HttpClient();
* client.findProxy = (url) {
* return HttpClient.findProxyFromEnvironment(
- * url, {"http_proxy": ..., "no_proxy": ...});
+ * url, environment: {"http_proxy": ..., "no_proxy": ...});
* }
*
* If a proxy requires authentication it is possible to configure
@@ -1688,16 +1687,14 @@
set badCertificateCallback(
bool callback(X509Certificate cert, String host, int port));
- /**
- * Shut down the HTTP client. If [force] is `false` (the default)
- * the [HttpClient] will be kept alive until all active
- * connections are done. If [force] is `true` any active
- * connections will be closed to immediately release all
- * resources. These closed connections will receive an error
- * event to indicate that the client was shut down. In both cases
- * trying to establish a new connection after calling [close]
- * will throw an exception.
- */
+ /// Shuts down the HTTP client.
+ ///
+ /// If [force] is `false` (the default) the [HttpClient] will be kept alive
+ /// until all active connections are done. If [force] is `true` any active
+ /// connections will be closed to immediately release all resources. These
+ /// closed connections will receive an error event to indicate that the client
+ /// was shut down. In both cases trying to establish a new connection after
+ /// calling [close] will throw an exception.
void close({bool force: false});
}
@@ -1744,7 +1741,7 @@
* automatically follow redirects. The default is [:true:].
*
* Automatic redirect will only happen for "GET" and "HEAD" requests
- * and only for the status codes [:HttpHeaders.MOVED_PERMANENTLY:]
+ * and only for the status codes [:HttpStatus.MOVED_PERMANENTLY:]
* (301), [:HttpStatus.FOUND:] (302),
* [:HttpStatus.MOVED_TEMPORARILY:] (302, alias for
* [:HttpStatus.FOUND:]), [:HttpStatus.SEE_OTHER:] (303) and
@@ -1778,15 +1775,14 @@
*/
Uri get uri;
- /**
- * Gets and sets the content length of the request. If the size of
- * the request is not known in advance set content length to -1,
- * which is also the default.
- */
+ /// Gets and sets the content length of the request.
+ ///
+ /// If the size of the request is not known in advance set content length to
+ /// -1, which is also the default.
int contentLength;
/**
- * Get or set if the [HttpClientRequest] should buffer output.
+ * Gets or sets if the [HttpClientRequest] should buffer output.
*
* Default value is `true`.
*
@@ -1809,11 +1805,11 @@
*/
List<Cookie> get cookies;
- /**
- * A [HttpClientResponse] future that will complete once the response is
- * available. If an error occurs before the response is available, this
- * future will complete with an error.
- */
+ /// A [HttpClientResponse] future that will complete once the response is
+ /// available.
+ ///
+ /// If an error occurs before the response is available, this future will
+ /// complete with an error.
Future<HttpClientResponse> get done;
/**
@@ -1821,10 +1817,9 @@
*/
Future<HttpClientResponse> close();
- /**
- * Get information about the client connection. Returns [:null:] if the socket
- * is not available.
- */
+ /// Gets information about the client connection.
+ ///
+ /// Returns [:null:] if the socket is not available.
HttpConnectionInfo get connectionInfo;
}
diff --git a/sdk/lib/_http/http_impl.dart b/sdk/lib/_http/http_impl.dart
index ee8f0c2..ed91dd4 100644
--- a/sdk/lib/_http/http_impl.dart
+++ b/sdk/lib/_http/http_impl.dart
@@ -1683,7 +1683,7 @@
_httpParser.isHead = method == "HEAD";
_streamFuture = outgoing.done.then<Socket>((Socket s) {
// Request sent, set up response completer.
- _nextResponseCompleter = new Completer();
+ _nextResponseCompleter = new Completer<_HttpIncoming>();
// Listen for response.
_nextResponseCompleter.future.then((incoming) {
@@ -2498,7 +2498,7 @@
address, int port, int backlog, bool v6Only, bool shared) {
return ServerSocket
.bind(address, port, backlog: backlog, v6Only: v6Only, shared: shared)
- .then((socket) {
+ .then<HttpServer>((socket) {
return new _HttpServer._(socket, true);
});
}
@@ -2517,7 +2517,7 @@
v6Only: v6Only,
requestClientCertificate: requestClientCertificate,
shared: shared)
- .then((socket) {
+ .then<HttpServer>((socket) {
return new _HttpServer._(socket, true);
});
}
@@ -2882,9 +2882,9 @@
Future flush() => _socket.flush();
- Future<Socket> close() => _socket.close();
+ Future close() => _socket.close();
- Future<Socket> get done => _socket.done;
+ Future get done => _socket.done;
int get port => _socket.port;
diff --git a/sdk/lib/_http/overrides.dart b/sdk/lib/_http/overrides.dart
index 7ef35b2..7f9e689 100644
--- a/sdk/lib/_http/overrides.dart
+++ b/sdk/lib/_http/overrides.dart
@@ -30,8 +30,19 @@
/// }
/// ```
abstract class HttpOverrides {
+ static HttpOverrides _global;
+
static HttpOverrides get current {
- return Zone.current[_httpOverridesToken];
+ return Zone.current[_httpOverridesToken] ?? _global;
+ }
+
+ /// The [HttpOverrides] to use in the root [Zone].
+ ///
+ /// These are the [HttpOverrides] that will be used in the root Zone, and in
+ /// Zone's that do not set [HttpOverrides] and whose ancestors up to the root
+ /// Zone do not set [HttpOverrides].
+ static set global(HttpOverrides overrides) {
+ _global = overrides;
}
/// Runs [body] in a fresh [Zone] using the provided overrides.
diff --git a/sdk/lib/_http/websocket_impl.dart b/sdk/lib/_http/websocket_impl.dart
index 1ffcaa4..726dfba 100644
--- a/sdk/lib/_http/websocket_impl.dart
+++ b/sdk/lib/_http/websocket_impl.dart
@@ -838,7 +838,7 @@
StreamSubscription _subscription;
bool _issuedPause = false;
bool _closed = false;
- Completer _closeCompleter = new Completer();
+ Completer _closeCompleter = new Completer<WebSocket>();
Completer _completer;
_WebSocketConsumer(this.webSocket, this.socket);
diff --git a/sdk/lib/_internal/js_runtime/lib/async_patch.dart b/sdk/lib/_internal/js_runtime/lib/async_patch.dart
index b938c3d..be475bd7 100644
--- a/sdk/lib/_internal/js_runtime/lib/async_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/async_patch.dart
@@ -21,6 +21,8 @@
import 'dart:_async_await_error_codes' as async_error_codes;
+import "dart:collection" show IterableBase;
+
@patch
class _AsyncRun {
@patch
diff --git a/sdk/lib/_internal/js_runtime/lib/collection_patch.dart b/sdk/lib/_internal/js_runtime/lib/collection_patch.dart
index 019c75b..33cfe4a 100644
--- a/sdk/lib/_internal/js_runtime/lib/collection_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/collection_patch.dart
@@ -17,6 +17,8 @@
LinkedHashMapKeyIterable,
LinkedHashMapKeyIterator;
+import 'dart:_internal' hide Symbol;
+
const _USE_ES6_MAPS = const bool.fromEnvironment("dart2js.use.es6.maps");
@patch
diff --git a/sdk/lib/_internal/js_runtime/lib/core_patch.dart b/sdk/lib/_internal/js_runtime/lib/core_patch.dart
index 6cd7e3c..1c8beff 100644
--- a/sdk/lib/_internal/js_runtime/lib/core_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/core_patch.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
// Patch file for dart:core classes.
+import "dart:_internal" hide Symbol, LinkedList, LinkedListEntry;
import "dart:_internal" as _symbol_dev;
import 'dart:_interceptors';
import 'dart:_js_helper'
@@ -26,7 +27,7 @@
import 'dart:_native_typed_data' show NativeUint8List;
-import 'dart:async' show StreamController;
+import "dart:convert" show Encoding, utf8;
String _symbolToString(Symbol symbol) => _symbol_dev.Symbol.getName(symbol);
diff --git a/sdk/lib/_internal/js_runtime/lib/developer_patch.dart b/sdk/lib/_internal/js_runtime/lib/developer_patch.dart
index d9c577b..a1ae56c 100644
--- a/sdk/lib/_internal/js_runtime/lib/developer_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/developer_patch.dart
@@ -6,6 +6,8 @@
import 'dart:_js_helper' show patch, ForceInline;
import 'dart:_foreign_helper' show JS;
+import 'dart:async' show Zone;
+import 'dart:isolate';
@patch
@ForceInline()
diff --git a/sdk/lib/_internal/js_runtime/lib/internal_patch.dart b/sdk/lib/_internal/js_runtime/lib/internal_patch.dart
index 420901d4..fddf0aa 100644
--- a/sdk/lib/_internal/js_runtime/lib/internal_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/internal_patch.dart
@@ -2,6 +2,8 @@
// 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:core' hide Symbol;
+import 'dart:core' as core;
import 'dart:_js_primitives' show printString;
import 'dart:_js_helper' show patch;
import 'dart:_interceptors' show JSArray;
diff --git a/sdk/lib/_internal/js_runtime/lib/io_patch.dart b/sdk/lib/_internal/js_runtime/lib/io_patch.dart
index 7330445..b71ae548 100644
--- a/sdk/lib/_internal/js_runtime/lib/io_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/io_patch.dart
@@ -3,6 +3,11 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:_js_helper' show patch;
+import 'dart:_internal' hide Symbol;
+import 'dart:async';
+import 'dart:convert';
+import 'dart:isolate';
+import 'dart:typed_data';
@patch
class _Directory {
diff --git a/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart b/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart
index 9b46ac2..9cfeabf 100644
--- a/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart
@@ -4,6 +4,7 @@
// Patch file for the dart:isolate library.
+import "dart:async";
import 'dart:_js_helper' show patch;
import 'dart:_isolate_helper'
show CapabilityImpl, IsolateNatives, ReceivePortImpl, RawReceivePortImpl;
diff --git a/sdk/lib/core/annotations.dart b/sdk/lib/core/annotations.dart
index 72afcce..ff32c8d 100644
--- a/sdk/lib/core/annotations.dart
+++ b/sdk/lib/core/annotations.dart
@@ -72,15 +72,15 @@
String toString() => "Deprecated feature. Will be removed $expires";
}
-class _Override {
- const _Override();
-}
-
/**
* Marks a feature as [Deprecated] until the next release.
*/
const Deprecated deprecated = const Deprecated("next release");
+class _Override {
+ const _Override();
+}
+
/**
* The annotation `@override` marks an instance member as overriding a
* superclass member with the same name.
@@ -108,6 +108,59 @@
*/
const Object override = const _Override();
+/**
+ * The annotation `@Provisional('message')` marks a feature as provisional.
+ *
+ * An API is considered to be provisional if it is still going through the
+ * process of stabilizing and is subject to change or removal.
+ *
+ * The intent of the `@Provisional` annotation is to mark APIs that are still in
+ * development or that are added only tentatively. Adding the API allows users
+ * to experiment with using the APIs, which can provide valuable feedback. Such
+ * provisional APIs do not promise stability. They can be changed or removed
+ * without warning.
+ *
+ * The `@Provisional` annotation applies to:
+ * - library directives,
+ * - public top-level declarations, and
+ * - public members of public classes.
+ *
+ * Provisionality is transitive:
+ * - If a library is provisional, so is every member of it.
+ * - If a class is provisional, so is every member of it.
+ * - If a variable is provisional, so are its implicit getter and setter.
+ *
+ * Further, if a class is provisional, so are classes that extend, implement,
+ * and mix-in the class.
+ *
+ * A tool that processes Dart source code may report when:
+ * - the code imports a provisional library.
+ * - the code exports a provisional library, or any provisional member of
+ * a non-provisional library.
+ * - the code refers statically to a provisional declaration.
+ * - the code dynamically uses a member of an object with a statically known
+ * type, where the member is provisional on the static type of the object.
+ *
+ * If the provisional use is inside a library, class or method which is itself
+ * provisional, the tool should not bother the user about it.
+ * A provisional feature is expected to use other provisional features.
+ */
+class Provisional {
+ /**
+ * A brief message describing how or why the feature is provisional.
+ */
+ final String message;
+
+ const Provisional({String message})
+ : this.message = message ?? "Subject to change or removal.";
+}
+
+/**
+ * Marks a feature as provisional with the message "Subject to change or
+ * removal".
+ */
+const Provisional provisional = const Provisional();
+
class _Proxy {
const _Proxy();
}
diff --git a/sdk/lib/io/overrides.dart b/sdk/lib/io/overrides.dart
index 3e3d5a7..4c85c9a 100644
--- a/sdk/lib/io/overrides.dart
+++ b/sdk/lib/io/overrides.dart
@@ -32,8 +32,19 @@
/// }
/// ```
abstract class IOOverrides {
+ static IOOverrides _global;
+
static IOOverrides get current {
- return Zone.current[_ioOverridesToken];
+ return Zone.current[_ioOverridesToken] ?? _global;
+ }
+
+ /// The [IOOverrides] to use in the root [Zone].
+ ///
+ /// These are the [IOOverrides] that will be used in the root Zone, and in
+ /// Zone's that do not set [IOOverrides] and whose ancestors up to the root
+ /// Zone do not set [IOOverrides].
+ static set global(IOOverrides overrides) {
+ _global = overrides;
}
/// Runs [body] in a fresh [Zone] using the provided overrides.
diff --git a/sdk/lib/libraries.json b/sdk/lib/libraries.json
index cc2dc29..82c4ff4 100644
--- a/sdk/lib/libraries.json
+++ b/sdk/lib/libraries.json
@@ -87,6 +87,9 @@
],
"uri": "mirrors/mirrors.dart"
},
+ "_vmservice": {
+ "uri": "vmservice/vmservice.dart"
+ },
"io": {
"patches": [
"../../runtime/bin/common_patch.dart",
@@ -130,12 +133,123 @@
"_http": {
"uri": "_http/http.dart"
},
- "_vmservice": {
- "uri": "vmservice/vmservice.dart"
- },
"vmservice_io": {
"uri": "../../runtime/bin/vmservice/vmservice_io.dart"
}
}
+ },
+ "dart2js": {
+ "libraries": {
+ "async": {
+ "patches": "_internal/js_runtime/lib/async_patch.dart",
+ "uri": "async/async.dart"
+ },
+ "mirrors": {
+ "patches": "_internal/js_runtime/lib/mirrors_patch.dart",
+ "uri": "mirrors/mirrors.dart"
+ },
+ "_interceptors": {
+ "uri": "_internal/js_runtime/lib/interceptors.dart"
+ },
+ "_js_embedded_names": {
+ "uri": "_internal/js_runtime/lib/shared/embedded_names.dart"
+ },
+ "io": {
+ "patches": "_internal/js_runtime/lib/io_patch.dart",
+ "uri": "io/io.dart"
+ },
+ "_internal": {
+ "patches": "_internal/js_runtime/lib/internal_patch.dart",
+ "uri": "internal/internal.dart"
+ },
+ "_metadata": {
+ "uri": "html/html_common/metadata.dart"
+ },
+ "_async_await_error_codes": {
+ "uri": "_internal/js_runtime/lib/shared/async_await_error_codes.dart"
+ },
+ "_http": {
+ "uri": "_http/http.dart"
+ },
+ "_js_primitives": {
+ "uri": "_internal/js_runtime/lib/js_primitives.dart"
+ },
+ "_js_helper": {
+ "uri": "_internal/js_runtime/lib/js_helper.dart"
+ },
+ "_chrome": {
+ "uri": "_chrome/dart2js/chrome_dart2js.dart"
+ },
+ "_js_mirrors": {
+ "uri": "_internal/js_runtime/lib/js_mirrors.dart"
+ },
+ "js": {
+ "uri": "js/dart2js/js_dart2js.dart"
+ },
+ "html_common": {
+ "uri": "html/html_common/html_common_dart2js.dart"
+ },
+ "_native_typed_data": {
+ "uri": "_internal/js_runtime/lib/native_typed_data.dart"
+ },
+ "_js_names": {
+ "uri": "_internal/js_runtime/lib/js_names.dart"
+ },
+ "core": {
+ "patches": "_internal/js_runtime/lib/core_patch.dart",
+ "uri": "core/core.dart"
+ },
+ "collection": {
+ "patches": "_internal/js_runtime/lib/collection_patch.dart",
+ "uri": "collection/collection.dart"
+ },
+ "js_util": {
+ "uri": "js_util/dart2js/js_util_dart2js.dart"
+ },
+ "typed_data": {
+ "patches": "_internal/js_runtime/lib/typed_data_patch.dart",
+ "uri": "typed_data/typed_data.dart"
+ },
+ "web_audio": {
+ "uri": "web_audio/dart2js/web_audio_dart2js.dart"
+ },
+ "html": {
+ "uri": "html/dart2js/html_dart2js.dart"
+ },
+ "isolate": {
+ "patches": "_internal/js_runtime/lib/isolate_patch.dart",
+ "uri": "isolate/isolate.dart"
+ },
+ "developer": {
+ "patches": "_internal/js_runtime/lib/developer_patch.dart",
+ "uri": "developer/developer.dart"
+ },
+ "web_gl": {
+ "uri": "web_gl/dart2js/web_gl_dart2js.dart"
+ },
+ "indexed_db": {
+ "uri": "indexed_db/dart2js/indexed_db_dart2js.dart"
+ },
+ "convert": {
+ "patches": "_internal/js_runtime/lib/convert_patch.dart",
+ "uri": "convert/convert.dart"
+ },
+ "_isolate_helper": {
+ "uri": "_internal/js_runtime/lib/isolate_helper.dart"
+ },
+ "math": {
+ "patches": "_internal/js_runtime/lib/math_patch.dart",
+ "uri": "math/math.dart"
+ },
+ "_foreign_helper": {
+ "uri": "_internal/js_runtime/lib/foreign_helper.dart"
+ },
+ "web_sql": {
+ "uri": "web_sql/dart2js/web_sql_dart2js.dart"
+ },
+ "svg": {
+ "uri": "svg/dart2js/svg_dart2js.dart"
+ }
+ }
}
-}
+}
\ No newline at end of file
diff --git a/sdk/lib/libraries.yaml b/sdk/lib/libraries.yaml
index 78e2eb9..6c88c97 100644
--- a/sdk/lib/libraries.yaml
+++ b/sdk/lib/libraries.yaml
@@ -137,3 +137,115 @@
vmservice_io:
uri: "../../runtime/bin/vmservice/vmservice_io.dart"
+
+dart2js:
+ libraries:
+ async:
+ uri: "async/async.dart"
+ patches: "_internal/js_runtime/lib/async_patch.dart"
+
+ _chrome:
+ uri: "_chrome/dart2js/chrome_dart2js.dart"
+
+ collection:
+ uri: "collection/collection.dart"
+ patches: "_internal/js_runtime/lib/collection_patch.dart"
+
+ convert:
+ uri: "convert/convert.dart"
+ patches: "_internal/js_runtime/lib/convert_patch.dart"
+
+ core:
+ uri: "core/core.dart"
+ patches: "_internal/js_runtime/lib/core_patch.dart"
+
+ developer:
+ uri: "developer/developer.dart"
+ patches: "_internal/js_runtime/lib/developer_patch.dart"
+
+ html:
+ uri: "html/dart2js/html_dart2js.dart"
+
+ html_common:
+ uri: "html/html_common/html_common_dart2js.dart"
+
+ indexed_db:
+ uri: "indexed_db/dart2js/indexed_db_dart2js.dart"
+
+ _http:
+ uri: "_http/http.dart"
+
+ io:
+ uri: "io/io.dart"
+ patches: "_internal/js_runtime/lib/io_patch.dart"
+
+ isolate:
+ uri: "isolate/isolate.dart"
+ patches: "_internal/js_runtime/lib/isolate_patch.dart"
+
+ js:
+ uri: "js/dart2js/js_dart2js.dart"
+
+ js_util:
+ uri: "js_util/dart2js/js_util_dart2js.dart"
+
+ math:
+ uri: "math/math.dart"
+ patches: "_internal/js_runtime/lib/math_patch.dart"
+
+ mirrors:
+ uri: "mirrors/mirrors.dart"
+ patches: "_internal/js_runtime/lib/mirrors_patch.dart"
+
+ typed_data:
+ uri: "typed_data/typed_data.dart"
+ patches: "_internal/js_runtime/lib/typed_data_patch.dart"
+
+ _native_typed_data:
+ uri: "_internal/js_runtime/lib/native_typed_data.dart"
+
+ svg:
+ uri: "svg/dart2js/svg_dart2js.dart"
+
+ web_audio:
+ uri: "web_audio/dart2js/web_audio_dart2js.dart"
+
+ web_gl:
+ uri: "web_gl/dart2js/web_gl_dart2js.dart"
+
+ web_sql:
+ uri: "web_sql/dart2js/web_sql_dart2js.dart"
+
+ _internal:
+ uri: "internal/internal.dart"
+ patches: "_internal/js_runtime/lib/internal_patch.dart"
+
+ _js_helper:
+ uri: "_internal/js_runtime/lib/js_helper.dart"
+
+ _interceptors:
+ uri: "_internal/js_runtime/lib/interceptors.dart"
+
+ _foreign_helper:
+ uri: "_internal/js_runtime/lib/foreign_helper.dart"
+
+ _isolate_helper:
+ uri: "_internal/js_runtime/lib/isolate_helper.dart"
+
+ _js_mirrors:
+ uri: "_internal/js_runtime/lib/js_mirrors.dart"
+
+ _js_names:
+ uri: "_internal/js_runtime/lib/js_names.dart"
+
+ _js_primitives:
+ uri: "_internal/js_runtime/lib/js_primitives.dart"
+
+ _js_embedded_names:
+ uri: "_internal/js_runtime/lib/shared/embedded_names.dart"
+
+ _async_await_error_codes:
+ uri: "_internal/js_runtime/lib/shared/async_await_error_codes.dart"
+
+ _metadata:
+ uri: "html/html_common/metadata.dart"
diff --git a/sdk/lib/vmservice/asset.dart b/sdk/lib/vmservice/asset.dart
index 32c8ec2..c0c31fc 100644
--- a/sdk/lib/vmservice/asset.dart
+++ b/sdk/lib/vmservice/asset.dart
@@ -67,144 +67,3 @@
}
return _assets;
}
-
-class _ByteStream {
- final Uint8List bytes;
- final int offset;
- int get length => bytes.length - offset;
- int _cursor = 0;
-
- _ByteStream(this.bytes, [this.offset = 0]);
-
- void reset() {
- _cursor = 0;
- }
-
- int peekByte([int index = 0]) => bytes[offset + _cursor + index];
-
- int readByte() {
- int r = peekByte();
- _advance(1);
- return r;
- }
-
- void skip(int bytes) => _advance(bytes);
-
- void seekToNextBlock(int blockSize) {
- int remainder = blockSize - (_cursor % blockSize);
- _advance(remainder);
- }
-
- void _advance(int bytes) {
- _cursor += bytes;
- if (_cursor > length) {
- _cursor = length;
- }
- }
-
- int get remaining => length - _cursor;
- bool get hasMore => remaining > 0;
- int get cursor => _cursor;
- void set cursor(int cursor) {
- _cursor = cursor;
- if (_cursor > length) {
- _cursor = length;
- }
- }
-}
-
-class _TarArchive {
- static const List<int> tarMagic = const [0x75, 0x73, 0x74, 0x61, 0x72, 0];
- static const List<int> tarVersion = const [0x30, 0x30];
- static const int tarHeaderSize = 512;
- static const int tarHeaderFilenameSize = 100;
- static const int tarHeaderFilenameOffset = 0;
- static const int tarHeaderSizeSize = 12;
- static const int tarHeaderSizeOffset = 124;
- static const int tarHeaderTypeSize = 1;
- static const int tarHeaderTypeOffset = 156;
- static const int tarHeaderFileType = 0x30;
-
- static String _readCString(_ByteStream bs, int length) {
- StringBuffer sb = new StringBuffer();
- int count = 0;
- while (bs.hasMore && count < length) {
- if (bs.peekByte() == 0) {
- // Null character.
- break;
- }
- sb.writeCharCode(bs.readByte());
- count++;
- }
- return sb.toString();
- }
-
- static String _readFilename(_ByteStream bs) {
- String filename = _readCString(bs, tarHeaderFilenameSize);
- if (filename.startsWith('/')) {
- return filename;
- }
- return '/' + filename;
- }
-
- static Uint8List _readContents(_ByteStream bs, int size) {
- Uint8List result = new Uint8List(size);
- int i = 0;
- while (bs.hasMore && i < size) {
- result[i] = bs.readByte();
- i++;
- }
- bs.seekToNextBlock(tarHeaderSize);
- return result;
- }
-
- static void _skipContents(_ByteStream bs, int size) {
- bs.skip(size);
- bs.seekToNextBlock(tarHeaderSize);
- }
-
- static int _readSize(_ByteStream bs) {
- String octalSize = _readCString(bs, tarHeaderSizeSize);
- return int.parse(octalSize, radix: 8, onError: (_) => 0);
- }
-
- static int _readType(_ByteStream bs) {
- return bs.readByte();
- }
-
- static bool _endOfArchive(_ByteStream bs) {
- if (bs.remaining < (tarHeaderSize * 2)) {
- return true;
- }
- for (int i = 0; i < (tarHeaderSize * 2); i++) {
- if (bs.peekByte(i) != 0) {
- return false;
- }
- }
- return true;
- }
-
- final _ByteStream _bs;
-
- _TarArchive(Uint8List bytes) : _bs = new _ByteStream(bytes);
-
- bool hasNext() {
- return !_endOfArchive(_bs);
- }
-
- Asset next() {
- int startOfBlock = _bs.cursor;
- String filename = _readFilename(_bs);
- _bs.cursor = startOfBlock + tarHeaderSizeOffset;
- int size = _readSize(_bs);
- _bs.cursor = startOfBlock + tarHeaderTypeOffset;
- int type = _readType(_bs);
- _bs.seekToNextBlock(tarHeaderSize);
- if (type != tarHeaderFileType) {
- _skipContents(_bs, size);
- return null;
- }
- Uint8List bytes = _readContents(_bs, size);
- return new Asset(filename, bytes);
- }
-}
diff --git a/sdk/lib/vmservice/client.dart b/sdk/lib/vmservice/client.dart
index 3f99607..7e0fdd8 100644
--- a/sdk/lib/vmservice/client.dart
+++ b/sdk/lib/vmservice/client.dart
@@ -41,7 +41,7 @@
void onRequest(Message message) {
// In JSON-RPC 2.0 messages with and id are Request and must be answered
// http://www.jsonrpc.org/specification#notification
- service.routeRequest(message).then((response) => post(response));
+ service.routeRequest(message).then(post);
}
void onResponse(Message message) {
@@ -57,7 +57,7 @@
}
// Sends a result to the client. Implemented in subclasses.
- void post(dynamic result);
+ void post(Response result);
dynamic toJson() {
return {};
diff --git a/sdk/lib/vmservice/message.dart b/sdk/lib/vmservice/message.dart
index 560ec63..dd808c7 100644
--- a/sdk/lib/vmservice/message.dart
+++ b/sdk/lib/vmservice/message.dart
@@ -7,11 +7,11 @@
enum MessageType { Request, Notification, Response }
class Message {
- final Completer<String> _completer = new Completer<String>.sync();
+ final Completer<Response> _completer = new Completer<Response>.sync();
bool get completed => _completer.isCompleted;
/// Future of response.
- Future<String> get response => _completer.future;
+ Future<Response> get response => _completer.future;
Client client;
// Is a notification message (no serial)
@@ -20,28 +20,12 @@
// Client-side identifier for this message.
final serial;
- // In new messages.
final String method;
- // In old messages.
- final List path = new List();
-
final Map params = new Map();
final Map result = new Map();
final Map error = new Map();
- void _setPath(List<String> pathSegments) {
- if (pathSegments == null) {
- return;
- }
- pathSegments.forEach((String segment) {
- if (segment == null || segment == '') {
- return;
- }
- path.add(segment);
- });
- }
-
factory Message.fromJsonRpc(Client client, Map map) {
if (map.containsKey('id')) {
final id = map['id'];
@@ -139,7 +123,7 @@
}
dynamic toJson() {
- return {'path': path, 'params': params};
+ throw 'unsupported';
}
dynamic forwardToJson([Map overloads]) {
@@ -183,7 +167,7 @@
return list;
}
- Future<String> send(SendPort sendPort) {
+ Future<Response> send(SendPort sendPort) {
final receivePort = new RawReceivePort();
receivePort.handler = (value) {
receivePort.close();
@@ -200,7 +184,7 @@
..[5] = values;
if (!sendIsolateServiceMessage(sendPort, request)) {
receivePort.close();
- _completer.complete(json.encode({
+ _completer.complete(new Response.json({
'type': 'ServiceError',
'id': '',
'kind': 'InternalError',
@@ -231,7 +215,7 @@
}
}
- Future<String> sendToVM() {
+ Future<Response> sendToVM() {
final receivePort = new RawReceivePort();
receivePort.handler = (value) {
receivePort.close();
@@ -262,22 +246,16 @@
return _completer.future;
}
- void _setResponseFromPort(response) {
- if (response is List) {
- // See JSONStream::PostReply for the format of messages that arrive from
- // VM.
- response = utf8.decode(response[0]);
- }
- _completer.complete(response);
+ void _setResponseFromPort(dynamic response) {
+ _completer.complete(new Response.from(response));
}
void setResponse(String response) {
- _completer.complete(response);
+ _completer.complete(new Response(ResponsePayloadKind.String, response));
}
void setErrorResponse(int code, String details) {
- _completer
- .complete(encodeRpcError(this, code, details: '$method: $details'));
+ setResponse(encodeRpcError(this, code, details: '$method: $details'));
}
}
diff --git a/sdk/lib/vmservice/message_router.dart b/sdk/lib/vmservice/message_router.dart
index 70e9d8e..21368a6 100644
--- a/sdk/lib/vmservice/message_router.dart
+++ b/sdk/lib/vmservice/message_router.dart
@@ -5,6 +5,72 @@
part of dart._vmservice;
abstract class MessageRouter {
- Future<String> routeRequest(Message message);
+ Future<Response> routeRequest(Message message);
void routeResponse(Message message);
}
+
+enum ResponsePayloadKind {
+ /// Response payload is a Dart string.
+ String,
+
+ /// Response payload is a binary (Uint8List).
+ Binary,
+
+ /// Response payload is a string encoded as UTF8 bytes (Uint8List).
+ Utf8String,
+}
+
+class Response {
+ final ResponsePayloadKind kind;
+ final payload;
+
+ /// Construct response object with the given [payload] and [kind].
+ Response(this.kind, this.payload) {
+ assert(() {
+ switch (kind) {
+ case ResponsePayloadKind.String:
+ return payload is String;
+ case ResponsePayloadKind.Binary:
+ case ResponsePayloadKind.Utf8String:
+ return payload is Uint8List;
+ }
+ }());
+ }
+
+ /// Construct a string response from the given [value] by encoding it
+ /// as JSON.
+ Response.json(Object value)
+ : this(ResponsePayloadKind.String, json.encode(value));
+
+ /// Construct response from the response [value] which can be either:
+ /// String: a string
+ /// Binary: a Uint8List
+ /// Utf8String: a single element list containing Uint8List
+ factory Response.from(Object value) {
+ if (value is String) {
+ return new Response(ResponsePayloadKind.String, value);
+ } else if (value is Uint8List) {
+ return new Response(ResponsePayloadKind.Binary, value);
+ } else if (value is List) {
+ assert(value.length == 1);
+ return new Response(
+ ResponsePayloadKind.Utf8String, value[0] as Uint8List);
+ } else if (value is Response) {
+ return value;
+ } else {
+ throw 'Unrecognized response: ${value}';
+ }
+ }
+
+ /// Decode JSON contained in this response.
+ dynamic decodeJson() {
+ switch (kind) {
+ case ResponsePayloadKind.String:
+ return json.decode(payload);
+ case ResponsePayloadKind.Utf8String:
+ return json.fuse(utf8).decode(payload);
+ case ResponsePayloadKind.Binary:
+ throw 'Binary responses can not be decoded';
+ }
+ }
+}
diff --git a/sdk/lib/vmservice/named_lookup.dart b/sdk/lib/vmservice/named_lookup.dart
index 1dab5f7..7087c94 100644
--- a/sdk/lib/vmservice/named_lookup.dart
+++ b/sdk/lib/vmservice/named_lookup.dart
@@ -11,8 +11,7 @@
final Map<E, String> _ids = new Map<E, String>();
NamedLookup({String prologue = ''})
- : super(),
- _generator = new IdGenerator(prologue: prologue);
+ : _generator = new IdGenerator(prologue: prologue);
void add(E e) {
final id = _generator.newId();
diff --git a/sdk/lib/vmservice/running_isolate.dart b/sdk/lib/vmservice/running_isolate.dart
index f93fac1..2aa6dc2 100644
--- a/sdk/lib/vmservice/running_isolate.dart
+++ b/sdk/lib/vmservice/running_isolate.dart
@@ -13,7 +13,7 @@
String get serviceId => 'isolates/$portId';
- Future<String> routeRequest(Message message) {
+ Future<Response> routeRequest(Message message) {
// Send message to isolate.
return message.send(sendPort);
}
diff --git a/sdk/lib/vmservice/running_isolates.dart b/sdk/lib/vmservice/running_isolates.dart
index 63b72d5..8f284d8 100644
--- a/sdk/lib/vmservice/running_isolates.dart
+++ b/sdk/lib/vmservice/running_isolates.dart
@@ -25,7 +25,7 @@
isolates.remove(portId);
}
- Future<String> routeRequest(Message message) {
+ Future<Response> routeRequest(Message message) {
String isolateParam = message.params['isolateId'];
int isolateId;
if (!isolateParam.startsWith('isolates/')) {
diff --git a/sdk/lib/vmservice/vmservice.dart b/sdk/lib/vmservice/vmservice.dart
index 0fcfeef..b0fe86d 100644
--- a/sdk/lib/vmservice/vmservice.dart
+++ b/sdk/lib/vmservice/vmservice.dart
@@ -7,7 +7,6 @@
import 'dart:async';
import 'dart:collection';
import 'dart:convert';
-import 'dart:developer' show ServiceProtocolInfo;
import 'dart:isolate';
import 'dart:math';
import 'dart:typed_data';
@@ -158,7 +157,7 @@
typedef Future<List<int>> ReadFileCallback(Uri path);
/// Called to list all files under some path.
-typedef Future<List<Map<String, String>>> ListFilesCallback(Uri path);
+typedef Future<List<Map<String, dynamic>>> ListFilesCallback(Uri path);
/// Called when we need information about the server.
typedef Future<Uri> ServerInformamessage_routertionCallback();
@@ -217,23 +216,22 @@
}
}
for (var service in client.services.keys) {
- _eventMessageHandler([
- '_Service',
- json.encode({
- 'jsonrpc': '2.0',
- 'method': 'streamNotify',
- 'params': {
- 'streamId': '_Service',
- 'event': {
- "type": "Event",
- "kind": "ServiceUnregistered",
- 'timestamp': new DateTime.now().millisecondsSinceEpoch,
- 'service': service,
- 'method': namespace + '.' + service,
+ _eventMessageHandler(
+ '_Service',
+ new Response.json({
+ 'jsonrpc': '2.0',
+ 'method': 'streamNotify',
+ 'params': {
+ 'streamId': '_Service',
+ 'event': {
+ "type": "Event",
+ "kind": "ServiceUnregistered",
+ 'timestamp': new DateTime.now().millisecondsSinceEpoch,
+ 'service': service,
+ 'method': namespace + '.' + service,
+ }
}
- }
- })
- ]);
+ }));
}
// Complete all requestes as failed
for (var handle in client.serviceHandles.values) {
@@ -241,9 +239,7 @@
}
}
- void _eventMessageHandler(List eventMessage) {
- var streamId = eventMessage[0];
- var event = eventMessage[1];
+ void _eventMessageHandler(String streamId, Response event) {
for (var client in clients) {
if (client.sendEvents && client.streams.contains(streamId)) {
client.post(event);
@@ -315,9 +311,7 @@
if (message is List) {
if (message.length == 2) {
// This is an event.
- assert(message[0] is String);
- assert(message[1] is String || message[1] is Uint8List);
- _eventMessageHandler(message);
+ _eventMessageHandler(message[0], new Response.from(message[1]));
return;
}
if (message.length == 1) {
@@ -454,7 +448,7 @@
{Client target}) async {
final namespace = clients.keyOf(client);
final alias = client.services[service];
- final event = json.encode({
+ final event = new Response.json({
'jsonrpc': '2.0',
'method': 'streamNotify',
'params': {
@@ -470,7 +464,7 @@
}
});
if (target == null) {
- _eventMessageHandler([kServiceStream, event]);
+ _eventMessageHandler(kServiceStream, event);
} else {
target.post(event);
}
@@ -492,8 +486,8 @@
completer.complete(encodeRpcError(message, kServiceDisappeared));
}
};
- client.post(
- json.encode(message.forwardToJson({'id': id, 'method': method})));
+ client.post(new Response.json(
+ message.forwardToJson({'id': id, 'method': method})));
return completer.future;
}
}
@@ -531,10 +525,6 @@
return encodeSuccess(message);
}
- static _responseAsJson(String response) => json.decode(response);
-
- // TODO(johnmccutchan): Turn this into a command line tool that uses the
- // service library.
Future<String> _getCrashDump(Message message) async {
var client = message.client;
final perIsolateRequests = [
@@ -556,13 +546,14 @@
// Request VM.
var getVM = Uri.parse('getVM');
var getVmResponse =
- _responseAsJson(await new Message.fromUri(client, getVM).sendToVM());
+ (await new Message.fromUri(client, getVM).sendToVM()).decodeJson();
responses[getVM.toString()] = getVmResponse['result'];
// Request command line flags.
var getFlagList = Uri.parse('getFlagList');
- var getFlagListResponse = _responseAsJson(
- await new Message.fromUri(client, getFlagList).sendToVM());
+ var getFlagListResponse =
+ (await new Message.fromUri(client, getFlagList).sendToVM())
+ .decodeJson();
responses[getFlagList.toString()] = getFlagListResponse['result'];
// Make requests to each isolate.
@@ -571,13 +562,13 @@
var message = new Message.forIsolate(client, request, isolate);
// Decode the JSON and and insert it into the map. The map key
// is the request Uri.
- var response = _responseAsJson(await isolate.routeRequest(message));
+ var response = (await isolate.routeRequest(message)).decodeJson();
responses[message.toUri().toString()] = response['result'];
}
// Dump the object id ring requests.
var message =
new Message.forIsolate(client, Uri.parse('_dumpIdZone'), isolate);
- var response = _responseAsJson(await isolate.routeRequest(message));
+ var response = (await isolate.routeRequest(message)).decodeJson();
// Insert getObject requests into responses map.
for (var object in response['result']['objects']) {
final requestUri =
@@ -590,7 +581,11 @@
return encodeResult(message, responses);
}
- Future<String> routeRequest(Message message) async {
+ Future<Response> routeRequest(Message message) async {
+ return new Response.from(await _routeRequestImpl(message));
+ }
+
+ Future _routeRequestImpl(Message message) async {
try {
if (message.completed) {
return await message.response;
diff --git a/tests/compiler/dart2js/dart2js.status b/tests/compiler/dart2js/dart2js.status
index f7e0d06..71a41a9 100644
--- a/tests/compiler/dart2js/dart2js.status
+++ b/tests/compiler/dart2js/dart2js.status
@@ -50,6 +50,10 @@
sourcemaps/source_mapping_test: Pass, Slow
subtype_test: Slow, Pass
uri_retention_test: Fail # Issue 26504
+kernel/compile_from_dill_fast_startup_test: RuntimeError # Test must be updated to support FE with patching.
+kernel/compile_from_dill_test: RuntimeError # Test must be updated to support FE with patching.
+kernel/closed_world2_test: RuntimeError # Test must be updated to support FE with patching.
+inference/swarm_test: RuntimeError # Test must be updated to support FE with patching.
[ $mode == debug ]
old_frontend/analyze_api_test: Pass, Slow # DON'T CHANGE THIS LINE -- Don't mark these tests as failing. Instead, fix the errors/warnings that they report or update the whitelist in the test-files to temporarily allow digression.
diff --git a/tests/compiler/dart2js/function_type_variable_test.dart b/tests/compiler/dart2js/function_type_variable_test.dart
index a7b833c..ba64289 100644
--- a/tests/compiler/dart2js/function_type_variable_test.dart
+++ b/tests/compiler/dart2js/function_type_variable_test.dart
@@ -16,6 +16,8 @@
const FunctionTypeData('void', 'F4', '<U, V>(V v, U u)'),
const FunctionTypeData('void', 'F5', '<W extends num>(W w)'),
const FunctionTypeData('void', 'F6', '<X extends int>(X x)'),
+ const FunctionTypeData('void', 'F7', '<Y extends num>(Y y, [int i])'),
+ const FunctionTypeData('Z', 'F8', '<Z extends num>(Z z)'),
];
main() {
@@ -47,7 +49,11 @@
"Unexpected instantiation of $type with $instantiation: $result");
}
- testRelations(DartType a, DartType b, bool areEqual, bool isSubtype) {
+ testRelations(DartType a, DartType b,
+ {bool areEqual: false, bool isSubtype: false}) {
+ if (areEqual) {
+ isSubtype = true;
+ }
Expect.equals(
areEqual,
a == b,
@@ -71,6 +77,8 @@
FunctionType F4 = env.getFieldType('F4');
FunctionType F5 = env.getFieldType('F5');
FunctionType F6 = env.getFieldType('F6');
+ FunctionType F7 = env.getFieldType('F7');
+ FunctionType F8 = env.getFieldType('F8');
testToString(F1, 'void Function<#A>(#A)');
testToString(F2, 'void Function<#A>(#A)');
@@ -78,6 +86,8 @@
testToString(F4, 'void Function<#A,#B>(#B,#A)');
testToString(F5, 'void Function<#A extends num>(#A)');
testToString(F6, 'void Function<#A extends int>(#A)');
+ testToString(F7, 'void Function<#A extends num>(#A,[int])');
+ testToString(F8, '#A Function<#A extends num>(#A)');
testBounds(F1, [Object_]);
testBounds(F2, [Object_]);
@@ -85,6 +95,8 @@
testBounds(F4, [Object_, Object_]);
testBounds(F5, [num_]);
testBounds(F6, [int_]);
+ testBounds(F7, [num_]);
+ testBounds(F8, [num_]);
testInstantiate(F1, [C1], 'void Function(C1)');
testInstantiate(F2, [C2], 'void Function(C2)');
@@ -92,50 +104,83 @@
testInstantiate(F4, [C1, C2], 'void Function(C2,C1)');
testInstantiate(F5, [num_], 'void Function(num)');
testInstantiate(F6, [int_], 'void Function(int)');
+ testInstantiate(F7, [int_], 'void Function(int,[int])');
+ testInstantiate(F8, [int_], 'int Function(int)');
- testRelations(F1, F1, true, true);
- testRelations(F1, F2, true, true);
- testRelations(F1, F3, false, false);
- testRelations(F1, F4, false, false);
- testRelations(F1, F5, false, false);
- testRelations(F1, F6, false, false);
+ testRelations(F1, F1, areEqual: true);
+ testRelations(F1, F2, areEqual: true);
+ testRelations(F1, F3);
+ testRelations(F1, F4);
+ testRelations(F1, F5);
+ testRelations(F1, F6);
+ testRelations(F1, F7);
+ testRelations(F1, F8);
- testRelations(F2, F1, true, true);
- testRelations(F2, F2, true, true);
- testRelations(F2, F3, false, false);
- testRelations(F2, F4, false, false);
- testRelations(F2, F5, false, false);
- testRelations(F2, F6, false, false);
+ testRelations(F2, F1, areEqual: true);
+ testRelations(F2, F2, areEqual: true);
+ testRelations(F2, F3);
+ testRelations(F2, F4);
+ testRelations(F2, F5);
+ testRelations(F2, F6);
+ testRelations(F2, F7);
+ testRelations(F2, F8);
- testRelations(F3, F1, false, false);
- testRelations(F3, F2, false, false);
- testRelations(F3, F3, true, true);
- testRelations(F3, F4, false, false);
- testRelations(F3, F5, false, false);
- testRelations(F3, F6, false, false);
+ testRelations(F3, F1);
+ testRelations(F3, F2);
+ testRelations(F3, F3, areEqual: true);
+ testRelations(F3, F4);
+ testRelations(F3, F5);
+ testRelations(F3, F6);
+ testRelations(F3, F7);
+ testRelations(F3, F8);
- testRelations(F4, F1, false, false);
- testRelations(F4, F2, false, false);
- testRelations(F4, F3, false, false);
- testRelations(F4, F4, true, true);
- testRelations(F4, F5, false, false);
- testRelations(F4, F6, false, false);
+ testRelations(F4, F1);
+ testRelations(F4, F2);
+ testRelations(F4, F3);
+ testRelations(F4, F4, areEqual: true);
+ testRelations(F4, F5);
+ testRelations(F4, F6);
+ testRelations(F4, F7);
+ testRelations(F4, F8);
- testRelations(F5, F1, false, false);
- testRelations(F5, F2, false, false);
- testRelations(F5, F3, false, false);
- testRelations(F5, F4, false, false);
- testRelations(F5, F5, true, true);
- testRelations(F5, F6, false, false);
+ testRelations(F5, F1);
+ testRelations(F5, F2);
+ testRelations(F5, F3);
+ testRelations(F5, F4);
+ testRelations(F5, F5, areEqual: true);
+ testRelations(F5, F6);
+ testRelations(F5, F7);
+ testRelations(F5, F8);
- testRelations(F6, F1, false, false);
- testRelations(F6, F2, false, false);
- testRelations(F6, F3, false, false);
- testRelations(F6, F4, false, false);
- testRelations(F6, F5, false, false);
- testRelations(F6, F6, true, true);
+ testRelations(F6, F1);
+ testRelations(F6, F2);
+ testRelations(F6, F3);
+ testRelations(F6, F4);
+ testRelations(F6, F5);
+ testRelations(F6, F6, areEqual: true);
+ testRelations(F6, F7);
+ testRelations(F6, F8);
- testRelations(F1.typeVariables.first, F1.typeVariables.first, true, true);
- testRelations(F1.typeVariables.first, F2.typeVariables.first, false, false);
+ testRelations(F7, F1);
+ testRelations(F7, F2);
+ testRelations(F7, F3);
+ testRelations(F7, F4);
+ testRelations(F7, F5, isSubtype: true);
+ testRelations(F7, F6);
+ testRelations(F7, F7, areEqual: true);
+ testRelations(F7, F8);
+
+ testRelations(F8, F1);
+ testRelations(F8, F2);
+ testRelations(F8, F3);
+ testRelations(F8, F4);
+ testRelations(F8, F5, isSubtype: true);
+ testRelations(F8, F6);
+ testRelations(F8, F7);
+ testRelations(F8, F8, areEqual: true);
+
+ testRelations(F1.typeVariables.first, F1.typeVariables.first,
+ areEqual: true);
+ testRelations(F1.typeVariables.first, F2.typeVariables.first);
});
}
diff --git a/tests/compiler/dart2js/inference/data/foreign.dart b/tests/compiler/dart2js/inference/data/foreign.dart
index f672a634..4f9c9be 100644
--- a/tests/compiler/dart2js/inference/data/foreign.dart
+++ b/tests/compiler/dart2js/inference/data/foreign.dart
@@ -8,8 +8,7 @@
/// ignore: IMPORT_INTERNAL_LIBRARY
import 'dart:_js_embedded_names';
-/// ignore: IMPORT_INTERNAL_LIBRARY
-/// ignore: UNUSED_IMPORT
+/// ignore: IMPORT_INTERNAL_LIBRARY, UNUSED_IMPORT
import 'dart:_interceptors';
/*element: main:[null]*/
diff --git a/tests/compiler/dart2js/inference/side_effects/foreign.dart b/tests/compiler/dart2js/inference/side_effects/foreign.dart
index b3d351f..00f8667 100644
--- a/tests/compiler/dart2js/inference/side_effects/foreign.dart
+++ b/tests/compiler/dart2js/inference/side_effects/foreign.dart
@@ -8,8 +8,7 @@
/// ignore: IMPORT_INTERNAL_LIBRARY
import 'dart:_js_embedded_names';
-/// ignore: IMPORT_INTERNAL_LIBRARY
-/// ignore: UNUSED_IMPORT
+/// ignore: IMPORT_INTERNAL_LIBRARY, UNUSED_IMPORT
import 'dart:_interceptors';
/*element: jsCallEmpty:SideEffects(reads nothing; writes nothing)*/
diff --git a/tests/compiler/dart2js/kernel/compile_from_dill_test_helper.dart b/tests/compiler/dart2js/kernel/compile_from_dill_test_helper.dart
index 24f0edd..b94a8e9 100644
--- a/tests/compiler/dart2js/kernel/compile_from_dill_test_helper.dart
+++ b/tests/compiler/dart2js/kernel/compile_from_dill_test_helper.dart
@@ -382,7 +382,7 @@
bool expectAstEquivalence: false,
bool expectIdenticalOutput: true}) async {
enableDebugMode();
- Elements.usePatchedDart2jsSdkSorting = true;
+ Elements.useCFEOrder = true;
useOptimizedMixins = true;
print('---- compile from ast ----------------------------------------------');
diff --git a/tests/compiler/dart2js/parser_helper.dart b/tests/compiler/dart2js/parser_helper.dart
index 862cf3f..e90b525 100644
--- a/tests/compiler/dart2js/parser_helper.dart
+++ b/tests/compiler/dart2js/parser_helper.dart
@@ -118,7 +118,7 @@
Node parseStatement(String text) => parseBodyCode(
text,
(parser, tokens) =>
- parser.parseStatementOpt(parser.syntheticPreviousToken(tokens)));
+ parser.parseStatement(parser.syntheticPreviousToken(tokens)));
Node parseFunction(String text, MockCompiler compiler) {
ElementX element = parseUnit(text, compiler, compiler.mainApp).head;
diff --git a/tests/compiler/dart2js/sourcemaps/source_mapping2_test.dart b/tests/compiler/dart2js/sourcemaps/source_mapping2_test.dart
index dcedca2..4076263 100644
--- a/tests/compiler/dart2js/sourcemaps/source_mapping2_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/source_mapping2_test.dart
@@ -24,7 +24,7 @@
// emitter.
full.Emitter fullEmitter = backend.emitter.emitter;
// CodeOutput isn't assignable to CodeBuffer.
- // ignore: RETURN_OF_INVALID_TYPE
+ // ignore: RETURN_OF_INVALID_TYPE_FROM_CLOSURE
return fullEmitter
.outputBuffers[compiler.backend.outputUnitData.mainOutputUnit];
});
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart b/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
index 5480d3e..12fd748 100644
--- a/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
@@ -69,11 +69,6 @@
List<LineException> testAfterExceptions = <LineException>[];
if (config == kernelMarker) {
for (LineException exception in afterExceptions) {
- if (exception.fileName == 'async_patch.dart') {
- testAfterExceptions
- .add(new LineException(exception.methodName, 'async.dart'));
- continue;
- }
testAfterExceptions.add(exception);
}
} else {
diff --git a/tests/compiler/dart2js/type_checker_test.dart b/tests/compiler/dart2js/type_checker_test.dart
index b16b704..6f4bcd5 100644
--- a/tests/compiler/dart2js/type_checker_test.dart
+++ b/tests/compiler/dart2js/type_checker_test.dart
@@ -2562,7 +2562,7 @@
NodeListener listener =
new NodeListener(const ScannerOptions(), compiler.reporter, null);
Parser parser = new Parser(listener);
- parser.parseStatementOpt(parser.syntheticPreviousToken(tokens));
+ parser.parseStatement(parser.syntheticPreviousToken(tokens));
Node node = listener.popNode();
Element compilationUnit = new CompilationUnitElementX(
new Script(null, null, null), compiler.mainApp);
@@ -2607,7 +2607,7 @@
new NodeListener(const ScannerOptions(), compiler.reporter, null);
Parser parser = new Parser(listener)
..asyncState = element.asyncMarker.asyncParserState;
- parser.parseStatementOpt(parser.syntheticPreviousToken(tokens));
+ parser.parseStatement(parser.syntheticPreviousToken(tokens));
Node node = listener.popNode();
TreeElements elements = compiler.resolveNodeStatement(node, element);
TypeCheckerVisitor checker =
diff --git a/tests/corelib_2/corelib_2.status b/tests/corelib_2/corelib_2.status
index f81aae5..033f5d8 100644
--- a/tests/corelib_2/corelib_2.status
+++ b/tests/corelib_2/corelib_2.status
@@ -117,6 +117,12 @@
int_parse_radix_test/*: Pass, Slow
integer_parsed_mul_div_vm_test: Pass, Slow
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $arch == simdbc64 && $compiler == dartk && $strong ]
+iterable_to_set_test: RuntimeError # Please triage.
+
[ $arch == x64 && $system == windows ]
stopwatch_test: Skip # Flaky test due to expected performance behaviour.
@@ -410,6 +416,13 @@
string_replace_static_test: MissingCompileTimeError
string_static_test: MissingCompileTimeError
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $compiler == dartk && $mode == debug && $strong && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
+bigint_parse_radix_test: Pass, Timeout # Please triage.
+bigint_test: Pass, Timeout # Please triage.
+
# ===== dartk + vm status lines =====
[ $compiler == dartk && $runtime == vm && $strong ]
apply3_test: CompileTimeError # Issue 31402 (Invocation arguments)
@@ -453,17 +466,12 @@
# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
# are to be triaged. Isolate tests are skipped on purpose due to the usage of
# batch mode.
-[ $compiler == dartk && $strong && ($arch == simarm || $arch == simarm64) ]
+[ $compiler == dartk && $strong && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
bit_twiddling_test/int64: CompileTimeError # Please triage.
integer_to_radix_string_test/02: CompileTimeError # Please triage.
integer_to_string_test/01: CompileTimeError # Please triage.
num_sign_test: CompileTimeError # Please triage.
-[ $compiler == dartkp && $mode == debug && $runtime == dart_precompiled && $strong ]
-bit_twiddling_test/int64: CompileTimeError
-integer_parsed_arith_vm_test/01: RuntimeError
-integer_parsed_arith_vm_test/02: RuntimeError
-
# ===== dartkp + dart_precompiled status lines =====
[ $compiler == dartkp && $runtime == dart_precompiled && $strong ]
bool_from_environment2_test/03: MissingCompileTimeError
@@ -696,3 +704,4 @@
bigint_parse_radix_test: Pass, Timeout # Issue 31659
bigint_test: Pass, Crash # Issue 31660
integer_parsed_mul_div_vm_test: Pass, Slow # Slow
+
diff --git a/tests/language_2/async_await_test.dart b/tests/language_2/async_await_test.dart
index dd8b177..4048692 100644
--- a/tests/language_2/async_await_test.dart
+++ b/tests/language_2/async_await_test.dart
@@ -4,13 +4,12 @@
library async_await_test;
-import "package:unittest/unittest.dart";
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
import "dart:async";
main() {
- bool assertionsEnabled = false;
- assert((assertionsEnabled = true));
-
+ asyncStart();
group("basic", () {
test("async w/o await", () {
f() async {
@@ -131,7 +130,7 @@
return throwsErr(f());
});
- if (assertionsEnabled) {
+ if (assertStatementsEnabled) {
test("assert before await", () {
f(v) async {
assert(v == 87);
@@ -232,7 +231,7 @@
});
});
- if (assertionsEnabled) {
+ if (assertStatementsEnabled) {
test("await for w/ await, asseert", () {
f(Stream<int> s) async {
int i = 0;
@@ -1695,9 +1694,7 @@
return expect42(asyncInSync(f42));
});
- // Equality and identity.
- // TODO(jmesserly): https://github.com/dart-lang/dev_compiler/issues/265
- skip_test("Identical and equals", () {
+ test("Identical and equals", () {
expect(async.instanceMethod, equals(async.instanceMethod));
expect(Async.staticMethod, same(Async.staticMethod));
expect(topMethod, same(topMethod));
@@ -1794,8 +1791,7 @@
return expect42(f());
});
- // TODO(jmesserly): https://github.com/dart-lang/dev_compiler/issues/265
- skip_test("suffix operator + pre-increment", () {
+ test("suffix operator + pre-increment", () {
f() async {
var v = [41];
return await ++v[0];
@@ -1913,7 +1909,7 @@
return expect42(f());
});
- if (!assertionsEnabled) return;
+ if (!assertStatementsEnabled) return;
test("inside assert, true", () { // //# 03: ok
f() async { // //# 03: continued
@@ -1967,8 +1963,57 @@
expect(yield, equals(42));
});
});
+ asyncEnd();
}
+// Mock test framework sufficient to run tests.
+
+String _currentName = "";
+
+test(name, action()) {
+ var oldName = _currentName;
+ _currentName = [oldName, name].join(" ");
+ runZoned(() {
+ asyncTest(() => new Future.sync(action));
+ }, zoneValues: {#testName: _currentName});
+ _currentName = oldName;
+}
+
+group(name, entries()) {
+ var oldName = _currentName;
+ _currentName = [oldName, name].join(" ");
+ entries();
+ _currentName = oldName;
+}
+
+expect(value, expectation) {
+ var name = Zone.current[#testName];
+ if (expectation is bool) {
+ // Just for better error message.
+ (expectation ? Expect.isTrue : Expect.isFalse)(value, name);
+ return;
+ }
+ if (expectation is List) {
+ Expect.listEquals(expectation, value, name);
+ return;
+ }
+ if (expectation is Function(Object, String)) {
+ expectation(value, name);
+ return;
+ }
+ Expect.equals(expectation, value, name);
+}
+
+equals(x) => x;
+final isTrue = true;
+same(v) => (Object o, String name) => Expect.identical(v, o, name);
+fail(message) {
+ var name = Zone.current[#testName];
+ Expect.fail("$name: $message");
+}
+
+// End mock.
+
// Attempt to obfuscates value to avoid too much constant folding.
id(v) {
try {
diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status
index 465cd64..634f34c 100644
--- a/tests/language_2/language_2_dart2js.status
+++ b/tests/language_2/language_2_dart2js.status
@@ -593,6 +593,7 @@
regress_26133_test: MissingCompileTimeError
regress_27572_test: MissingCompileTimeError
regress_31057_test: RuntimeError
+regress_31591_test: RuntimeError, OK # strong mode only
return_type_test: MissingCompileTimeError
rewrite_implicit_this_test/01: MissingCompileTimeError
runtime_type_function_test: RuntimeError
diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status
index 6578d02..fbe1059 100644
--- a/tests/language_2/language_2_kernel.status
+++ b/tests/language_2/language_2_kernel.status
@@ -78,9 +78,6 @@
assert_initializer_test/none: RuntimeError # KernelVM bug: Constant evaluation.
assertion_initializer_const_function_test/01: RuntimeError
assign_static_type_test/02: MissingCompileTimeError
-async_await_test/02: RuntimeError
-async_await_test/03: RuntimeError
-async_await_test/none: RuntimeError
async_return_types_test/nestedFuture: Fail
async_return_types_test/wrongTypeParameter: Fail
async_star_regression_2238_test: RuntimeError
@@ -385,8 +382,8 @@
deferred_constraints_constants_test/default_argument2: Pass # Passes by mistake. KernelVM bug: Deferred loading kernel issue 28335.
deferred_constraints_constants_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
deferred_constraints_constants_test/reference_after_load: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/as_operation: MissingCompileTimeError
deferred_constraints_type_annotation_test/as_operation: Pass # Passes by mistake. Deferred loading kernel issue 28335
+deferred_constraints_type_annotation_test/as_operation: MissingCompileTimeError
deferred_constraints_type_annotation_test/catch_check: MissingCompileTimeError
deferred_constraints_type_annotation_test/catch_check: Pass # Passes by mistake. Deferred loading kernel issue 28335.
deferred_constraints_type_annotation_test/is_check: MissingCompileTimeError
@@ -643,8 +640,8 @@
generalized_void_syntax_test: CompileTimeError # Issue #30176.
generic_async_star_test: RuntimeError
generic_closure_test: RuntimeError
-generic_function_bounds_test: CompileTimeError
generic_function_bounds_test: RuntimeError
+generic_function_bounds_test: CompileTimeError
generic_function_dcall_test: CompileTimeError
generic_function_dcall_test: RuntimeError
generic_function_type_as_type_argument_test/02: Pass # For the wrong reason, issue 30931
@@ -744,8 +741,8 @@
local_function_test/01: MissingCompileTimeError
local_function_test/02: MissingCompileTimeError
local_function_test/none: RuntimeError
-main_not_a_function_test: DartkCrash
main_not_a_function_test: Skip
+main_not_a_function_test: DartkCrash
main_test/03: RuntimeError
malbounded_instantiation_test/01: MissingCompileTimeError
malbounded_instantiation_test/02: MissingCompileTimeError
@@ -1152,7 +1149,6 @@
vm/regress_27201_test: CompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 28335.
vm/regress_29145_test: Skip # Issue 29145
vm/type_cast_vm_test: RuntimeError
-vm/type_vm_test/none: RuntimeError
void_block_return_test/00: MissingCompileTimeError
void_type_callbacks_test/none: CompileTimeError
void_type_function_types_test/none: CompileTimeError
@@ -1200,7 +1196,7 @@
# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
# are to be triaged. Isolate tests are skipped on purpose due to the usage of
# batch mode.
-[ $compiler == dartk && $strong && ($arch == simarm || $arch == simarm64) ]
+[ $compiler == dartk && $strong && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
bit_operations_test/03: CompileTimeError # Please triage.
bit_operations_test/04: CompileTimeError # Please triage.
bit_operations_test/none: CompileTimeError # Please triage.
@@ -1408,9 +1404,6 @@
async_await_syntax_test/c10a: MissingCompileTimeError
async_await_syntax_test/d08b: MissingCompileTimeError
async_await_syntax_test/d10a: MissingCompileTimeError
-async_await_test/02: CompileTimeError # Issue 31402 (Invocation arguments)
-async_await_test/03: CompileTimeError # Issue 31402 (Invocation arguments)
-async_await_test/none: CompileTimeError # Issue 31402 (Invocation arguments)
async_or_generator_return_type_stacktrace_test/01: MissingCompileTimeError
async_or_generator_return_type_stacktrace_test/02: MissingCompileTimeError
async_or_generator_return_type_stacktrace_test/03: MissingCompileTimeError
@@ -1624,8 +1617,8 @@
deferred_constraints_type_annotation_test/is_check: MissingCompileTimeError
deferred_constraints_type_annotation_test/is_check: Pass
deferred_constraints_type_annotation_test/new: CompileTimeError
-deferred_constraints_type_annotation_test/new_before_load: Pass
deferred_constraints_type_annotation_test/new_before_load: MissingCompileTimeError
+deferred_constraints_type_annotation_test/new_before_load: Pass
deferred_constraints_type_annotation_test/new_generic1: CompileTimeError
deferred_constraints_type_annotation_test/new_generic2: MissingCompileTimeError
deferred_constraints_type_annotation_test/new_generic2: Pass
@@ -1756,6 +1749,7 @@
function_subtype_bound_closure7_test: CompileTimeError # Issue 31402 (Variable declaration)
function_subtype_call1_test: RuntimeError
function_subtype_call2_test: RuntimeError
+function_subtype_cast0_test: RuntimeError
function_subtype_cast2_test: RuntimeError
function_subtype_cast3_test: RuntimeError
function_subtype_checked0_test: RuntimeError
@@ -1768,8 +1762,8 @@
function_subtype_not0_test: RuntimeError
function_subtype_not2_test: RuntimeError
function_subtype_not3_test: RuntimeError
-function_subtype_optional1_test: Pass
function_subtype_optional1_test: RuntimeError
+function_subtype_optional1_test: Pass
function_subtype_setter0_test: RuntimeError
function_subtype_simple1_test: RuntimeError
function_subtype_top_level1_test: RuntimeError
@@ -1883,8 +1877,8 @@
generalized_void_syntax_test: CompileTimeError # Issue #30176
generic_async_star_test: RuntimeError
generic_closure_test: RuntimeError
-generic_function_bounds_test: RuntimeError
generic_function_bounds_test: CompileTimeError
+generic_function_bounds_test: RuntimeError
generic_function_dcall_test: CompileTimeError
generic_function_dcall_test: RuntimeError
generic_function_type_as_type_argument_test/02: MissingCompileTimeError, OK # No type inference
@@ -1911,8 +1905,8 @@
generic_methods_recursive_bound_test/03: MissingRuntimeError
generic_methods_recursive_bound_test/03: Crash, Pass
generic_methods_reuse_type_variables_test: Pass
-generic_methods_tearoff_specialization_test: RuntimeError
generic_methods_tearoff_specialization_test: CompileTimeError # Issue 31402 (Variable declaration)
+generic_methods_tearoff_specialization_test: RuntimeError
generic_methods_unused_parameter_test: CompileTimeError # Issue 31402 (Variable declaration)
generic_methods_unused_parameter_test: RuntimeError
generic_no_such_method_dispatcher_simple_test: CompileTimeError # Issue 31533
@@ -1968,8 +1962,8 @@
initializing_formal_type_annotation_test/02: MissingCompileTimeError
instance_creation_in_function_annotation_test: SkipByDesign
instanceof2_test: RuntimeError
-instanceof4_test/01: Pass
instanceof4_test/01: RuntimeError
+instanceof4_test/01: Pass
instanceof4_test/none: Pass
instanceof4_test/none: RuntimeError
instantiate_tearoff_after_contravariance_check_test: CompileTimeError
@@ -2011,8 +2005,8 @@
known_identifier_prefix_error_test/23: MissingCompileTimeError # Issue 28814
known_identifier_prefix_error_test/24: MissingCompileTimeError # Issue 28814
language_2/least_upper_bound_expansive_test/none: CompileTimeError
-least_upper_bound_expansive_test/none: CompileTimeError
least_upper_bound_expansive_test/none: RuntimeError
+least_upper_bound_expansive_test/none: CompileTimeError
library_ambiguous_test/00: MissingCompileTimeError
library_ambiguous_test/01: MissingCompileTimeError
library_ambiguous_test/02: MissingCompileTimeError
@@ -2186,8 +2180,8 @@
mock_writable_final_private_field_test: RuntimeError # Issue 30849
multiline_strings_test: Pass
multiline_strings_test: Fail # Issue 23020
-named_constructor_test/01: MissingCompileTimeError
named_constructor_test/01: MissingRuntimeError # Fasta bug: Bad compilation of constructor reference.
+named_constructor_test/01: MissingCompileTimeError
named_constructor_test/03: MissingCompileTimeError
named_parameters2_test: MissingCompileTimeError
named_parameters3_test: MissingCompileTimeError
@@ -2357,8 +2351,8 @@
regress_28217_test/none: MissingCompileTimeError # Fasta bug: Bad constructor redirection.
regress_28255_test: SkipByDesign
regress_28278_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-regress_28341_test: Pass
regress_28341_test: RuntimeError
+regress_28341_test: Pass
regress_29025_test: CompileTimeError # Issue 31402 (Variable declaration)
regress_29405_test: CompileTimeError # Issue 31402 (Invocation arguments)
regress_29784_test/01: MissingCompileTimeError
@@ -2473,8 +2467,8 @@
vm/reflect_core_vm_test: SkipByDesign
vm/regress_27201_test: CompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 28335.
vm/regress_27201_test: Fail
-vm/regress_27671_test: Crash
vm/regress_27671_test: Skip # Unsupported
+vm/regress_27671_test: Crash
vm/regress_29145_test: Skip # Issue 29145
vm/type_cast_vm_test: RuntimeError # Expects line and column numbers
vm/type_vm_test: RuntimeError, Pass # Expects line and column numbers
diff --git a/tests/language_2/language_2_precompiled.status b/tests/language_2/language_2_precompiled.status
index f5f5cd5..9cb5e23 100644
--- a/tests/language_2/language_2_precompiled.status
+++ b/tests/language_2/language_2_precompiled.status
@@ -819,6 +819,7 @@
regress_27572_test: MissingCompileTimeError
regress_28255_test: SkipByDesign
regress_28341_test: RuntimeError
+regress_31591_test: RuntimeError, OK # strong mode only
return_type_test: MissingCompileTimeError
rewrite_implicit_this_test/01: MissingCompileTimeError
runtime_type_function_test: RuntimeError
diff --git a/tests/language_2/language_2_vm.status b/tests/language_2/language_2_vm.status
index 360e97e..ec44f5d 100644
--- a/tests/language_2/language_2_vm.status
+++ b/tests/language_2/language_2_vm.status
@@ -779,6 +779,7 @@
regress_23408_test: RuntimeError
regress_26133_test: MissingCompileTimeError
regress_27572_test: MissingCompileTimeError
+regress_31591_test: RuntimeError, OK # strong mode only
return_type_test: MissingCompileTimeError
rewrite_implicit_this_test/01: MissingCompileTimeError
runtime_type_function_test: RuntimeError
diff --git a/tests/language_2/regress_31591_test.dart b/tests/language_2/regress_31591_test.dart
new file mode 100644
index 0000000..7b09643
--- /dev/null
+++ b/tests/language_2/regress_31591_test.dart
@@ -0,0 +1,20 @@
+// 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.
+
+// VMOptions=--optimization-counter-threshold=5
+
+import 'package:expect/expect.dart';
+
+typedef FunObjObj = Object Function<T>(Object, {Object y});
+
+Object funTypObj<T>(T x, {Object y}) => y;
+
+main() {
+ for (int i = 0; i < 10; i++) {
+ Expect.throwsTypeError(() {
+ dynamic y = funTypObj;
+ final FunObjObj x2 = y;
+ });
+ }
+}
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index 2482bda..ffdb31d 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -280,6 +280,7 @@
# are to be triaged. Isolate tests are skipped on purpose due to the usage of
# batch mode.
[ $compiler == dartk && $mode == debug && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
+mirrors/invocation_fuzz_test/smi: Pass, Slow
mirrors/variable_is_const_test/01: Crash # Please triage.
# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
diff --git a/tests/lib_2/lib_2_kernel.status b/tests/lib_2/lib_2_kernel.status
index af19ce3..1ca7690 100644
--- a/tests/lib_2/lib_2_kernel.status
+++ b/tests/lib_2/lib_2_kernel.status
@@ -22,6 +22,12 @@
isolate/static_function_test: Skip # Flaky (https://github.com/dart-lang/sdk/issues/30063).
mirrors/other_declarations_location_test: Crash # assertion error, TypeParameter not having position.
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $compiler == dartk && $mode == debug && $strong && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
+mirrors/variable_is_const_test/01: Crash # Please triage.
+
[ $compiler == dartk && $runtime == vm && $checked && $strong ]
mirrors/invocation_fuzz_test/smi: Crash
mirrors/redirecting_factory_different_type_test/01: Crash # Issue 28424
@@ -159,8 +165,8 @@
mirrors/library_declarations_test/none: CompileTimeError # Issue 31402 (Invocation arguments)
mirrors/library_enumeration_deferred_loading_test: CompileTimeError # Deferred loading kernel issue 28335.
mirrors/library_enumeration_deferred_loading_test: RuntimeError
-mirrors/library_exports_hidden_test: CompileTimeError # Issue 31402 (Invocation arguments)
mirrors/library_exports_hidden_test: RuntimeError, Crash
+mirrors/library_exports_hidden_test: CompileTimeError # Issue 31402 (Invocation arguments)
mirrors/library_exports_shown_test: CompileTimeError # Issue 31402 (Invocation arguments)
mirrors/library_exports_shown_test: RuntimeError
mirrors/library_import_deferred_loading_test: CompileTimeError # Deferred loading kernel issue 28335.
@@ -212,8 +218,8 @@
mirrors/operator_test: CompileTimeError # Issue 31402 (Invocation arguments)
mirrors/other_declarations_location_test: RuntimeError
mirrors/parameter_annotation_mirror_test: RuntimeError
-mirrors/parameter_metadata_test: Crash
mirrors/parameter_metadata_test: RuntimeError
+mirrors/parameter_metadata_test: Crash
mirrors/parameter_of_mixin_app_constructor_test: CompileTimeError # Issue 31402 (Invocation arguments)
mirrors/parameter_test/01: CompileTimeError # Issue 31402 (Invocation arguments)
mirrors/parameter_test/none: CompileTimeError # Issue 31402 (Invocation arguments)
@@ -381,21 +387,17 @@
# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
# are to be triaged. Isolate tests are skipped on purpose due to the usage of
# batch mode.
-[ $compiler == dartk && $strong && ($arch == simarm || $arch == simarm64) ]
+[ $compiler == dartk && $strong && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
+isolate/*: Skip
mirrors/invocation_fuzz_test/emptyarray: CompileTimeError # Please triage.
mirrors/invocation_fuzz_test/false: CompileTimeError # Please triage.
mirrors/invocation_fuzz_test/none: CompileTimeError # Please triage.
mirrors/invocation_fuzz_test/smi: CompileTimeError # Please triage.
mirrors/invocation_fuzz_test/string: CompileTimeError # Please triage.
+mirrors/library_uri_io_test: CompileTimeError # Please triage.
mirrors/spawn_function_root_library_test: Skip
typed_data/int32x4_arithmetic_test/int64: CompileTimeError # Please triage.
-# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
-# are to be triaged. Isolate tests are skipped on purpose due to the usage of
-# batch mode.
-[ $compiler == dartk && $strong && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
-isolate/*: Skip
-
# ===== Skip dartk and darkp in !$strong mode ====
[ $compiler == dartk && !$strong ]
*: SkipByDesign
diff --git a/tests/standalone/io/http_override_test.dart b/tests/standalone/io/http_override_test.dart
index e797e9a..6060a67 100644
--- a/tests/standalone/io/http_override_test.dart
+++ b/tests/standalone/io/http_override_test.dart
@@ -171,9 +171,39 @@
}, new MyHttpOverrides());
}
+globalHttpOverridesTest() {
+ HttpOverrides.global = new MyHttpOverrides();
+ var httpClient = new HttpClient();
+ Expect.isNotNull(httpClient);
+ Expect.isTrue(httpClient is MyHttpClient1);
+ Expect.equals((new MyHttpClient1(null)).userAgent, httpClient.userAgent);
+ HttpOverrides.global = null;
+ httpClient = new HttpClient();
+ Expect.isTrue(httpClient is HttpClient);
+ Expect.isTrue(httpClient is! MyHttpClient1);
+}
+
+globalHttpOverridesZoneTest() {
+ HttpOverrides.global = new MyHttpOverrides();
+ runZoned(() {
+ runZoned(() {
+ var httpClient = new HttpClient();
+ Expect.isNotNull(httpClient);
+ Expect.isTrue(httpClient is MyHttpClient1);
+ Expect.equals((new MyHttpClient1(null)).userAgent, httpClient.userAgent);
+ });
+ });
+ HttpOverrides.global = null;
+ var httpClient = new HttpClient();
+ Expect.isTrue(httpClient is HttpClient);
+ Expect.isTrue(httpClient is! MyHttpClient1);
+}
+
main() {
withHttpOverridesTest();
nestedWithHttpOverridesTest();
nestedDifferentOverridesTest();
zonedWithHttpOverridesTest();
+ globalHttpOverridesTest();
+ globalHttpOverridesZoneTest();
}
diff --git a/tests/standalone/io/io_override_test.dart b/tests/standalone/io/io_override_test.dart
index 042c9cc..fe69637 100644
--- a/tests/standalone/io/io_override_test.dart
+++ b/tests/standalone/io/io_override_test.dart
@@ -196,6 +196,34 @@
await f;
}
+class MyIOOverrides extends IOOverrides {
+ Directory createDirectory(String path) => DirectoryMock.createDirectory(path);
+}
+
+globalIOOverridesTest() {
+ IOOverrides.global = new MyIOOverrides();
+ Expect.isTrue(new Directory("directory") is DirectoryMock);
+ IOOverrides.global = null;
+ Directory dir = new Directory("directory");
+ Expect.isTrue(dir is! DirectoryMock);
+ Expect.isTrue(dir is Directory);
+}
+
+globalIOOverridesZoneTest() {
+ IOOverrides.global = new MyIOOverrides();
+ runZoned(() {
+ runZoned(() {
+ Expect.isTrue(new Directory("directory") is DirectoryMock);
+ });
+ });
+ IOOverrides.global = null;
+ Directory dir = new Directory("directory");
+ Expect.isTrue(dir is! DirectoryMock);
+ Expect.isTrue(dir is Directory);
+}
+
main() async {
await ioOverridesRunTest();
+ globalIOOverridesTest();
+ globalIOOverridesZoneTest();
}
diff --git a/tests/standalone_2/io/client_socket_add_close_error_test.dart b/tests/standalone_2/io/client_socket_add_close_error_test.dart
new file mode 100644
index 0000000..b7ebf2c
--- /dev/null
+++ b/tests/standalone_2/io/client_socket_add_close_error_test.dart
@@ -0,0 +1,51 @@
+// Copyright (c) 2013, 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.
+//
+// Tests socket exceptions.
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void clientSocketAddCloseErrorTest() {
+ asyncStart();
+ ServerSocket.bind("127.0.0.1", 0).then((server) {
+ var completer = new Completer();
+ server.listen((socket) {
+ completer.future.then((_) => socket.destroy());
+ });
+ Socket.connect("127.0.0.1", server.port).then((client) {
+ const int SIZE = 1024 * 1024;
+ int errors = 0;
+ client.listen((data) => Expect.fail("Unexpected data"), onError: (error) {
+ Expect.isTrue(error is SocketException);
+ errors++;
+ }, onDone: () {
+ // We get either a close or an error followed by a close
+ // on the socket. Whether we get both depends on
+ // whether the system notices the error for the read
+ // event or only for the write event.
+ Expect.isTrue(errors <= 1);
+ server.close();
+ });
+ client.add(new List.filled(SIZE, 0));
+ // Destroy other socket now.
+ completer.complete(null);
+ client.done.then((_) {
+ Expect.fail("Expected error");
+ }, onError: (error) {
+ Expect.isTrue(error is SocketException);
+ asyncEnd();
+ });
+ });
+ });
+}
+
+main() {
+ asyncStart();
+ clientSocketAddCloseErrorTest();
+ asyncEnd();
+}
diff --git a/tests/standalone_2/io/client_socket_add_close_no_error_test.dart b/tests/standalone_2/io/client_socket_add_close_no_error_test.dart
new file mode 100644
index 0000000..a70d779
--- /dev/null
+++ b/tests/standalone_2/io/client_socket_add_close_no_error_test.dart
@@ -0,0 +1,39 @@
+// Copyright (c) 2013, 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.
+//
+// Tests socket exceptions.
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void clientSocketAddCloseNoErrorTest() {
+ ServerSocket.bind("127.0.0.1", 0).then((server) {
+ var completer = new Completer();
+ server.listen((socket) {
+ // The socket is 'paused' until the future completes.
+ completer.future.then((_) => socket.pipe(socket));
+ });
+ Socket.connect("127.0.0.1", server.port).then((client) {
+ const int SIZE = 1024 * 1024;
+ int count = 0;
+ client.listen((data) => count += data.length, onDone: () {
+ Expect.equals(SIZE, count);
+ server.close();
+ });
+ client.add(new List.filled(SIZE, 0));
+ client.close();
+ // Start piping now.
+ completer.complete(null);
+ });
+ });
+}
+
+main() {
+ asyncStart();
+ clientSocketAddCloseNoErrorTest();
+ asyncEnd();
+}
diff --git a/tests/standalone_2/io/client_socket_add_close_result_error_test.dart b/tests/standalone_2/io/client_socket_add_close_result_error_test.dart
new file mode 100644
index 0000000..58ff72f
--- /dev/null
+++ b/tests/standalone_2/io/client_socket_add_close_result_error_test.dart
@@ -0,0 +1,37 @@
+// Copyright (c) 2013, 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.
+//
+// Tests socket exceptions.
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void clientSocketAddCloseResultErrorTest() {
+ ServerSocket.bind("127.0.0.1", 0).then((server) {
+ var completer = new Completer();
+ server.listen((socket) {
+ completer.future.then((_) => socket.destroy());
+ });
+ Socket.connect("127.0.0.1", server.port).then((client) {
+ const int SIZE = 1024 * 1024;
+ int errors = 0;
+ client.add(new List.filled(SIZE, 0));
+ client.close();
+ client.done.catchError((_) {}).whenComplete(() {
+ server.close();
+ });
+ // Destroy other socket now.
+ completer.complete(null);
+ });
+ });
+}
+
+main() {
+ asyncStart();
+ clientSocketAddCloseResultErrorTest();
+ asyncEnd();
+}
diff --git a/tests/standalone_2/io/client_socket_add_destroy_no_error_test.dart b/tests/standalone_2/io/client_socket_add_destroy_no_error_test.dart
new file mode 100644
index 0000000..66d7da1
--- /dev/null
+++ b/tests/standalone_2/io/client_socket_add_destroy_no_error_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2013, 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.
+//
+// Tests socket exceptions.
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void clientSocketAddDestroyNoErrorTest() {
+ ServerSocket.bind("127.0.0.1", 0).then((server) {
+ server.listen((socket) {
+ // Passive block data by not subscribing to socket.
+ });
+ Socket.connect("127.0.0.1", server.port).then((client) {
+ client.listen((data) {}, onDone: server.close);
+ client.add(new List.filled(1024 * 1024, 0));
+ client.destroy();
+ });
+ });
+}
+
+main() {
+ asyncStart();
+ clientSocketAddDestroyNoErrorTest();
+ asyncEnd();
+}
diff --git a/tests/standalone_2/io/client_socket_destory_no_error_test.dart b/tests/standalone_2/io/client_socket_destory_no_error_test.dart
new file mode 100644
index 0000000..23d6473
--- /dev/null
+++ b/tests/standalone_2/io/client_socket_destory_no_error_test.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2013, 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.
+//
+// Tests socket exceptions.
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void clientSocketDestroyNoErrorTest() {
+ ServerSocket.bind("127.0.0.1", 0).then((server) {
+ server.listen((socket) {
+ socket.pipe(socket);
+ });
+ Socket.connect("127.0.0.1", server.port).then((client) {
+ client.listen((data) {}, onDone: server.close);
+ client.destroy();
+ });
+ });
+}
+
+main() {
+ asyncStart();
+ clientSocketDestroyNoErrorTest();
+ asyncEnd();
+}
diff --git a/tests/standalone_2/io/client_socket_exception_test.dart b/tests/standalone_2/io/client_socket_exception_test.dart
new file mode 100644
index 0000000..647804c
--- /dev/null
+++ b/tests/standalone_2/io/client_socket_exception_test.dart
@@ -0,0 +1,104 @@
+// Copyright (c) 2013, 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.
+//
+// Tests socket exceptions.
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void clientSocketExceptionTest() {
+ bool exceptionCaught = false;
+ bool wrongExceptionCaught = false;
+
+ ServerSocket.bind("127.0.0.1", 0).then((server) {
+ Expect.isNotNull(server);
+ int port = server.port;
+ Socket.connect("127.0.0.1", port).then((client) {
+ Expect.isNotNull(client);
+ client.close();
+ // First calls for which exceptions are note expected.
+ try {
+ client.close();
+ } on SocketException catch (ex) {
+ exceptionCaught = true;
+ } catch (ex) {
+ wrongExceptionCaught = true;
+ }
+ Expect.isFalse(exceptionCaught);
+ Expect.isFalse(wrongExceptionCaught);
+ try {
+ client.destroy();
+ } on SocketException catch (ex) {
+ exceptionCaught = true;
+ } catch (ex) {
+ wrongExceptionCaught = true;
+ }
+ Expect.isFalse(exceptionCaught);
+ Expect.isFalse(wrongExceptionCaught);
+ try {
+ List<int> buffer = new List<int>(10);
+ client.add(buffer);
+ } on StateError catch (ex) {
+ exceptionCaught = true;
+ } catch (ex) {
+ wrongExceptionCaught = true;
+ }
+ Expect.isFalse(exceptionCaught);
+ Expect.isFalse(wrongExceptionCaught);
+
+ // From here exceptions are expected.
+ exceptionCaught = false;
+ try {
+ client.port;
+ } on SocketException catch (ex) {
+ exceptionCaught = true;
+ } catch (ex) {
+ wrongExceptionCaught = true;
+ }
+ Expect.isTrue(exceptionCaught);
+ Expect.isFalse(wrongExceptionCaught);
+ exceptionCaught = false;
+ try {
+ client.remotePort;
+ } on SocketException catch (ex) {
+ exceptionCaught = true;
+ } catch (ex) {
+ wrongExceptionCaught = true;
+ }
+ Expect.isTrue(exceptionCaught);
+ Expect.isFalse(wrongExceptionCaught);
+ exceptionCaught = false;
+ try {
+ client.address;
+ } on SocketException catch (ex) {
+ exceptionCaught = true;
+ } catch (ex) {
+ wrongExceptionCaught = true;
+ }
+ Expect.isTrue(exceptionCaught);
+ Expect.isFalse(wrongExceptionCaught);
+ exceptionCaught = false;
+ try {
+ client.remoteAddress;
+ } on SocketException catch (ex) {
+ exceptionCaught = true;
+ } catch (ex) {
+ wrongExceptionCaught = true;
+ }
+ Expect.isTrue(exceptionCaught);
+ Expect.isFalse(wrongExceptionCaught);
+
+ server.close();
+ });
+ });
+}
+
+main() {
+ asyncStart();
+ clientSocketExceptionTest();
+ asyncEnd();
+}
diff --git a/tests/standalone_2/io/http_auth_digest_test.dart b/tests/standalone_2/io/http_auth_digest_test.dart
index d599af1..efe18a2 100644
--- a/tests/standalone_2/io/http_auth_digest_test.dart
+++ b/tests/standalone_2/io/http_auth_digest_test.dart
@@ -33,7 +33,7 @@
var nonce = "12345678"; // No need for random nonce in test.
- var completer = new Completer();
+ var completer = new Completer<Server>();
HttpServer.bind("127.0.0.1", 0).then((s) {
server = s;
server.listen((HttpRequest request) {
diff --git a/tests/standalone_2/io/http_auth_test.dart b/tests/standalone_2/io/http_auth_test.dart
index 7ca4da6..8a3fc36 100644
--- a/tests/standalone_2/io/http_auth_test.dart
+++ b/tests/standalone_2/io/http_auth_test.dart
@@ -14,7 +14,7 @@
bool passwordChanged = false;
Future<Server> start() {
- var completer = new Completer();
+ var completer = new Completer<Server>();
HttpServer.bind("127.0.0.1", 0).then((s) {
server = s;
server.listen((HttpRequest request) {
diff --git a/tests/standalone_2/io/server_socket_close_listen_test.dart b/tests/standalone_2/io/server_socket_close_listen_test.dart
new file mode 100644
index 0000000..cfeb11a
--- /dev/null
+++ b/tests/standalone_2/io/server_socket_close_listen_test.dart
@@ -0,0 +1,29 @@
+// Copyright (c) 2013, 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.
+//
+// Tests socket exceptions.
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void serverSocketCloseListenTest() {
+ asyncStart();
+ ServerSocket.bind("127.0.0.1", 0).then((server) {
+ Socket.connect("127.0.0.1", server.port).then((socket) {
+ socket.destroy();
+ server.close();
+ server.listen((incoming) => Expect.fail("Unexpected socket"),
+ onDone: asyncEnd);
+ });
+ });
+}
+
+main() {
+ asyncStart();
+ serverSocketCloseListenTest();
+ asyncEnd();
+}
diff --git a/tests/standalone_2/io/server_socket_exception_test.dart b/tests/standalone_2/io/server_socket_exception_test.dart
new file mode 100644
index 0000000..f6c0993
--- /dev/null
+++ b/tests/standalone_2/io/server_socket_exception_test.dart
@@ -0,0 +1,42 @@
+// Copyright (c) 2013, 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.
+//
+// Tests socket exceptions.
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void serverSocketExceptionTest() {
+ bool exceptionCaught = false;
+ bool wrongExceptionCaught = false;
+
+ ServerSocket.bind("127.0.0.1", 0).then((server) {
+ Expect.isNotNull(server);
+ server.close();
+ try {
+ server.close();
+ } on SocketException catch (ex) {
+ exceptionCaught = true;
+ } catch (ex) {
+ wrongExceptionCaught = true;
+ }
+ Expect.equals(false, exceptionCaught);
+ Expect.equals(true, !wrongExceptionCaught);
+
+ // Test invalid host.
+ ServerSocket
+ .bind("__INVALID_HOST__", 0)
+ .then((server) {})
+ .catchError((e) => e is SocketException);
+ });
+}
+
+main() {
+ asyncStart();
+ serverSocketExceptionTest();
+ asyncEnd();
+}
diff --git a/tests/standalone_2/io/server_socket_listen_close_test.dart b/tests/standalone_2/io/server_socket_listen_close_test.dart
new file mode 100644
index 0000000..5a1fb71
--- /dev/null
+++ b/tests/standalone_2/io/server_socket_listen_close_test.dart
@@ -0,0 +1,30 @@
+// Copyright (c) 2013, 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.
+//
+// Tests socket exceptions.
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void serverSocketListenCloseTest() {
+ asyncStart();
+ ServerSocket.bind("127.0.0.1", 0).then((server) {
+ Socket.connect("127.0.0.1", server.port).then((socket) {
+ server.listen((incoming) {
+ incoming.destroy();
+ socket.destroy();
+ server.close();
+ }, onDone: asyncEnd);
+ });
+ });
+}
+
+main() {
+ asyncStart();
+ serverSocketListenCloseTest();
+ asyncEnd();
+}
diff --git a/tests/standalone_2/io/socket_arguments_test.dart b/tests/standalone_2/io/socket_arguments_test.dart
new file mode 100644
index 0000000..251adc6
--- /dev/null
+++ b/tests/standalone_2/io/socket_arguments_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2013, 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=
+// VMOptions=--short_socket_read
+// VMOptions=--short_socket_write
+// VMOptions=--short_socket_read --short_socket_write
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void main() {
+ Expect.throws(() => ServerSocket.bind("127.0.0.1", 65536));
+ Expect.throws(() => ServerSocket.bind("127.0.0.1", -1));
+ Expect.throws(() => ServerSocket.bind("127.0.0.1", 0, backlog: -1));
+}
diff --git a/tests/standalone_2/io/socket_connect_consume_close_test.dart b/tests/standalone_2/io/socket_connect_consume_close_test.dart
new file mode 100644
index 0000000..0eeb410
--- /dev/null
+++ b/tests/standalone_2/io/socket_connect_consume_close_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2013, 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=
+// VMOptions=--short_socket_read
+// VMOptions=--short_socket_write
+// VMOptions=--short_socket_read --short_socket_write
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void main() {
+ // Connect socket then immediate close the consumer without
+ // listening on the stream.
+ asyncStart();
+ ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
+ server.listen((_) {});
+ Socket.connect("127.0.0.1", server.port).then((socket) {
+ socket.close();
+ socket.done.then((_) {
+ socket.destroy();
+ server.close();
+ asyncEnd();
+ });
+ });
+ });
+}
diff --git a/tests/standalone_2/io/socket_connect_consume_write_close_test.dart b/tests/standalone_2/io/socket_connect_consume_write_close_test.dart
new file mode 100644
index 0000000..de2d958
--- /dev/null
+++ b/tests/standalone_2/io/socket_connect_consume_write_close_test.dart
@@ -0,0 +1,32 @@
+// Copyright (c) 2013, 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=
+// VMOptions=--short_socket_read
+// VMOptions=--short_socket_write
+// VMOptions=--short_socket_read --short_socket_write
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void main() {
+ // Connect socket write some data immediate close the consumer
+ // without listening on the stream.
+ asyncStart();
+ ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
+ server.listen((_) {});
+ Socket.connect("127.0.0.1", server.port).then((socket) {
+ socket.add([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
+ socket.close();
+ socket.done.then((_) {
+ socket.destroy();
+ server.close();
+ asyncEnd();
+ });
+ });
+ });
+}
diff --git a/tests/standalone_2/io/socket_connect_immediate_destory_test.dart b/tests/standalone_2/io/socket_connect_immediate_destory_test.dart
new file mode 100644
index 0000000..8a9a379
--- /dev/null
+++ b/tests/standalone_2/io/socket_connect_immediate_destory_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2013, 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=
+// VMOptions=--short_socket_read
+// VMOptions=--short_socket_write
+// VMOptions=--short_socket_read --short_socket_write
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void main() {
+ asyncStart();
+ ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
+ server.listen((_) {});
+ Socket.connect("127.0.0.1", server.port).then((socket) {
+ socket.destroy();
+ server.close();
+ asyncEnd();
+ });
+ });
+}
diff --git a/tests/standalone_2/io/socket_connect_stream_close_test.dart b/tests/standalone_2/io/socket_connect_stream_close_test.dart
new file mode 100644
index 0000000..b5899ae
--- /dev/null
+++ b/tests/standalone_2/io/socket_connect_stream_close_test.dart
@@ -0,0 +1,38 @@
+// Copyright (c) 2013, 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=
+// VMOptions=--short_socket_read
+// VMOptions=--short_socket_write
+// VMOptions=--short_socket_read --short_socket_write
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void main() {
+ // Connect socket and listen on the stream. The server closes
+ // immediately so only a done event is received.
+ asyncStart();
+ ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
+ server.listen((client) {
+ client.close();
+ client.done.then((_) => client.destroy());
+ });
+ Socket.connect("127.0.0.1", server.port).then((socket) {
+ bool onDoneCalled = false;
+ socket.listen((_) {
+ Expect.fail("Unexpected data");
+ }, onDone: () {
+ Expect.isFalse(onDoneCalled);
+ onDoneCalled = true;
+ socket.close();
+ server.close();
+ asyncEnd();
+ });
+ });
+ });
+}
diff --git a/tests/standalone_2/io/socket_connect_stream_data_close_cancel_test.dart b/tests/standalone_2/io/socket_connect_stream_data_close_cancel_test.dart
new file mode 100644
index 0000000..7c2c833
--- /dev/null
+++ b/tests/standalone_2/io/socket_connect_stream_data_close_cancel_test.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2013, 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=
+// VMOptions=--short_socket_read
+// VMOptions=--short_socket_write
+// VMOptions=--short_socket_read --short_socket_write
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void testConnectStreamDataCloseCancel(bool useDestroy) {
+ List<int> sendData = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
+ asyncStart();
+ ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
+ server.listen((client) {
+ client.add(sendData);
+ if (useDestroy) {
+ client.destroy();
+ } else {
+ client.close();
+ }
+ client.done.then((_) {
+ if (!useDestroy) client.destroy();
+ }).catchError((e) {/* can happen with short writes */});
+ });
+ Socket.connect("127.0.0.1", server.port).then((socket) {
+ List<int> data = [];
+ bool onDoneCalled = false;
+ var subscription;
+ subscription = socket.listen((_) {
+ subscription.cancel();
+ socket.close();
+ server.close();
+ asyncEnd();
+ }, onDone: () {
+ Expect.fail("Unexpected pipe completion");
+ });
+ });
+ });
+}
+
+main() {
+ testConnectStreamDataCloseCancel(true);
+ testConnectStreamDataCloseCancel(false);
+}
diff --git a/tests/standalone_2/io/socket_connect_stream_data_close_test.dart b/tests/standalone_2/io/socket_connect_stream_data_close_test.dart
new file mode 100644
index 0000000..fbfb7e7
--- /dev/null
+++ b/tests/standalone_2/io/socket_connect_stream_data_close_test.dart
@@ -0,0 +1,54 @@
+// Copyright (c) 2013, 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=
+// VMOptions=--short_socket_read
+// VMOptions=--short_socket_write
+// VMOptions=--short_socket_read --short_socket_write
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void testConnectStreamDataClose(bool useDestroy) {
+ // Connect socket and listen on the stream. The server sends data
+ // and then closes so both data and a done event is received.
+ List<int> sendData = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
+ asyncStart();
+ ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
+ server.listen((client) {
+ client.add(sendData);
+ if (useDestroy) {
+ client.destroy();
+ } else {
+ client.close();
+ }
+ client.done.then((_) {
+ if (!useDestroy) {
+ client.destroy();
+ }
+ });
+ });
+ Socket.connect("127.0.0.1", server.port).then((socket) {
+ List<int> data = [];
+ bool onDoneCalled = false;
+ socket.listen(data.addAll, onDone: () {
+ Expect.isFalse(onDoneCalled);
+ onDoneCalled = true;
+ if (!useDestroy) Expect.listEquals(sendData, data);
+ socket.add([0]);
+ socket.close();
+ server.close();
+ asyncEnd();
+ });
+ });
+ });
+}
+
+main() {
+ testConnectStreamDataClose(true);
+ testConnectStreamDataClose(false);
+}
diff --git a/tests/standalone_2/io/socket_connect_timeout_test.dart b/tests/standalone_2/io/socket_connect_timeout_test.dart
new file mode 100644
index 0000000..d507a2a
--- /dev/null
+++ b/tests/standalone_2/io/socket_connect_timeout_test.dart
@@ -0,0 +1,26 @@
+// Copyright (c) 2013, 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=
+// VMOptions=--short_socket_read
+// VMOptions=--short_socket_write
+// VMOptions=--short_socket_read --short_socket_write
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void main() {
+ asyncStart();
+ Duration timeout = new Duration(milliseconds: 20);
+ Socket.connect("8.8.8.7", 80, timeout: timeout).then((socket) {
+ Expect.fail("Unexpected connection made.");
+ asyncEnd();
+ }).catchError((e) {
+ Expect.isTrue(e is SocketException);
+ asyncEnd();
+ });
+}
diff --git a/tests/standalone_2/io/socket_exception_test.dart b/tests/standalone_2/io/socket_exception_test.dart
deleted file mode 100644
index 3dbe93e..0000000
--- a/tests/standalone_2/io/socket_exception_test.dart
+++ /dev/null
@@ -1,279 +0,0 @@
-// Copyright (c) 2013, 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.
-//
-// Tests socket exceptions.
-
-import "dart:async";
-import "dart:io";
-
-import "package:async_helper/async_helper.dart";
-import "package:expect/expect.dart";
-
-class SocketExceptionTest {
- static void serverSocketExceptionTest() {
- bool exceptionCaught = false;
- bool wrongExceptionCaught = false;
-
- ServerSocket.bind("127.0.0.1", 0).then((server) {
- Expect.isNotNull(server);
- server.close();
- try {
- server.close();
- } on SocketException catch (ex) {
- exceptionCaught = true;
- } catch (ex) {
- wrongExceptionCaught = true;
- }
- Expect.equals(false, exceptionCaught);
- Expect.equals(true, !wrongExceptionCaught);
-
- // Test invalid host.
- ServerSocket
- .bind("__INVALID_HOST__", 0)
- .then((server) {})
- .catchError((e) => e is SocketException);
- });
- }
-
- static void serverSocketCloseListenTest() {
- asyncStart();
- ServerSocket.bind("127.0.0.1", 0).then((server) {
- Socket.connect("127.0.0.1", server.port).then((socket) {
- socket.destroy();
- server.close();
- server.listen((incoming) => Expect.fail("Unexpected socket"),
- onDone: asyncEnd);
- });
- });
- }
-
- static void serverSocketListenCloseTest() {
- asyncStart();
- ServerSocket.bind("127.0.0.1", 0).then((server) {
- Socket.connect("127.0.0.1", server.port).then((socket) {
- server.listen((incoming) {
- incoming.destroy();
- socket.destroy();
- server.close();
- }, onDone: asyncEnd);
- });
- });
- }
-
- static void clientSocketExceptionTest() {
- bool exceptionCaught = false;
- bool wrongExceptionCaught = false;
-
- ServerSocket.bind("127.0.0.1", 0).then((server) {
- Expect.isNotNull(server);
- int port = server.port;
- Socket.connect("127.0.0.1", port).then((client) {
- Expect.isNotNull(client);
- client.close();
- // First calls for which exceptions are note expected.
- try {
- client.close();
- } on SocketException catch (ex) {
- exceptionCaught = true;
- } catch (ex) {
- wrongExceptionCaught = true;
- }
- Expect.isFalse(exceptionCaught);
- Expect.isFalse(wrongExceptionCaught);
- try {
- client.destroy();
- } on SocketException catch (ex) {
- exceptionCaught = true;
- } catch (ex) {
- wrongExceptionCaught = true;
- }
- Expect.isFalse(exceptionCaught);
- Expect.isFalse(wrongExceptionCaught);
- try {
- List<int> buffer = new List<int>(10);
- client.add(buffer);
- } on StateError catch (ex) {
- exceptionCaught = true;
- } catch (ex) {
- wrongExceptionCaught = true;
- }
- Expect.isFalse(exceptionCaught);
- Expect.isFalse(wrongExceptionCaught);
-
- // From here exceptions are expected.
- exceptionCaught = false;
- try {
- client.port;
- } on SocketException catch (ex) {
- exceptionCaught = true;
- } catch (ex) {
- wrongExceptionCaught = true;
- }
- Expect.isTrue(exceptionCaught);
- Expect.isFalse(wrongExceptionCaught);
- exceptionCaught = false;
- try {
- client.remotePort;
- } on SocketException catch (ex) {
- exceptionCaught = true;
- } catch (ex) {
- wrongExceptionCaught = true;
- }
- Expect.isTrue(exceptionCaught);
- Expect.isFalse(wrongExceptionCaught);
- exceptionCaught = false;
- try {
- client.address;
- } on SocketException catch (ex) {
- exceptionCaught = true;
- } catch (ex) {
- wrongExceptionCaught = true;
- }
- Expect.isTrue(exceptionCaught);
- Expect.isFalse(wrongExceptionCaught);
- exceptionCaught = false;
- try {
- client.remoteAddress;
- } on SocketException catch (ex) {
- exceptionCaught = true;
- } catch (ex) {
- wrongExceptionCaught = true;
- }
- Expect.isTrue(exceptionCaught);
- Expect.isFalse(wrongExceptionCaught);
-
- server.close();
- });
- });
- }
-
- static void clientSocketDestroyNoErrorTest() {
- ServerSocket.bind("127.0.0.1", 0).then((server) {
- server.listen((socket) {
- socket.pipe(socket);
- });
- Socket.connect("127.0.0.1", server.port).then((client) {
- client.listen((data) {}, onDone: server.close);
- client.destroy();
- });
- });
- }
-
- static void clientSocketAddDestroyNoErrorTest() {
- ServerSocket.bind("127.0.0.1", 0).then((server) {
- server.listen((socket) {
- // Passive block data by not subscribing to socket.
- });
- Socket.connect("127.0.0.1", server.port).then((client) {
- client.listen((data) {}, onDone: server.close);
- client.add(new List.filled(1024 * 1024, 0));
- client.destroy();
- });
- });
- }
-
- static void clientSocketAddCloseNoErrorTest() {
- ServerSocket.bind("127.0.0.1", 0).then((server) {
- var completer = new Completer();
- server.listen((socket) {
- // The socket is 'paused' until the future completes.
- completer.future.then((_) => socket.pipe(socket));
- });
- Socket.connect("127.0.0.1", server.port).then((client) {
- const int SIZE = 1024 * 1024;
- int count = 0;
- client.listen((data) => count += data.length, onDone: () {
- Expect.equals(SIZE, count);
- server.close();
- });
- client.add(new List.filled(SIZE, 0));
- client.close();
- // Start piping now.
- completer.complete(null);
- });
- });
- }
-
- static void clientSocketAddCloseErrorTest() {
- asyncStart();
- ServerSocket.bind("127.0.0.1", 0).then((server) {
- var completer = new Completer();
- server.listen((socket) {
- completer.future.then((_) => socket.destroy());
- });
- Socket.connect("127.0.0.1", server.port).then((client) {
- const int SIZE = 1024 * 1024;
- int errors = 0;
- client.listen((data) => Expect.fail("Unexpected data"),
- onError: (error) {
- Expect.isTrue(error is SocketException);
- errors++;
- }, onDone: () {
- // We get either a close or an error followed by a close
- // on the socket. Whether we get both depends on
- // whether the system notices the error for the read
- // event or only for the write event.
- Expect.isTrue(errors <= 1);
- server.close();
- });
- client.add(new List.filled(SIZE, 0));
- // Destroy other socket now.
- completer.complete(null);
- client.done.then((_) {
- Expect.fail("Expected error");
- }, onError: (error) {
- Expect.isTrue(error is SocketException);
- asyncEnd();
- });
- });
- });
- }
-
- static void clientSocketAddCloseResultErrorTest() {
- ServerSocket.bind("127.0.0.1", 0).then((server) {
- var completer = new Completer();
- server.listen((socket) {
- completer.future.then((_) => socket.destroy());
- });
- Socket.connect("127.0.0.1", server.port).then((client) {
- const int SIZE = 1024 * 1024;
- int errors = 0;
- client.add(new List.filled(SIZE, 0));
- client.close();
- client.done.catchError((_) {}).whenComplete(() {
- server.close();
- });
- // Destroy other socket now.
- completer.complete(null);
- });
- });
- }
-
- static void unknownHostTest() {
- asyncStart();
- Socket
- .connect("hede.hule.hest", 1234)
- .then((socket) => Expect.fail("Connection completed"))
- .catchError((e) => asyncEnd(), test: (e) => e is SocketException);
- }
-
- static void testMain() {
- serverSocketExceptionTest();
- serverSocketCloseListenTest();
- serverSocketListenCloseTest();
- clientSocketExceptionTest();
- clientSocketDestroyNoErrorTest();
- clientSocketAddDestroyNoErrorTest();
- clientSocketAddCloseNoErrorTest();
- clientSocketAddCloseErrorTest();
- clientSocketAddCloseResultErrorTest();
- unknownHostTest();
- }
-}
-
-main() {
- asyncStart();
- SocketExceptionTest.testMain();
- asyncEnd();
-}
diff --git a/tests/standalone_2/io/socket_invalid_bind_test.dart b/tests/standalone_2/io/socket_invalid_bind_test.dart
new file mode 100644
index 0000000..f19d551
--- /dev/null
+++ b/tests/standalone_2/io/socket_invalid_bind_test.dart
@@ -0,0 +1,46 @@
+// Copyright (c) 2013, 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=
+// VMOptions=--short_socket_read
+// VMOptions=--short_socket_write
+// VMOptions=--short_socket_read --short_socket_write
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void main() {
+ // Bind to a unknown DNS name.
+ asyncStart();
+ ServerSocket.bind("ko.faar.__hest__", 0).then((_) {
+ Expect.fail("Failure expected");
+ }).catchError((error) {
+ Expect.isTrue(error is SocketException);
+ asyncEnd();
+ });
+
+ // Bind to an unavaliable IP-address.
+ asyncStart();
+ ServerSocket.bind("8.8.8.8", 0).then((_) {
+ Expect.fail("Failure expected");
+ }).catchError((error) {
+ Expect.isTrue(error is SocketException);
+ asyncEnd();
+ });
+
+ // Bind to a port already in use.
+ asyncStart();
+ ServerSocket.bind("127.0.0.1", 0).then((s) {
+ ServerSocket.bind("127.0.0.1", s.port).then((t) {
+ Expect.fail("Multiple listens on same port");
+ }).catchError((error) {
+ Expect.isTrue(error is SocketException);
+ s.close();
+ asyncEnd();
+ });
+ });
+}
diff --git a/tests/standalone_2/io/socket_simple_bind_test.dart b/tests/standalone_2/io/socket_simple_bind_test.dart
new file mode 100644
index 0000000..fad63df
--- /dev/null
+++ b/tests/standalone_2/io/socket_simple_bind_test.dart
@@ -0,0 +1,23 @@
+// Copyright (c) 2013, 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=
+// VMOptions=--short_socket_read
+// VMOptions=--short_socket_write
+// VMOptions=--short_socket_read --short_socket_write
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void main() {
+ asyncStart();
+ ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((s) {
+ Expect.isTrue(s.port > 0);
+ s.close();
+ asyncEnd();
+ });
+}
diff --git a/tests/standalone_2/io/socket_test.dart b/tests/standalone_2/io/socket_test.dart
deleted file mode 100644
index 4ed8355..0000000
--- a/tests/standalone_2/io/socket_test.dart
+++ /dev/null
@@ -1,225 +0,0 @@
-// Copyright (c) 2013, 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=
-// VMOptions=--short_socket_read
-// VMOptions=--short_socket_write
-// VMOptions=--short_socket_read --short_socket_write
-
-import "dart:async";
-import "dart:io";
-
-import "package:async_helper/async_helper.dart";
-import "package:expect/expect.dart";
-
-void testArguments() {
- Expect.throws(() => ServerSocket.bind("127.0.0.1", 65536));
- Expect.throws(() => ServerSocket.bind("127.0.0.1", -1));
- Expect.throws(() => ServerSocket.bind("127.0.0.1", 0, backlog: -1));
-}
-
-void testSimpleBind() {
- asyncStart();
- ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((s) {
- Expect.isTrue(s.port > 0);
- s.close();
- asyncEnd();
- });
-}
-
-void testInvalidBind() {
- // Bind to a unknown DNS name.
- asyncStart();
- ServerSocket.bind("ko.faar.__hest__", 0).then((_) {
- Expect.fail("Failure expected");
- }).catchError((error) {
- Expect.isTrue(error is SocketException);
- asyncEnd();
- });
-
- // Bind to an unavaliable IP-address.
- asyncStart();
- ServerSocket.bind("8.8.8.8", 0).then((_) {
- Expect.fail("Failure expected");
- }).catchError((error) {
- Expect.isTrue(error is SocketException);
- asyncEnd();
- });
-
- // Bind to a port already in use.
- asyncStart();
- ServerSocket.bind("127.0.0.1", 0).then((s) {
- ServerSocket.bind("127.0.0.1", s.port).then((t) {
- Expect.fail("Multiple listens on same port");
- }).catchError((error) {
- Expect.isTrue(error is SocketException);
- s.close();
- asyncEnd();
- });
- });
-}
-
-void testConnectImmediateDestroy() {
- asyncStart();
- ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
- server.listen((_) {});
- Socket.connect("127.0.0.1", server.port).then((socket) {
- socket.destroy();
- server.close();
- asyncEnd();
- });
- });
-}
-
-void testConnectConsumerClose() {
- // Connect socket then immediate close the consumer without
- // listening on the stream.
- asyncStart();
- ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
- server.listen((_) {});
- Socket.connect("127.0.0.1", server.port).then((socket) {
- socket.close();
- socket.done.then((_) {
- socket.destroy();
- server.close();
- asyncEnd();
- });
- });
- });
-}
-
-void testConnectConsumerWriteClose() {
- // Connect socket write some data immediate close the consumer
- // without listening on the stream.
- asyncStart();
- ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
- server.listen((_) {});
- Socket.connect("127.0.0.1", server.port).then((socket) {
- socket.add([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
- socket.close();
- socket.done.then((_) {
- socket.destroy();
- server.close();
- asyncEnd();
- });
- });
- });
-}
-
-void testConnectStreamClose() {
- // Connect socket and listen on the stream. The server closes
- // immediately so only a done event is received.
- asyncStart();
- ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
- server.listen((client) {
- client.close();
- client.done.then((_) => client.destroy());
- });
- Socket.connect("127.0.0.1", server.port).then((socket) {
- bool onDoneCalled = false;
- socket.listen((_) {
- Expect.fail("Unexpected data");
- }, onDone: () {
- Expect.isFalse(onDoneCalled);
- onDoneCalled = true;
- socket.close();
- server.close();
- asyncEnd();
- });
- });
- });
-}
-
-void testConnectStreamDataClose(bool useDestroy) {
- // Connect socket and listen on the stream. The server sends data
- // and then closes so both data and a done event is received.
- List<int> sendData = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
- asyncStart();
- ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
- server.listen((client) {
- client.add(sendData);
- if (useDestroy) {
- client.destroy();
- } else {
- client.close();
- }
- client.done.then((_) {
- if (!useDestroy) {
- client.destroy();
- }
- });
- });
- Socket.connect("127.0.0.1", server.port).then((socket) {
- List<int> data = [];
- bool onDoneCalled = false;
- socket.listen(data.addAll, onDone: () {
- Expect.isFalse(onDoneCalled);
- onDoneCalled = true;
- if (!useDestroy) Expect.listEquals(sendData, data);
- socket.add([0]);
- socket.close();
- server.close();
- asyncEnd();
- });
- });
- });
-}
-
-void testConnectStreamDataCloseCancel(bool useDestroy) {
- List<int> sendData = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];
- asyncStart();
- ServerSocket.bind(InternetAddress.LOOPBACK_IP_V4, 0).then((server) {
- server.listen((client) {
- client.add(sendData);
- if (useDestroy) {
- client.destroy();
- } else {
- client.close();
- }
- client.done.then((_) {
- if (!useDestroy) client.destroy();
- }).catchError((e) {/* can happen with short writes */});
- });
- Socket.connect("127.0.0.1", server.port).then((socket) {
- List<int> data = [];
- bool onDoneCalled = false;
- var subscription;
- subscription = socket.listen((_) {
- subscription.cancel();
- socket.close();
- server.close();
- asyncEnd();
- }, onDone: () {
- Expect.fail("Unexpected pipe completion");
- });
- });
- });
-}
-
-void testConnectTimeout() {
- asyncStart();
- Duration timeout = new Duration(milliseconds: 20);
- Socket.connect("8.8.8.7", 80, timeout: timeout).then((socket) {
- Expect.fail("Unexpected connection made.");
- asyncEnd();
- }).catchError((e) {
- Expect.isTrue(e is SocketException);
- asyncEnd();
- });
-}
-
-main() {
- testArguments();
- testSimpleBind();
- testInvalidBind();
- testConnectImmediateDestroy();
- testConnectConsumerClose();
- testConnectConsumerWriteClose();
- testConnectStreamClose();
- testConnectStreamDataClose(true);
- testConnectStreamDataClose(false);
- testConnectStreamDataCloseCancel(true);
- testConnectStreamDataCloseCancel(false);
- testConnectTimeout();
-}
diff --git a/tests/standalone_2/io/unknown_host_test.dart b/tests/standalone_2/io/unknown_host_test.dart
new file mode 100644
index 0000000..636bdfb
--- /dev/null
+++ b/tests/standalone_2/io/unknown_host_test.dart
@@ -0,0 +1,25 @@
+// Copyright (c) 2013, 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.
+//
+// Tests socket exceptions.
+
+import "dart:async";
+import "dart:io";
+
+import "package:async_helper/async_helper.dart";
+import "package:expect/expect.dart";
+
+void unknownHostTest() {
+ asyncStart();
+ Socket
+ .connect("hede.hule.hest", 1234)
+ .then((socket) => Expect.fail("Connection completed"))
+ .catchError((e) => asyncEnd(), test: (e) => e is SocketException);
+}
+
+main() {
+ asyncStart();
+ unknownHostTest();
+ asyncEnd();
+}
diff --git a/tests/standalone_2/standalone_2.status b/tests/standalone_2/standalone_2.status
index 8055590..a28eedf 100644
--- a/tests/standalone_2/standalone_2.status
+++ b/tests/standalone_2/standalone_2.status
@@ -58,6 +58,9 @@
[ !$strong ]
float_array_static_test: MissingCompileTimeError
+[ $arch == simdbc64 && $strong && ($compiler == dartk || $compiler == dartkp) ]
+io/*: Skip # Issue 31695
+
[ $builder_tag == swarming && $system == macos ]
io/*: Skip # Issue 30618
@@ -88,13 +91,31 @@
io/raw_secure_server_socket_test: Pass, Crash # Issue 29524
io/raw_server_socket_cancel_test: Skip # Issue 28182 # This test sometimes hangs on Mac.
io/secure_server_client_certificate_test: Skip # Re-enable once the bots have been updated. Issue #26057
+io/socket_connect_stream_data_close_cancel_test: Pass, Timeout # Issue 27453
io/socket_many_connections_test: Skip # This test fails with "Too many open files" on the Mac OS buildbot. This is expected as MacOS by default runs with a very low number of allowed open files ('ulimit -n' says something like 256).
-io/socket_test: Pass, Timeout # Issue 27453
[ $strong && ($compiler == dartk || $compiler == dartkp) ]
assert_test: RuntimeError
-http_launch_test: RuntimeError
-io/*: Skip # Too many errors to triage, io not strong mode clean.
+io/dependency_graph_test: CompileTimeError
+io/directory_test: RuntimeError
+io/file_error_test: RuntimeError
+io/file_system_watcher_test: RuntimeError
+io/file_test: RuntimeError
+io/http_auth_digest_test: RuntimeError
+io/http_auth_test: RuntimeError
+io/http_proxy_advanced_test: CompileTimeError
+io/http_redirect_test: RuntimeError
+io/http_reuse_server_port_test: RuntimeError
+io/http_server_response_test: RuntimeError
+io/http_session_test: RuntimeError
+io/regress_10026_test: RuntimeError
+io/skipping_dart2js_compilations_test: CompileTimeError
+io/socket_upgrade_to_secure_test: RuntimeError
+io/test_harness_analyzer_test: CompileTimeError
+io/test_runner_test: CompileTimeError
+io/web_socket_pipe_test: RuntimeError
+io/web_socket_protocol_processor_test: RuntimeError
+io/zlib_test: RuntimeError
[ !$strong && ($compiler == dartk || $compiler == dartkp) ]
assert_test: RuntimeError
diff --git a/tests/standalone_2/standalone_2_kernel.status b/tests/standalone_2/standalone_2_kernel.status
index 1b4afc1..7ac601f 100644
--- a/tests/standalone_2/standalone_2_kernel.status
+++ b/tests/standalone_2/standalone_2_kernel.status
@@ -28,33 +28,11 @@
[ $compiler == dartk && $runtime == vm && $strong ]
assert_test: CompileTimeError # Issue 31402 (Assert statement)
io/compile_all_test: Crash
-io/file_blocking_lock_test: RuntimeError # Issue 31402 (Variable declaration)
-io/file_lock_test: RuntimeError # Issue 31402 (Variable declaration)
-io/http_client_connect_test: Skip # Flaky.
io/http_client_request_test: Pass, Timeout
io/http_compression_test: RuntimeError
-io/http_content_length_test: Skip # Flaky.
-io/http_cookie_test: Skip # Flaky
-io/http_cross_process_test: RuntimeError # Issue 31402 (Variable declaration)
-io/http_proxy_advanced_test: Skip # Flaky
-io/http_proxy_test: Skip # Flaky.
-io/http_response_deadline_test: Skip # Flaky.
-io/http_reuse_server_port_test: Skip # Flaky.
-io/http_server_close_response_after_error_test: Skip # Flaky.
-io/http_shutdown_test: Skip # Flaky.
-io/raw_datagram_socket_test: Skip # Flaky.
-io/raw_secure_server_closing_test: Skip # Flaky.
-io/raw_socket_cross_process_test: RuntimeError # Issue 31402 (Variable declaration)
+io/http_proxy_test: CompileTimeError
io/secure_builtin_roots_test: Timeout
-io/secure_multiple_client_server_test: Skip # Flaky.
-io/secure_server_closing_test: Skip # Flaky.
-io/secure_server_socket_test: Skip # Flaky.
-io/socket_cross_process_test: RuntimeError # Issue 31402 (Variable declaration)
io/socket_finalizer_test: Pass, Timeout
-io/socket_many_connections_test: Skip # Flaky
-io/web_socket_error_test: Skip # Flaky
-io/web_socket_ping_test: Skip # Flaky.
-io/web_socket_test: Skip # Flaky.
map_insert_remove_oom_test: Crash
no_support_debugger_test: Skip # kernel-service snapshot not compatible with flag disabled
package/package1_test: CompileTimeError
@@ -68,7 +46,7 @@
# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
# are to be triaged. Isolate tests are skipped on purpose due to the usage of
# batch mode.
-[ $compiler == dartk && $strong && ($arch == simarm || $arch == simarm64) ]
+[ $compiler == dartk && $strong && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
bytedata_test: CompileTimeError # Please triage.
map_insert_remove_oom_test: Pass # Please triage.
package/scenarios/invalid/invalid_utf8_test: Pass # Please triage.
@@ -100,7 +78,6 @@
# ===== dartkp + dart_precompiled status lines =====
[ $compiler == dartkp && $runtime == dart_precompiled && $strong ]
dwarf_stack_trace_test: RuntimeError
-io/arguments_test: RuntimeError
io/compile_all_test: Crash
io/file_fuzz_test: RuntimeError, Pass
io/http_client_connect_test: Skip # Flaky.
@@ -115,6 +92,7 @@
io/http_server_close_response_after_error_test: Skip # Flaky.
io/http_shutdown_test: Skip # Flaky.
io/https_client_certificate_test: Crash
+io/namespace_test: RuntimeError
io/platform_test: Crash
io/raw_datagram_socket_test: Skip # Flaky.
io/raw_secure_server_closing_test: Skip # Flaky
diff --git a/tests/standalone_2/standalone_2_precompiled.status b/tests/standalone_2/standalone_2_precompiled.status
index 6d4e52c..da21313 100644
--- a/tests/standalone_2/standalone_2_precompiled.status
+++ b/tests/standalone_2/standalone_2_precompiled.status
@@ -56,7 +56,7 @@
io/namespace_test: RuntimeError
io/test_runner_test: RuntimeError
-[ $runtime == dart_precompiled && !$checked ]
+[ $runtime == dart_precompiled && !$checked && !$strong ]
io/file_constructor_test: RuntimeError
[ $compiler == app_jit || $compiler == precompiler ]
diff --git a/tests/standalone_2/standalone_2_vm.status b/tests/standalone_2/standalone_2_vm.status
index c68c181..583b0e2 100644
--- a/tests/standalone_2/standalone_2_vm.status
+++ b/tests/standalone_2/standalone_2_vm.status
@@ -72,7 +72,7 @@
io/http_server_close_response_after_error_test: Pass, Timeout # Issue 28370: timeout.
io/regress_7191_test: Pass, Timeout # Issue 28374: timeout.
-[ $runtime == vm && !$checked ]
+[ $runtime == vm && !$checked && !$strong ]
io/file_constructor_test: RuntimeError
[ $runtime == vm && ($arch == arm || $arch == arm64) ]
diff --git a/tools/VERSION b/tools/VERSION
index 508d185..e0fa1c0 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 0
PATCH 0
-PRERELEASE 13
+PRERELEASE 14
PRERELEASE_PATCH 0
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index 6e5f830..3b03d8c 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -657,7 +657,7 @@
{
"name": "build dart",
"script": "tools/build.py",
- "arguments": ["dart2js_bot","patched_dart2js_sdk"]
+ "arguments": ["dart2js_bot", "compile_dart2js_platform"]
},
{
"name": "dart2js tests",
diff --git a/tools/patch_sdk.dart b/tools/patch_sdk.dart
index b3f9bf7..290c4af 100644
--- a/tools/patch_sdk.dart
+++ b/tools/patch_sdk.dart
@@ -83,11 +83,10 @@
exit(1);
}
-const validModes = const ['vm', 'dart2js', 'flutter'];
+const validModes = const ['vm', 'flutter'];
String mode;
bool get forVm => mode == 'vm';
bool get forFlutter => mode == 'flutter';
-bool get forDart2js => mode == 'dart2js';
Future _main(List<String> argv) async {
if (argv.isEmpty) usage('[${validModes.join('|')}]');
@@ -115,8 +114,7 @@
// Enumerate core libraries and apply patches
for (SdkLibrary library in sdkLibraries) {
- if (forDart2js && library.isVmLibrary) continue;
- if (!forDart2js && library.isDart2JsLibrary) continue;
+ if (library.isDart2JsLibrary) continue;
_applyPatch(library, sdkLibIn, patchIn, sdkOut, locations);
}
@@ -174,9 +172,9 @@
// [platformForDeps] is always the VM-specific `platform.dill` file.
var platformForDeps = platform;
var sdkDir = outDirUri;
- if (forDart2js || forFlutter) {
+ if (forFlutter) {
// Note: this fails if `$root_out_dir/vm_platform.dill` doesn't exist. The
- // target //utils/compiler:patched_dart2js_sdk depends on
+ // target to build the flutter patched sdk depends on
// //runtime/vm:kernel_platform_files to ensure this file exists.
platformForDeps = outDirUri.resolve('../vm_platform.dill');
sdkDir = null;
@@ -313,7 +311,6 @@
/// patched_sdk folder. For the VM< this includes files under 'runtime/bin/',
/// for flutter, this is includes also the ui library.
_copyExtraLibraries(String sdkOut, Map<String, Map<String, String>> locations) {
- if (forDart2js) return;
var base = path.fromUri(Platform.script);
var dartDir = path.dirname(path.dirname(path.absolute(base)));
@@ -576,7 +573,7 @@
var name = _qualifiedName(node);
var patchNode = patch.patches[name];
if (patchNode == null) {
- if (externalKeyword != null && _shouldHaveImplementation(name)) {
+ if (externalKeyword != null) {
print('warning: patch not found for $name: $node');
exitCode = 1;
}
@@ -595,23 +592,6 @@
}
}
-/// Whether a member should have an implementation after patching the SDK.
-///
-/// True for most members except for the *.fromEnvironment constructors under
-/// the dart2js target.
-bool _shouldHaveImplementation(String qualifiedName) {
- if (!forDart2js) return true;
- // Note: dart2js implements int.fromEnvironment, bool.fromEnvironment
- // and String.fromEnvironment directly and expects the SDK code to
- // have an external declaration.
- var isFromEnvironment = const [
- 'bool.fromEnvironment',
- 'int.fromEnvironment',
- 'String.fromEnvironment'
- ].contains(qualifiedName);
- return !isFromEnvironment;
-}
-
class PatchFinder extends GeneralizingAstVisitor {
final String contents;
final CompilationUnit unit;
@@ -781,7 +761,7 @@
}
List<SdkLibrary> _getSdkLibraries(String contents) {
- var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(forDart2js);
+ var libraryBuilder = new SdkLibrariesReader_LibraryBuilder(false);
parseCompilationUnit(contents).accept(libraryBuilder);
return libraryBuilder.librariesMap.sdkLibraries;
}
diff --git a/tools/run_dart.py b/tools/run_dart.py
index edd1239..a77d15f 100644
--- a/tools/run_dart.py
+++ b/tools/run_dart.py
@@ -39,10 +39,10 @@
parser = BuildArguments()
(options, args) = parser.parse_known_args()
if utils.CheckedInSdkCheckExecutable():
- options.dart_executable = utils.CheckedInSdkExecutable()
- elif options.dart_executable is not None:
+ options.dart = utils.CheckedInSdkExecutable()
+ elif options.dart is not None:
DisplayBootstrapWarning()
- options.dart_executable = os.path.abspath(options.dart_executable)
+ options.dart = os.path.abspath(options.dart)
else:
print >> sys.stderr, 'ERROR: cannot locate dart executable'
return -1
@@ -53,7 +53,7 @@
else:
out = None
- return subprocess.call([options.dart_executable] + args,
+ return subprocess.call([options.dart] + args,
stdout=out, stderr=out)
if __name__ == '__main__':
diff --git a/tools/sdks/linux/dart-sdk.tar.gz.sha1 b/tools/sdks/linux/dart-sdk.tar.gz.sha1
index ae04283..6411e77 100644
--- a/tools/sdks/linux/dart-sdk.tar.gz.sha1
+++ b/tools/sdks/linux/dart-sdk.tar.gz.sha1
@@ -1 +1 @@
-d051022a6ec9b5e2566c1793c27da4f1d11ad27a
\ No newline at end of file
+49e617f9794692ed227c0722813e10c3d4196346
\ No newline at end of file
diff --git a/tools/sdks/mac/dart-sdk.tar.gz.sha1 b/tools/sdks/mac/dart-sdk.tar.gz.sha1
index 18c061f..02551c5 100644
--- a/tools/sdks/mac/dart-sdk.tar.gz.sha1
+++ b/tools/sdks/mac/dart-sdk.tar.gz.sha1
@@ -1 +1 @@
-babb94e198e65662cdb4cfa9075729e6fe25b3ce
\ No newline at end of file
+1874dc616540bedab2352f0e1c7b5351bc243983
\ No newline at end of file
diff --git a/tools/sdks/win/dart-sdk.tar.gz.sha1 b/tools/sdks/win/dart-sdk.tar.gz.sha1
index 78dc1ad..46075fb 100644
--- a/tools/sdks/win/dart-sdk.tar.gz.sha1
+++ b/tools/sdks/win/dart-sdk.tar.gz.sha1
@@ -1 +1 @@
-c090c957f926ad26da13e58f2a5c101f61f88512
\ No newline at end of file
+78643b42a0fc10aea1409d5ce9ed10a14d128e77
\ No newline at end of file
diff --git a/tools/testing/dart/compiler_configuration.dart b/tools/testing/dart/compiler_configuration.dart
index 268d96e..be504f66 100644
--- a/tools/testing/dart/compiler_configuration.dart
+++ b/tools/testing/dart/compiler_configuration.dart
@@ -645,10 +645,6 @@
return multiplier;
}
- // TODO(dartbug.com/30480): create a separate option to toggle
- // strong mode optimizations.
- bool get _enableStrongModeOptimizations => false;
-
CommandArtifact computeCompilationArtifact(String tempDir,
List<String> arguments, Map<String, String> environmentOverrides) {
var commands = <Command>[];
@@ -723,10 +719,6 @@
args.add('--obfuscate');
}
- if (_enableStrongModeOptimizations) {
- args.add('--experimental-strong-mode');
- }
-
if (_isStrong) {
args.add('--strong');
}
diff --git a/utils/compiler/BUILD.gn b/utils/compiler/BUILD.gn
index 2f44254..391a10b 100644
--- a/utils/compiler/BUILD.gn
+++ b/utils/compiler/BUILD.gn
@@ -80,26 +80,9 @@
training_args = [ "--help" ]
}
-generate_patched_sdk("patched_dart2js_sdk") {
- mode = "dart2js"
- deps = [
- # TODO(ahe): This is needed by ../../tools/patch_sdk.dart to compute
- # dependencies.
- "../../runtime/vm:kernel_platform_files($dart_host_toolchain)",
- ]
- input_patches_dir = "../../sdk/lib/_internal/js_runtime/lib"
- patched_sdk_dir = "patched_dart2js_sdk"
-
- outputs = [
- # Instead of listing all outputs we list those consumed by
- # other BUILD rules.
- "$root_out_dir/$patched_sdk_dir/lib/libraries.json",
- ]
-}
-
compile_platform("compile_dart2js_platform") {
sources = [
- "$root_out_dir/patched_dart2js_sdk/lib/libraries.json",
+ "../../sdk/lib/libraries.json",
]
outputs = [
@@ -107,10 +90,6 @@
"$root_out_dir/dart2js_outline.dill",
]
- deps = [
- ":patched_dart2js_sdk",
- ]
-
args = [
"--target=dart2js",
"dart:core",
diff --git a/utils/dartdevc/BUILD.gn b/utils/dartdevc/BUILD.gn
index 7a9cf2f..5285538 100644
--- a/utils/dartdevc/BUILD.gn
+++ b/utils/dartdevc/BUILD.gn
@@ -9,7 +9,6 @@
patched_sdk_dir = "$target_gen_dir/patched_sdk"
sdk_summary = "$target_gen_dir/ddc_sdk.sum"
sdk_dill = "$target_gen_dir/ddc_sdk.dill"
-dart_root = rebase_path("../..")
application_snapshot("dartdevc") {
main_dart = "../../pkg/dev_compiler/bin/dartdevc.dart"
@@ -140,7 +139,7 @@
]
if (!prebuilt_dart_exe_works) {
- deps += [ "$dart_root/runtime/bin:dart_bootstrap($dart_host_toolchain)" ]
+ deps += [ "../../runtime/bin:dart_bootstrap($dart_host_toolchain)" ]
}
script = "../../tools/patch_sdk.py"
@@ -172,7 +171,7 @@
args = []
if (!prebuilt_dart_exe_works) {
dart_out_dir = get_label_info(
- "$dart_root/runtime/bin:dart_bootstrap($dart_host_toolchain)",
+ "../../runtime/bin:dart_bootstrap($dart_host_toolchain)",
"root_out_dir")
dart_bootstrap =
rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix")
@@ -201,7 +200,7 @@
]
if (!prebuilt_dart_exe_works) {
- deps += [ "$dart_root/runtime/bin:dart_bootstrap($dart_host_toolchain)" ]
+ deps += [ "../../runtime/bin:dart_bootstrap($dart_host_toolchain)" ]
}
script = "../../tools/run_dart.py"
@@ -209,7 +208,7 @@
args = []
if (!prebuilt_dart_exe_works) {
dart_out_dir = get_label_info(
- "$dart_root/runtime/bin:dart_bootstrap($dart_host_toolchain)",
+ "../../runtime/bin:dart_bootstrap($dart_host_toolchain)",
"root_out_dir")
dart_bootstrap =
rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix")