Version 2.0.0-dev.55.0
Merge commit '4a323f8aef90b0dc65c351b978ef66cedd55f73e' into dev
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0269232..a13f6d2 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,46 @@
+## 2.0.0-dev.55.0
+
+### Language
+
+* Changed the `cast` method to always change the type. Deprecated the
+ `retype` method and made it redirect to `cast`. Applies to all of the
+ following interfaces:
+ * `Stream`:
+ * `StreamTransformer`
+ * `Iterable`
+ * `Map`
+
+### Tool Changes
+
+#### dart2js
+
+* Several fixes to improve support for running output of dart2js as a webworker.
+
+* `dart:isolate` implementation removed. To launch background tasks,
+ please use webworkers instead. APIs for webworkers can be accessed from
+ `dart:html` or JS-interop.
+
+#### Pub
+
+* Use forward-slash paths to Git on Windows
+
## 2.0.0-dev.54.0
+### Core library changes
+
+* `dart:io`
+ * Added Dart-styled constants to `ZLibOptions`, `FileMode`, `FileLock`,
+ `FileSystemEntityType`, `FileSystemEvent`, `ProcessStartMode`,
+ `ProcessSignal`, `InternetAddressType`, `InternetAddress`,
+ `SocketDirection`, `SocketOption`, `RawSocketEvent`, and `StdioType`, and
+ deprecated the old `SCREAMING_CAPS` constants.
+ * Added the Dart-styled top-level constants `zlib`, `gzip`, and
+ `systemEncoding`, and deprecated the old `SCREAMING_CAPS` top-level
+ constants.
+ * Removed the top-level `FileMode` constants `READ`, `WRITE`, `APPEND`,
+ `WRITE_ONLY`, and `WRITE_ONLY_APPEND`. Please use e.g. `FileMode.read`
+ instead.
+
### Tool Changes
#### Pub
diff --git a/DEPS b/DEPS
index 6564eee..6e0ad81 100644
--- a/DEPS
+++ b/DEPS
@@ -98,7 +98,7 @@
"intl_tag": "0.15.2",
"jinja2_rev": "2222b31554f03e62600cd7e383376a7c187967a1",
"json_rpc_2_tag": "2.0.6",
- "linter_tag": "0.1.49",
+ "linter_tag": "0.1.50",
"logging_tag": "0.11.3+1",
"markdown_tag": "1.1.1",
"matcher_tag": "0.12.1+4",
@@ -114,7 +114,7 @@
"ply_rev": "604b32590ffad5cbb82e4afef1d305512d06ae93",
"pool_tag": "1.3.4",
"protobuf_tag": "0.7.1",
- "pub_rev": "c61b8a3a24a7b1f931bad24b1f663e2c9a4c4354",
+ "pub_rev": "0c172864be2d2043a9d630e07f6b4eae7472653f",
"pub_semver_tag": "1.4.1",
"quiver_tag": "5aaa3f58c48608af5b027444d561270b53f15dbf",
"resource_rev":"af5a5bf65511943398146cf146e466e5f0b95cb9",
diff --git a/docs/language/Dart.g b/docs/language/Dart.g
index 827db76..f586c96 100644
--- a/docs/language/Dart.g
+++ b/docs/language/Dart.g
@@ -471,7 +471,11 @@
;
enumType
- : ENUM typeIdentifier LBRACE identifier (',' identifier)* (',')? RBRACE
+ : ENUM typeIdentifier LBRACE enumEntry (',' enumEntry)* (',')? RBRACE
+ ;
+
+enumEntry
+ : metadata identifier
;
typeParameter
diff --git a/docs/language/dartLangSpec.tex b/docs/language/dartLangSpec.tex
index 30d92e1..3d99fb8 100644
--- a/docs/language/dartLangSpec.tex
+++ b/docs/language/dartLangSpec.tex
@@ -2738,21 +2738,26 @@
An {\em enumerated type}, or {\em enum}, is used to represent a fixed number of constant values.
\begin{grammar}
-{\bf enumType:}metadata \ENUM{} id `\{' id [\gcomma{} id]* [\gcomma{}] `\}'
+{\bf enumType:}metadata \ENUM{} identifier
+ \gnewline{} `\{' enumEntry (\gcomma{} enumEntry)* (\gcomma{})? `\}'
+ .
+
+{\bf enumEntry:}metadata identifier
.
\end{grammar}
\LMHash{}
-The declaration of an enum of the form \code{metadata \ENUM{} E \{ id$_0$, \ldots,\ id$_{n-1}$\};}
+The declaration of an enum of the form
+\code{$m$ \ENUM{} E \{$m_0\,\,id_0, \ldots,\ m_{n-1}\,\,id_{n-1}$\}}
has the same effect as a class declaration
\begin{dartCode}
-metadata \CLASS{} E \{
+$m$ \CLASS{} E \{
\FINAL{} int index;
\CONST{} E(\THIS{}.index);
- \STATIC{} \CONST{} E id$_0$ = \CONST{} E(0);
+ $m_0$ \STATIC{} \CONST{} E id$_0$ = \CONST{} E(0);
$\ldots$
- \STATIC{} \CONST{} E id$_{n-1}$ = const E(n - 1);
+ $m_{n-1}$ \STATIC{} \CONST{} E id$_{n-1}$ = const E(n - 1);
\STATIC{} \CONST{} List<E> values = const <E>[id$_0, \ldots, $ id$_{n-1}$];
String toString() => \{ 0: `E.id$_0$', $\ldots$, n-1: `E.id$_{n-1}$'\}[index]
\}
diff --git a/pkg/analysis_server/lib/src/analysis_server.dart b/pkg/analysis_server/lib/src/analysis_server.dart
index b838056..110ad96 100644
--- a/pkg/analysis_server/lib/src/analysis_server.dart
+++ b/pkg/analysis_server/lib/src/analysis_server.dart
@@ -1275,15 +1275,13 @@
analysisServer, path, result.lineInfo, unit);
});
}
- // TODO:(dantup) Uncomment this and equivilent in
- // test/analysis/notification_folding_test.dart once the
- // implementation is complete.
- // if (analysisServer._hasAnalysisServiceSubscription(
- // AnalysisService.FOLDING, path)) {
- // _runDelayed(() {
- // sendAnalysisNotificationFolding(analysisServer, path, unit);
- // });
- // }
+ if (analysisServer._hasAnalysisServiceSubscription(
+ AnalysisService.FOLDING, path)) {
+ _runDelayed(() {
+ sendAnalysisNotificationFolding(
+ analysisServer, path, result.lineInfo, unit);
+ });
+ }
if (analysisServer._hasAnalysisServiceSubscription(
AnalysisService.OUTLINE, path)) {
_runDelayed(() {
diff --git a/pkg/analysis_server/lib/src/computer/computer_folding.dart b/pkg/analysis_server/lib/src/computer/computer_folding.dart
index 19b0c0d..bea49f1 100644
--- a/pkg/analysis_server/lib/src/computer/computer_folding.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_folding.dart
@@ -4,18 +4,20 @@
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/visitor.dart';
+import 'package:analyzer/src/generated/source.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
/**
* A computer for [CompilationUnit] folding.
*/
class DartUnitFoldingComputer {
+ final LineInfo _lineInfo;
final CompilationUnit _unit;
Directive _firstDirective, _lastDirective;
final List<FoldingRegion> _foldingRegions = [];
- DartUnitFoldingComputer(this._unit);
+ DartUnitFoldingComputer(this._lineInfo, this._unit);
/**
* Returns a list of folding regions, not `null`.
@@ -26,8 +28,10 @@
if (_firstDirective != null &&
_lastDirective != null &&
_firstDirective != _lastDirective) {
- _foldingRegions.add(new FoldingRegion(FoldingKind.DIRECTIVES,
- _firstDirective.offset, _lastDirective.end - _firstDirective.offset));
+ _foldingRegions.add(new FoldingRegion(
+ FoldingKind.DIRECTIVES,
+ _firstDirective.keyword.end,
+ _lastDirective.end - _firstDirective.keyword.end));
}
return _foldingRegions;
@@ -42,11 +46,89 @@
_DartUnitFoldingComputerVisitor(this._computer);
@override
- visitImportDirective(ImportDirective node) {
- if (_computer._firstDirective == null) {
- _computer._firstDirective = node;
+ Object visitBlockFunctionBody(BlockFunctionBody node) {
+ final FoldingKind kind = node.parent is ConstructorDeclaration ||
+ node.parent is MethodDeclaration
+ ? FoldingKind.CLASS_MEMBER
+ : FoldingKind.TOP_LEVEL_DECLARATION;
+ _addRegion(
+ node.block.leftBracket.end, node.block.rightBracket.offset, kind);
+ return super.visitBlockFunctionBody(node);
+ }
+
+ @override
+ Object visitClassDeclaration(ClassDeclaration node) {
+ _addRegion(node.leftBracket.end, node.rightBracket.offset,
+ FoldingKind.TOP_LEVEL_DECLARATION);
+ return super.visitClassDeclaration(node);
+ }
+
+ @override
+ Object visitAnnotation(Annotation node) {
+ if (node.arguments != null &&
+ node.arguments.leftParenthesis != null &&
+ node.arguments.rightParenthesis != null) {
+ _addRegion(
+ node.arguments.leftParenthesis.end,
+ node.arguments.rightParenthesis.offset,
+ FoldingKind.TOP_LEVEL_DECLARATION);
}
- _computer._lastDirective = node;
+ return super.visitAnnotation(node);
+ }
+
+ @override
+ Object visitComment(Comment node) {
+ final FoldingKind kind = node.isDocumentation
+ ? FoldingKind.DOCUMENTATION_COMMENT
+ : FoldingKind.COMMENT;
+ _addRegion(node.offset, node.end, kind);
+ return super.visitComment(node);
+ }
+
+ @override
+ Object visitExportDirective(ExportDirective node) {
+ _recordDirective(node);
+ return super.visitExportDirective(node);
+ }
+
+ @override
+ visitImportDirective(ImportDirective node) {
+ _recordDirective(node);
return super.visitImportDirective(node);
}
+
+ @override
+ Object visitLibraryDirective(LibraryDirective node) {
+ _recordDirective(node);
+ return super.visitLibraryDirective(node);
+ }
+
+ @override
+ Object visitPartDirective(PartDirective node) {
+ _recordDirective(node);
+ return super.visitPartDirective(node);
+ }
+
+ @override
+ Object visitPartOfDirective(PartOfDirective node) {
+ _recordDirective(node);
+ return super.visitPartOfDirective(node);
+ }
+
+ _addRegion(int startOffset, int endOffset, FoldingKind kind) {
+ // TODO(dantup): This class is marked deprecated; find out what to change it to.
+ final LineInfo_Location start =
+ _computer._lineInfo.getLocation(startOffset);
+ final LineInfo_Location end = _computer._lineInfo.getLocation(endOffset);
+
+ if (start.lineNumber != end.lineNumber) {
+ _computer._foldingRegions
+ .add(new FoldingRegion(kind, startOffset, endOffset - startOffset));
+ }
+ }
+
+ _recordDirective(Directive node) {
+ _computer._firstDirective ??= node;
+ _computer._lastDirective = node;
+ }
}
diff --git a/pkg/analysis_server/lib/src/operation/operation_analysis.dart b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
index c08b148..24a4811 100644
--- a/pkg/analysis_server/lib/src/operation/operation_analysis.dart
+++ b/pkg/analysis_server/lib/src/operation/operation_analysis.dart
@@ -81,10 +81,10 @@
});
}
-void sendAnalysisNotificationFolding(
- AnalysisServer server, String file, CompilationUnit dartUnit) {
+void sendAnalysisNotificationFolding(AnalysisServer server, String file,
+ LineInfo lineInfo, CompilationUnit dartUnit) {
_sendNotification(server, () {
- var regions = new DartUnitFoldingComputer(dartUnit).compute();
+ var regions = new DartUnitFoldingComputer(lineInfo, dartUnit).compute();
var params = new protocol.AnalysisFoldingParams(file, regions);
server.sendNotification(params.toNotification());
});
diff --git a/pkg/analysis_server/lib/src/server/driver.dart b/pkg/analysis_server/lib/src/server/driver.dart
index e111a67..ac0d78b 100644
--- a/pkg/analysis_server/lib/src/server/driver.dart
+++ b/pkg/analysis_server/lib/src/server/driver.dart
@@ -17,7 +17,6 @@
import 'package:analyzer/file_system/physical_file_system.dart';
import 'package:analyzer/instrumentation/file_instrumentation.dart';
import 'package:analyzer/instrumentation/instrumentation.dart';
-import 'package:analyzer/src/context/builder.dart';
import 'package:analyzer/src/dart/sdk/sdk.dart';
import 'package:analyzer/src/generated/engine.dart';
import 'package:analyzer/src/generated/sdk.dart';
@@ -199,12 +198,6 @@
static const String FILE_READ_MODE = "file-read-mode";
/**
- * The name of the flag used when analyzing the flutter repository.
- * See comments in source for `flutter analyze --watch`.
- */
- static const FLUTTER_REPO = "flutter-repo";
-
- /**
* The name of the option used to print usage information.
*/
static const String HELP_OPTION = "help";
@@ -321,8 +314,6 @@
}
analysisServerOptions.useCFE = results[USE_CFE];
- ContextBuilderOptions.flutterRepo = results[FLUTTER_REPO];
-
telemetry.Analytics analytics = telemetry.createAnalyticsInstance(
'UA-26406144-29', 'analysis-server',
disableForSession: results[SUPPRESS_ANALYTICS_FLAG]);
@@ -501,10 +492,6 @@
help: "enable sending instrumentation information to a server",
defaultsTo: false,
negatable: false);
- parser.addFlag(FLUTTER_REPO,
- help: 'used by "flutter analyze" to enable specific lints'
- ' when analyzing the flutter repository',
- hide: false);
parser.addFlag(HELP_OPTION,
help: "print this help message without starting a server",
abbr: 'h',
diff --git a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
index 79b6f55..a97741f 100644
--- a/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
+++ b/pkg/analysis_server/lib/src/services/correction/fix_internal.dart
@@ -632,8 +632,7 @@
AstNode argumentList = namedExpression.parent;
// Prepare the invoked element.
- var context =
- new _ExecutableParameters(session, astProvider, argumentList.parent);
+ var context = new _ExecutableParameters(astProvider, argumentList.parent);
if (context == null) {
return;
}
@@ -645,8 +644,15 @@
Future<void> addParameter(int offset, String prefix, String suffix) async {
if (offset != null) {
- DartChangeBuilder changeBuilder = await context.addParameter(
- offset, prefix, namedExpression.staticType, name, suffix);
+ var changeBuilder = new DartChangeBuilder(session);
+ await changeBuilder.addFileEdit(context.file, (builder) {
+ builder.addInsertion(offset, (builder) {
+ builder.write(prefix);
+ builder.writeParameterMatchingArgument(
+ namedExpression, 0, new Set<String>());
+ builder.write(suffix);
+ });
+ });
_addFixFromBuilder(
changeBuilder, DartFixKind.ADD_MISSING_PARAMETER_NAMED,
args: [name]);
@@ -666,91 +672,67 @@
}
Future<Null> _addFix_addMissingParameter() async {
- if (node is ArgumentList && node.parent is MethodInvocation) {
- ArgumentList argumentList = node;
- MethodInvocation invocation = node.parent;
- SimpleIdentifier methodName = invocation.methodName;
- Element targetElement = methodName.bestElement;
- List<Expression> arguments = argumentList.arguments;
- if (targetElement is ExecutableElement) {
- List<ParameterElement> parameters = targetElement.parameters;
- int numParameters = parameters.length;
- Iterable<ParameterElement> requiredParameters =
- parameters.takeWhile((p) => p.isNotOptional);
- Iterable<ParameterElement> optionalParameters =
- parameters.skipWhile((p) => p.isNotOptional);
- // prepare the argument to add a new parameter for
- int numRequired = requiredParameters.length;
- if (numRequired >= arguments.length) {
- return;
- }
- Expression argument = arguments[numRequired];
- // prepare target
- int targetOffset;
- if (numRequired != 0) {
- SimpleIdentifier lastName = await astProvider
- .getParsedNameForElement(requiredParameters.last);
- if (lastName != null) {
- targetOffset = lastName.end;
- } else {
- return;
- }
- } else {
- SimpleIdentifier targetName =
- await astProvider.getParsedNameForElement(targetElement);
- AstNode targetDeclaration = targetName?.parent;
- if (targetDeclaration is FunctionDeclaration) {
- FunctionExpression function = targetDeclaration.functionExpression;
- Token paren = function.parameters?.leftParenthesis;
- if (paren == null) {
- return;
- }
- targetOffset = paren.end;
- } else if (targetDeclaration is MethodDeclaration) {
- Token paren = targetDeclaration.parameters?.leftParenthesis;
- if (paren == null) {
- return;
- }
- targetOffset = paren.end;
- } else {
- return;
- }
- }
- Source targetSource = targetElement.source;
- String targetFile = targetSource.fullName;
- DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
- await changeBuilder.addFileEdit(targetFile,
- (DartFileEditBuilder builder) {
- builder.addInsertion(targetOffset, (DartEditBuilder builder) {
- if (numRequired != 0) {
- builder.write(', ');
- }
+ // The error is reported on ArgumentList.
+ if (node is! ArgumentList) {
+ return;
+ }
+ ArgumentList argumentList = node;
+ List<Expression> arguments = argumentList.arguments;
+
+ // Prepare the invoked element.
+ var context = new _ExecutableParameters(astProvider, node.parent);
+ if (context == null) {
+ return;
+ }
+
+ // prepare the argument to add a new parameter for
+ int numRequired = context.required.length;
+ if (numRequired >= arguments.length) {
+ return;
+ }
+ Expression argument = arguments[numRequired];
+
+ Future<void> addParameter(
+ FixKind kind, int offset, String prefix, String suffix) async {
+ if (offset != null) {
+ var changeBuilder = new DartChangeBuilder(session);
+ await changeBuilder.addFileEdit(context.file, (builder) {
+ builder.addInsertion(offset, (builder) {
+ builder.write(prefix);
builder.writeParameterMatchingArgument(
argument, numRequired, new Set<String>());
- if (numRequired != numParameters) {
- builder.write(', ');
- }
+ builder.write(suffix);
});
});
- _addFixFromBuilder(
- changeBuilder, DartFixKind.ADD_MISSING_PARAMETER_REQUIRED);
- if (optionalParameters.isEmpty) {
- DartChangeBuilder changeBuilder = new DartChangeBuilder(session);
- await changeBuilder.addFileEdit(targetFile,
- (DartFileEditBuilder builder) {
- builder.addInsertion(targetOffset, (DartEditBuilder builder) {
- if (numRequired != 0) {
- builder.write(', ');
- }
- builder.write('[');
- builder.writeParameterMatchingArgument(
- argument, numRequired, new Set<String>());
- builder.write(']');
- });
- });
- _addFixFromBuilder(
- changeBuilder, DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL);
- }
+ _addFixFromBuilder(changeBuilder, kind);
+ }
+ }
+
+ // Suggest adding a required parameter.
+ {
+ var kind = DartFixKind.ADD_MISSING_PARAMETER_REQUIRED;
+ if (context.required.isNotEmpty) {
+ var prevNode = await context.getParameterNode(context.required.last);
+ await addParameter(kind, prevNode?.end, ', ', '');
+ } else {
+ var parameterList = await context.getParameterList();
+ var offset = parameterList?.leftParenthesis?.end;
+ var suffix = context.executable.parameters.isNotEmpty ? ', ' : '';
+ await addParameter(kind, offset, '', suffix);
+ }
+ }
+
+ // Suggest adding the first optional positional parameter.
+ if (context.optionalPositional.isEmpty && context.named.isEmpty) {
+ var kind = DartFixKind.ADD_MISSING_PARAMETER_POSITIONAL;
+ var prefix = context.required.isNotEmpty ? ', [' : '[';
+ if (context.required.isNotEmpty) {
+ var prevNode = await context.getParameterNode(context.required.last);
+ await addParameter(kind, prevNode?.end, prefix, ']');
+ } else {
+ var parameterList = await context.getParameterList();
+ var offset = parameterList?.leftParenthesis?.end;
+ await addParameter(kind, offset, prefix, ']');
}
}
}
@@ -3791,7 +3773,6 @@
* [ExecutableElement], its parameters, and operations on them.
*/
class _ExecutableParameters {
- final AnalysisSession session;
final AstProvider astProvider;
final ExecutableElement executable;
@@ -3799,8 +3780,7 @@
final List<ParameterElement> optionalPositional = [];
final List<ParameterElement> named = [];
- factory _ExecutableParameters(
- AnalysisSession session, AstProvider astProvider, AstNode invocation) {
+ factory _ExecutableParameters(AstProvider astProvider, AstNode invocation) {
Element element;
if (invocation is InstanceCreationExpression) {
element = invocation.staticElement;
@@ -3809,13 +3789,13 @@
element = invocation.methodName.staticElement;
}
if (element is ExecutableElement) {
- return new _ExecutableParameters._(session, astProvider, element);
+ return new _ExecutableParameters._(astProvider, element);
} else {
return null;
}
}
- _ExecutableParameters._(this.session, this.astProvider, this.executable) {
+ _ExecutableParameters._(this.astProvider, this.executable) {
for (var parameter in executable.parameters) {
if (parameter.isNotOptional) {
required.add(parameter);
@@ -3827,22 +3807,7 @@
}
}
- /**
- * Write the code for a new parameter with the given [type] and [name].
- */
- Future<DartChangeBuilder> addParameter(int offset, String prefix,
- DartType type, String name, String suffix) async {
- String targetFile = executable.source.fullName;
- var changeBuilder = new DartChangeBuilder(session);
- await changeBuilder.addFileEdit(targetFile, (builder) {
- builder.addInsertion(offset, (builder) {
- builder.write(prefix);
- builder.writeParameter(name, type: type);
- builder.write(suffix);
- });
- });
- return changeBuilder;
- }
+ String get file => executable.source.fullName;
/**
* Return the [FormalParameterList] of the [executable], or `null` is cannot
@@ -3851,7 +3816,9 @@
Future<FormalParameterList> getParameterList() async {
var name = await astProvider.getParsedNameForElement(executable);
AstNode targetDeclaration = name?.parent;
- if (targetDeclaration is FunctionDeclaration) {
+ if (targetDeclaration is ConstructorDeclaration) {
+ return targetDeclaration.parameters;
+ } else if (targetDeclaration is FunctionDeclaration) {
FunctionExpression function = targetDeclaration.functionExpression;
return function.parameters;
} else if (targetDeclaration is MethodDeclaration) {
diff --git a/pkg/analysis_server/lib/src/services/refactoring/naming_conventions.dart b/pkg/analysis_server/lib/src/services/refactoring/naming_conventions.dart
index 0e5e556..94bfd73 100644
--- a/pkg/analysis_server/lib/src/services/refactoring/naming_conventions.dart
+++ b/pkg/analysis_server/lib/src/services/refactoring/naming_conventions.dart
@@ -178,17 +178,9 @@
}
}
}
- // first character
- int currentChar = identifier.codeUnitAt(0);
- if (!isLetter(currentChar) &&
- currentChar != CHAR_UNDERSCORE &&
- currentChar != CHAR_DOLLAR) {
- String message = "$desc must begin with $beginDesc.";
- return new RefactoringStatus.fatal(message);
- }
- // other characters
- for (int i = 1; i < length; i++) {
- currentChar = identifier.codeUnitAt(i);
+ // invalid characters
+ for (int i = 0; i < length; i++) {
+ int currentChar = identifier.codeUnitAt(i);
if (!isLetterOrDigit(currentChar) &&
currentChar != CHAR_UNDERSCORE &&
currentChar != CHAR_DOLLAR) {
@@ -197,6 +189,14 @@
return new RefactoringStatus.fatal(message);
}
}
+ // first character
+ final int currentChar = identifier.codeUnitAt(0);
+ if (!isLetter(currentChar) &&
+ currentChar != CHAR_UNDERSCORE &&
+ currentChar != CHAR_DOLLAR) {
+ String message = "$desc must begin with $beginDesc.";
+ return new RefactoringStatus.fatal(message);
+ }
// OK
return new RefactoringStatus();
}
diff --git a/pkg/analysis_server/test/analysis/notification_folding_test.dart b/pkg/analysis_server/test/analysis/notification_folding_test.dart
index 51a400b..6d43ddb 100644
--- a/pkg/analysis_server/test/analysis/notification_folding_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_folding_test.dart
@@ -15,11 +15,7 @@
main() {
defineReflectiveSuite(() {
- // TODO(dantup): Uncomment once implementation is complete.
- // Cannot just mark the tests as @failingTest as they time out
- // (no FOLDING notification ever) and failingTest doesn't seem
- // to cover that.
- // defineReflectiveTests(_AnalysisNotificationFoldingTest);
+ defineReflectiveTests(_AnalysisNotificationFoldingTest);
});
}
@@ -33,7 +29,9 @@
''';
static final expectedResults = [
- new FoldingRegion(FoldingKind.DIRECTIVES, 0, 40)
+ // We don't include the first "import" in the region because
+ // we want that to remain visible (not collapse).
+ new FoldingRegion(FoldingKind.DIRECTIVES, 6, 34)
];
List<FoldingRegion> lastRegions;
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart
index 0f0bb9c..be7a4cc 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -825,6 +825,90 @@
''');
}
+ test_addMissingParameterNamed_constructor_hasNamed() async {
+ await resolveTestUnit('''
+class A {
+ A(int a, {int b}) {}
+}
+
+main() {
+ new A(1, b: 2, named: 3.0);
+}
+''');
+ await assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_NAMED, '''
+class A {
+ A(int a, {int b, double named}) {}
+}
+
+main() {
+ new A(1, b: 2, named: 3.0);
+}
+''');
+ }
+
+ test_addMissingParameterNamed_constructor_hasRequired() async {
+ await resolveTestUnit('''
+class A {
+ A(int a) {}
+}
+
+main() {
+ new A(1, named: 2.0);
+}
+''');
+ await assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_NAMED, '''
+class A {
+ A(int a, {double named}) {}
+}
+
+main() {
+ new A(1, named: 2.0);
+}
+''');
+ }
+
+ test_addMissingParameterNamed_constructor_noParameters() async {
+ await resolveTestUnit('''
+class A {
+ A() {}
+}
+
+main() {
+ new A(named: 42);
+}
+''');
+ await assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_NAMED, '''
+class A {
+ A({int named}) {}
+}
+
+main() {
+ new A(named: 42);
+}
+''');
+ }
+
+ test_addMissingParameterNamed_constructor_noParameters_named() async {
+ await resolveTestUnit('''
+class A {
+ A.aaa() {}
+}
+
+main() {
+ new A.aaa(named: 42);
+}
+''');
+ await assertHasFix(DartFixKind.ADD_MISSING_PARAMETER_NAMED, '''
+class A {
+ A.aaa({int named}) {}
+}
+
+main() {
+ new A.aaa(named: 42);
+}
+''');
+ }
+
test_addMissingParameterNamed_function_hasNamed() async {
await resolveTestUnit('''
test(int a, {int b: 0}) {}
@@ -897,6 +981,19 @@
''');
}
+ test_addMissingParameterNamed_method_hasOptionalPositional() async {
+ await resolveTestUnit('''
+class A {
+ test(int a, [int b]) {}
+
+ main() {
+ test(1, 2, named: 3.0);
+ }
+}
+''');
+ await assertNoFix(DartFixKind.ADD_MISSING_PARAMETER_NAMED);
+ }
+
test_addMissingParameterNamed_method_hasRequired() async {
await resolveTestUnit('''
class A {
diff --git a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
index 4079387..bcdb836 100644
--- a/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/extract_method_test.dart
@@ -779,6 +779,22 @@
assertRefactoringStatus(
refactoring.checkName(), RefactoringProblemSeverity.FATAL,
expectedMessage: "Method name must not be empty.");
+ // incorrect casing
+ refactoring.name = 'Aaa';
+ assertRefactoringStatus(
+ refactoring.checkName(), RefactoringProblemSeverity.WARNING,
+ expectedMessage: "Method name should start with a lowercase letter.");
+ // starts with digit
+ refactoring.name = '0aa';
+ assertRefactoringStatus(
+ refactoring.checkName(), RefactoringProblemSeverity.FATAL,
+ expectedMessage:
+ "Method name must begin with a lowercase letter or underscore.");
+ // invalid name (quote)
+ refactoring.name = '"';
+ assertRefactoringStatus(
+ refactoring.checkName(), RefactoringProblemSeverity.FATAL,
+ expectedMessage: "Method name must not contain '\"'.");
// OK
refactoring.name = 'res';
assertRefactoringStatusOK(refactoring.checkName());
diff --git a/pkg/analysis_server/test/services/refactoring/naming_conventions_test.dart b/pkg/analysis_server/test/services/refactoring/naming_conventions_test.dart
index fb78873..9c3f157 100644
--- a/pkg/analysis_server/test/services/refactoring/naming_conventions_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/naming_conventions_test.dart
@@ -48,9 +48,14 @@
void test_validateClassName_notIdentifierStart() {
assertRefactoringStatus(
+ validateClassName("badName"), RefactoringProblemSeverity.WARNING,
+ expectedMessage: "Class name should start with an uppercase letter.");
+ }
+
+ void test_validateClassName_invalidCharacter() {
+ assertRefactoringStatus(
validateClassName("-NewName"), RefactoringProblemSeverity.FATAL,
- expectedMessage:
- "Class name must begin with an uppercase letter or underscore.");
+ expectedMessage: "Class name must not contain '-'.");
}
void test_validateClassName_null() {
@@ -290,10 +295,16 @@
}
void test_validateFunctionTypeAliasName_notIdentifierStart() {
- assertRefactoringStatus(validateFunctionTypeAliasName("-NewName"),
- RefactoringProblemSeverity.FATAL,
+ assertRefactoringStatus(validateFunctionTypeAliasName("newName"),
+ RefactoringProblemSeverity.WARNING,
expectedMessage:
- "Function type alias name must begin with an uppercase letter or underscore.");
+ "Function type alias name should start with an uppercase letter.");
+ }
+
+ void test_validateFunctionTypeAliasName_invalidCharacters() {
+ assertRefactoringStatus(validateFunctionTypeAliasName("New-Name"),
+ RefactoringProblemSeverity.FATAL,
+ expectedMessage: "Function type alias name must not contain \'-\'.");
}
void test_validateFunctionTypeAliasName_null() {
diff --git a/pkg/analysis_server/test/src/computer/folding_computer_test.dart b/pkg/analysis_server/test/src/computer/folding_computer_test.dart
index c9d00a1..72a26a7 100644
--- a/pkg/analysis_server/test/src/computer/folding_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/folding_computer_test.dart
@@ -41,13 +41,13 @@
test_multiple_import_directives() async {
String content = """
-/*1*/import 'dart:async';
+import/*1:INC*/ 'dart:async';
// We can have comments
import 'package:a/b.dart';
import 'package:b/c.dart';
-import '../a.dart';/*1:DIRECTIVES*/
+import '../a.dart';/*1:EXC:DIRECTIVES*/
main() {}
""";
@@ -56,11 +56,116 @@
_compareRegions(regions, content);
}
+ test_multiple_directive_types() async {
+ String content = """
+import/*1:INC*/ 'dart:async';
+
+// We can have comments
+import 'package:a/b.dart';
+import 'package:b/c.dart';
+
+export '../a.dart';/*1:EXC:DIRECTIVES*/
+
+main() {}
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
+ test_function() async {
+ String content = """
+// Content before
+
+main() {/*1:INC*/
+ print("Hello, world!");
+/*1:INC:TOP_LEVEL_DECLARATION*/}
+
+// Content after
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
+ test_function_with_dart_doc() async {
+ String content = """
+// Content before
+
+/*1:EXC*//// This is a doc comment
+/// that spans lines/*1:INC:DOCUMENTATION_COMMENT*/
+main() {/*2:INC*/
+ print("Hello, world!");
+/*2:INC:TOP_LEVEL_DECLARATION*/}
+
+// Content after
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
+ test_nested_function() async {
+ String content = """
+// Content before
+
+main() {/*1:INC*/
+ doPrint() {/*2:INC*/
+ print("Hello, world!");
+ /*2:INC:TOP_LEVEL_DECLARATION*/}
+ doPrint();
+/*1:INC:TOP_LEVEL_DECLARATION*/}
+
+// Content after
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
+ test_class() async {
+ String content = """
+// Content before
+
+class Person {/*1:INC*/
+ Person() {/*2:INC*/
+ print("Hello, world!");
+ /*2:INC:CLASS_MEMBER*/}
+
+ void sayHello() {/*3:INC*/
+ print("Hello, world!");
+ /*3:INC:CLASS_MEMBER*/}
+/*1:INC:TOP_LEVEL_DECLARATION*/}
+
+// Content after
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
+ test_annotations() async {
+ String content = """
+@myMultilineAnnotation(/*1:INC*/
+ "this",
+ "is a test"
+/*1:INC:TOP_LEVEL_DECLARATION*/)
+@another()
+@andAnother
+main() {/*2:INC*/
+ print("Hello, world!");
+/*2:INC:TOP_LEVEL_DECLARATION*/}
+""";
+
+ final regions = await _computeRegions(content);
+ _compareRegions(regions, content);
+ }
+
/// Compares provided folding regions with expected
/// regions extracted from the comments in the provided content.
void _compareRegions(List<FoldingRegion> regions, String content) {
// Find all numeric markers for region starts.
- final regex = new RegExp(r'/\*(\d+)\*/');
+ final regex = new RegExp(r'/\*(\d+):(INC|EXC)\*/');
final expectedRegions = regex.allMatches(content);
// Check we didn't get more than expected, since the loop below only
@@ -71,14 +176,22 @@
// ensure it's in the results.
expectedRegions.forEach((m) {
final i = m.group(1);
+ final inclusiveStart = m.group(2) == "INC";
// Find the end marker.
- final endMatch = new RegExp('/\\*$i:(.+?)\\*/').firstMatch(content);
+ final endMatch =
+ new RegExp('/\\*$i:(INC|EXC):(.+?)\\*/').firstMatch(content);
- final expectedStart = m.end;
- final expectedLength = endMatch.start - expectedStart;
- final expectedKindString = endMatch.group(1);
- final expectedKind = FoldingKind.VALUES
- .firstWhere((f) => f.toString() == 'FoldingKind.$expectedKindString');
+ final inclusiveEnd = endMatch.group(1) == "INC";
+ final expectedKindString = endMatch.group(2);
+ final expectedKind = FoldingKind.VALUES.firstWhere(
+ (f) => f.toString() == 'FoldingKind.$expectedKindString',
+ orElse: () => throw new Exception(
+ "Annotated test code references $expectedKindString but "
+ "this does not exist in FoldingKind"));
+
+ final expectedStart = inclusiveStart ? m.start : m.end;
+ final expectedLength =
+ (inclusiveEnd ? endMatch.end : endMatch.start) - expectedStart;
expect(
regions,
@@ -90,7 +203,8 @@
Future<List<FoldingRegion>> _computeRegions(String sourceContent) async {
newFile(sourcePath, content: sourceContent);
ResolveResult result = await driver.getResult(sourcePath);
- DartUnitFoldingComputer computer = new DartUnitFoldingComputer(result.unit);
+ DartUnitFoldingComputer computer =
+ new DartUnitFoldingComputer(result.lineInfo, result.unit);
return computer.compute();
}
}
diff --git a/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart b/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart
index b03c081..ef5fb8f 100644
--- a/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart
+++ b/pkg/analysis_server/test/src/plugin/plugin_manager_test.dart
@@ -779,6 +779,7 @@
import 'dart:isolate';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/physical_file_system.dart';
+import 'package:analyzer/src/dart/analysis/driver.dart';
import 'package:analyzer_plugin/plugin/plugin.dart';
import 'package:analyzer_plugin/protocol/protocol_generated.dart';
import 'package:analyzer_plugin/starter.dart';
@@ -802,6 +803,9 @@
String get version => '0.0.1';
@override
+ AnalysisDriverGeneric createAnalysisDriver(ContextRoot contextRoot) => null;
+
+ @override
Future<AnalysisHandleWatchEventsResult> handleAnalysisHandleWatchEvents(
AnalysisHandleWatchEventsParams parameters) async =>
new AnalysisHandleWatchEventsResult();
diff --git a/pkg/analyzer/lib/src/context/builder.dart b/pkg/analyzer/lib/src/context/builder.dart
index 5b3e1db..7be888a 100644
--- a/pkg/analyzer/lib/src/context/builder.dart
+++ b/pkg/analyzer/lib/src/context/builder.dart
@@ -28,7 +28,6 @@
import 'package:analyzer/src/generated/workspace.dart';
import 'package:analyzer/src/lint/registry.dart';
import 'package:analyzer/src/plugin/resolver_provider.dart';
-import 'package:analyzer/src/services/lint.dart';
import 'package:analyzer/src/source/package_map_resolver.dart';
import 'package:analyzer/src/summary/summary_sdk.dart';
import 'package:analyzer/src/task/options.dart';
@@ -487,18 +486,6 @@
verbose('Using default lint rules');
}
}
- if (ContextBuilderOptions.flutterRepo) {
- // TODO(devoncarew): Should we still be auto-inserting this?
- const lintName = 'public_member_api_docs';
- Linter rule = options.lintRules.firstWhere(
- (Linter lint) => lint.name == lintName,
- orElse: () => null);
- if (rule == null) {
- rule = Registry.ruleRegistry
- .firstWhere((Linter lint) => lint.name == lintName);
- options.lintRules = new List.from(options.lintRules)..add(rule);
- }
- }
} else {
verbose('Using default analysis options');
}
@@ -656,12 +643,6 @@
*/
class ContextBuilderOptions {
/**
- * A flag indicating that the flutter repository is being analyzed.
- * See comments in source for `flutter analyze --watch`.
- */
- static bool flutterRepo = false;
-
- /**
* The results of parsing the command line arguments as defined by
* [defineAnalysisArguments] or `null` if none.
*/
diff --git a/pkg/analyzer/lib/src/fasta/ast_body_builder.dart b/pkg/analyzer/lib/src/fasta/ast_body_builder.dart
new file mode 100644
index 0000000..c24180f1
--- /dev/null
+++ b/pkg/analyzer/lib/src/fasta/ast_body_builder.dart
@@ -0,0 +1,42 @@
+// Copyright (c) 2018, 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/dart/ast/ast.dart' show Expression, Statement;
+import 'package:analyzer/src/fasta/ast_building_factory.dart'
+ show AstBuildingForest;
+import 'package:analyzer/src/generated/resolver.dart' show TypeProvider;
+import 'package:front_end/src/fasta/kernel/body_builder.dart' show BodyBuilder;
+import 'package:front_end/src/fasta/kernel/kernel_builder.dart'
+ show KernelClassBuilder, KernelLibraryBuilder, ModifierBuilder, Scope;
+import 'package:front_end/src/fasta/type_inference/type_inferrer.dart'
+ show TypeInferrer;
+import 'package:kernel/class_hierarchy.dart' show ClassHierarchy;
+import 'package:kernel/core_types.dart' show CoreTypes;
+
+class AstBodyBuilder extends BodyBuilder<Expression, Statement, dynamic> {
+ @override
+ final AstBuildingForest forest;
+
+ AstBodyBuilder(
+ KernelLibraryBuilder library,
+ ModifierBuilder member,
+ Scope scope,
+ Scope formalParameterScope,
+ ClassHierarchy hierarchy,
+ CoreTypes coreTypes,
+ KernelClassBuilder classBuilder,
+ bool isInstanceMember,
+ Uri uri,
+ TypeInferrer typeInferrer,
+ TypeProvider typeProvider)
+ : forest = new AstBuildingForest(typeProvider),
+ super(library, member, scope, formalParameterScope, hierarchy,
+ coreTypes, classBuilder, isInstanceMember, uri, typeInferrer);
+
+ @override
+ void printEvent(String name) {
+ // TODO(scheglov): Call of super is commented out to prevent spamming.
+// super.printEvent(name);
+ }
+}
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 9c01d75..b654900 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -2530,6 +2530,12 @@
push(popTypedList<Annotation>(count) ?? NullValue.Metadata);
}
+ @override
+ void printEvent(String name) {
+ // TODO(scheglov): Call of super is commented out to prevent spamming.
+// super.printEvent(name);
+ }
+
ParameterKind _toAnalyzerParameterKind(FormalParameterKind type) {
if (type == FormalParameterKind.optionalPositional) {
return ParameterKind.POSITIONAL;
diff --git a/pkg/analyzer/lib/src/fasta/ast_building_factory.dart b/pkg/analyzer/lib/src/fasta/ast_building_factory.dart
index 96318e4..4382c12 100644
--- a/pkg/analyzer/lib/src/fasta/ast_building_factory.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_building_factory.dart
@@ -5,17 +5,22 @@
import 'package:analyzer/dart/ast/ast.dart';
import 'package:analyzer/dart/ast/token.dart';
import 'package:analyzer/src/dart/ast/ast_factory.dart';
+import 'package:analyzer/src/generated/resolver.dart' show TypeProvider;
import 'package:front_end/src/fasta/kernel/forest.dart';
import 'package:kernel/ast.dart' as kernel;
/// An implementation of a [Forest] that can be used to build an AST structure.
class AstBuildingForest
implements Forest<Expression, Statement, Token, _Arguments> {
+ /// The type provider used to resolve the types of literal nodes, or `null` if
+ /// type resolution is not being performed.
+ final TypeProvider _typeProvider;
+
/// The factory used to create AST nodes.
AstFactoryImpl astFactory = new AstFactoryImpl();
/// Initialize a newly created AST-building forest.
- AstBuildingForest();
+ AstBuildingForest(this._typeProvider);
@override
_Arguments arguments(List<Expression> positional, Token location,
@@ -79,14 +84,13 @@
condition, question, thenExpression, colon, elseExpression);
@override
- kernel.DartType getTypeAt(Object typeArguments, int index) {
- return null; // (typeArguments as TypeArgumentList).arguments[index].type.kernelType;
+ kernel.DartType getTypeAt(TypeArgumentList typeArguments, int index) {
+ return null; // typeArguments.arguments[index].type.kernelType;
}
@override
- int getTypeCount(Object typeArguments) {
- return (typeArguments as TypeArgumentList).arguments.length;
- }
+ int getTypeCount(TypeArgumentList typeArguments) =>
+ typeArguments.arguments.length;
@override
bool isErroneousNode(covariant node) => false; // ???
@@ -98,15 +102,18 @@
@override
Expression literalBool(bool value, Token location) =>
- astFactory.booleanLiteral(location, value);
+ astFactory.booleanLiteral(location, value)
+ ..staticType = _typeProvider?.boolType;
@override
Expression literalDouble(double value, Token location) =>
- astFactory.doubleLiteral(location, value);
+ astFactory.doubleLiteral(location, value)
+ ..staticType = _typeProvider?.doubleType;
@override
Expression literalInt(int value, Token location) =>
- astFactory.integerLiteral(location, value);
+ astFactory.integerLiteral(location, value)
+ ..staticType = _typeProvider?.intType;
@override
Expression literalList(
@@ -134,22 +141,26 @@
constKeyword, typeArguments, leftBracket, entries, rightBracket);
@override
- Expression literalNull(Token location) => astFactory.nullLiteral(location);
+ Expression literalNull(Token location) =>
+ astFactory.nullLiteral(location)..staticType = _typeProvider?.nullType;
@override
Expression literalString(String value, Token location) =>
- astFactory.simpleStringLiteral(location, value);
+ astFactory.simpleStringLiteral(location, value)
+ ..staticType = _typeProvider?.stringType;
@override
Expression literalSymbol(String value, Token location) {
// TODO(brianwilkerson) Get the missing information.
- return astFactory.symbolLiteral(location, null /* components */);
+ return astFactory.symbolLiteral(location, null /* components */)
+ ..staticType = _typeProvider?.symbolType;
}
@override
Expression literalType(covariant type, Token location) {
// TODO(brianwilkerson) Capture the type information.
- return astFactory.simpleIdentifier(location);
+ return astFactory.simpleIdentifier(location)
+ ..staticType = _typeProvider?.typeType;
}
@override
@@ -167,7 +178,8 @@
@override
Expression notExpression(Expression operand, Token operator) =>
- astFactory.prefixExpression(operator, operand);
+ astFactory.prefixExpression(operator, operand)
+ ..staticType = _typeProvider?.boolType;
@override
int readOffset(AstNode node) => node.offset;
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index a96b872..8d228f3 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -28,6 +28,7 @@
import 'package:front_end/src/fasta/parser/identifier_context.dart' as fasta;
import 'package:front_end/src/fasta/parser/member_kind.dart' as fasta;
import 'package:front_end/src/fasta/parser/parser.dart' as fasta;
+import 'package:front_end/src/fasta/parser/type_info.dart' as fasta;
import 'package:front_end/src/fasta/scanner.dart' as fasta;
export 'package:analyzer/src/dart/ast/utilities.dart' show ResolutionCopier;
diff --git a/pkg/analyzer/lib/src/generated/parser_fasta.dart b/pkg/analyzer/lib/src/generated/parser_fasta.dart
index 2a7322b..3944ae3 100644
--- a/pkg/analyzer/lib/src/generated/parser_fasta.dart
+++ b/pkg/analyzer/lib/src/generated/parser_fasta.dart
@@ -291,8 +291,10 @@
@override
TypeArgumentList parseTypeArgumentList() {
- currentToken = fastaParser
- .parseTypeArgumentsOpt(fastaParser.syntheticPreviousToken(currentToken))
+ Token previous = fastaParser.syntheticPreviousToken(currentToken);
+ currentToken = fasta
+ .computeTypeParamOrArg(previous)
+ .parseArguments(previous, fastaParser)
.next;
return astBuilder.pop();
}
diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart
index 3120bb0..5103eca 100644
--- a/pkg/analyzer/test/generated/parser_fasta_test.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_test.dart
@@ -53,6 +53,12 @@
@reflectiveTest
class ClassMemberParserTest_Fasta extends FastaParserTestCase
with ClassMemberParserTestMixin {
+ @failingTest
+ @override
+ void test_parseAwaitExpression_inSync() {
+ super.test_parseAwaitExpression_inSync();
+ }
+
@override
void test_parseClassMember_method_generic_comment_noReturnType() {
// Ignored: Fasta does not support the generic comment syntax.
diff --git a/pkg/analyzer/test/generated/parser_forest_test.dart b/pkg/analyzer/test/generated/parser_forest_test.dart
index 7b9bc03..5c22fec 100644
--- a/pkg/analyzer/test/generated/parser_forest_test.dart
+++ b/pkg/analyzer/test/generated/parser_forest_test.dart
@@ -2,43 +2,24 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'dart:async';
-import 'dart:io' show File;
-
-import 'package:analyzer/dart/ast/ast.dart';
-import 'package:analyzer/src/fasta/ast_building_factory.dart';
-import "package:front_end/src/api_prototype/front_end.dart";
-import "package:front_end/src/api_prototype/memory_file_system.dart";
-import "package:front_end/src/base/processed_options.dart";
-import "package:front_end/src/compute_platform_binaries_location.dart";
-import 'package:front_end/src/fasta/compiler_context.dart';
-import 'package:front_end/src/fasta/constant_context.dart';
-import 'package:front_end/src/fasta/dill/built_type_builder.dart';
-import 'package:front_end/src/fasta/dill/dill_target.dart';
-import "package:front_end/src/fasta/fasta_codes.dart";
-import 'package:front_end/src/fasta/kernel/body_builder.dart';
-import 'package:front_end/src/fasta/kernel/forest.dart';
-import 'package:front_end/src/fasta/kernel/kernel_builder.dart';
-import "package:front_end/src/fasta/kernel/kernel_target.dart";
-import 'package:front_end/src/fasta/modifier.dart' as Modifier;
-import 'package:front_end/src/fasta/parser/parser.dart';
-import 'package:front_end/src/fasta/scanner.dart';
-import 'package:front_end/src/fasta/ticker.dart';
-import 'package:front_end/src/fasta/type_inference/type_inferrer.dart';
-import 'package:front_end/src/fasta/type_inference/type_schema_environment.dart';
-import 'package:front_end/src/fasta/uri_translator_impl.dart';
-import 'package:front_end/src/scanner/token.dart';
-import 'package:kernel/class_hierarchy.dart' as kernel;
-import 'package:kernel/core_types.dart' as kernel;
-import 'package:kernel/kernel.dart' as kernel;
-import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
+import '../src/fasta/body_builder_test_helper.dart';
import 'parser_test.dart';
main() async {
defineReflectiveSuite(() {
+ // TODO(brianwilkerson) Implement the remaining parser tests.
+// defineReflectiveTests(ClassMemberParserTest_Forest);
+// defineReflectiveTests(ComplexParserTest_Forest);
+// defineReflectiveTests(ErrorParserTest_Forest);
defineReflectiveTests(ExpressionParserTest_Forest);
+// defineReflectiveTests(FormalParameterParserTest_Forest);
+// defineReflectiveTests(NonErrorParserTest_Forest);
+// defineReflectiveTests(RecoveryParserTest_Forest);
+// defineReflectiveTests(SimpleParserTest_Forest);
+ defineReflectiveTests(StatementParserTest_Forest);
+ defineReflectiveTests(TopLevelParserTest_Forest);
});
}
@@ -46,19 +27,9 @@
* Tests of the fasta parser based on [ExpressionParserTestMixin].
*/
@reflectiveTest
-class ExpressionParserTest_Forest extends FastaParserTestCase
+class ExpressionParserTest_Forest extends FastaBodyBuilderTestCase
with ExpressionParserTestMixin {
- @failingTest
- void test_1_plus_2() {
- Expression expression = parseAdditiveExpression('1 + 2');
- expect(expression, isNotNull);
- assertNoErrors();
- var binaryExpression = expression as BinaryExpression;
- expect(binaryExpression.leftOperand, isNotNull);
- expect(binaryExpression.operator, isNotNull);
- expect(binaryExpression.operator.type, TokenType.PLUS);
- expect(binaryExpression.rightOperand, isNotNull);
- }
+ ExpressionParserTest_Forest() : super(false);
@failingTest
void test_namedArgument() {
@@ -355,11 +326,6 @@
}
@failingTest
- void test_parseConstExpression_listLiteral_untyped() {
- super.test_parseConstExpression_listLiteral_untyped();
- }
-
- @failingTest
void test_parseConstExpression_mapLiteral_typed() {
super.test_parseConstExpression_mapLiteral_typed();
}
@@ -370,11 +336,6 @@
}
@failingTest
- void test_parseConstExpression_mapLiteral_untyped() {
- super.test_parseConstExpression_mapLiteral_untyped();
- }
-
- @failingTest
void test_parseEqualityExpression_normal() {
super.test_parseEqualityExpression_normal();
}
@@ -586,26 +547,11 @@
}
@failingTest
- void test_parseListLiteral_multiple() {
- super.test_parseListLiteral_multiple();
- }
-
- @failingTest
- void test_parseListLiteral_single() {
- super.test_parseListLiteral_single();
- }
-
- @failingTest
void test_parseListLiteral_single_withTypeArgument() {
super.test_parseListLiteral_single_withTypeArgument();
}
@failingTest
- void test_parseListOrMapLiteral_list_noType() {
- super.test_parseListOrMapLiteral_list_noType();
- }
-
- @failingTest
void test_parseListOrMapLiteral_list_type() {
super.test_parseListOrMapLiteral_list_type();
}
@@ -747,16 +693,6 @@
}
@failingTest
- void test_parsePrimaryExpression_double() {
- super.test_parsePrimaryExpression_double();
- }
-
- @failingTest
- void test_parsePrimaryExpression_false() {
- super.test_parsePrimaryExpression_false();
- }
-
- @failingTest
void test_parsePrimaryExpression_function_arguments() {
super.test_parsePrimaryExpression_function_arguments();
}
@@ -772,31 +708,11 @@
}
@failingTest
- void test_parsePrimaryExpression_hex() {
- super.test_parsePrimaryExpression_hex();
- }
-
- @failingTest
void test_parsePrimaryExpression_identifier() {
super.test_parsePrimaryExpression_identifier();
}
@failingTest
- void test_parsePrimaryExpression_int() {
- super.test_parsePrimaryExpression_int();
- }
-
- @failingTest
- void test_parsePrimaryExpression_listLiteral() {
- super.test_parsePrimaryExpression_listLiteral();
- }
-
- @failingTest
- void test_parsePrimaryExpression_listLiteral_index() {
- super.test_parsePrimaryExpression_listLiteral_index();
- }
-
- @failingTest
void test_parsePrimaryExpression_listLiteral_typed() {
super.test_parsePrimaryExpression_listLiteral_typed();
}
@@ -807,11 +723,6 @@
}
@failingTest
- void test_parsePrimaryExpression_mapLiteral() {
- super.test_parsePrimaryExpression_mapLiteral();
- }
-
- @failingTest
void test_parsePrimaryExpression_mapLiteral_typed() {
super.test_parsePrimaryExpression_mapLiteral_typed();
}
@@ -827,31 +738,11 @@
}
@failingTest
- void test_parsePrimaryExpression_null() {
- super.test_parsePrimaryExpression_null();
- }
-
- @failingTest
void test_parsePrimaryExpression_parenthesized() {
super.test_parsePrimaryExpression_parenthesized();
}
@failingTest
- void test_parsePrimaryExpression_string() {
- super.test_parsePrimaryExpression_string();
- }
-
- @failingTest
- void test_parsePrimaryExpression_string_multiline() {
- super.test_parsePrimaryExpression_string_multiline();
- }
-
- @failingTest
- void test_parsePrimaryExpression_string_raw() {
- super.test_parsePrimaryExpression_string_raw();
- }
-
- @failingTest
void test_parsePrimaryExpression_super() {
super.test_parsePrimaryExpression_super();
}
@@ -862,11 +753,6 @@
}
@failingTest
- void test_parsePrimaryExpression_true() {
- super.test_parsePrimaryExpression_true();
- }
-
- @failingTest
void test_parseRedirectingConstructorInvocation_named() {
super.test_parseRedirectingConstructorInvocation_named();
}
@@ -962,56 +848,11 @@
}
@failingTest
- void test_parseStringLiteral_multiline_encodedSpace() {
- super.test_parseStringLiteral_multiline_encodedSpace();
- }
-
- @failingTest
void test_parseStringLiteral_multiline_endsWithInterpolation() {
super.test_parseStringLiteral_multiline_endsWithInterpolation();
}
@failingTest
- void test_parseStringLiteral_multiline_escapedBackslash() {
- super.test_parseStringLiteral_multiline_escapedBackslash();
- }
-
- @failingTest
- void test_parseStringLiteral_multiline_escapedBackslash_raw() {
- super.test_parseStringLiteral_multiline_escapedBackslash_raw();
- }
-
- @failingTest
- void test_parseStringLiteral_multiline_escapedEolMarker() {
- super.test_parseStringLiteral_multiline_escapedEolMarker();
- }
-
- @failingTest
- void test_parseStringLiteral_multiline_escapedEolMarker_raw() {
- super.test_parseStringLiteral_multiline_escapedEolMarker_raw();
- }
-
- @failingTest
- void test_parseStringLiteral_multiline_escapedSpaceAndEolMarker() {
- super.test_parseStringLiteral_multiline_escapedSpaceAndEolMarker();
- }
-
- @failingTest
- void test_parseStringLiteral_multiline_escapedSpaceAndEolMarker_raw() {
- super.test_parseStringLiteral_multiline_escapedSpaceAndEolMarker_raw();
- }
-
- @failingTest
- void test_parseStringLiteral_multiline_escapedTab() {
- super.test_parseStringLiteral_multiline_escapedTab();
- }
-
- @failingTest
- void test_parseStringLiteral_multiline_escapedTab_raw() {
- super.test_parseStringLiteral_multiline_escapedTab_raw();
- }
-
- @failingTest
void test_parseStringLiteral_multiline_quoteAfterInterpolation() {
super.test_parseStringLiteral_multiline_quoteAfterInterpolation();
}
@@ -1022,31 +863,11 @@
}
@failingTest
- void test_parseStringLiteral_multiline_twoSpaces() {
- super.test_parseStringLiteral_multiline_twoSpaces();
- }
-
- @failingTest
- void test_parseStringLiteral_multiline_twoSpaces_raw() {
- super.test_parseStringLiteral_multiline_twoSpaces_raw();
- }
-
- @failingTest
- void test_parseStringLiteral_multiline_untrimmed() {
- super.test_parseStringLiteral_multiline_untrimmed();
- }
-
- @failingTest
void test_parseStringLiteral_quoteAfterInterpolation() {
super.test_parseStringLiteral_quoteAfterInterpolation();
}
@failingTest
- void test_parseStringLiteral_single() {
- super.test_parseStringLiteral_single();
- }
-
- @failingTest
void test_parseStringLiteral_startsWithInterpolation() {
super.test_parseStringLiteral_startsWithInterpolation();
}
@@ -1163,129 +984,1381 @@
}
/**
- * Implementation of [AbstractParserTestCase] specialized for testing building
- * Analyzer AST using the fasta [Forest] API.
+ * Tests of the fasta parser based on [StatementParserTestMixin].
*/
-class FastaParserTestCase extends Object
- with ParserTestHelpers
- implements AbstractParserTestCase {
- // TODO(danrubel): Consider HybridFileSystem.
- static final MemoryFileSystem fs =
- new MemoryFileSystem(Uri.parse("org-dartlang-test:///"));
+@reflectiveTest
+class StatementParserTest_Forest extends FastaBodyBuilderTestCase
+ with StatementParserTestMixin {
+ StatementParserTest_Forest() : super(false);
- /// The custom URI used to locate the dill file in the MemoryFileSystem.
- static final Uri sdkSummary = fs.currentDirectory.resolve("vm_platform.dill");
-
- /// The in memory test code URI
- static final Uri entryPoint = fs.currentDirectory.resolve("main.dart");
-
- static ProcessedOptions options;
-
- static KernelTarget kernelTarget;
-
- @override
- Expression parseAdditiveExpression(String code) {
- ScannerResult scan = scanString(code);
-
- return CompilerContext.runWithOptions(options, (CompilerContext c) {
- KernelLibraryBuilder library = new KernelLibraryBuilder(
- entryPoint,
- entryPoint,
- kernelTarget.loader,
- null /* actualOrigin */,
- null /* enclosingLibrary */,
- );
- List<KernelTypeVariableBuilder> typeVariableBuilders =
- <KernelTypeVariableBuilder>[];
- List<KernelFormalParameterBuilder> formalParameterBuilders =
- <KernelFormalParameterBuilder>[];
- KernelProcedureBuilder procedureBuilder = new KernelProcedureBuilder(
- null /* metadata */,
- Modifier.staticMask /* or Modifier.varMask */,
- new BuiltTypeBuilder(new kernel.DynamicType()),
- "analyzerTest",
- typeVariableBuilders,
- formalParameterBuilders,
- kernel.ProcedureKind.Method,
- library,
- -1 /* charOffset */,
- -1 /* charOpenParenOffset */,
- -1 /* charEndOffset */);
-
- TypeInferrerDisabled typeInferrer =
- new TypeInferrerDisabled(new TypeSchemaEnvironment(
- kernelTarget.loader.coreTypes,
- kernelTarget.loader.hierarchy,
- // TODO(danrubel): Enable strong mode.
- false /* strong mode */,
- ));
-
- BodyBuilder builder = new BodyBuilder(
- library,
- procedureBuilder,
- library.scope,
- procedureBuilder.computeFormalParameterScope(library.scope),
- kernelTarget.loader.hierarchy,
- kernelTarget.loader.coreTypes,
- null /* classBuilder */,
- false /* isInstanceMember */,
- null /* uri */,
- typeInferrer,
- new AstBuildingForest(),
- )..constantContext = ConstantContext.none; // .inferred ?
-
- Parser parser = new Parser(builder);
- parser.parseExpression(parser.syntheticPreviousToken(scan.tokens));
- return builder.pop();
- });
+ @failingTest
+ void test_invalid_typeParamAnnotation() {
+ super.test_invalid_typeParamAnnotation();
}
- Future setUp() async {
- // TODO(danrubel): Tear down once all tests in group have been run.
- if (options != null) {
- return;
- }
-
- // Read the dill file containing kernel platform summaries into memory.
- List<int> sdkSummaryBytes = await new File.fromUri(
- computePlatformBinariesLocation().resolve("vm_platform.dill"))
- .readAsBytes();
- fs.entityForUri(sdkSummary).writeAsBytesSync(sdkSummaryBytes);
-
- final CompilerOptions optionBuilder = new CompilerOptions()
- ..strongMode = false // TODO(danrubel): enable strong mode.
- ..reportMessages = true
- ..verbose = false
- ..fileSystem = fs
- ..sdkSummary = sdkSummary
- ..onProblem = (FormattedMessage problem, Severity severity,
- List<FormattedMessage> context) {
- // TODO(danrubel): Capture problems and check against expectations.
- print(problem.formatted);
- };
-
- options = new ProcessedOptions(optionBuilder, false, [entryPoint]);
-
- UriTranslatorImpl uriTranslator = await options.getUriTranslator();
-
- await CompilerContext.runWithOptions(options, (CompilerContext c) async {
- DillTarget dillTarget = new DillTarget(
- new Ticker(isVerbose: false), uriTranslator, options.target);
-
- kernelTarget = new KernelTarget(fs, true, dillTarget, uriTranslator);
-
- // Load the dill file containing platform code.
- dillTarget.loader.read(Uri.parse('dart:core'), -1, fileUri: sdkSummary);
- kernel.Component sdkComponent =
- kernel.loadComponentFromBytes(sdkSummaryBytes);
- dillTarget.loader
- .appendLibraries(sdkComponent, byteCount: sdkSummaryBytes.length);
- await dillTarget.buildOutlines();
- await kernelTarget.buildOutlines();
- kernelTarget.computeCoreTypes();
- assert(kernelTarget.loader.coreTypes != null);
- });
+ @failingTest
+ void test_invalid_typeParamAnnotation2() {
+ super.test_invalid_typeParamAnnotation2();
}
- noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
+ @failingTest
+ void test_invalid_typeParamAnnotation3() {
+ super.test_invalid_typeParamAnnotation3();
+ }
+
+ @failingTest
+ void test_parseAssertStatement() {
+ super.test_parseAssertStatement();
+ }
+
+ @failingTest
+ void test_parseAssertStatement_messageLowPrecedence() {
+ super.test_parseAssertStatement_messageLowPrecedence();
+ }
+
+ @failingTest
+ void test_parseAssertStatement_messageString() {
+ super.test_parseAssertStatement_messageString();
+ }
+
+ @failingTest
+ void test_parseAssertStatement_trailingComma_message() {
+ super.test_parseAssertStatement_trailingComma_message();
+ }
+
+ @failingTest
+ void test_parseAssertStatement_trailingComma_noMessage() {
+ super.test_parseAssertStatement_trailingComma_noMessage();
+ }
+
+ @failingTest
+ void test_parseBlock_empty() {
+ super.test_parseBlock_empty();
+ }
+
+ @failingTest
+ void test_parseBlock_nonEmpty() {
+ super.test_parseBlock_nonEmpty();
+ }
+
+ @failingTest
+ void test_parseBreakStatement_label() {
+ super.test_parseBreakStatement_label();
+ }
+
+ @failingTest
+ void test_parseBreakStatement_noLabel() {
+ super.test_parseBreakStatement_noLabel();
+ }
+
+ @failingTest
+ void test_parseContinueStatement_label() {
+ super.test_parseContinueStatement_label();
+ }
+
+ @failingTest
+ void test_parseContinueStatement_noLabel() {
+ super.test_parseContinueStatement_noLabel();
+ }
+
+ @failingTest
+ void test_parseDoStatement() {
+ super.test_parseDoStatement();
+ }
+
+ @failingTest
+ void test_parseEmptyStatement() {
+ super.test_parseEmptyStatement();
+ }
+
+ @failingTest
+ void test_parseForStatement_each_await() {
+ super.test_parseForStatement_each_await();
+ }
+
+ @failingTest
+ void test_parseForStatement_each_genericFunctionType() {
+ super.test_parseForStatement_each_genericFunctionType();
+ }
+
+ @failingTest
+ void test_parseForStatement_each_identifier() {
+ super.test_parseForStatement_each_identifier();
+ }
+
+ @failingTest
+ void test_parseForStatement_each_noType_metadata() {
+ super.test_parseForStatement_each_noType_metadata();
+ }
+
+ @failingTest
+ void test_parseForStatement_each_type() {
+ super.test_parseForStatement_each_type();
+ }
+
+ @failingTest
+ void test_parseForStatement_each_var() {
+ super.test_parseForStatement_each_var();
+ }
+
+ @failingTest
+ void test_parseForStatement_loop_c() {
+ super.test_parseForStatement_loop_c();
+ }
+
+ @failingTest
+ void test_parseForStatement_loop_cu() {
+ super.test_parseForStatement_loop_cu();
+ }
+
+ @failingTest
+ void test_parseForStatement_loop_ecu() {
+ super.test_parseForStatement_loop_ecu();
+ }
+
+ @failingTest
+ void test_parseForStatement_loop_i() {
+ super.test_parseForStatement_loop_i();
+ }
+
+ @failingTest
+ void test_parseForStatement_loop_i_withMetadata() {
+ super.test_parseForStatement_loop_i_withMetadata();
+ }
+
+ @failingTest
+ void test_parseForStatement_loop_ic() {
+ super.test_parseForStatement_loop_ic();
+ }
+
+ @failingTest
+ void test_parseForStatement_loop_icu() {
+ super.test_parseForStatement_loop_icu();
+ }
+
+ @failingTest
+ void test_parseForStatement_loop_iicuu() {
+ super.test_parseForStatement_loop_iicuu();
+ }
+
+ @failingTest
+ void test_parseForStatement_loop_iu() {
+ super.test_parseForStatement_loop_iu();
+ }
+
+ @failingTest
+ void test_parseForStatement_loop_u() {
+ super.test_parseForStatement_loop_u();
+ }
+
+ @failingTest
+ void test_parseFunctionDeclarationStatement() {
+ super.test_parseFunctionDeclarationStatement();
+ }
+
+ @failingTest
+ void test_parseFunctionDeclarationStatement_typeParameterComments() {
+ super.test_parseFunctionDeclarationStatement_typeParameterComments();
+ }
+
+ @failingTest
+ void test_parseFunctionDeclarationStatement_typeParameters() {
+ super.test_parseFunctionDeclarationStatement_typeParameters();
+ }
+
+ @failingTest
+ void test_parseFunctionDeclarationStatement_typeParameters_noReturnType() {
+ super.test_parseFunctionDeclarationStatement_typeParameters_noReturnType();
+ }
+
+ @failingTest
+ void test_parseIfStatement_else_block() {
+ super.test_parseIfStatement_else_block();
+ }
+
+ @failingTest
+ void test_parseIfStatement_else_statement() {
+ super.test_parseIfStatement_else_statement();
+ }
+
+ @failingTest
+ void test_parseIfStatement_noElse_block() {
+ super.test_parseIfStatement_noElse_block();
+ }
+
+ @failingTest
+ void test_parseIfStatement_noElse_statement() {
+ super.test_parseIfStatement_noElse_statement();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_const_list_empty() {
+ super.test_parseNonLabeledStatement_const_list_empty();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_const_list_nonEmpty() {
+ super.test_parseNonLabeledStatement_const_list_nonEmpty();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_const_map_empty() {
+ super.test_parseNonLabeledStatement_const_map_empty();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_const_map_nonEmpty() {
+ super.test_parseNonLabeledStatement_const_map_nonEmpty();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_const_object() {
+ super.test_parseNonLabeledStatement_const_object();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_const_object_named_typeParameters() {
+ super.test_parseNonLabeledStatement_const_object_named_typeParameters();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_constructorInvocation() {
+ super.test_parseNonLabeledStatement_constructorInvocation();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_false() {
+ super.test_parseNonLabeledStatement_false();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_functionDeclaration() {
+ super.test_parseNonLabeledStatement_functionDeclaration();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_functionDeclaration_arguments() {
+ super.test_parseNonLabeledStatement_functionDeclaration_arguments();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_functionExpressionIndex() {
+ super.test_parseNonLabeledStatement_functionExpressionIndex();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_functionInvocation() {
+ super.test_parseNonLabeledStatement_functionInvocation();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_invokeFunctionExpression() {
+ super.test_parseNonLabeledStatement_invokeFunctionExpression();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_localFunction_gftReturnType() {
+ super.test_parseNonLabeledStatement_localFunction_gftReturnType();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_null() {
+ super.test_parseNonLabeledStatement_null();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_startingWithBuiltInIdentifier() {
+ super.test_parseNonLabeledStatement_startingWithBuiltInIdentifier();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_true() {
+ super.test_parseNonLabeledStatement_true();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_typeCast() {
+ super.test_parseNonLabeledStatement_typeCast();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_variableDeclaration_final_namedFunction() {
+ super
+ .test_parseNonLabeledStatement_variableDeclaration_final_namedFunction();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_variableDeclaration_gftType() {
+ super.test_parseNonLabeledStatement_variableDeclaration_gftType();
+ }
+
+ @failingTest
+ void
+ test_parseNonLabeledStatement_variableDeclaration_gftType_functionReturnType() {
+ super
+ .test_parseNonLabeledStatement_variableDeclaration_gftType_functionReturnType();
+ }
+
+ @failingTest
+ void
+ test_parseNonLabeledStatement_variableDeclaration_gftType_gftReturnType() {
+ super
+ .test_parseNonLabeledStatement_variableDeclaration_gftType_gftReturnType();
+ }
+
+ @failingTest
+ void
+ test_parseNonLabeledStatement_variableDeclaration_gftType_gftReturnType2() {
+ super
+ .test_parseNonLabeledStatement_variableDeclaration_gftType_gftReturnType2();
+ }
+
+ @failingTest
+ void
+ test_parseNonLabeledStatement_variableDeclaration_gftType_noReturnType() {
+ super
+ .test_parseNonLabeledStatement_variableDeclaration_gftType_noReturnType();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_variableDeclaration_gftType_returnType() {
+ super
+ .test_parseNonLabeledStatement_variableDeclaration_gftType_returnType();
+ }
+
+ @failingTest
+ void
+ test_parseNonLabeledStatement_variableDeclaration_gftType_voidReturnType() {
+ super
+ .test_parseNonLabeledStatement_variableDeclaration_gftType_voidReturnType();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_variableDeclaration_typeParam() {
+ super.test_parseNonLabeledStatement_variableDeclaration_typeParam();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_variableDeclaration_typeParam2() {
+ super.test_parseNonLabeledStatement_variableDeclaration_typeParam2();
+ }
+
+ @failingTest
+ void test_parseNonLabeledStatement_variableDeclaration_typeParam3() {
+ super.test_parseNonLabeledStatement_variableDeclaration_typeParam3();
+ }
+
+ @failingTest
+ void test_parseStatement_emptyTypeArgumentList() {
+ super.test_parseStatement_emptyTypeArgumentList();
+ }
+
+ @failingTest
+ void test_parseStatement_function_gftReturnType() {
+ super.test_parseStatement_function_gftReturnType();
+ }
+
+ @failingTest
+ void test_parseStatement_functionDeclaration_noReturnType() {
+ super.test_parseStatement_functionDeclaration_noReturnType();
+ }
+
+ @failingTest
+ void
+ test_parseStatement_functionDeclaration_noReturnType_typeParameterComments() {
+ super
+ .test_parseStatement_functionDeclaration_noReturnType_typeParameterComments();
+ }
+
+ @failingTest
+ void test_parseStatement_functionDeclaration_noReturnType_typeParameters() {
+ super.test_parseStatement_functionDeclaration_noReturnType_typeParameters();
+ }
+
+ @failingTest
+ void test_parseStatement_functionDeclaration_returnType() {
+ super.test_parseStatement_functionDeclaration_returnType();
+ }
+
+ @failingTest
+ void test_parseStatement_functionDeclaration_returnType_typeParameters() {
+ super.test_parseStatement_functionDeclaration_returnType_typeParameters();
+ }
+
+ @failingTest
+ void test_parseStatement_multipleLabels() {
+ super.test_parseStatement_multipleLabels();
+ }
+
+ @failingTest
+ void test_parseStatement_noLabels() {
+ super.test_parseStatement_noLabels();
+ }
+
+ @failingTest
+ void test_parseStatement_singleLabel() {
+ super.test_parseStatement_singleLabel();
+ }
+
+ @failingTest
+ void test_parseSwitchStatement_case() {
+ super.test_parseSwitchStatement_case();
+ }
+
+ @failingTest
+ void test_parseSwitchStatement_empty() {
+ super.test_parseSwitchStatement_empty();
+ }
+
+ @failingTest
+ void test_parseSwitchStatement_labeledCase() {
+ super.test_parseSwitchStatement_labeledCase();
+ }
+
+ @failingTest
+ void test_parseSwitchStatement_labeledDefault() {
+ super.test_parseSwitchStatement_labeledDefault();
+ }
+
+ @failingTest
+ void test_parseSwitchStatement_labeledStatementInCase() {
+ super.test_parseSwitchStatement_labeledStatementInCase();
+ }
+
+ @failingTest
+ void test_parseTryStatement_catch() {
+ super.test_parseTryStatement_catch();
+ }
+
+ @failingTest
+ void test_parseTryStatement_catch_error_missingCatchParam() {
+ super.test_parseTryStatement_catch_error_missingCatchParam();
+ }
+
+ @failingTest
+ void test_parseTryStatement_catch_error_missingCatchParen() {
+ super.test_parseTryStatement_catch_error_missingCatchParen();
+ }
+
+ @failingTest
+ void test_parseTryStatement_catch_error_missingCatchTrace() {
+ super.test_parseTryStatement_catch_error_missingCatchTrace();
+ }
+
+ @failingTest
+ void test_parseTryStatement_catch_finally() {
+ super.test_parseTryStatement_catch_finally();
+ }
+
+ @failingTest
+ void test_parseTryStatement_finally() {
+ super.test_parseTryStatement_finally();
+ }
+
+ @failingTest
+ void test_parseTryStatement_multiple() {
+ super.test_parseTryStatement_multiple();
+ }
+
+ @failingTest
+ void test_parseTryStatement_on() {
+ super.test_parseTryStatement_on();
+ }
+
+ @failingTest
+ void test_parseTryStatement_on_catch() {
+ super.test_parseTryStatement_on_catch();
+ }
+
+ @failingTest
+ void test_parseTryStatement_on_catch_finally() {
+ super.test_parseTryStatement_on_catch_finally();
+ }
+
+ @failingTest
+ void test_parseVariableDeclaration_equals_builtIn() {
+ super.test_parseVariableDeclaration_equals_builtIn();
+ }
+
+ @failingTest
+ void test_parseVariableDeclarationListAfterMetadata_const_noType() {
+ super.test_parseVariableDeclarationListAfterMetadata_const_noType();
+ }
+
+ @failingTest
+ void test_parseVariableDeclarationListAfterMetadata_const_type() {
+ super.test_parseVariableDeclarationListAfterMetadata_const_type();
+ }
+
+ @failingTest
+ void test_parseVariableDeclarationListAfterMetadata_const_typeComment() {
+ super.test_parseVariableDeclarationListAfterMetadata_const_typeComment();
+ }
+
+ @failingTest
+ void test_parseVariableDeclarationListAfterMetadata_dynamic_typeComment() {
+ super.test_parseVariableDeclarationListAfterMetadata_dynamic_typeComment();
+ }
+
+ @failingTest
+ void test_parseVariableDeclarationListAfterMetadata_final_noType() {
+ super.test_parseVariableDeclarationListAfterMetadata_final_noType();
+ }
+
+ @failingTest
+ void test_parseVariableDeclarationListAfterMetadata_final_type() {
+ super.test_parseVariableDeclarationListAfterMetadata_final_type();
+ }
+
+ @failingTest
+ void test_parseVariableDeclarationListAfterMetadata_final_typeComment() {
+ super.test_parseVariableDeclarationListAfterMetadata_final_typeComment();
+ }
+
+ @failingTest
+ void test_parseVariableDeclarationListAfterMetadata_type_multiple() {
+ super.test_parseVariableDeclarationListAfterMetadata_type_multiple();
+ }
+
+ @failingTest
+ void test_parseVariableDeclarationListAfterMetadata_type_single() {
+ super.test_parseVariableDeclarationListAfterMetadata_type_single();
+ }
+
+ @failingTest
+ void test_parseVariableDeclarationListAfterMetadata_type_typeComment() {
+ super.test_parseVariableDeclarationListAfterMetadata_type_typeComment();
+ }
+
+ @failingTest
+ void test_parseVariableDeclarationListAfterMetadata_var_multiple() {
+ super.test_parseVariableDeclarationListAfterMetadata_var_multiple();
+ }
+
+ @failingTest
+ void test_parseVariableDeclarationListAfterMetadata_var_single() {
+ super.test_parseVariableDeclarationListAfterMetadata_var_single();
+ }
+
+ @failingTest
+ void test_parseVariableDeclarationListAfterMetadata_var_typeComment() {
+ super.test_parseVariableDeclarationListAfterMetadata_var_typeComment();
+ }
+
+ @failingTest
+ void test_parseVariableDeclarationStatementAfterMetadata_multiple() {
+ super.test_parseVariableDeclarationStatementAfterMetadata_multiple();
+ }
+
+ @failingTest
+ void test_parseVariableDeclarationStatementAfterMetadata_single() {
+ super.test_parseVariableDeclarationStatementAfterMetadata_single();
+ }
+
+ @failingTest
+ void test_parseWhileStatement() {
+ super.test_parseWhileStatement();
+ }
+
+ @failingTest
+ void test_parseYieldStatement_each() {
+ super.test_parseYieldStatement_each();
+ }
+
+ @failingTest
+ void test_parseYieldStatement_normal() {
+ super.test_parseYieldStatement_normal();
+ }
+}
+
+@reflectiveTest
+class TopLevelParserTest_Forest extends FastaBodyBuilderTestCase
+ with TopLevelParserTestMixin {
+ TopLevelParserTest_Forest() : super(false);
+
+ @failingTest
+ void test_function_literal_allowed_at_toplevel() {
+ super.test_function_literal_allowed_at_toplevel();
+ }
+
+ @failingTest
+ void
+ test_function_literal_allowed_in_ArgumentList_in_ConstructorFieldInitializer() {
+ super
+ .test_function_literal_allowed_in_ArgumentList_in_ConstructorFieldInitializer();
+ }
+
+ @failingTest
+ void
+ test_function_literal_allowed_in_IndexExpression_in_ConstructorFieldInitializer() {
+ super
+ .test_function_literal_allowed_in_IndexExpression_in_ConstructorFieldInitializer();
+ }
+
+ @failingTest
+ void
+ test_function_literal_allowed_in_ListLiteral_in_ConstructorFieldInitializer() {
+ super
+ .test_function_literal_allowed_in_ListLiteral_in_ConstructorFieldInitializer();
+ }
+
+ @failingTest
+ void
+ test_function_literal_allowed_in_MapLiteral_in_ConstructorFieldInitializer() {
+ super
+ .test_function_literal_allowed_in_MapLiteral_in_ConstructorFieldInitializer();
+ }
+
+ @failingTest
+ void
+ test_function_literal_allowed_in_ParenthesizedExpression_in_ConstructorFieldInitializer() {
+ super
+ .test_function_literal_allowed_in_ParenthesizedExpression_in_ConstructorFieldInitializer();
+ }
+
+ @failingTest
+ void
+ test_function_literal_allowed_in_StringInterpolation_in_ConstructorFieldInitializer() {
+ super
+ .test_function_literal_allowed_in_StringInterpolation_in_ConstructorFieldInitializer();
+ }
+
+ @failingTest
+ void test_import_as_show() {
+ super.test_import_as_show();
+ }
+
+ @failingTest
+ void test_import_show_hide() {
+ super.test_import_show_hide();
+ }
+
+ @failingTest
+ void test_import_withDocComment() {
+ super.test_import_withDocComment();
+ }
+
+ @failingTest
+ void test_parseClassDeclaration_abstract() {
+ super.test_parseClassDeclaration_abstract();
+ }
+
+ @failingTest
+ void test_parseClassDeclaration_empty() {
+ super.test_parseClassDeclaration_empty();
+ }
+
+ @failingTest
+ void test_parseClassDeclaration_extends() {
+ super.test_parseClassDeclaration_extends();
+ }
+
+ @failingTest
+ void test_parseClassDeclaration_extendsAndImplements() {
+ super.test_parseClassDeclaration_extendsAndImplements();
+ }
+
+ @failingTest
+ void test_parseClassDeclaration_extendsAndWith() {
+ super.test_parseClassDeclaration_extendsAndWith();
+ }
+
+ @failingTest
+ void test_parseClassDeclaration_extendsAndWithAndImplements() {
+ super.test_parseClassDeclaration_extendsAndWithAndImplements();
+ }
+
+ @failingTest
+ void test_parseClassDeclaration_implements() {
+ super.test_parseClassDeclaration_implements();
+ }
+
+ @failingTest
+ void test_parseClassDeclaration_metadata() {
+ super.test_parseClassDeclaration_metadata();
+ }
+
+ @failingTest
+ void test_parseClassDeclaration_native() {
+ super.test_parseClassDeclaration_native();
+ }
+
+ @failingTest
+ void test_parseClassDeclaration_nonEmpty() {
+ super.test_parseClassDeclaration_nonEmpty();
+ }
+
+ @failingTest
+ void test_parseClassDeclaration_typeAlias_implementsC() {
+ super.test_parseClassDeclaration_typeAlias_implementsC();
+ }
+
+ @failingTest
+ void test_parseClassDeclaration_typeAlias_withB() {
+ super.test_parseClassDeclaration_typeAlias_withB();
+ }
+
+ @failingTest
+ void test_parseClassDeclaration_typeParameters() {
+ super.test_parseClassDeclaration_typeParameters();
+ }
+
+ @failingTest
+ void test_parseClassDeclaration_withDocumentationComment() {
+ super.test_parseClassDeclaration_withDocumentationComment();
+ }
+
+ @failingTest
+ void test_parseClassTypeAlias_withDocumentationComment() {
+ super.test_parseClassTypeAlias_withDocumentationComment();
+ }
+
+ @failingTest
+ void test_parseCompilationUnit_abstractAsPrefix_parameterized() {
+ super.test_parseCompilationUnit_abstractAsPrefix_parameterized();
+ }
+
+ @failingTest
+ void test_parseCompilationUnit_builtIn_asFunctionName() {
+ super.test_parseCompilationUnit_builtIn_asFunctionName();
+ }
+
+ @failingTest
+ void test_parseCompilationUnit_builtIn_asFunctionName_withTypeParameter() {
+ super.test_parseCompilationUnit_builtIn_asFunctionName_withTypeParameter();
+ }
+
+ @failingTest
+ void test_parseCompilationUnit_builtIn_asGetter() {
+ super.test_parseCompilationUnit_builtIn_asGetter();
+ }
+
+ @failingTest
+ void test_parseCompilationUnit_directives_multiple() {
+ super.test_parseCompilationUnit_directives_multiple();
+ }
+
+ @failingTest
+ void test_parseCompilationUnit_directives_single() {
+ super.test_parseCompilationUnit_directives_single();
+ }
+
+ @failingTest
+ void test_parseCompilationUnit_empty() {
+ super.test_parseCompilationUnit_empty();
+ }
+
+ @failingTest
+ void test_parseCompilationUnit_exportAsPrefix() {
+ super.test_parseCompilationUnit_exportAsPrefix();
+ }
+
+ @failingTest
+ void test_parseCompilationUnit_exportAsPrefix_parameterized() {
+ super.test_parseCompilationUnit_exportAsPrefix_parameterized();
+ }
+
+ @failingTest
+ void test_parseCompilationUnit_operatorAsPrefix_parameterized() {
+ super.test_parseCompilationUnit_operatorAsPrefix_parameterized();
+ }
+
+ @failingTest
+ void test_parseCompilationUnit_pseudo_prefixed() {
+ super.test_parseCompilationUnit_pseudo_prefixed();
+ }
+
+ @failingTest
+ void test_parseCompilationUnit_script() {
+ super.test_parseCompilationUnit_script();
+ }
+
+ @failingTest
+ void test_parseCompilationUnit_skipFunctionBody_withInterpolation() {
+ super.test_parseCompilationUnit_skipFunctionBody_withInterpolation();
+ }
+
+ @failingTest
+ void test_parseCompilationUnit_topLevelDeclaration() {
+ super.test_parseCompilationUnit_topLevelDeclaration();
+ }
+
+ @failingTest
+ void test_parseCompilationUnit_typedefAsPrefix() {
+ super.test_parseCompilationUnit_typedefAsPrefix();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_abstractAsPrefix() {
+ super.test_parseCompilationUnitMember_abstractAsPrefix();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_class() {
+ super.test_parseCompilationUnitMember_class();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_classTypeAlias() {
+ super.test_parseCompilationUnitMember_classTypeAlias();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_constVariable() {
+ super.test_parseCompilationUnitMember_constVariable();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_expressionFunctionBody_tokens() {
+ super.test_parseCompilationUnitMember_expressionFunctionBody_tokens();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_finalVariable() {
+ super.test_parseCompilationUnitMember_finalVariable();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_function_external_noType() {
+ super.test_parseCompilationUnitMember_function_external_noType();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_function_external_type() {
+ super.test_parseCompilationUnitMember_function_external_type();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_function_generic_noReturnType() {
+ super.test_parseCompilationUnitMember_function_generic_noReturnType();
+ }
+
+ @failingTest
+ void
+ test_parseCompilationUnitMember_function_generic_noReturnType_annotated() {
+ super
+ .test_parseCompilationUnitMember_function_generic_noReturnType_annotated();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_function_generic_returnType() {
+ super.test_parseCompilationUnitMember_function_generic_returnType();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_function_generic_void() {
+ super.test_parseCompilationUnitMember_function_generic_void();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_function_gftReturnType() {
+ super.test_parseCompilationUnitMember_function_gftReturnType();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_function_noReturnType() {
+ super.test_parseCompilationUnitMember_function_noReturnType();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_function_noType() {
+ super.test_parseCompilationUnitMember_function_noType();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_function_type() {
+ super.test_parseCompilationUnitMember_function_type();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_function_void() {
+ super.test_parseCompilationUnitMember_function_void();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_getter_external_noType() {
+ super.test_parseCompilationUnitMember_getter_external_noType();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_getter_external_type() {
+ super.test_parseCompilationUnitMember_getter_external_type();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_getter_noType() {
+ super.test_parseCompilationUnitMember_getter_noType();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_getter_type() {
+ super.test_parseCompilationUnitMember_getter_type();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_setter_external_noType() {
+ super.test_parseCompilationUnitMember_setter_external_noType();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_setter_external_type() {
+ super.test_parseCompilationUnitMember_setter_external_type();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_setter_noType() {
+ super.test_parseCompilationUnitMember_setter_noType();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_setter_type() {
+ super.test_parseCompilationUnitMember_setter_type();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_typeAlias_abstract() {
+ super.test_parseCompilationUnitMember_typeAlias_abstract();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_typeAlias_generic() {
+ super.test_parseCompilationUnitMember_typeAlias_generic();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_typeAlias_implements() {
+ super.test_parseCompilationUnitMember_typeAlias_implements();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_typeAlias_noImplements() {
+ super.test_parseCompilationUnitMember_typeAlias_noImplements();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_typedef() {
+ super.test_parseCompilationUnitMember_typedef();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_typedef_withDocComment() {
+ super.test_parseCompilationUnitMember_typedef_withDocComment();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_typedVariable() {
+ super.test_parseCompilationUnitMember_typedVariable();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_variable() {
+ super.test_parseCompilationUnitMember_variable();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_variable_gftType_gftReturnType() {
+ super.test_parseCompilationUnitMember_variable_gftType_gftReturnType();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_variable_gftType_noReturnType() {
+ super.test_parseCompilationUnitMember_variable_gftType_noReturnType();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_variable_withDocumentationComment() {
+ super.test_parseCompilationUnitMember_variable_withDocumentationComment();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_variableGet() {
+ super.test_parseCompilationUnitMember_variableGet();
+ }
+
+ @failingTest
+ void test_parseCompilationUnitMember_variableSet() {
+ super.test_parseCompilationUnitMember_variableSet();
+ }
+
+ @failingTest
+ void test_parseDirective_export() {
+ super.test_parseDirective_export();
+ }
+
+ @failingTest
+ void test_parseDirective_export_withDocComment() {
+ super.test_parseDirective_export_withDocComment();
+ }
+
+ @failingTest
+ void test_parseDirective_import() {
+ super.test_parseDirective_import();
+ }
+
+ @failingTest
+ void test_parseDirective_library() {
+ super.test_parseDirective_library();
+ }
+
+ @failingTest
+ void test_parseDirective_library_1_component() {
+ super.test_parseDirective_library_1_component();
+ }
+
+ @failingTest
+ void test_parseDirective_library_2_components() {
+ super.test_parseDirective_library_2_components();
+ }
+
+ @failingTest
+ void test_parseDirective_library_3_components() {
+ super.test_parseDirective_library_3_components();
+ }
+
+ @failingTest
+ void test_parseDirective_library_withDocumentationComment() {
+ super.test_parseDirective_library_withDocumentationComment();
+ }
+
+ @failingTest
+ void test_parseDirective_part() {
+ super.test_parseDirective_part();
+ }
+
+ @failingTest
+ void test_parseDirective_part_of_1_component() {
+ super.test_parseDirective_part_of_1_component();
+ }
+
+ @failingTest
+ void test_parseDirective_part_of_2_components() {
+ super.test_parseDirective_part_of_2_components();
+ }
+
+ @failingTest
+ void test_parseDirective_part_of_3_components() {
+ super.test_parseDirective_part_of_3_components();
+ }
+
+ @failingTest
+ void test_parseDirective_part_of_withDocumentationComment() {
+ super.test_parseDirective_part_of_withDocumentationComment();
+ }
+
+ @failingTest
+ void test_parseDirective_part_withDocumentationComment() {
+ super.test_parseDirective_part_withDocumentationComment();
+ }
+
+ @failingTest
+ void test_parseDirective_partOf() {
+ super.test_parseDirective_partOf();
+ }
+
+ @failingTest
+ void test_parseDirectives_complete() {
+ super.test_parseDirectives_complete();
+ }
+
+ @failingTest
+ void test_parseDirectives_empty() {
+ super.test_parseDirectives_empty();
+ }
+
+ @failingTest
+ void test_parseDirectives_mixed() {
+ super.test_parseDirectives_mixed();
+ }
+
+ @failingTest
+ void test_parseDirectives_multiple() {
+ super.test_parseDirectives_multiple();
+ }
+
+ @failingTest
+ void test_parseDirectives_script() {
+ super.test_parseDirectives_script();
+ }
+
+ @failingTest
+ void test_parseDirectives_single() {
+ super.test_parseDirectives_single();
+ }
+
+ @failingTest
+ void test_parseDirectives_topLevelDeclaration() {
+ super.test_parseDirectives_topLevelDeclaration();
+ }
+
+ @failingTest
+ void test_parseEnumDeclaration_one() {
+ super.test_parseEnumDeclaration_one();
+ }
+
+ @failingTest
+ void test_parseEnumDeclaration_trailingComma() {
+ super.test_parseEnumDeclaration_trailingComma();
+ }
+
+ @failingTest
+ void test_parseEnumDeclaration_two() {
+ super.test_parseEnumDeclaration_two();
+ }
+
+ @failingTest
+ void test_parseEnumDeclaration_withDocComment_onEnum() {
+ super.test_parseEnumDeclaration_withDocComment_onEnum();
+ }
+
+ @failingTest
+ void test_parseEnumDeclaration_withDocComment_onValue() {
+ super.test_parseEnumDeclaration_withDocComment_onValue();
+ }
+
+ @failingTest
+ void test_parseExportDirective_configuration_multiple() {
+ super.test_parseExportDirective_configuration_multiple();
+ }
+
+ @failingTest
+ void test_parseExportDirective_configuration_single() {
+ super.test_parseExportDirective_configuration_single();
+ }
+
+ @failingTest
+ void test_parseExportDirective_hide() {
+ super.test_parseExportDirective_hide();
+ }
+
+ @failingTest
+ void test_parseExportDirective_hide_show() {
+ super.test_parseExportDirective_hide_show();
+ }
+
+ @failingTest
+ void test_parseExportDirective_noCombinator() {
+ super.test_parseExportDirective_noCombinator();
+ }
+
+ @failingTest
+ void test_parseExportDirective_show() {
+ super.test_parseExportDirective_show();
+ }
+
+ @failingTest
+ void test_parseExportDirective_show_hide() {
+ super.test_parseExportDirective_show_hide();
+ }
+
+ @failingTest
+ void test_parseFunctionDeclaration_function() {
+ super.test_parseFunctionDeclaration_function();
+ }
+
+ @failingTest
+ void test_parseFunctionDeclaration_functionWithTypeParameters() {
+ super.test_parseFunctionDeclaration_functionWithTypeParameters();
+ }
+
+ @failingTest
+ void test_parseFunctionDeclaration_functionWithTypeParameters_comment() {
+ super.test_parseFunctionDeclaration_functionWithTypeParameters_comment();
+ }
+
+ @failingTest
+ void test_parseFunctionDeclaration_getter() {
+ super.test_parseFunctionDeclaration_getter();
+ }
+
+ @failingTest
+ void test_parseFunctionDeclaration_getter_generic_comment_returnType() {
+ super.test_parseFunctionDeclaration_getter_generic_comment_returnType();
+ }
+
+ @failingTest
+ void test_parseFunctionDeclaration_metadata() {
+ super.test_parseFunctionDeclaration_metadata();
+ }
+
+ @failingTest
+ void test_parseFunctionDeclaration_setter() {
+ super.test_parseFunctionDeclaration_setter();
+ }
+
+ @failingTest
+ void test_parseGenericTypeAlias_noTypeParameters() {
+ super.test_parseGenericTypeAlias_noTypeParameters();
+ }
+
+ @failingTest
+ void test_parseGenericTypeAlias_typeParameters() {
+ super.test_parseGenericTypeAlias_typeParameters();
+ }
+
+ @failingTest
+ void test_parseImportDirective_configuration_multiple() {
+ super.test_parseImportDirective_configuration_multiple();
+ }
+
+ @failingTest
+ void test_parseImportDirective_configuration_single() {
+ super.test_parseImportDirective_configuration_single();
+ }
+
+ @failingTest
+ void test_parseImportDirective_deferred() {
+ super.test_parseImportDirective_deferred();
+ }
+
+ @failingTest
+ void test_parseImportDirective_hide() {
+ super.test_parseImportDirective_hide();
+ }
+
+ @failingTest
+ void test_parseImportDirective_noCombinator() {
+ super.test_parseImportDirective_noCombinator();
+ }
+
+ @failingTest
+ void test_parseImportDirective_prefix() {
+ super.test_parseImportDirective_prefix();
+ }
+
+ @failingTest
+ void test_parseImportDirective_prefix_hide_show() {
+ super.test_parseImportDirective_prefix_hide_show();
+ }
+
+ @failingTest
+ void test_parseImportDirective_prefix_show_hide() {
+ super.test_parseImportDirective_prefix_show_hide();
+ }
+
+ @failingTest
+ void test_parseImportDirective_show() {
+ super.test_parseImportDirective_show();
+ }
+
+ @failingTest
+ void test_parseLibraryDirective() {
+ super.test_parseLibraryDirective();
+ }
+
+ @failingTest
+ void test_parsePartDirective() {
+ super.test_parsePartDirective();
+ }
+
+ @failingTest
+ void test_parsePartOfDirective_name() {
+ super.test_parsePartOfDirective_name();
+ }
+
+ @failingTest
+ void test_parsePartOfDirective_uri() {
+ super.test_parsePartOfDirective_uri();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_function_noParameters() {
+ super.test_parseTypeAlias_function_noParameters();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_function_noReturnType() {
+ super.test_parseTypeAlias_function_noReturnType();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_function_parameterizedReturnType() {
+ super.test_parseTypeAlias_function_parameterizedReturnType();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_function_parameters() {
+ super.test_parseTypeAlias_function_parameters();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_function_typeParameters() {
+ super.test_parseTypeAlias_function_typeParameters();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_function_voidReturnType() {
+ super.test_parseTypeAlias_function_voidReturnType();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_genericFunction_noParameters() {
+ super.test_parseTypeAlias_genericFunction_noParameters();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_genericFunction_noReturnType() {
+ super.test_parseTypeAlias_genericFunction_noReturnType();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_genericFunction_parameterizedReturnType() {
+ super.test_parseTypeAlias_genericFunction_parameterizedReturnType();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_genericFunction_parameters() {
+ super.test_parseTypeAlias_genericFunction_parameters();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_genericFunction_typeParameters() {
+ super.test_parseTypeAlias_genericFunction_typeParameters();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_genericFunction_typeParameters_noParameters() {
+ super.test_parseTypeAlias_genericFunction_typeParameters_noParameters();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_genericFunction_typeParameters_noReturnType() {
+ super.test_parseTypeAlias_genericFunction_typeParameters_noReturnType();
+ }
+
+ @failingTest
+ void
+ test_parseTypeAlias_genericFunction_typeParameters_parameterizedReturnType() {
+ super
+ .test_parseTypeAlias_genericFunction_typeParameters_parameterizedReturnType();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_genericFunction_typeParameters_parameters() {
+ super.test_parseTypeAlias_genericFunction_typeParameters_parameters();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_genericFunction_typeParameters_typeParameters() {
+ super.test_parseTypeAlias_genericFunction_typeParameters_typeParameters();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_genericFunction_typeParameters_voidReturnType() {
+ super.test_parseTypeAlias_genericFunction_typeParameters_voidReturnType();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_genericFunction_voidReturnType() {
+ super.test_parseTypeAlias_genericFunction_voidReturnType();
+ }
+
+ @failingTest
+ void test_parseTypeAlias_genericFunction_withDocComment() {
+ super.test_parseTypeAlias_genericFunction_withDocComment();
+ }
+
+ @failingTest
+ void test_parseTypeVariable_withDocumentationComment() {
+ super.test_parseTypeVariable_withDocumentationComment();
+ }
}
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index 1f39754e..7c45cac 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -322,7 +322,13 @@
@reflectiveTest
class ClassMemberParserTest extends ParserTestCase
- with ClassMemberParserTestMixin {}
+ with ClassMemberParserTestMixin {
+ @failingTest
+ @override
+ void test_parseAwaitExpression_inSync() {
+ super.test_parseAwaitExpression_inSync();
+ }
+}
/**
* Tests which exercise the parser using a class member.
@@ -365,7 +371,6 @@
statement);
}
- @failingTest
void test_parseAwaitExpression_inSync() {
// This test requires better error recovery than we currently have. In
// particular, we need to be able to distinguish between an await expression
@@ -525,38 +530,6 @@
expect(variable.name, isNotNull);
}
- void test_parseClassMember_field_nameKeyword() {
- createParser('var for;');
- ClassMember member = parser.parseClassMember('C');
- expect(member, isNotNull);
- listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.MISSING_IDENTIFIER, 4, 3)]
- : [
- expectedError(ParserErrorCode.MISSING_IDENTIFIER, 4, 3),
- expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 4, 3)
- ]);
- }
-
- void test_parseClassMember_field_nameMissing() {
- createParser('var ;');
- ClassMember member = parser.parseClassMember('C');
- expect(member, isNotNull);
- listener.assertErrors(
- [expectedError(ParserErrorCode.MISSING_IDENTIFIER, 4, 1)]);
- }
-
- void test_parseClassMember_field_nameMissing2() {
- createParser('var "";');
- ClassMember member = parser.parseClassMember('C');
- expect(member, isNotNull);
- listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.MISSING_IDENTIFIER, 4, 2)]
- : [
- expectedError(ParserErrorCode.MISSING_IDENTIFIER, 4, 2),
- expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 4, 2)
- ]);
- }
-
void test_parseClassMember_field_namedOperator() {
createParser('var operator;');
ClassMember member = parser.parseClassMember('C');
@@ -615,6 +588,38 @@
expect(variable.name, isNotNull);
}
+ void test_parseClassMember_field_nameKeyword() {
+ createParser('var for;');
+ ClassMember member = parser.parseClassMember('C');
+ expect(member, isNotNull);
+ listener.assertErrors(usingFastaParser
+ ? [expectedError(ParserErrorCode.MISSING_IDENTIFIER, 4, 3)]
+ : [
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 4, 3),
+ expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 4, 3)
+ ]);
+ }
+
+ void test_parseClassMember_field_nameMissing() {
+ createParser('var ;');
+ ClassMember member = parser.parseClassMember('C');
+ expect(member, isNotNull);
+ listener.assertErrors(
+ [expectedError(ParserErrorCode.MISSING_IDENTIFIER, 4, 1)]);
+ }
+
+ void test_parseClassMember_field_nameMissing2() {
+ createParser('var "";');
+ ClassMember member = parser.parseClassMember('C');
+ expect(member, isNotNull);
+ listener.assertErrors(usingFastaParser
+ ? [expectedError(ParserErrorCode.MISSING_IDENTIFIER, 4, 2)]
+ : [
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 4, 2),
+ expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 4, 2)
+ ]);
+ }
+
void test_parseClassMember_field_static() {
createParser('static A f;');
ClassMember member = parser.parseClassMember('C');
@@ -2209,6 +2214,16 @@
expect(expression.leftOperand, new isInstanceOf<BinaryExpression>());
}
+ void test_logicalAndExpression_precedence_bitwiseOr_left() {
+ BinaryExpression expression = parseExpression("x | y < z");
+ expect(expression.leftOperand, new isInstanceOf<BinaryExpression>());
+ }
+
+ void test_logicalAndExpression_precedence_bitwiseOr_right() {
+ BinaryExpression expression = parseExpression("x < y | z");
+ expect(expression.rightOperand, new isInstanceOf<BinaryExpression>());
+ }
+
void test_logicalAndExpressionStatement() {
// Assert that `<` and `>` are not interpreted as type arguments.
ExpressionStatement statement = parseStatement("C<T && T>U;");
@@ -2216,6 +2231,22 @@
expect(expression.leftOperand, new isInstanceOf<BinaryExpression>());
}
+ void test_logicalOrExpression() {
+ BinaryExpression expression = parseExpression("x || y || z");
+ expect(expression.leftOperand, new isInstanceOf<BinaryExpression>());
+ }
+
+ void test_logicalOrExpression_precedence_logicalAnd_left() {
+ BinaryExpression expression = parseExpression("x && y || z");
+ expect(expression.leftOperand, new isInstanceOf<BinaryExpression>());
+ }
+
+ void test_logicalOrExpression_precedence_logicalAnd_right() {
+ BinaryExpression expression = parseExpression("x || y && z");
+ EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
+ BinaryExpression, expression.rightOperand);
+ }
+
void test_methodInvocation1() {
// Assert that `<` and `>` are not interpreted as type arguments.
ExpressionStatement statement = parseStatement("f(a < b, c > 3);");
@@ -2240,32 +2271,6 @@
expect(method.argumentList.arguments, hasLength(2));
}
- void test_logicalAndExpression_precedence_bitwiseOr_left() {
- BinaryExpression expression = parseExpression("x | y < z");
- expect(expression.leftOperand, new isInstanceOf<BinaryExpression>());
- }
-
- void test_logicalAndExpression_precedence_bitwiseOr_right() {
- BinaryExpression expression = parseExpression("x < y | z");
- expect(expression.rightOperand, new isInstanceOf<BinaryExpression>());
- }
-
- void test_logicalOrExpression() {
- BinaryExpression expression = parseExpression("x || y || z");
- expect(expression.leftOperand, new isInstanceOf<BinaryExpression>());
- }
-
- void test_logicalOrExpression_precedence_logicalAnd_left() {
- BinaryExpression expression = parseExpression("x && y || z");
- expect(expression.leftOperand, new isInstanceOf<BinaryExpression>());
- }
-
- void test_logicalOrExpression_precedence_logicalAnd_right() {
- BinaryExpression expression = parseExpression("x || y && z");
- EngineTestCase.assertInstanceOf((obj) => obj is BinaryExpression,
- BinaryExpression, expression.rightOperand);
- }
-
void test_multipleLabels_statement() {
LabeledStatement statement = parseStatement("a: b: c: return x;");
expect(statement.labels, hasLength(3));
@@ -2386,6 +2391,36 @@
*/
@reflectiveTest
class ErrorParserTest extends ParserTestCase with ErrorParserTestMixin {
+ @failingTest
+ @override
+ void test_expectedListOrMapLiteral() {
+ super.test_expectedListOrMapLiteral();
+ }
+
+ @failingTest
+ @override
+ void test_invalidCommentReference__new_nonIdentifier() {
+ super.test_invalidCommentReference__new_nonIdentifier();
+ }
+
+ @failingTest
+ @override
+ void test_invalidCommentReference__new_tooMuch() {
+ super.test_invalidCommentReference__new_tooMuch();
+ }
+
+ @failingTest
+ @override
+ void test_invalidCommentReference__nonNew_nonIdentifier() {
+ super.test_invalidCommentReference__nonNew_nonIdentifier();
+ }
+
+ @failingTest
+ @override
+ void test_invalidCommentReference__nonNew_tooMuch() {
+ super.test_invalidCommentReference__nonNew_tooMuch();
+ }
+
void test_missingIdentifier_number() {
createParser('1');
SimpleIdentifier expression = parser.parseSimpleIdentifier();
@@ -2633,7 +2668,14 @@
void test_constEnum() {
parseCompilationUnit("const enum E {ONE}",
- errors: [expectedError(ParserErrorCode.CONST_ENUM, 0, 5)]);
+ errors: usingFastaParser
+ ? [
+ // Fasta interprets the `const` as a malformed top level const
+ // and `enum` as the start of an enum declaration.
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 6, 4),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 6, 4),
+ ]
+ : [expectedError(ParserErrorCode.CONST_ENUM, 0, 5)]);
}
void test_constFactory() {
@@ -2687,7 +2729,14 @@
void test_constTypedef() {
parseCompilationUnit("const typedef F();",
- errors: [expectedError(ParserErrorCode.CONST_TYPEDEF, 0, 5)]);
+ errors: usingFastaParser
+ ? [
+ // Fasta interprets the `const` as a malformed top level const
+ // and `typedef` as the start of an typedef declaration.
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 6, 7),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 6, 7),
+ ]
+ : [expectedError(ParserErrorCode.CONST_TYPEDEF, 0, 5)]);
}
void test_continueOutsideOfLoop_continueInDoStatement() {
@@ -3159,7 +3208,6 @@
expectNotNullIfNoErrors(literal);
}
- @failingTest
void test_expectedListOrMapLiteral() {
// It isn't clear that this test can ever pass. The parser is currently
// create a synthetic list literal in this case, but isSynthetic() isn't
@@ -3616,7 +3664,14 @@
void test_finalEnum() {
parseCompilationUnit("final enum E {ONE}",
- errors: [expectedError(ParserErrorCode.FINAL_ENUM, 0, 5)]);
+ errors: usingFastaParser
+ ? [
+ // Fasta interprets the `final` as a malformed top level final
+ // and `enum` as the start of a enum declaration.
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 6, 4),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 6, 4),
+ ]
+ : [expectedError(ParserErrorCode.FINAL_ENUM, 0, 5)]);
}
void test_finalMethod() {
@@ -3633,7 +3688,14 @@
void test_finalTypedef() {
parseCompilationUnit("final typedef F();",
- errors: [expectedError(ParserErrorCode.FINAL_TYPEDEF, 0, 5)]);
+ errors: usingFastaParser
+ ? [
+ // Fasta interprets the `final` as a malformed top level final
+ // and `typedef` as the start of an typedef declaration.
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 6, 7),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 6, 7),
+ ]
+ : [expectedError(ParserErrorCode.FINAL_TYPEDEF, 0, 5)]);
}
void test_functionTypedField_invalidType_abstract() {
@@ -3929,7 +3991,6 @@
expectNotNullIfNoErrors(literal);
}
- @failingTest
void test_invalidCommentReference__new_nonIdentifier() {
// This test fails because the method parseCommentReference returns null.
createParser('');
@@ -3939,7 +4000,6 @@
[expectedError(ParserErrorCode.INVALID_COMMENT_REFERENCE, 0, 6)]);
}
- @failingTest
void test_invalidCommentReference__new_tooMuch() {
createParser('');
CommentReference reference = parser.parseCommentReference('new a.b.c.d', 0);
@@ -3948,7 +4008,6 @@
[expectedError(ParserErrorCode.INVALID_COMMENT_REFERENCE, 0, 11)]);
}
- @failingTest
void test_invalidCommentReference__nonNew_nonIdentifier() {
// This test fails because the method parseCommentReference returns null.
createParser('');
@@ -3958,7 +4017,6 @@
[expectedError(ParserErrorCode.INVALID_COMMENT_REFERENCE, 0, 2)]);
}
- @failingTest
void test_invalidCommentReference__nonNew_tooMuch() {
createParser('');
CommentReference reference = parser.parseCommentReference('a.b.c.d', 0);
@@ -3967,17 +4025,6 @@
[expectedError(ParserErrorCode.INVALID_COMMENT_REFERENCE, 0, 7)]);
}
- void test_invalidConstructorName_with() {
- createParser("C.with();");
- ClassMember member = parser.parseClassMember('C');
- expectNotNullIfNoErrors(member);
- listener.assertErrors([
- usingFastaParser
- ? expectedError(ParserErrorCode.MISSING_IDENTIFIER, 2, 4)
- : expectedError(ParserErrorCode.INVALID_CONSTRUCTOR_NAME, 0, 1)
- ]);
- }
-
void test_invalidConstructorName_star() {
createParser("C.*();");
ClassMember member = parser.parseClassMember('C');
@@ -3990,6 +4037,17 @@
]);
}
+ void test_invalidConstructorName_with() {
+ createParser("C.with();");
+ ClassMember member = parser.parseClassMember('C');
+ expectNotNullIfNoErrors(member);
+ listener.assertErrors([
+ usingFastaParser
+ ? expectedError(ParserErrorCode.MISSING_IDENTIFIER, 2, 4)
+ : expectedError(ParserErrorCode.INVALID_CONSTRUCTOR_NAME, 0, 1)
+ ]);
+ }
+
void test_invalidHexEscape_invalidDigit() {
StringLiteral literal = parseExpression("'\\x0 a'",
errors: [expectedError(ParserErrorCode.INVALID_HEX_ESCAPE, 1, 3)]);
@@ -5702,14 +5760,24 @@
void test_varClass() {
parseCompilationUnit("var class C {}",
errors: usingFastaParser
- ? [expectedError(ParserErrorCode.EXTRANEOUS_MODIFIER, 0, 3)]
+ ? [
+ // Fasta interprets the `var` as a malformed top level var
+ // and `class` as the start of a class declaration.
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 4, 5),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 4, 5),
+ ]
: [expectedError(ParserErrorCode.VAR_CLASS, 0, 3)]);
}
void test_varEnum() {
parseCompilationUnit("var enum E {ONE}",
errors: usingFastaParser
- ? [expectedError(ParserErrorCode.EXTRANEOUS_MODIFIER, 0, 3)]
+ ? [
+ // Fasta interprets the `var` as a malformed top level var
+ // and `enum` as the start of an enum declaration.
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 4, 4),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 4, 4),
+ ]
: [expectedError(ParserErrorCode.VAR_ENUM, 0, 3)]);
}
@@ -5724,7 +5792,12 @@
void test_varTypedef() {
parseCompilationUnit("var typedef F();",
errors: usingFastaParser
- ? [expectedError(ParserErrorCode.EXTRANEOUS_MODIFIER, 0, 3)]
+ ? [
+ // Fasta interprets the `var` as a malformed top level var
+ // and `typedef` as the start of an typedef declaration.
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 4, 7),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 4, 7),
+ ]
: [expectedError(ParserErrorCode.VAR_TYPEDEF, 0, 3)]);
}
@@ -11056,17 +11129,10 @@
}
void test_incomplete_topLevelVariable_const() {
- CompilationUnit unit = parseCompilationUnit("const ",
- codes: usingFastaParser
- ? [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN,
- CompileTimeErrorCode.CONST_NOT_INITIALIZED
- ]
- : [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN
- ]);
+ CompilationUnit unit = parseCompilationUnit("const ", codes: [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN
+ ]);
NodeList<CompilationUnitMember> declarations = unit.declarations;
expect(declarations, hasLength(1));
CompilationUnitMember member = declarations[0];
@@ -11080,17 +11146,10 @@
}
void test_incomplete_topLevelVariable_final() {
- CompilationUnit unit = parseCompilationUnit("final ",
- codes: usingFastaParser
- ? [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN,
- StaticWarningCode.FINAL_NOT_INITIALIZED
- ]
- : [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN
- ]);
+ CompilationUnit unit = parseCompilationUnit("final ", codes: [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN
+ ]);
NodeList<CompilationUnitMember> declarations = unit.declarations;
expect(declarations, hasLength(1));
CompilationUnitMember member = declarations[0];
@@ -11124,17 +11183,10 @@
CompilationUnit unit = parseCompilationUnit(r'''
class C {
const
-}''',
- codes: usingFastaParser
- ? [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN,
- CompileTimeErrorCode.CONST_NOT_INITIALIZED
- ]
- : [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN
- ]);
+}''', codes: [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN
+ ]);
NodeList<CompilationUnitMember> declarations = unit.declarations;
expect(declarations, hasLength(1));
CompilationUnitMember unitMember = declarations[0];
@@ -13259,20 +13311,6 @@
* More complex tests should be defined in the class [ComplexParserTest].
*/
abstract class SimpleParserTestMixin implements AbstractParserTestCase {
- void test_classDeclaration_complexTypeParam() {
- CompilationUnit unit = parseCompilationUnit('''
-class C<@Foo.bar(const [], const [1], const{"":r""}, 0xFF + 2, .3, 4.5) T> {}
-''');
- ClassDeclaration clazz = unit.declarations[0];
- expect(clazz.name.name, 'C');
- expect(clazz.typeParameters.typeParameters, hasLength(1));
- TypeParameter typeParameter = clazz.typeParameters.typeParameters[0];
- expect(typeParameter.name.name, 'T');
- expect(typeParameter.metadata, hasLength(1));
- Annotation metadata = typeParameter.metadata[0];
- expect(metadata.name.name, 'Foo.bar');
- }
-
ConstructorName parseConstructorName(String name) {
createParser('new $name();');
Statement statement = parser.parseStatement2();
@@ -13351,6 +13389,20 @@
return classDecl.withClause;
}
+ void test_classDeclaration_complexTypeParam() {
+ CompilationUnit unit = parseCompilationUnit('''
+class C<@Foo.bar(const [], const [1], const{"":r""}, 0xFF + 2, .3, 4.5) T> {}
+''');
+ ClassDeclaration clazz = unit.declarations[0];
+ expect(clazz.name.name, 'C');
+ expect(clazz.typeParameters.typeParameters, hasLength(1));
+ TypeParameter typeParameter = clazz.typeParameters.typeParameters[0];
+ expect(typeParameter.name.name, 'T');
+ expect(typeParameter.metadata, hasLength(1));
+ Annotation metadata = typeParameter.metadata[0];
+ expect(metadata.name.name, 'Foo.bar');
+ }
+
void test_parseAnnotation_n1() {
createParser('@A');
Annotation annotation = parser.parseAnnotation();
@@ -13947,6 +13999,15 @@
expect(creation.typeArguments.toSource(), '<int, int Function(String)>');
}
+ void test_parseLibraryIdentifier_builtin() {
+ String name = "deferred";
+ LibraryIdentifier identifier = parseLibraryIdentifier(name);
+ expectNotNullIfNoErrors(identifier);
+ listener.assertNoErrors();
+ expect(identifier.name, name);
+ expect(identifier.beginToken.type.isBuiltIn, isTrue);
+ }
+
void test_parseLibraryIdentifier_invalid() {
parseCompilationUnit('library <myLibId>;',
errors: usingFastaParser
@@ -13966,23 +14027,6 @@
expect(identifier.name, name);
}
- void test_parseLibraryIdentifier_single() {
- String name = "a";
- LibraryIdentifier identifier = parseLibraryIdentifier(name);
- expectNotNullIfNoErrors(identifier);
- listener.assertNoErrors();
- expect(identifier.name, name);
- }
-
- void test_parseLibraryIdentifier_builtin() {
- String name = "deferred";
- LibraryIdentifier identifier = parseLibraryIdentifier(name);
- expectNotNullIfNoErrors(identifier);
- listener.assertNoErrors();
- expect(identifier.name, name);
- expect(identifier.beginToken.type.isBuiltIn, isTrue);
- }
-
void test_parseLibraryIdentifier_pseudo() {
String name = "await";
LibraryIdentifier identifier = parseLibraryIdentifier(name);
@@ -13992,6 +14036,14 @@
expect(identifier.beginToken.type.isPseudo, isTrue);
}
+ void test_parseLibraryIdentifier_single() {
+ String name = "a";
+ LibraryIdentifier identifier = parseLibraryIdentifier(name);
+ expectNotNullIfNoErrors(identifier);
+ listener.assertNoErrors();
+ expect(identifier.name, name);
+ }
+
void test_parseOptionalReturnType() {
// TODO(brianwilkerson) Implement tests for this method.
}
@@ -14484,6 +14536,48 @@
* the parsing statements.
*/
abstract class StatementParserTestMixin implements AbstractParserTestCase {
+ void test_invalid_typeParamAnnotation() {
+ parseCompilationUnit('main() { C<@Foo T> v; }',
+ errors: usingFastaParser
+ // TODO(danrubel): Improve this error to indicate that annotations
+ // are not valid in this context.
+ ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 11, 1)]
+ : [
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 11, 1),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 11, 1)
+ ]);
+ }
+
+ void test_invalid_typeParamAnnotation2() {
+ parseCompilationUnit('main() { C<@Foo.bar(1) T> v; }',
+ errors: usingFastaParser
+ // TODO(danrubel): Improve this error to indicate that annotations
+ // are not valid in this context.
+ ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 11, 1)]
+ : [
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 11, 1),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 11, 1)
+ ]);
+ }
+
+ void test_invalid_typeParamAnnotation3() {
+ if (usingFastaParser) {
+ parseCompilationUnit('''
+main() {
+ C<@Foo.bar(const [], const [1], const{"":r""}, 0xFF + 2, .3, 4.5) T,
+ F Function<G>(int, String, {Bar b}),
+ void Function<H>(int i, [String j, K]),
+ A<B<C>>,
+ W<X<Y<Z>>>
+ > v;
+}''', errors: [
+ // TODO(danrubel): Improve this error to indicate that annotations
+ // are not valid in this context.
+ expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 13, 1)
+ ]);
+ }
+ }
+
void test_parseAssertStatement() {
var statement = parseStatement('assert (x);') as AssertStatement;
assertNoErrors();
@@ -15232,48 +15326,6 @@
new isInstanceOf<GenericFunctionType>());
}
- void test_invalid_typeParamAnnotation() {
- parseCompilationUnit('main() { C<@Foo T> v; }',
- errors: usingFastaParser
- // TODO(danrubel): Improve this error to indicate that annotations
- // are not valid in this context.
- ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 11, 1)]
- : [
- expectedError(ParserErrorCode.MISSING_IDENTIFIER, 11, 1),
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 11, 1)
- ]);
- }
-
- void test_invalid_typeParamAnnotation2() {
- parseCompilationUnit('main() { C<@Foo.bar(1) T> v; }',
- errors: usingFastaParser
- // TODO(danrubel): Improve this error to indicate that annotations
- // are not valid in this context.
- ? [expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 11, 1)]
- : [
- expectedError(ParserErrorCode.MISSING_IDENTIFIER, 11, 1),
- expectedError(ParserErrorCode.EXPECTED_TOKEN, 11, 1)
- ]);
- }
-
- void test_invalid_typeParamAnnotation3() {
- if (usingFastaParser) {
- parseCompilationUnit('''
-main() {
- C<@Foo.bar(const [], const [1], const{"":r""}, 0xFF + 2, .3, 4.5) T,
- F Function<G>(int, String, {Bar b}),
- void Function<H>(int i, [String j, K]),
- A<B<C>>,
- W<X<Y<Z>>>
- > v;
-}''', errors: [
- // TODO(danrubel): Improve this error to indicate that annotations
- // are not valid in this context.
- expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 13, 1)
- ]);
- }
- }
-
void test_parseStatement_emptyTypeArgumentList() {
var declaration = parseStatement('C<> c;') as VariableDeclarationStatement;
assertErrorsWithCodes([ParserErrorCode.EXPECTED_TYPE_NAME]);
@@ -15478,29 +15530,6 @@
expect(statement.finallyBlock, isNull);
}
- void test_parseTryStatement_catch_error_missingCatchTrace() {
- var statement = parseStatement('try {} catch (e,) {}') as TryStatement;
- listener.assertErrors(usingFastaParser
- ? [expectedError(ParserErrorCode.CATCH_SYNTAX, 14, 1)]
- : [
- expectedError(ParserErrorCode.MISSING_IDENTIFIER, 14, 1),
- ]);
- expect(statement.tryKeyword, isNotNull);
- expect(statement.body, isNotNull);
- NodeList<CatchClause> catchClauses = statement.catchClauses;
- expect(catchClauses, hasLength(1));
- CatchClause clause = catchClauses[0];
- expect(clause.onKeyword, isNull);
- expect(clause.exceptionType, isNull);
- expect(clause.catchKeyword, isNotNull);
- expect(clause.exceptionParameter, isNotNull);
- expect(clause.comma, isNotNull);
- expect(clause.stackTraceParameter, isNotNull);
- expect(clause.body, isNotNull);
- expect(statement.finallyKeyword, isNull);
- expect(statement.finallyBlock, isNull);
- }
-
void test_parseTryStatement_catch_error_missingCatchParen() {
var statement = parseStatement('try {} catch {}') as TryStatement;
listener.assertErrors(usingFastaParser
@@ -15526,6 +15555,29 @@
expect(statement.finallyBlock, isNull);
}
+ void test_parseTryStatement_catch_error_missingCatchTrace() {
+ var statement = parseStatement('try {} catch (e,) {}') as TryStatement;
+ listener.assertErrors(usingFastaParser
+ ? [expectedError(ParserErrorCode.CATCH_SYNTAX, 14, 1)]
+ : [
+ expectedError(ParserErrorCode.MISSING_IDENTIFIER, 14, 1),
+ ]);
+ expect(statement.tryKeyword, isNotNull);
+ expect(statement.body, isNotNull);
+ NodeList<CatchClause> catchClauses = statement.catchClauses;
+ expect(catchClauses, hasLength(1));
+ CatchClause clause = catchClauses[0];
+ expect(clause.onKeyword, isNull);
+ expect(clause.exceptionType, isNull);
+ expect(clause.catchKeyword, isNotNull);
+ expect(clause.exceptionParameter, isNotNull);
+ expect(clause.comma, isNotNull);
+ expect(clause.stackTraceParameter, isNotNull);
+ expect(clause.body, isNotNull);
+ expect(statement.finallyKeyword, isNull);
+ expect(statement.finallyBlock, isNull);
+ }
+
void test_parseTryStatement_catch_finally() {
var statement =
parseStatement('try {} catch (e, s) {} finally {}') as TryStatement;
diff --git a/pkg/analyzer/test/src/context/builder_test.dart b/pkg/analyzer/test/src/context/builder_test.dart
index 2601fcd..17789d4368 100644
--- a/pkg/analyzer/test/src/context/builder_test.dart
+++ b/pkg/analyzer/test/src/context/builder_test.dart
@@ -736,34 +736,6 @@
_expectEqualOptions(options, expected);
}
- void test_getAnalysisOptions_default_flutter_repo() {
- _defineMockLintRules();
- AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl();
- builderOptions.defaultOptions = defaultOptions;
- AnalysisOptionsImpl expected = new AnalysisOptionsImpl();
- expected.lint = true;
- expected.lintRules = <Linter>[_mockLintRule, _mockPublicMemberApiDocs];
- String packagesFilePath =
- resourceProvider.convertPath('/some/directory/path/.packages');
- createFile(packagesFilePath, 'flutter:/pkg/flutter/lib/');
- String optionsFilePath = resourceProvider
- .convertPath('/pkg/flutter/lib/analysis_options_user.yaml');
- createFile(optionsFilePath, '''
-linter:
- rules:
- - mock_lint_rule
-''');
- String projPath = resourceProvider.convertPath('/some/directory/path');
- AnalysisOptions options;
- try {
- ContextBuilderOptions.flutterRepo = true;
- options = builder.getAnalysisOptions(projPath);
- } finally {
- ContextBuilderOptions.flutterRepo = false;
- }
- _expectEqualOptions(options, expected);
- }
-
void test_getAnalysisOptions_default_noOverrides() {
AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl();
defaultOptions.enableLazyAssignmentOperators = true;
diff --git a/pkg/analyzer/test/src/fasta/body_builder_test_helper.dart b/pkg/analyzer/test/src/fasta/body_builder_test_helper.dart
new file mode 100644
index 0000000..c39a719
--- /dev/null
+++ b/pkg/analyzer/test/src/fasta/body_builder_test_helper.dart
@@ -0,0 +1,470 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+import 'dart:async';
+import 'dart:io' show File;
+
+import 'package:analyzer/analyzer.dart';
+import 'package:analyzer/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/element.dart';
+import 'package:analyzer/src/dart/element/type.dart';
+import 'package:analyzer/src/fasta/ast_body_builder.dart';
+import 'package:analyzer/src/generated/resolver.dart';
+import "package:front_end/src/api_prototype/front_end.dart";
+import "package:front_end/src/api_prototype/memory_file_system.dart";
+import "package:front_end/src/base/processed_options.dart";
+import "package:front_end/src/compute_platform_binaries_location.dart";
+import 'package:front_end/src/fasta/compiler_context.dart';
+import 'package:front_end/src/fasta/constant_context.dart';
+import 'package:front_end/src/fasta/dill/dill_target.dart';
+import "package:front_end/src/fasta/fasta_codes.dart";
+import 'package:front_end/src/fasta/kernel/body_builder.dart' hide Identifier;
+import 'package:front_end/src/fasta/kernel/forest.dart';
+import 'package:front_end/src/fasta/kernel/kernel_builder.dart';
+import "package:front_end/src/fasta/kernel/kernel_target.dart";
+import 'package:front_end/src/fasta/modifier.dart' as Modifier;
+import 'package:front_end/src/fasta/parser/parser.dart';
+import 'package:front_end/src/fasta/scanner.dart';
+import 'package:front_end/src/fasta/ticker.dart';
+import 'package:front_end/src/fasta/type_inference/type_inferrer.dart';
+import 'package:front_end/src/fasta/type_inference/type_schema_environment.dart';
+import 'package:front_end/src/fasta/uri_translator_impl.dart';
+import 'package:kernel/class_hierarchy.dart' as kernel;
+import 'package:kernel/core_types.dart' as kernel;
+import 'package:kernel/kernel.dart' as kernel;
+
+import '../../generated/parser_test.dart';
+import '../../generated/test_support.dart';
+
+/**
+ * Implementation of [AbstractParserTestCase] specialized for testing building
+ * Analyzer AST using the fasta [Forest] API.
+ */
+class FastaBodyBuilderTestCase extends Object
+ with ParserTestHelpers
+ implements AbstractParserTestCase {
+ // TODO(danrubel): Consider HybridFileSystem.
+ static final MemoryFileSystem fs =
+ new MemoryFileSystem(Uri.parse("org-dartlang-test:///"));
+
+ /// The custom URI used to locate the dill file in the MemoryFileSystem.
+ static final Uri sdkSummary = fs.currentDirectory.resolve("vm_platform.dill");
+
+ /// The in memory test code URI
+ static final Uri entryPoint = fs.currentDirectory.resolve("main.dart");
+
+ static ProcessedOptions options;
+
+ static KernelTarget kernelTarget;
+
+ static TypeProvider _typeProvider;
+
+ final bool resolveTypes;
+
+ FastaBodyBuilderTestCase(this.resolveTypes);
+
+ TypeProvider get typeProvider => _typeProvider;
+
+ @override
+ void assertNoErrors() {
+ // TODO(brianwilkerson) Implement this.
+ }
+
+ noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
+
+ @override
+ Expression parseAdditiveExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ Expression parseAssignableExpression(String code, bool primaryAllowed) {
+ return parseExpression(code);
+ }
+
+ @override
+ Expression parseAssignableSelector(String code, bool optional,
+ {bool allowConditional: true}) {
+ return parseExpression(code);
+ }
+
+ @override
+ AwaitExpression parseAwaitExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ Expression parseBitwiseAndExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ Expression parseBitwiseOrExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ Expression parseBitwiseXorExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ Expression parseCascadeSection(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ CompilationUnit parseCompilationUnit(String source,
+ {List<ErrorCode> codes, List<ExpectedError> errors}) {
+ return _parse(source, (parser, token) => parser.parseUnit(token.next));
+ }
+
+ @override
+ ConditionalExpression parseConditionalExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ Expression parseConstExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ ConstructorInitializer parseConstructorInitializer(String code) {
+ throw new UnimplementedError();
+ }
+
+ @override
+ CompilationUnit parseDirectives(String source,
+ [List<ErrorCode> errorCodes = const <ErrorCode>[]]) {
+ throw new UnimplementedError();
+ }
+
+ @override
+ BinaryExpression parseEqualityExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ Expression parseExpression(String source,
+ {List<ErrorCode> codes,
+ List<ExpectedError> errors,
+ int expectedEndOffset}) {
+ // TODO(brianwilkerson) Check error codes.
+ return _parse(source, (parser, token) => parser.parseExpression(token));
+ }
+
+ @override
+ List<Expression> parseExpressionList(String code) {
+ throw new UnimplementedError();
+ }
+
+ @override
+ Expression parseExpressionWithoutCascade(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ FormalParameter parseFormalParameter(String code, ParameterKind kind,
+ {List<ErrorCode> errorCodes: const <ErrorCode>[]}) {
+ throw new UnimplementedError();
+ }
+
+ @override
+ FormalParameterList parseFormalParameterList(String code,
+ {bool inFunctionType: false,
+ List<ErrorCode> errorCodes: const <ErrorCode>[],
+ List<ExpectedError> errors}) {
+ throw new UnimplementedError();
+ }
+
+ @override
+ CompilationUnitMember parseFullCompilationUnitMember() {
+ throw new UnimplementedError();
+ }
+
+ @override
+ Directive parseFullDirective() {
+ throw new UnimplementedError();
+ }
+
+ @override
+ FunctionExpression parseFunctionExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ InstanceCreationExpression parseInstanceCreationExpression(
+ String code, Token newToken) {
+ return parseExpression(code);
+ }
+
+ @override
+ ListLiteral parseListLiteral(
+ Token token, String typeArgumentsCode, String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ TypedLiteral parseListOrMapLiteral(Token modifier, String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ Expression parseLogicalAndExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ Expression parseLogicalOrExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ MapLiteral parseMapLiteral(
+ Token token, String typeArgumentsCode, String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ MapLiteralEntry parseMapLiteralEntry(String code) {
+ throw new UnimplementedError();
+ }
+
+ @override
+ Expression parseMultiplicativeExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ InstanceCreationExpression parseNewExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ NormalFormalParameter parseNormalFormalParameter(String code,
+ {bool inFunctionType: false,
+ List<ErrorCode> errorCodes: const <ErrorCode>[]}) {
+ throw new UnimplementedError();
+ }
+
+ @override
+ Expression parsePostfixExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ Identifier parsePrefixedIdentifier(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ Expression parsePrimaryExpression(String code,
+ {int expectedEndOffset, List<ExpectedError> errors}) {
+ return parseExpression(code,
+ expectedEndOffset: expectedEndOffset, errors: errors);
+ }
+
+ @override
+ Expression parseRelationalExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ RethrowExpression parseRethrowExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ BinaryExpression parseShiftExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ SimpleIdentifier parseSimpleIdentifier(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ Statement parseStatement(String source,
+ {bool enableLazyAssignmentOperators, int expectedEndOffset}) {
+ // TODO(brianwilkerson) Check error codes.
+ return _parse(source, (parser, token) => parser.parseStatement(token));
+ }
+
+ @override
+ Expression parseStringLiteral(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ SymbolLiteral parseSymbolLiteral(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ Expression parseThrowExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ Expression parseThrowExpressionWithoutCascade(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ PrefixExpression parseUnaryExpression(String code) {
+ return parseExpression(code);
+ }
+
+ @override
+ VariableDeclarationList parseVariableDeclarationList(String source) {
+ throw new UnimplementedError();
+ }
+
+ Future setUp() async {
+ // TODO(danrubel): Tear down once all tests in group have been run.
+ if (options != null) {
+ return;
+ }
+
+ // Read the dill file containing kernel platform summaries into memory.
+ List<int> sdkSummaryBytes = await new File.fromUri(
+ computePlatformBinariesLocation().resolve("vm_platform.dill"))
+ .readAsBytes();
+ fs.entityForUri(sdkSummary).writeAsBytesSync(sdkSummaryBytes);
+
+ final CompilerOptions optionBuilder = new CompilerOptions()
+ ..strongMode = false // TODO(danrubel): enable strong mode.
+ ..reportMessages = true
+ ..verbose = false
+ ..fileSystem = fs
+ ..sdkSummary = sdkSummary
+ ..onProblem = (FormattedMessage problem, Severity severity,
+ List<FormattedMessage> context) {
+ // TODO(danrubel): Capture problems and check against expectations.
+// print(problem.formatted);
+ };
+
+ options = new ProcessedOptions(optionBuilder, false, [entryPoint]);
+
+ UriTranslatorImpl uriTranslator = await options.getUriTranslator();
+
+ await CompilerContext.runWithOptions(options, (CompilerContext c) async {
+ DillTarget dillTarget = new DillTarget(
+ new Ticker(isVerbose: false), uriTranslator, options.target);
+
+ kernelTarget = new KernelTarget(fs, true, dillTarget, uriTranslator);
+
+ // Load the dill file containing platform code.
+ dillTarget.loader.read(Uri.parse('dart:core'), -1, fileUri: sdkSummary);
+ kernel.Component sdkComponent =
+ kernel.loadComponentFromBytes(sdkSummaryBytes);
+ dillTarget.loader
+ .appendLibraries(sdkComponent, byteCount: sdkSummaryBytes.length);
+ await dillTarget.buildOutlines();
+ await kernelTarget.buildOutlines();
+ kernelTarget.computeCoreTypes();
+ assert(kernelTarget.loader.coreTypes != null);
+
+ // Initialize the typeProvider if types should be resolved.
+ Map<String, Element> map = <String, Element>{};
+ var coreTypes = kernelTarget.loader.coreTypes;
+ for (var coreType in [
+ coreTypes.boolClass,
+ coreTypes.doubleClass,
+ coreTypes.functionClass,
+ coreTypes.futureClass,
+ coreTypes.futureOrClass,
+ coreTypes.intClass,
+ coreTypes.iterableClass,
+ coreTypes.iteratorClass,
+ coreTypes.listClass,
+ coreTypes.mapClass,
+ coreTypes.nullClass,
+ coreTypes.numClass,
+ coreTypes.objectClass,
+ coreTypes.stackTraceClass,
+ coreTypes.streamClass,
+ coreTypes.stringClass,
+ coreTypes.symbolClass,
+ coreTypes.typeClass
+ ]) {
+ map[coreType.name] = _buildElement(coreType);
+ }
+ Namespace namespace = new Namespace(map);
+ _typeProvider = new TypeProviderImpl.forNamespaces(namespace, namespace);
+ });
+ }
+
+ Element _buildElement(kernel.Class coreType) {
+ ClassElementImpl element =
+ new ClassElementImpl(coreType.name, coreType.fileOffset);
+ element.typeParameters = coreType.typeParameters.map((parameter) {
+ TypeParameterElementImpl element =
+ new TypeParameterElementImpl(parameter.name, parameter.fileOffset);
+ element.type = new TypeParameterTypeImpl(element);
+ return element;
+ }).toList();
+ return element;
+ }
+
+ T _parse<T>(
+ String source, void parseFunction(Parser parser, Token previousToken)) {
+ ScannerResult scan = scanString(source);
+
+ return CompilerContext.runWithOptions(options, (CompilerContext c) {
+ KernelLibraryBuilder library = new KernelLibraryBuilder(
+ entryPoint,
+ entryPoint,
+ kernelTarget.loader,
+ null /* actualOrigin */,
+ null /* enclosingLibrary */,
+ );
+ List<KernelTypeVariableBuilder> typeVariableBuilders =
+ <KernelTypeVariableBuilder>[];
+ List<KernelFormalParameterBuilder> formalParameterBuilders =
+ <KernelFormalParameterBuilder>[];
+ KernelProcedureBuilder procedureBuilder = new KernelProcedureBuilder(
+ null /* metadata */,
+ Modifier.staticMask /* or Modifier.varMask */,
+ kernelTarget.dynamicType,
+ "analyzerTest",
+ typeVariableBuilders,
+ formalParameterBuilders,
+ kernel.ProcedureKind.Method,
+ library,
+ -1 /* charOffset */,
+ -1 /* charOpenParenOffset */,
+ -1 /* charEndOffset */);
+
+ TypeInferrerDisabled typeInferrer =
+ new TypeInferrerDisabled(new TypeSchemaEnvironment(
+ kernelTarget.loader.coreTypes,
+ kernelTarget.loader.hierarchy,
+ // TODO(danrubel): Enable strong mode.
+ false /* strong mode */,
+ ));
+
+ BodyBuilder builder = new AstBodyBuilder(
+ library,
+ procedureBuilder,
+ library.scope,
+ procedureBuilder.computeFormalParameterScope(library.scope),
+ kernelTarget.loader.hierarchy,
+ kernelTarget.loader.coreTypes,
+ null /* classBuilder */,
+ false /* isInstanceMember */,
+ null /* uri */,
+ typeInferrer,
+ typeProvider,
+ )..constantContext = ConstantContext.none; // .inferred ?
+
+ Parser parser = new Parser(builder);
+ parseFunction(parser, parser.syntheticPreviousToken(scan.tokens));
+ return builder.pop();
+ });
+ }
+}
diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/class_declaration_test.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/class_declaration_test.dart
index 5f08265..5041adb 100644
--- a/pkg/analyzer/test/src/fasta/recovery/partial_code/class_declaration_test.dart
+++ b/pkg/analyzer/test/src/fasta/recovery/partial_code/class_declaration_test.dart
@@ -68,7 +68,7 @@
ParserErrorCode.MISSING_CLASS_BODY
],
'class A extends B with _s_ {}',
- failing: allExceptEof),
+ failing: ['functionVoid', 'functionNonVoid', 'getter']),
new TestDescriptor(
'extendsNameWithBody',
'class A extends B with {}',
diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/enum_declaration_test.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/enum_declaration_test.dart
new file mode 100644
index 0000000..22b63e2
--- /dev/null
+++ b/pkg/analyzer/test/src/fasta/recovery/partial_code/enum_declaration_test.dart
@@ -0,0 +1,104 @@
+// 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 EnumDeclarationTest().buildAll();
+}
+
+class EnumDeclarationTest extends PartialCodeTest {
+ buildAll() {
+ List<String> allExceptEof = PartialCodeTest.declarationSuffixes
+ .map((TestSuffix t) => t.name)
+ .toList();
+ buildTests(
+ 'enum_declaration',
+ [
+ new TestDescriptor(
+ 'keyword',
+ 'enum',
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_ENUM_BODY
+ ],
+ 'enum _s_ {}',
+ expectedErrorsInValidCode: [ParserErrorCode.EMPTY_ENUM_BODY],
+ failing: ['functionNonVoid', 'getter']),
+ new TestDescriptor('name', 'enum E',
+ [ParserErrorCode.MISSING_ENUM_BODY], 'enum E {}',
+ expectedErrorsInValidCode: [ParserErrorCode.EMPTY_ENUM_BODY]),
+ new TestDescriptor(
+ 'missingName',
+ 'enum {}',
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EMPTY_ENUM_BODY
+ ],
+ 'enum _s_ {}',
+ expectedErrorsInValidCode: [ParserErrorCode.EMPTY_ENUM_BODY]),
+ new TestDescriptor(
+ 'leftBrace',
+ 'enum E {',
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ScannerErrorCode.EXPECTED_TOKEN
+ ],
+ 'enum E {_s_}',
+ failing: [
+ 'eof' /* tested separately below */,
+ 'typedef',
+ 'functionNonVoid',
+ 'getter',
+ 'setter'
+ ]),
+ new TestDescriptor(
+ 'comma',
+ 'enum E {,',
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ScannerErrorCode.EXPECTED_TOKEN
+ ],
+ 'enum E {_s_,_s_}',
+ failing: [
+ 'eof' /* tested separately below */,
+ 'typedef',
+ 'functionNonVoid',
+ 'getter',
+ 'setter'
+ ]),
+ new TestDescriptor('value', 'enum E {a',
+ [ScannerErrorCode.EXPECTED_TOKEN], 'enum E {a}'),
+ new TestDescriptor(
+ 'commaValue',
+ 'enum E {,a',
+ [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ScannerErrorCode.EXPECTED_TOKEN
+ ],
+ 'enum E {_s_, a}'),
+ new TestDescriptor('commaRightBrace', 'enum E {,}',
+ [ParserErrorCode.MISSING_IDENTIFIER], 'enum E {_s_}'),
+ new TestDescriptor('commaValueRightBrace', 'enum E {, a}',
+ [ParserErrorCode.MISSING_IDENTIFIER], 'enum E {_s_, a}'),
+ ],
+ PartialCodeTest.declarationSuffixes);
+ buildTests('enum_eof', [
+ new TestDescriptor(
+ 'leftBrace',
+ 'enum E {',
+ [ParserErrorCode.EMPTY_ENUM_BODY, ScannerErrorCode.EXPECTED_TOKEN],
+ 'enum E {}',
+ expectedErrorsInValidCode: [ParserErrorCode.EMPTY_ENUM_BODY]),
+ new TestDescriptor(
+ 'comma',
+ 'enum E {,',
+ [ParserErrorCode.MISSING_IDENTIFIER, ScannerErrorCode.EXPECTED_TOKEN],
+ 'enum E {_s_}'),
+ ], []);
+ }
+}
diff --git a/pkg/analyzer/test/src/fasta/recovery/partial_code/field_declaration_test.dart b/pkg/analyzer/test/src/fasta/recovery/partial_code/field_declaration_test.dart
index d3a1af6..a4ddf6b 100644
--- a/pkg/analyzer/test/src/fasta/recovery/partial_code/field_declaration_test.dart
+++ b/pkg/analyzer/test/src/fasta/recovery/partial_code/field_declaration_test.dart
@@ -31,11 +31,7 @@
new TestDescriptor(
'const_noName',
'const',
- [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN,
- CompileTimeErrorCode.CONST_NOT_INITIALIZED
- ],
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.EXPECTED_TOKEN],
'const _s_;',
failing: allExceptEof,
expectedErrorsInValidCode: [
@@ -166,11 +162,7 @@
new TestDescriptor(
'static_const_noName',
'static const',
- [
- ParserErrorCode.MISSING_IDENTIFIER,
- ParserErrorCode.EXPECTED_TOKEN,
- CompileTimeErrorCode.CONST_NOT_INITIALIZED
- ],
+ [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.EXPECTED_TOKEN],
'static const _s_;',
failing: allExceptEof,
expectedErrorsInValidCode: [
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 eb14122..b7269e7 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
@@ -10,6 +10,7 @@
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 'enum_declaration_test.dart' as enum_declaration;
import 'export_directive_test.dart' as export_directive;
import 'field_declaration_test.dart' as field_declaration;
import 'forEach_statement_test.dart' as forEach_statement;
@@ -38,6 +39,7 @@
class_declaration.main();
continue_statement.main();
do_statement.main();
+ enum_declaration.main();
export_directive.main();
field_declaration.main();
for_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 1d27bed..bb3264c 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
@@ -33,10 +33,15 @@
[
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.EXPECTED_TOKEN,
- CompileTimeErrorCode.CONST_NOT_INITIALIZED
],
"const _s_;",
- failing: allExceptEof,
+ failing: [
+ 'class',
+ 'functionVoid',
+ 'functionNonVoid',
+ 'getter',
+ 'setter'
+ ],
expectedErrorsInValidCode: [
CompileTimeErrorCode.CONST_NOT_INITIALIZED
],
@@ -49,7 +54,7 @@
CompileTimeErrorCode.CONST_NOT_INITIALIZED
],
"const a;",
- failing: ['typedef', 'functionNonVoid', 'getter', 'setter'],
+ failing: ['functionNonVoid', 'getter', 'setter'],
expectedErrorsInValidCode: [
CompileTimeErrorCode.CONST_NOT_INITIALIZED
],
@@ -72,11 +77,10 @@
[
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.EXPECTED_TOKEN,
- CompileTimeErrorCode.CONST_NOT_INITIALIZED,
CompileTimeErrorCode.CONST_NOT_INITIALIZED
],
"const a, _s_;",
- failing: ['typedef', 'functionNonVoid', 'getter', 'setter'],
+ failing: ['functionNonVoid', 'getter'],
expectedErrorsInValidCode: [
CompileTimeErrorCode.CONST_NOT_INITIALIZED,
CompileTimeErrorCode.CONST_NOT_INITIALIZED
@@ -88,11 +92,10 @@
[
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.EXPECTED_TOKEN,
- CompileTimeErrorCode.CONST_NOT_INITIALIZED,
CompileTimeErrorCode.CONST_NOT_INITIALIZED
],
"const int a, _s_;",
- failing: ['typedef', 'functionNonVoid', 'getter', 'setter'],
+ failing: ['functionNonVoid', 'getter'],
expectedErrorsInValidCode: [
CompileTimeErrorCode.CONST_NOT_INITIALIZED,
CompileTimeErrorCode.CONST_NOT_INITIALIZED
@@ -132,10 +135,15 @@
[
ParserErrorCode.MISSING_IDENTIFIER,
ParserErrorCode.EXPECTED_TOKEN,
- StaticWarningCode.FINAL_NOT_INITIALIZED
],
"final _s_;",
- failing: allExceptEof,
+ failing: [
+ 'class',
+ 'functionVoid',
+ 'functionNonVoid',
+ 'getter',
+ 'setter'
+ ],
expectedErrorsInValidCode: [
StaticWarningCode.FINAL_NOT_INITIALIZED
],
@@ -148,7 +156,7 @@
StaticWarningCode.FINAL_NOT_INITIALIZED
],
"final a;",
- failing: ['typedef', 'functionNonVoid', 'getter', 'setter'],
+ failing: ['functionNonVoid', 'getter', 'setter'],
expectedErrorsInValidCode: [
StaticWarningCode.FINAL_NOT_INITIALIZED
],
@@ -189,14 +197,14 @@
ParserErrorCode.EXPECTED_TOKEN
],
"var _s_;",
- failing: allExceptEof,
+ failing: ['functionVoid', 'functionNonVoid', 'getter', 'setter'],
),
new TestDescriptor(
'varName',
'var a',
[ParserErrorCode.EXPECTED_TOKEN],
"var a;",
- failing: ['typedef', 'functionNonVoid', 'getter', 'setter'],
+ failing: ['functionNonVoid', 'getter', 'setter'],
),
new TestDescriptor(
'varNameEquals',
diff --git a/pkg/analyzer/test/src/fasta/resolution_test.dart b/pkg/analyzer/test/src/fasta/resolution_test.dart
new file mode 100644
index 0000000..0eedb6b
--- /dev/null
+++ b/pkg/analyzer/test/src/fasta/resolution_test.dart
@@ -0,0 +1,99 @@
+// Copyright (c) 2018, 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/dart/ast/ast.dart';
+import 'package:analyzer/dart/element/type.dart';
+import 'package:test/test.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import '../../generated/parser_test.dart';
+import 'body_builder_test_helper.dart';
+
+main() async {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(ResolutionTest);
+ });
+}
+
+/**
+ * Tests of the fasta parser based on [ExpressionParserTestMixin].
+ */
+@reflectiveTest
+class ResolutionTest extends FastaBodyBuilderTestCase {
+ ResolutionTest() : super(true);
+
+ test_booleanLiteral_false() {
+ Expression result = parseExpression('false');
+ expect(result, new isInstanceOf<BooleanLiteral>());
+ expect((result as BooleanLiteral).staticType, typeProvider.boolType);
+ }
+
+ test_booleanLiteral_true() {
+ Expression result = parseExpression('true');
+ expect(result, new isInstanceOf<BooleanLiteral>());
+ expect((result as BooleanLiteral).staticType, typeProvider.boolType);
+ }
+
+ test_doubleLiteral() {
+ Expression result = parseExpression('4.2');
+ expect(result, new isInstanceOf<DoubleLiteral>());
+ expect((result as DoubleLiteral).staticType, typeProvider.doubleType);
+ }
+
+ test_integerLiteral() {
+ Expression result = parseExpression('3');
+ expect(result, new isInstanceOf<IntegerLiteral>());
+ expect((result as IntegerLiteral).staticType, typeProvider.intType);
+ }
+
+ @failingTest
+ test_listLiteral_explicitType() {
+ Expression result = parseExpression('<int>[]');
+ expect(result, new isInstanceOf<ListLiteral>());
+ InterfaceType listType = typeProvider.listType;
+ expect((result as ListLiteral).staticType,
+ listType.instantiate([typeProvider.intType]));
+ }
+
+ @failingTest
+ test_listLiteral_noType() {
+ Expression result = parseExpression('[]');
+ expect(result, new isInstanceOf<ListLiteral>());
+ InterfaceType listType = typeProvider.listType;
+ expect((result as ListLiteral).staticType,
+ listType.instantiate([typeProvider.dynamicType]));
+ }
+
+ @failingTest
+ test_mapLiteral_explicitType() {
+ Expression result = parseExpression('<String, int>{}');
+ expect(result, new isInstanceOf<MapLiteral>());
+ InterfaceType mapType = typeProvider.mapType;
+ expect((result as MapLiteral).staticType,
+ mapType.instantiate([typeProvider.stringType, typeProvider.intType]));
+ }
+
+ @failingTest
+ test_mapLiteral_noType() {
+ Expression result = parseExpression('{}');
+ expect(result, new isInstanceOf<MapLiteral>());
+ InterfaceType mapType = typeProvider.mapType;
+ expect(
+ (result as MapLiteral).staticType,
+ mapType
+ .instantiate([typeProvider.dynamicType, typeProvider.dynamicType]));
+ }
+
+ test_nullLiteral() {
+ Expression result = parseExpression('null');
+ expect(result, new isInstanceOf<NullLiteral>());
+ expect((result as NullLiteral).staticType, typeProvider.nullType);
+ }
+
+ test_simpleStringLiteral() {
+ Expression result = parseExpression('"abc"');
+ expect(result, new isInstanceOf<SimpleStringLiteral>());
+ expect((result as SimpleStringLiteral).staticType, typeProvider.stringType);
+ }
+}
diff --git a/pkg/analyzer/test/src/fasta/test_all.dart b/pkg/analyzer/test/src/fasta/test_all.dart
index 036a911..675b470 100644
--- a/pkg/analyzer/test/src/fasta/test_all.dart
+++ b/pkg/analyzer/test/src/fasta/test_all.dart
@@ -8,6 +8,7 @@
import 'message_coverage_test.dart' as message_coverage;
import 'recovery/test_all.dart' as recovery;
import 'resolution_applier_test.dart' as resolution_applier;
+import 'resolution_test.dart' as resolution;
main() {
defineReflectiveSuite(() {
@@ -15,5 +16,6 @@
message_coverage.main();
recovery.main();
resolution_applier.main();
+ resolution.main();
}, name: 'fasta');
}
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 44e1444..73af369 100644
--- a/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
+++ b/pkg/analyzer/test/src/task/strong/inferred_type_test.dart
@@ -385,7 +385,6 @@
expect(v.initializer.type.toString(), '() → () → Null');
}
- @failingTest
test_circularReference_viaClosures() async {
var mainUnit = await checkFileElement('''
var x = /*info:INFERRED_TYPE_CLOSURE*/() => /*error:TOP_LEVEL_CYCLE*/y;
@@ -399,7 +398,6 @@
expect(y.type.toString(), 'dynamic');
}
- @failingTest
test_circularReference_viaClosures_initializerTypes() async {
var mainUnit = await checkFileElement('''
var x = /*info:INFERRED_TYPE_CLOSURE*/() => /*error:TOP_LEVEL_CYCLE*/y;
@@ -3604,7 +3602,6 @@
''');
}
- @failingTest
test_instantiateToBounds_typeName_OK_hasBound_definedAfter() async {
var unit = await checkFileElement(r'''
class B<T extends A> {}
@@ -4149,7 +4146,6 @@
expect(v.type.toString(), 'List<dynamic>');
}
- @failingTest
test_unsafeBlockClosureInference_functionCall_explicitDynamicParam_viaExpr1() async {
// Note: (f<dynamic>) is not properly resulting in an instantiated
// function type due to dartbug.com/25824.
@@ -4182,7 +4178,6 @@
expect(v.type.toString(), 'List<int>');
}
- @failingTest
test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr1() async {
// TODO(paulberry): for some reason (f<int>) is not properly resulting
// in an instantiated function type.
@@ -4419,6 +4414,40 @@
CompilationUnit unit = await checkFile(content);
return unit.element;
}
+
+ @failingTest
+ @override
+ void test_circularReference_viaClosures() {
+ super.test_circularReference_viaClosures();
+ }
+
+ @failingTest
+ @override
+ void test_circularReference_viaClosures_initializerTypes() {
+ super.test_circularReference_viaClosures_initializerTypes();
+ }
+
+ @failingTest
+ @override
+ void test_instantiateToBounds_typeName_OK_hasBound_definedAfter() {
+ super.test_instantiateToBounds_typeName_OK_hasBound_definedAfter();
+ }
+
+ @failingTest
+ @override
+ void
+ test_unsafeBlockClosureInference_functionCall_explicitDynamicParam_viaExpr1() {
+ super
+ .test_unsafeBlockClosureInference_functionCall_explicitDynamicParam_viaExpr1();
+ }
+
+ @failingTest
+ @override
+ void
+ test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr1() {
+ super
+ .test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr1();
+ }
}
@reflectiveTest
@@ -4429,6 +4458,19 @@
@override
bool get hasExtraTaskModelPass => false;
+ @failingTest
+ @override
+ void test_circularReference_viaClosures() {
+ super.test_circularReference_viaClosures();
+ }
+
+ @failingTest
+ @override
+ test_circularReference_viaClosures_initializerTypes() async {
+ await super.test_circularReference_viaClosures_initializerTypes();
+ }
+
+ @failingTest
@override
test_instantiateToBounds_typeName_OK_hasBound_definedAfter() async {
await super.test_instantiateToBounds_typeName_OK_hasBound_definedAfter();
@@ -4448,18 +4490,16 @@
}
@override
- test_circularReference_viaClosures() async {
- await super.test_circularReference_viaClosures();
- }
-
- @override
test_unsafeBlockClosureInference_closureCall() async {
await super.test_unsafeBlockClosureInference_closureCall();
}
+ @failingTest
@override
- test_circularReference_viaClosures_initializerTypes() async {
- await super.test_circularReference_viaClosures_initializerTypes();
+ void
+ test_unsafeBlockClosureInference_functionCall_explicitDynamicParam_viaExpr1() {
+ super
+ .test_unsafeBlockClosureInference_functionCall_explicitDynamicParam_viaExpr1();
}
@failingTest
@@ -4471,6 +4511,14 @@
@failingTest
@override
+ void
+ test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr1() {
+ super
+ .test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr1();
+ }
+
+ @failingTest
+ @override
test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr2() async {
await super
.test_unsafeBlockClosureInference_functionCall_explicitTypeParam_viaExpr2();
diff --git a/pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart b/pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart
index 1c2fad7..2ab6bc1 100644
--- a/pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart
+++ b/pkg/analyzer_plugin/lib/src/channel/isolate_channel.dart
@@ -222,7 +222,7 @@
@override
void kill() {
- _isolate.kill(priority: Isolate.immediate);
+ _isolate?.kill(priority: Isolate.immediate);
}
@override
diff --git a/pkg/compiler/lib/src/apiimpl.dart b/pkg/compiler/lib/src/apiimpl.dart
index 8ff3879..1ad4fc81 100644
--- a/pkg/compiler/lib/src/apiimpl.dart
+++ b/pkg/compiler/lib/src/apiimpl.dart
@@ -382,12 +382,7 @@
// TODO(sigmund): use libraries.json instead of .platform files, then simply
// use the `supported` bit.
if (libraryUri != null && libraryUri.scheme != "unsupported") {
- // Dart2js always "supports" importing 'dart:mirrors' but will abort
- // the compilation at a later point if the backend doesn't support
- // mirrors. In this case 'mirrors' should not be in the environment.
- if (libraryName == 'mirrors') {
- return compiler.backend.supportsReflection ? "true" : null;
- }
+ if (libraryName == 'mirrors') return null;
if (libraryName == 'isolate') return null;
return "true";
}
diff --git a/pkg/compiler/lib/src/commandline_options.dart b/pkg/compiler/lib/src/commandline_options.dart
index 152ac6c..c35ddbb 100644
--- a/pkg/compiler/lib/src/commandline_options.dart
+++ b/pkg/compiler/lib/src/commandline_options.dart
@@ -35,12 +35,10 @@
static const String generateCodeWithCompileTimeErrors =
'--generate-code-with-compile-time-errors';
- /// TODO(sigmund): delete this flag.
+ /// TODO(sigmund): delete these flags.
static const String useKernel = '--use-kernel';
-
- /// Temporary flag to revert to the old front-end once the new common
- /// front-end is the default.
static const String useOldFrontend = '--use-old-frontend';
+
static const String strongMode = '--strong';
static const String previewDart2 = '--preview-dart-2';
static const String omitImplicitChecks = '--omit-implicit-checks';
diff --git a/pkg/compiler/lib/src/common_elements.dart b/pkg/compiler/lib/src/common_elements.dart
index d0a95e6..ff7d0d7 100644
--- a/pkg/compiler/lib/src/common_elements.dart
+++ b/pkg/compiler/lib/src/common_elements.dart
@@ -1129,6 +1129,10 @@
FunctionEntity get convertRtiToRuntimeType =>
_findHelperFunction('convertRtiToRuntimeType');
+ FunctionEntity _extractTypeArguments;
+ FunctionEntity get extractTypeArguments => _extractTypeArguments ??=
+ _findLibraryMember(internalLibrary, 'extractTypeArguments');
+
FunctionEntity get toStringForNativeObject =>
_findHelperFunction('toStringForNativeObject');
@@ -1210,17 +1214,6 @@
_env.lookupLibrary(Uris.dart__js_embedded_names, required: true),
'JsBuiltin');
- // From dart:_isolate_helper
-
- FunctionEntity get startRootIsolate =>
- _findLibraryMember(isolateHelperLibrary, 'startRootIsolate');
-
- FunctionEntity get currentIsolate =>
- _findLibraryMember(isolateHelperLibrary, '_currentIsolate');
-
- FunctionEntity get callInIsolate =>
- _findLibraryMember(isolateHelperLibrary, '_callInIsolate');
-
static final Uri PACKAGE_EXPECT =
new Uri(scheme: 'package', path: 'expect/expect.dart');
@@ -1393,6 +1386,9 @@
/// Calls [f] for each class member declared in [cls].
void forEachLocalClassMember(ClassEntity cls, void f(MemberEntity member));
+ /// Calls [f] for each class member added to [cls] during compilation.
+ void forEachInjectedClassMember(ClassEntity cls, void f(MemberEntity member));
+
/// Calls [f] for each class member declared or inherited in [cls] together
/// with the class that declared the member.
///
diff --git a/pkg/compiler/lib/src/compiler.dart b/pkg/compiler/lib/src/compiler.dart
index 7bc310e..dde70dd 100644
--- a/pkg/compiler/lib/src/compiler.dart
+++ b/pkg/compiler/lib/src/compiler.dart
@@ -39,7 +39,6 @@
import 'io/source_information.dart' show SourceInformation;
import 'io/source_file.dart' show Binary;
import 'js_backend/backend.dart' show JavaScriptBackend;
-import 'js_backend/element_strategy.dart' show ElementBackendStrategy;
import 'kernel/kernel_backend_strategy.dart';
import 'kernel/kernel_strategy.dart';
import 'library_loader.dart'
@@ -192,20 +191,12 @@
} else {
_reporter = new CompilerDiagnosticReporter(this, options);
}
- if (options.useKernel) {
- kernelFrontEndTask = new GenericTask('Front end', measurer);
- frontendStrategy = new KernelFrontEndStrategy(kernelFrontEndTask, options,
- reporter, environment, options.kernelInitializedCompilerState);
- backendStrategy = new KernelBackendStrategy(this);
- _impactCache = <Entity, WorldImpact>{};
- _impactCacheDeleter = new _MapImpactCacheDeleter(_impactCache);
- } else {
- frontendStrategy = new ResolutionFrontEndStrategy(this);
- backendStrategy = new ElementBackendStrategy(this);
- _resolution = createResolution();
- _impactCache = _resolution._worldImpactCache;
- _impactCacheDeleter = _resolution;
- }
+ kernelFrontEndTask = new GenericTask('Front end', measurer);
+ frontendStrategy = new KernelFrontEndStrategy(kernelFrontEndTask, options,
+ reporter, environment, options.kernelInitializedCompilerState);
+ backendStrategy = new KernelBackendStrategy(this);
+ _impactCache = <Entity, WorldImpact>{};
+ _impactCacheDeleter = new _MapImpactCacheDeleter(_impactCache);
if (options.verbose) {
progress = new ProgressImpl(_reporter);
@@ -241,7 +232,7 @@
dumpInfoTask = new DumpInfoTask(this),
selfTask,
];
- if (options.useKernel) tasks.add(kernelFrontEndTask);
+ tasks.add(kernelFrontEndTask);
_parsingContext =
new ParsingContext(reporter, parser, scanner, patchParser, backend);
@@ -385,47 +376,9 @@
// front end for the Kernel path since Kernel doesn't have the notion of
// imports (everything has already been resolved). (See
// https://github.com/dart-lang/sdk/issues/29368)
- if (!options.useKernel) {
- for (Uri uri in resolvedUriTranslator.disallowedLibraryUris) {
- if (loadedLibraries.containsLibrary(uri)) {
- Set<String> importChains =
- computeImportChainsFor(loadedLibraries, uri);
- reporter.reportInfo(
- NO_LOCATION_SPANNABLE, MessageKind.DISALLOWED_LIBRARY_IMPORT, {
- 'uri': uri,
- 'importChain': importChains
- .join(MessageTemplate.DISALLOWED_LIBRARY_IMPORT_PADDING)
- });
- }
- }
-
- if (loadedLibraries.containsLibrary(Uris.dart_core)) {
- bool importsMirrorsLibrary =
- loadedLibraries.containsLibrary(Uris.dart_mirrors);
- if (importsMirrorsLibrary && !backend.supportsReflection) {
- Set<String> importChains =
- computeImportChainsFor(loadedLibraries, Uris.dart_mirrors);
- reporter.reportErrorMessage(NO_LOCATION_SPANNABLE,
- MessageKind.MIRRORS_LIBRARY_NOT_SUPPORT_BY_BACKEND, {
- 'importChain': importChains
- .join(MessageTemplate.MIRRORS_NOT_SUPPORTED_BY_BACKEND_PADDING)
- });
- } else if (importsMirrorsLibrary &&
- !options.enableExperimentalMirrors) {
- Set<String> importChains =
- computeImportChainsFor(loadedLibraries, Uris.dart_mirrors);
- reporter.reportWarningMessage(
- NO_LOCATION_SPANNABLE, MessageKind.IMPORT_EXPERIMENTAL_MIRRORS, {
- 'importChain': importChains
- .join(MessageTemplate.IMPORT_EXPERIMENTAL_MIRRORS_PADDING)
- });
- }
- }
- } else {
- if (loadedLibraries.containsLibrary(Uris.dart_mirrors)) {
- reporter.reportWarningMessage(NO_LOCATION_SPANNABLE,
- MessageKind.MIRRORS_LIBRARY_NOT_SUPPORT_WITH_CFE);
- }
+ if (loadedLibraries.containsLibrary(Uris.dart_mirrors)) {
+ reporter.reportWarningMessage(NO_LOCATION_SPANNABLE,
+ MessageKind.MIRRORS_LIBRARY_NOT_SUPPORT_WITH_CFE);
}
backend.onLibrariesLoaded(frontendStrategy.commonElements, loadedLibraries);
return loadedLibraries;
@@ -529,11 +482,6 @@
FunctionEntity mainFunction =
frontendStrategy.computeMain(rootLibrary, mainImpact);
- if (!options.useKernel) {
- // TODO(johnniwinther): Support mirrors usages analysis from dill.
- mirrorUsageAnalyzerTask.analyzeUsage(rootLibrary);
- }
-
// In order to see if a library is deferred, we must compute the
// compile-time constants that are metadata. This means adding
// something to the resolution queue. So we cannot wait with
@@ -562,11 +510,6 @@
}
}
}
- if (frontendStrategy.commonElements.mirrorsLibrary != null &&
- !options.useKernel) {
- // TODO(johnniwinther): Support mirrors from dill.
- resolveLibraryMetadata();
- }
reporter.log('Resolving...');
processQueue(frontendStrategy.elementEnvironment, resolutionEnqueuer,
diff --git a/pkg/compiler/lib/src/dart2js.dart b/pkg/compiler/lib/src/dart2js.dart
index e08a1d1..0c6117c 100644
--- a/pkg/compiler/lib/src/dart2js.dart
+++ b/pkg/compiler/lib/src/dart2js.dart
@@ -132,7 +132,6 @@
bool showWarnings;
bool showHints;
bool enableColors;
- bool useKernel = true;
Uri platformBinaries = computePlatformBinariesLocation();
Map<String, dynamic> environment = new Map<String, dynamic>();
@@ -248,8 +247,7 @@
}
void setUseOldFrontend(String argument) {
- useKernel = false;
- passThrough(argument);
+ helpAndFail("Option '${Flags.useOldFrontend}' is not supported.");
}
void setPlatformBinaries(String argument) {
@@ -505,11 +503,9 @@
}
Uri script = currentDirectory.resolve(arguments[0]);
- if (useKernel) {
- diagnosticHandler.autoReadFileUri = true;
- // TODO(sigmund): reenable hints (Issue #32111)
- diagnosticHandler.showHints = showHints = false;
- }
+ diagnosticHandler.autoReadFileUri = true;
+ // TODO(sigmund): reenable hints (Issue #32111)
+ diagnosticHandler.showHints = showHints = false;
CompilerOptions compilerOptions = CompilerOptions.parse(options,
libraryRoot: libraryRoot, platformBinaries: platformBinaries)
..entryPoint = script
diff --git a/pkg/compiler/lib/src/deferred_load.dart b/pkg/compiler/lib/src/deferred_load.dart
index 1e56455..1ccd493 100644
--- a/pkg/compiler/lib/src/deferred_load.dart
+++ b/pkg/compiler/lib/src/deferred_load.dart
@@ -97,9 +97,6 @@
/// Will be `true` if the program contains deferred libraries.
bool isProgramSplit = false;
- /// Whether mirrors have been used in the program.
- bool _isMirrorsUsed = false;
-
static const ImpactUseCase IMPACT_USE = const ImpactUseCase('Deferred load');
/// A mapping from the name of a defer import to all the output units it
@@ -224,10 +221,6 @@
collectConstantsInBody(analyzableElement, constants);
}
- if (_isMirrorsUsed) {
- collectConstantsFromMetadata(element, constants);
- }
-
if (element is FunctionEntity) {
_collectTypeDependencies(
elementEnvironment.getFunctionType(element), elements);
@@ -686,8 +679,6 @@
work() {
var queue = new WorkQueue(this.importSets);
- _isMirrorsUsed =
- closedWorld.backendUsage.isMirrorsUsed && !compiler.options.useKernel;
// Add `main` and their recursive dependencies to the main output unit.
// We do this upfront to avoid wasting time visiting these elements when
@@ -696,8 +687,8 @@
// Also add "global" dependencies to the main output unit. These are
// things that the backend needs but cannot associate with a particular
- // element, for example, startRootIsolate. This set also contains
- // elements for which we lack precise information.
+ // element. This set also contains elements for which we lack precise
+ // information.
for (MemberEntity element
in closedWorld.backendUsage.globalFunctionDependencies) {
element = element is MethodElement ? element.implementation : element;
@@ -708,9 +699,6 @@
element = element is ClassElement ? element.implementation : element;
queue.addElement(element, importSets.mainSet);
}
- if (_isMirrorsUsed) {
- addMirrorElementsForLibrary(queue, main.library, importSets.mainSet);
- }
void emptyQueue() {
while (queue.isNotEmpty) {
@@ -729,10 +717,6 @@
}
emptyQueue();
- if (_isMirrorsUsed) {
- addDeferredMirrorElements(queue);
- emptyQueue();
- }
}
reporter.withCurrentElement(main.library, () => measure(work));
@@ -1262,4 +1246,12 @@
_constantToUnit[constant] == null || _constantToUnit[constant] == unit);
_constantToUnit[constant] = unit;
}
+
+ /// Registers [newEntity] to be emitted in the same output unit as
+ /// [existingEntity];
+ void registerColocatedMembers(
+ MemberEntity existingEntity, MemberEntity newEntity) {
+ assert(_entityToUnit[newEntity] == null);
+ _entityToUnit[newEntity] = outputUnitForMember(existingEntity);
+ }
}
diff --git a/pkg/compiler/lib/src/dump_info.dart b/pkg/compiler/lib/src/dump_info.dart
index dee89c3..251dacd 100644
--- a/pkg/compiler/lib/src/dump_info.dart
+++ b/pkg/compiler/lib/src/dump_info.dart
@@ -637,7 +637,7 @@
dumpInfoDuration: new Duration(milliseconds: this.timing),
noSuchMethodEnabled: closedWorld.backendUsage.isNoSuchMethodUsed,
isRuntimeTypeUsed: closedWorld.backendUsage.isRuntimeTypeUsed,
- isIsolateInUse: closedWorld.backendUsage.isIsolateInUse,
+ isIsolateInUse: false,
isFunctionApplyUsed: closedWorld.backendUsage.isFunctionApplyUsed,
isMirrorsUsed: closedWorld.backendUsage.isMirrorsUsed,
minified: compiler.options.enableMinification);
diff --git a/pkg/compiler/lib/src/helpers/debug_collection.dart b/pkg/compiler/lib/src/helpers/debug_collection.dart
index 2ec5eb9..03ac0e9 100644
--- a/pkg/compiler/lib/src/helpers/debug_collection.dart
+++ b/pkg/compiler/lib/src/helpers/debug_collection.dart
@@ -21,12 +21,10 @@
putIfAbsentCallback = value;
}
- Map<RK, RV> cast<RK, RV>() {
- Map<Object, Object> self = this;
- return self is Map<RK, RV> ? self : this.retype<RK, RV>();
- }
+ Map<RK, RV> cast<RK, RV>() => Map.castFrom<K, V, RK, RV>(this);
- Map<RK, RV> retype<RK, RV>() => Map.castFrom<K, V, RK, RV>(this);
+ @Deprecated("Use cast instead.")
+ Map<RK, RV> retype<RK, RV>() => cast<RK, RV>();
bool containsValue(Object value) {
return sourceMap.containsValue(value);
@@ -109,12 +107,10 @@
Iterator<E> get iterator => iterable.iterator;
- Iterable<R> cast<R>() {
- Iterable<Object> self = this;
- return self is Iterable<R> ? self : this.retype<R>();
- }
+ Iterable<R> cast<R>() => Iterable.castFrom<E, R>(this);
- Iterable<R> retype<R>() => Iterable.castFrom<E, R>(this);
+ @Deprecated("Use cast instead.")
+ Iterable<R> retype<R>() => cast<R>();
Iterable<T> map<T>(T f(E element)) => iterable.map(f);
@@ -193,12 +189,10 @@
List<E> get list => iterable;
- List<R> cast<R>() {
- List<Object> self = this;
- return self is List<R> ? self : this.retype<R>();
- }
+ List<R> cast<R>() => List.castFrom<E, R>(this);
- List<R> retype<R>() => List.castFrom<E, R>(this);
+ @Deprecated("Use cast instead.")
+ List<R> retype<R>() => cast<R>();
List<E> operator +(List<E> other) => list + other;
@@ -302,12 +296,10 @@
Set<E> get set => iterable;
- Set<R> cast<R>() {
- Set<Object> self = this;
- return self is Set<R> ? self : this.retype<R>();
- }
+ Set<R> cast<R>() => Set.castFrom<E, R>(this);
- Set<R> retype<R>() => Set.castFrom<E, R>(this);
+ @Deprecated("Use cast instead.")
+ Set<R> retype<R>() => cast<R>();
bool contains(Object value) => set.contains(value);
diff --git a/pkg/compiler/lib/src/helpers/expensive_map.dart b/pkg/compiler/lib/src/helpers/expensive_map.dart
index 35001e4..48be384 100644
--- a/pkg/compiler/lib/src/helpers/expensive_map.dart
+++ b/pkg/compiler/lib/src/helpers/expensive_map.dart
@@ -68,12 +68,10 @@
}
}
- Map<KR, VR> cast<KR, VR>() {
- Map<Object, Object> self = this;
- return self is Map<KR, VR> ? self : Map.castFrom<K, V, KR, VR>(this);
- }
+ Map<KR, VR> cast<KR, VR>() => Map.castFrom<K, V, KR, VR>(this);
- Map<KR, VR> retype<KR, VR>() => Map.castFrom<K, V, KR, VR>(this);
+ @Deprecated("Use cast instead.")
+ Map<KR, VR> retype<KR, VR>() => cast<KR, VR>();
Iterable<MapEntry<K, V>> get entries => _maps[0].entries;
diff --git a/pkg/compiler/lib/src/helpers/track_map.dart b/pkg/compiler/lib/src/helpers/track_map.dart
index 833a08a..0a87cf5 100644
--- a/pkg/compiler/lib/src/helpers/track_map.dart
+++ b/pkg/compiler/lib/src/helpers/track_map.dart
@@ -99,7 +99,8 @@
Map<KR, VR> cast<KR, VR>() => _map.cast<KR, VR>();
- Map<KR, VR> retype<KR, VR>() => _map.retype<KR, VR>();
+ @Deprecated("Use cast instead.")
+ Map<KR, VR> retype<KR, VR>() => cast<KR, VR>();
Iterable<MapEntry<K, V>> get entries => _map.entries;
diff --git a/pkg/compiler/lib/src/inferrer/kernel_inferrer_engine.dart b/pkg/compiler/lib/src/inferrer/kernel_inferrer_engine.dart
index 217c1ee..dc823ff 100644
--- a/pkg/compiler/lib/src/inferrer/kernel_inferrer_engine.dart
+++ b/pkg/compiler/lib/src/inferrer/kernel_inferrer_engine.dart
@@ -212,8 +212,8 @@
}
break;
case MemberKind.closureField:
- break;
case MemberKind.signature:
+ case MemberKind.generatorBody:
break;
}
failedAt(member, 'Unexpected member definition: $definition.');
diff --git a/pkg/compiler/lib/src/io/kernel_source_information.dart b/pkg/compiler/lib/src/io/kernel_source_information.dart
index 586b0f7..1b85861 100644
--- a/pkg/compiler/lib/src/io/kernel_source_information.dart
+++ b/pkg/compiler/lib/src/io/kernel_source_information.dart
@@ -144,6 +144,7 @@
return _buildFunction(name, base ?? node, node.function);
}
break;
+ // TODO(sra): generatorBody
default:
}
return _buildTreeNode(base ?? node, name: name);
@@ -209,6 +210,16 @@
return _buildBody(node, node.function.body);
}
break;
+ case MemberKind.generatorBody:
+ ir.Node node = definition.node;
+ if (node is ir.FunctionDeclaration) {
+ return _buildBody(node, node.function.body);
+ } else if (node is ir.FunctionExpression) {
+ return _buildBody(node, node.function.body);
+ } else if (node is ir.Member && node.function != null) {
+ return _buildBody(node, node.function.body);
+ }
+ break;
default:
}
return _buildTreeNode(definition.node);
diff --git a/pkg/compiler/lib/src/js/rewrite_async.dart b/pkg/compiler/lib/src/js/rewrite_async.dart
index c26521e..936cddf 100644
--- a/pkg/compiler/lib/src/js/rewrite_async.dart
+++ b/pkg/compiler/lib/src/js/rewrite_async.dart
@@ -159,6 +159,9 @@
js.VariableUse get self => new js.VariableUse(selfName);
String selfName;
+ /// The rewritten code can take type arguments. These are added if needed.
+ List<String> typeArgumentNames = <String>[];
+
final DiagnosticReporter reporter;
// For error reporting only.
Spannable get spannable {
@@ -245,6 +248,15 @@
return result;
}
+ List<js.Expression> processTypeArguments(List<js.Expression> types) {
+ if (types == null) {
+ String name = freshName('type');
+ typeArgumentNames.add(name);
+ return <js.Expression>[new js.VariableUse(name)];
+ }
+ return types;
+ }
+
/// All the pieces are collected in this map, to create a switch with a case
/// for each label.
///
@@ -532,6 +544,7 @@
/// Returns the rewritten function.
js.Fun finishFunction(
List<js.Parameter> parameters,
+ List<js.Parameter> typeParameters,
js.Statement rewrittenBody,
js.VariableDeclarationList variableDeclarations,
SourceInformation functionSourceInformation,
@@ -738,8 +751,11 @@
js.VariableDeclarationList variableDeclarations =
new js.VariableDeclarationList(variables);
- return finishFunction(node.params, rewrittenBody, variableDeclarations,
- node.sourceInformation, bodySourceInformation);
+ // Names are already safe when added.
+ List<js.Parameter> typeParameters =
+ typeArgumentNames.map((name) => new js.Parameter(name)).toList();
+ return finishFunction(node.params, typeParameters, rewrittenBody,
+ variableDeclarations, node.sourceInformation, bodySourceInformation);
}
@override
@@ -1739,7 +1755,7 @@
///
/// Specific to async methods.
final js.Expression completerFactory;
- final js.Expression completerFactoryTypeArgument;
+ List<js.Expression> completerFactoryTypeArguments;
final js.Expression wrapBody;
@@ -1749,7 +1765,7 @@
this.asyncReturn,
this.asyncRethrow,
this.completerFactory,
- this.completerFactoryTypeArgument,
+ this.completerFactoryTypeArguments,
this.wrapBody,
String safeVariableName(String proposedName),
js.Name bodyName})
@@ -1803,7 +1819,7 @@
completer,
js.js('#(#)', [
completerFactory,
- completerFactoryTypeArgument
+ completerFactoryTypeArguments
]).withSourceInformation(sourceInformation),
sourceInformation));
if (analysis.hasExplicitReturns) {
@@ -1816,6 +1832,8 @@
@override
void initializeNames() {
completerName = freshName("completer");
+ completerFactoryTypeArguments =
+ processTypeArguments(completerFactoryTypeArguments);
}
@override
@@ -1833,6 +1851,7 @@
@override
js.Fun finishFunction(
List<js.Parameter> parameters,
+ List<js.Parameter> typeParameters,
js.Statement rewrittenBody,
js.VariableDeclarationList variableDeclarations,
SourceInformation functionSourceInformation,
@@ -1884,12 +1903,13 @@
"innerFunction": innerFunction,
}).withSourceInformation(bodySourceInformation);
return js.js("""
- function (#parameters) {
+ function (#parameters, #typeParameters) {
#variableDeclarations;
var #bodyName = #wrapBodyCall;
#returnAsyncStart;
}""", {
"parameters": parameters,
+ "typeParameters": typeParameters,
"variableDeclarations": variableDeclarations,
"bodyName": bodyName,
"wrapBodyCall": wrapBodyCall,
@@ -1904,7 +1924,7 @@
/// Constructor creating the Iterable for a sync* method. Called with
/// [bodyName].
final js.Expression iterableFactory;
- final js.Expression iterableFactoryTypeArgument;
+ List<js.Expression> iterableFactoryTypeArguments;
/// A JS Expression that creates a marker showing that iteration is over.
///
@@ -1922,7 +1942,7 @@
SyncStarRewriter(DiagnosticReporter diagnosticListener, spannable,
{this.endOfIteration,
this.iterableFactory,
- this.iterableFactoryTypeArgument,
+ this.iterableFactoryTypeArguments,
this.yieldStarExpression,
this.uncaughtErrorExpression,
String safeVariableName(String proposedName),
@@ -1949,6 +1969,7 @@
@override
js.Fun finishFunction(
List<js.Parameter> parameters,
+ List<js.Parameter> typeParameters,
js.Statement rewrittenBody,
js.VariableDeclarationList variableDeclarations,
SourceInformation functionSourceInformation,
@@ -2017,19 +2038,20 @@
js.Expression callIterableFactory =
js.js("#iterableFactory(#innerFunction, #type)", {
"iterableFactory": iterableFactory,
- "type": iterableFactoryTypeArgument,
+ "type": iterableFactoryTypeArguments,
"innerFunction": innerFunction,
}).withSourceInformation(bodySourceInformation);
js.Statement returnCallIterableFactory = new js.Return(callIterableFactory)
.withSourceInformation(bodySourceInformation);
return js.js("""
- function (#renamedParameters) {
+ function (#renamedParameters, #typeParameters) {
if (#needsThis)
var #self = this;
#returnCallIterableFactory;
}
""", {
"renamedParameters": renamedParameters,
+ "typeParameters": typeParameters,
"needsThis": analysis.hasThis,
"self": selfName,
"returnCallIterableFactory": returnCallIterableFactory,
@@ -2075,7 +2097,10 @@
}
@override
- void initializeNames() {}
+ void initializeNames() {
+ iterableFactoryTypeArguments =
+ processTypeArguments(iterableFactoryTypeArguments);
+ }
}
class AsyncStarRewriter extends AsyncRewriterBase {
@@ -2115,7 +2140,7 @@
///
/// Specific to async* methods.
final js.Expression newController;
- final js.Expression newControllerTypeArgument;
+ List<js.Expression> newControllerTypeArguments;
/// Used to get the `Stream` out of the [controllerName] variable.
final js.Expression streamOfController;
@@ -2136,7 +2161,7 @@
{this.asyncStarHelper,
this.streamOfController,
this.newController,
- this.newControllerTypeArgument,
+ this.newControllerTypeArguments,
this.yieldExpression,
this.yieldStarExpression,
this.wrapBody,
@@ -2184,6 +2209,7 @@
@override
js.Fun finishFunction(
List<js.Parameter> parameters,
+ List<js.Parameter> typeParameters,
js.Statement rewrittenBody,
js.VariableDeclarationList variableDeclarations,
SourceInformation functionSourceInformation,
@@ -2277,12 +2303,13 @@
new js.Return(streamOfControllerCall)
.withSourceInformation(bodySourceInformation);
return js.js("""
- function (#parameters) {
+ function (#parameters, #typeParameters) {
#declareBodyName;
#variableDeclarations;
#returnStreamOfControllerCall;
}""", {
"parameters": parameters,
+ "typeParameters": typeParameters,
"declareBodyName": declareBodyName,
"variableDeclarations": variableDeclarations,
"returnStreamOfControllerCall": returnStreamOfControllerCall,
@@ -2329,7 +2356,7 @@
js.js('#(#, #)', [
newController,
bodyName,
- newControllerTypeArgument
+ newControllerTypeArguments
]).withSourceInformation(sourceInformation),
sourceInformation));
if (analysis.hasYield) {
@@ -2343,6 +2370,8 @@
void initializeNames() {
controllerName = freshName("controller");
nextWhenCanceledName = freshName("nextWhenCanceled");
+ newControllerTypeArguments =
+ processTypeArguments(newControllerTypeArguments);
}
@override
diff --git a/pkg/compiler/lib/src/js_backend/backend.dart b/pkg/compiler/lib/src/js_backend/backend.dart
index c83d813..28f2622 100644
--- a/pkg/compiler/lib/src/js_backend/backend.dart
+++ b/pkg/compiler/lib/src/js_backend/backend.dart
@@ -324,10 +324,6 @@
FrontendStrategy get frontendStrategy => compiler.frontendStrategy;
- /// Returns true if the backend supports reflection and this isn't Dart 2.
- bool get supportsReflection =>
- emitter.supportsReflection && !compiler.options.useKernel;
-
FunctionCompiler functionCompiler;
CodeEmitterTask emitter;
@@ -1169,7 +1165,8 @@
if (element.asyncMarker == AsyncMarker.SYNC) return code;
AsyncRewriterBase rewriter = null;
- jsAst.Name name = namer.methodPropertyName(element);
+ jsAst.Name name = namer.methodPropertyName(
+ element is JGeneratorBody ? element.function : element);
switch (element.asyncMarker) {
case AsyncMarker.ASYNC:
@@ -1182,7 +1179,7 @@
emitter.staticFunctionAccess(commonElements.endOfIteration),
iterableFactory: emitter
.staticFunctionAccess(commonElements.syncStarIterableFactory),
- iterableFactoryTypeArgument:
+ iterableFactoryTypeArguments:
_fetchItemType(element, elementEnvironment),
yieldStarExpression:
emitter.staticFunctionAccess(commonElements.yieldStar),
@@ -1205,7 +1202,7 @@
wrapBody: emitter.staticFunctionAccess(commonElements.wrapBody),
newController: emitter.staticFunctionAccess(
commonElements.asyncStarStreamControllerFactory),
- newControllerTypeArgument:
+ newControllerTypeArguments:
_fetchItemType(element, elementEnvironment),
safeVariableName: namer.safeVariablePrefixForAsyncRewrite,
yieldExpression:
@@ -1223,19 +1220,22 @@
return rewriter.rewrite(code, bodySourceInformation, exitSourceInformation);
}
- /// Returns an expression that evaluates the type argument to the
+ /// Returns an optional expression that evaluates the type argument to the
/// Future/Stream/Iterable.
- jsAst.Expression _fetchItemType(
+ /// Returns an empty list if the type is not needed.
+ /// Returns `null` if the type expression is determined by
+ /// the outside context and should be added as a function parameter.
+ List<jsAst.Expression> _fetchItemType(
FunctionEntity element, ElementEnvironment elementEnvironment) {
- DartType type =
- elementEnvironment.getFunctionAsyncOrSyncStarElementType(element);
+ //DartType type =
+ // elementEnvironment.getFunctionAsyncOrSyncStarElementType(element);
- if (!type.containsFreeTypeVariables) {
- return rtiEncoder.getTypeRepresentation(emitter.emitter, type, null);
- }
+ //if (!type.containsFreeTypeVariables) {
+ // var ast = rtiEncoder.getTypeRepresentation(emitter.emitter, type, null);
+ // return <jsAst.Expression>[ast];
+ //}
- // TODO(sra): Handle types that have type variables.
- return js('null');
+ return null;
}
AsyncRewriter _makeAsyncRewriter(
@@ -1254,7 +1254,7 @@
? commonElements.asyncAwaitCompleterFactory
: commonElements.syncCompleterFactory;
- jsAst.Expression itemTypeExpression =
+ List<jsAst.Expression> itemTypeExpression =
_fetchItemType(element, elementEnvironment);
var rewriter = new AsyncRewriter(reporter, element,
@@ -1267,7 +1267,7 @@
emitter.staticFunctionAccess(commonElements.asyncHelperRethrow),
wrapBody: emitter.staticFunctionAccess(commonElements.wrapBody),
completerFactory: emitter.staticFunctionAccess(completerFactory),
- completerFactoryTypeArgument: itemTypeExpression,
+ completerFactoryTypeArguments: itemTypeExpression,
safeVariableName: namer.safeVariablePrefixForAsyncRewrite,
bodyName: namer.deriveAsyncBodyName(name));
diff --git a/pkg/compiler/lib/src/js_backend/backend_impact.dart b/pkg/compiler/lib/src/js_backend/backend_impact.dart
index cf43c6c..71bec0c 100644
--- a/pkg/compiler/lib/src/js_backend/backend_impact.dart
+++ b/pkg/compiler/lib/src/js_backend/backend_impact.dart
@@ -141,54 +141,30 @@
} else {
staticUses.add(_commonElements.asyncHelperStart);
}
- if (!_options.useKernel) {
- if (_options.startAsyncSynchronously) {
- staticUses.add(_commonElements.asyncAwaitCompleterFactory);
- } else {
- staticUses.add(_commonElements.syncCompleterFactory);
- }
- }
return new BackendImpact(staticUses: staticUses);
}();
BackendImpact _syncStarBody;
BackendImpact get syncStarBody {
- return _syncStarBody ??= _options.useKernel
- ? new BackendImpact(staticUses: [
- _commonElements.endOfIteration,
- _commonElements.yieldStar,
- _commonElements.syncStarUncaughtError,
- ])
- : new BackendImpact(staticUses: [
- _commonElements.endOfIteration,
- _commonElements.yieldStar,
- _commonElements.syncStarUncaughtError,
- _commonElements.syncStarIterableFactory,
- ]);
+ return _syncStarBody ??= new BackendImpact(staticUses: [
+ _commonElements.endOfIteration,
+ _commonElements.yieldStar,
+ _commonElements.syncStarUncaughtError,
+ ]);
}
BackendImpact _asyncStarBody;
BackendImpact get asyncStarBody {
- return _asyncStarBody ??= _options.useKernel
- ? new BackendImpact(staticUses: [
- _commonElements.asyncStarHelper,
- _commonElements.streamOfController,
- _commonElements.yieldSingle,
- _commonElements.yieldStar,
- _commonElements.streamIteratorConstructor,
- _commonElements.wrapBody,
- ])
- : new BackendImpact(staticUses: [
- _commonElements.asyncStarHelper,
- _commonElements.streamOfController,
- _commonElements.yieldSingle,
- _commonElements.yieldStar,
- _commonElements.streamIteratorConstructor,
- _commonElements.wrapBody,
- _commonElements.asyncStarStreamControllerFactory,
- ]);
+ return _asyncStarBody ??= new BackendImpact(staticUses: [
+ _commonElements.asyncStarHelper,
+ _commonElements.streamOfController,
+ _commonElements.yieldSingle,
+ _commonElements.yieldStar,
+ _commonElements.streamIteratorConstructor,
+ _commonElements.wrapBody,
+ ]);
}
BackendImpact _typeVariableBoundCheck;
@@ -749,24 +725,6 @@
dynamicUses: [Selectors.noSuchMethod_]);
}
- BackendImpact _isolateSupport;
-
- /// Backend impact for isolate support.
- BackendImpact get isolateSupport {
- return _isolateSupport ??=
- new BackendImpact(globalUses: [_commonElements.startRootIsolate]);
- }
-
- BackendImpact _isolateSupportForResolution;
-
- /// Additional backend impact for isolate support in resolution.
- BackendImpact get isolateSupportForResolution {
- return _isolateSupportForResolution ??= new BackendImpact(globalUses: [
- _commonElements.currentIsolate,
- _commonElements.callInIsolate
- ]);
- }
-
BackendImpact _loadLibrary;
/// Backend impact for accessing a `loadLibrary` function on a deferred
diff --git a/pkg/compiler/lib/src/js_backend/backend_usage.dart b/pkg/compiler/lib/src/js_backend/backend_usage.dart
index ac81356..ed8dced 100644
--- a/pkg/compiler/lib/src/js_backend/backend_usage.dart
+++ b/pkg/compiler/lib/src/js_backend/backend_usage.dart
@@ -36,9 +36,6 @@
/// `true` of `Object.runtimeType` is used.
bool get isRuntimeTypeUsed;
- /// `true` if the `dart:isolate` library is in use.
- bool get isIsolateInUse;
-
/// `true` if `Function.apply` is used.
bool get isFunctionApplyUsed;
@@ -81,9 +78,6 @@
/// `true` of `Object.runtimeType` is used.
bool isRuntimeTypeUsed;
- /// `true` if the `dart:isolate` library is in use.
- bool isIsolateInUse;
-
/// `true` if `Function.apply` is used.
bool isFunctionApplyUsed;
@@ -120,9 +114,6 @@
/// `true` of `Object.runtimeType` is used.
bool isRuntimeTypeUsed = false;
- /// `true` if the `dart:isolate` library is in use.
- bool isIsolateInUse = false;
-
/// `true` if `Function.apply` is used.
bool isFunctionApplyUsed = false;
@@ -289,7 +280,6 @@
requiresPreamble: requiresPreamble,
isInvokeOnUsed: isInvokeOnUsed,
isRuntimeTypeUsed: isRuntimeTypeUsed,
- isIsolateInUse: isIsolateInUse,
isFunctionApplyUsed: isFunctionApplyUsed,
isMirrorsUsed: isMirrorsUsed,
isNoSuchMethodUsed: isNoSuchMethodUsed,
@@ -320,9 +310,6 @@
/// `true` of `Object.runtimeType` is used.
final bool isRuntimeTypeUsed;
- /// `true` if the `dart:isolate` library is in use.
- final bool isIsolateInUse;
-
/// `true` if `Function.apply` is used.
final bool isFunctionApplyUsed;
@@ -345,7 +332,6 @@
this.requiresPreamble,
this.isInvokeOnUsed,
this.isRuntimeTypeUsed,
- this.isIsolateInUse,
this.isFunctionApplyUsed,
this.isMirrorsUsed,
this.isNoSuchMethodUsed,
diff --git a/pkg/compiler/lib/src/js_backend/codegen_listener.dart b/pkg/compiler/lib/src/js_backend/codegen_listener.dart
index b5d3feb..39c2fb4 100644
--- a/pkg/compiler/lib/src/js_backend/codegen_listener.dart
+++ b/pkg/compiler/lib/src/js_backend/codegen_listener.dart
@@ -78,26 +78,6 @@
}
}
- /// Called to enable support for isolates. Any backend specific [WorldImpact]
- /// of this is returned.
- WorldImpact _enableIsolateSupport(FunctionEntity mainMethod) {
- WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
- // TODO(floitsch): We should also ensure that the class IsolateMessage is
- // instantiated. Currently, just enabling isolate support works.
- if (mainMethod != null) {
- // The JavaScript backend implements [Isolate.spawn] by looking up
- // top-level functions by name. So all top-level function tear-off
- // closures have a private name field.
- //
- // The JavaScript backend of [Isolate.spawnUri] uses the same internal
- // implementation as [Isolate.spawn], and fails if it cannot look main up
- // by name.
- impactBuilder.registerStaticUse(new StaticUse.staticTearOff(mainMethod));
- }
- _impacts.isolateSupport.registerImpact(impactBuilder, _elementEnvironment);
- return impactBuilder;
- }
-
/// Computes the [WorldImpact] of calling [mainMethod] as the entry point.
WorldImpact _computeMainImpact(FunctionEntity mainMethod) {
WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl();
@@ -107,11 +87,6 @@
.registerImpact(mainImpact, _elementEnvironment);
mainImpact.registerStaticUse(
new StaticUse.staticInvoke(mainMethod, callStructure));
- // If the main method takes arguments, this compilation could be the
- // target of Isolate.spawnUri. Strictly speaking, that can happen also if
- // main takes no arguments, but in this case the spawned isolate can't
- // communicate with the spawning isolate.
- mainImpact.addImpact(_enableIsolateSupport(mainMethod));
}
mainImpact.registerStaticUse(
new StaticUse.staticInvoke(mainMethod, CallStructure.NO_ARGS));
@@ -125,9 +100,6 @@
if (mainMethod != null) {
enqueuer.applyImpact(_computeMainImpact(mainMethod));
}
- if (_backendUsage.isIsolateInUse) {
- enqueuer.applyImpact(_enableIsolateSupport(mainMethod));
- }
}
@override
diff --git a/pkg/compiler/lib/src/js_backend/mirrors_data.dart b/pkg/compiler/lib/src/js_backend/mirrors_data.dart
index c128794..fe94bca 100644
--- a/pkg/compiler/lib/src/js_backend/mirrors_data.dart
+++ b/pkg/compiler/lib/src/js_backend/mirrors_data.dart
@@ -542,11 +542,11 @@
void computeMembersNeededForReflection(
ResolutionWorldBuilder worldBuilder, ClosedWorld closedWorld) {
if (_membersNeededForReflection != null) return;
- if (!closedWorld.backendUsage.isMirrorsUsed ||
- _compiler.options.useKernel) {
+ if (!closedWorld.backendUsage.isMirrorsUsed || true) {
createImmutableSets();
return;
}
+ // TODO(johnniwinther): Remove this:
_classesNeededForReflection = new Set<ClassEntity>();
_typedefsNeededForReflection = new Set<TypedefEntity>();
_membersNeededForReflection = new Set<MemberEntity>();
diff --git a/pkg/compiler/lib/src/js_backend/namer.dart b/pkg/compiler/lib/src/js_backend/namer.dart
index 00393c0..f671f25 100644
--- a/pkg/compiler/lib/src/js_backend/namer.dart
+++ b/pkg/compiler/lib/src/js_backend/namer.dart
@@ -24,6 +24,7 @@
import '../elements/types.dart';
import '../js/js.dart' as jsAst;
import '../js_model/closure.dart';
+import '../js_model/elements.dart' show JGeneratorBody;
import '../universe/call_structure.dart' show CallStructure;
import '../universe/selector.dart' show Selector, SelectorKind;
import '../universe/world_builder.dart' show CodegenWorldBuilder;
@@ -782,13 +783,29 @@
ctor, () => _proposeNameForConstructorBody(ctor));
}
+ /// Name for a generator body.
+ jsAst.Name generatorBodyInstanceMethodName(JGeneratorBody method) {
+ assert(method.isInstanceMember);
+ // TODO(sra): Except for methods declared in mixins, we can use a compact
+ // naming scheme like we do for [ConstructorBodyEntity].
+ FunctionEntity function = method.function;
+ return _disambiguateInternalMember(method, () {
+ String invocationName = operatorNameToIdentifier(function.name);
+ return '${invocationName}\$body\$${method.enclosingClass.name}';
+ });
+ }
+
/// Annotated name for [method] encoding arity and named parameters.
jsAst.Name instanceMethodName(FunctionEntity method) {
- // TODO(johnniwinther): Avoid the use of [ConstructorBodyEntity]. The
- // codegen model should be explicit about its constructor body elements.
+ // TODO(johnniwinther): Avoid the use of [ConstructorBodyEntity] and
+ // [JGeneratorBody]. The codegen model should be explicit about its
+ // constructor body elements.
if (method is ConstructorBodyEntity) {
return constructorBodyName(method);
}
+ if (method is JGeneratorBody) {
+ return generatorBodyInstanceMethodName(method);
+ }
return invocationName(new Selector.fromElement(method));
}
@@ -1337,6 +1354,8 @@
String _proposeNameForMember(MemberEntity element) {
if (element.isConstructor) {
return _proposeNameForConstructor(element);
+ } else if (element is JGeneratorBody) {
+ return _proposeNameForMember(element.function) + r'$body';
} else if (element.enclosingClass != null) {
ClassEntity enclosingClass = element.enclosingClass;
return '${enclosingClass.name}_${element.name}';
diff --git a/pkg/compiler/lib/src/js_backend/resolution_listener.dart b/pkg/compiler/lib/src/js_backend/resolution_listener.dart
index 289ae42..d0ecf6e 100644
--- a/pkg/compiler/lib/src/js_backend/resolution_listener.dart
+++ b/pkg/compiler/lib/src/js_backend/resolution_listener.dart
@@ -4,7 +4,7 @@
library js_backend.backend.resolution_listener;
-import '../common/names.dart' show Identifiers, Uris;
+import '../common/names.dart' show Identifiers;
import '../common_elements.dart' show CommonElements, ElementEnvironment;
import '../constants/values.dart';
import '../deferred_load.dart';
@@ -117,30 +117,6 @@
}
}
- /// Called to enable support for isolates. Any backend specific [WorldImpact]
- /// of this is returned.
- WorldImpact _enableIsolateSupport(FunctionEntity mainMethod) {
- WorldImpactBuilderImpl impactBuilder = new WorldImpactBuilderImpl();
- // TODO(floitsch): We should also ensure that the class IsolateMessage is
- // instantiated. Currently, just enabling isolate support works.
- if (mainMethod != null) {
- // The JavaScript backend implements [Isolate.spawn] by looking up
- // top-level functions by name. So all top-level function tear-off
- // closures have a private name field.
- //
- // The JavaScript backend of [Isolate.spawnUri] uses the same internal
- // implementation as [Isolate.spawn], and fails if it cannot look main up
- // by name.
- impactBuilder.registerStaticUse(new StaticUse.staticTearOff(mainMethod));
- }
- _impacts.isolateSupport.registerImpact(impactBuilder, _elementEnvironment);
- _backendUsage.processBackendImpact(_impacts.isolateSupport);
- _impacts.isolateSupportForResolution
- .registerImpact(impactBuilder, _elementEnvironment);
- _backendUsage.processBackendImpact(_impacts.isolateSupportForResolution);
- return impactBuilder;
- }
-
/// Computes the [WorldImpact] of calling [mainMethod] as the entry point.
WorldImpact _computeMainImpact(FunctionEntity mainMethod) {
WorldImpactBuilderImpl mainImpact = new WorldImpactBuilderImpl();
@@ -151,11 +127,6 @@
_backendUsage.processBackendImpact(_impacts.mainWithArguments);
mainImpact.registerStaticUse(
new StaticUse.staticInvoke(mainMethod, callStructure));
- // If the main method takes arguments, this compilation could be the
- // target of Isolate.spawnUri. Strictly speaking, that can happen also if
- // main takes no arguments, but in this case the spawned isolate can't
- // communicate with the spawning isolate.
- mainImpact.addImpact(_enableIsolateSupport(mainMethod));
}
mainImpact.registerStaticUse(
new StaticUse.staticInvoke(mainMethod, CallStructure.NO_ARGS));
@@ -311,29 +282,6 @@
}
}
- // Enable isolate support if we start using something from the isolate
- // library, or timers for the async library. We exclude constant fields,
- // which are ending here because their initializing expression is
- // compiled.
- LibraryEntity library = member.library;
- if (!_backendUsage.isIsolateInUse && !(member.isField && member.isConst)) {
- Uri uri = library.canonicalUri;
- if (uri == Uris.dart_isolate) {
- _backendUsage.isIsolateInUse = true;
- worldImpact
- .addImpact(_enableIsolateSupport(_elementEnvironment.mainFunction));
- } else if (uri == Uris.dart_async) {
- if (member.name == '_createTimer' ||
- member.name == '_createPeriodicTimer') {
- // The [:Timer:] class uses the event queue of the isolate
- // library, so we make sure that event queue is generated.
- _backendUsage.isIsolateInUse = true;
- worldImpact.addImpact(
- _enableIsolateSupport(_elementEnvironment.mainFunction));
- }
- }
- }
-
if (member.isGetter && member.name == Identifiers.runtimeType_) {
// Enable runtime type support if we discover a getter called
// runtimeType. We have to enable runtime type before hitting the
diff --git a/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
index 6002105..e333f45 100644
--- a/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/full_emitter/emitter.dart
@@ -278,11 +278,6 @@
jsAst.Name get makeConstListProperty =>
namer.internalGlobal('makeConstantList');
- /// The name of the property that contains all field names.
- ///
- /// This property is added to constructors when isolate support is enabled.
- static const String FIELD_NAMES_PROPERTY_NAME = r"$__fields__";
-
/// For deferred loading we communicate the initializers via this global var.
final String deferredInitializers = r"$dart_deferred_initializers$";
@@ -374,13 +369,6 @@
generateEmbeddedGlobalAccessString(embeddedNames.TYPES);
return jsAst.js.expressionTemplateFor("$typesAccess[#]");
- case JsBuiltin.createDartClosureFromNameOfStaticFunction:
- // The global-functions map contains a map from name to tear-off
- // getters.
- String functionGettersMap =
- generateEmbeddedGlobalAccessString(embeddedNames.GLOBAL_FUNCTIONS);
- return jsAst.js.expressionTemplateFor("$functionGettersMap[#]()");
-
default:
reporter.internalError(
NO_LOCATION_SPANNABLE, "Unhandled Builtin: $builtin");
@@ -1115,18 +1103,7 @@
cspPrecompiledFunctionFor(outputUnit)
.add(new jsAst.FunctionDeclaration(constructorName, constructorAst));
- String fieldNamesProperty = FIELD_NAMES_PROPERTY_NAME;
- bool hasIsolateSupport = _closedWorld.backendUsage.isIsolateInUse;
- jsAst.Node fieldNamesArray;
- if (hasIsolateSupport) {
- fieldNamesArray =
- new jsAst.ArrayInitializer(fields.map(js.quoteName).toList());
- } else {
- fieldNamesArray = new jsAst.LiteralNull();
- }
-
- cspPrecompiledFunctionFor(outputUnit).add(js.statement(
- r'''
+ cspPrecompiledFunctionFor(outputUnit).add(js.statement(r'''
{
#constructorName.#typeNameProperty = #constructorNameString;
// IE does not have a name property.
@@ -1134,18 +1111,11 @@
#constructorName.name = #constructorNameString;
$desc = $collectedClasses$.#constructorName[1];
#constructorName.prototype = $desc;
- ''' /* next string is not a raw string */ '''
- if (#hasIsolateSupport) {
- #constructorName.$fieldNamesProperty = #fieldNamesArray;
- }
- }''',
- {
- "constructorName": constructorName,
- "typeNameProperty": typeNameProperty,
- "constructorNameString": js.quoteName(constructorName),
- "hasIsolateSupport": hasIsolateSupport,
- "fieldNamesArray": fieldNamesArray
- }));
+ }''', {
+ "constructorName": constructorName,
+ "typeNameProperty": typeNameProperty,
+ "constructorNameString": js.quoteName(constructorName),
+ }));
cspPrecompiledConstructorNamesFor(outputUnit).add(js('#', constructorName));
}
@@ -1961,12 +1931,11 @@
jsAst.Comment buildGeneratedBy() {
StringBuffer flavor = new StringBuffer();
- flavor.write(compiler.options.useKernel ? 'kernel FE' : 'ast FE');
+ flavor.write('full emitter');
if (compiler.options.strongMode) flavor.write(', strong');
if (compiler.options.trustPrimitives) flavor.write(', trust primitives');
if (compiler.options.trustTypeAnnotations) flavor.write(', trust types');
if (compiler.options.omitImplicitChecks) flavor.write(', omit checks');
- flavor.write(', full emitter');
if (compiler.options.useContentSecurityPolicy) flavor.write(', CSP');
if (_closedWorld.backendUsage.isMirrorsUsed) flavor.write(', mirrors');
return new jsAst.Comment(generatedBy(compiler, flavor: '$flavor'));
diff --git a/pkg/compiler/lib/src/js_emitter/full_emitter/setup_program_builder.dart b/pkg/compiler/lib/src/js_emitter/full_emitter/setup_program_builder.dart
index e734b9d..b8df5d2 100644
--- a/pkg/compiler/lib/src/js_emitter/full_emitter/setup_program_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/full_emitter/setup_program_builder.dart
@@ -35,8 +35,6 @@
ClosedWorld closedWorld) {
jsAst.Expression typeInformationAccess =
emitter.generateEmbeddedGlobalAccess(embeddedNames.TYPE_INFORMATION);
- jsAst.Expression globalFunctionsAccess =
- emitter.generateEmbeddedGlobalAccess(embeddedNames.GLOBAL_FUNCTIONS);
jsAst.Expression staticsAccess =
emitter.generateEmbeddedGlobalAccess(embeddedNames.STATICS);
jsAst.Expression interceptedNamesAccess =
@@ -49,10 +47,6 @@
emitter.generateEmbeddedGlobalAccess(embeddedNames.LIBRARIES);
jsAst.Expression typesAccess =
emitter.generateEmbeddedGlobalAccess(embeddedNames.TYPES);
- jsAst.Expression createNewIsolateFunctionAccess =
- emitter.generateEmbeddedGlobalAccess(embeddedNames.CREATE_NEW_ISOLATE);
- jsAst.Expression classIdExtractorAccess =
- emitter.generateEmbeddedGlobalAccess(embeddedNames.CLASS_ID_EXTRACTOR);
jsAst.Expression allClassesAccess =
emitter.generateEmbeddedGlobalAccess(embeddedNames.ALL_CLASSES);
jsAst.Expression precompiledAccess =
@@ -63,12 +57,6 @@
emitter.generateEmbeddedGlobalAccess(embeddedNames.INTERCEPTORS_BY_TAG);
jsAst.Expression leafTagsAccess =
emitter.generateEmbeddedGlobalAccess(embeddedNames.LEAF_TAGS);
- jsAst.Expression initializeEmptyInstanceAccess = emitter
- .generateEmbeddedGlobalAccess(embeddedNames.INITIALIZE_EMPTY_INSTANCE);
- jsAst.Expression classFieldsExtractorAccess = emitter
- .generateEmbeddedGlobalAccess(embeddedNames.CLASS_FIELDS_EXTRACTOR);
- jsAst.Expression instanceFromClassIdAccess = emitter
- .generateEmbeddedGlobalAccess(embeddedNames.INSTANCE_FROM_CLASS_ID);
String reflectableField = namer.reflectableField;
String reflectionInfoField = namer.reflectionInfoField;
@@ -108,21 +96,12 @@
'staticsPropertyName': namer.staticsPropertyName,
'staticsPropertyNameString': js.quoteName(namer.staticsPropertyName),
'typeInformation': typeInformationAccess,
- 'globalFunctions': globalFunctionsAccess,
'enabledInvokeOn': closedWorld.backendUsage.isInvokeOnUsed,
'interceptedNames': interceptedNamesAccess,
'interceptedNamesSet': emitter.generateInterceptedNamesSet(),
'notInCspMode': !compiler.options.useContentSecurityPolicy,
'inCspMode': compiler.options.useContentSecurityPolicy,
'deferredAction': namer.deferredAction,
- 'hasIsolateSupport': program.hasIsolateSupport,
- 'fieldNamesProperty': js.string(Emitter.FIELD_NAMES_PROPERTY_NAME),
- 'createNewIsolateFunction': createNewIsolateFunctionAccess,
- 'isolateName': namer.isolateName,
- 'classIdExtractor': classIdExtractorAccess,
- 'classFieldsExtractor': classFieldsExtractorAccess,
- 'instanceFromClassId': instanceFromClassIdAccess,
- 'initializeEmptyInstance': initializeEmptyInstanceAccess,
'allClasses': allClassesAccess,
'debugFastObjects': DEBUG_FAST_OBJECTS,
'isTreeShakingDisabled': backend.mirrorsData.isTreeShakingDisabled,
@@ -232,13 +211,11 @@
var str = "function " + name + "(";
var body = "";
- if (#hasIsolateSupport) { var fieldNames = ""; }
for (var i = 0; i < fields.length; i++) {
if(i != 0) str += ", ";
var field = generateAccessor(fields[i], accessors, name);
- if (#hasIsolateSupport) { fieldNames += "'" + field + "',"; }
var parameter = "p_" + field;
str += parameter;
body += ("this." + field + " = " + parameter + ";\\n");
@@ -253,39 +230,11 @@
if (typeof defineClass.name != "string") {
str += name + ".name=\\"" + name + "\\";\\n";
}
- if (#hasIsolateSupport) {
- str += name + "." + #fieldNamesProperty + "=[" + fieldNames
- + "];\\n";
- }
str += accessors.join("");
return str;
}
- if (#hasIsolateSupport) {
- #createNewIsolateFunction = function() { return new #isolateName(); };
-
- #classIdExtractor = function(o) { return o.constructor.name; };
-
- #classFieldsExtractor = function(o) {
- var fieldNames = o.constructor.#fieldNamesProperty;
- if (!fieldNames) return []; // TODO(floitsch): do something else here.
- var result = [];
- result.length = fieldNames.length;
- for (var i = 0; i < fieldNames.length; i++) {
- result[i] = o[fieldNames[i]];
- }
- return result;
- };
-
- #instanceFromClassId = function(name) { return new #allClasses[name](); };
-
- #initializeEmptyInstance = function(name, o, fields) {
- #allClasses[name].apply(o, fields);
- return o;
- }
- }
-
// If the browser supports changing the prototype via __proto__, we make
// use of that feature. Otherwise, we copy the properties into a new
// constructor.
@@ -629,7 +578,6 @@
} else if (typeof element === "function") {
globalObject[previousProperty = property] = element;
functions.push(property);
- #globalFunctions[property] = element;
} else if (element.constructor === Array) {
if (#needsStructuredMemberInfo) {
addStubs(globalObject, element, property, true, functions);
@@ -732,9 +680,7 @@
f = tearOff(funcs, array, isStatic, name, isIntercepted);
prototype[name].\$getter = f;
f.\$getterStub = true;
- // Used to create an isolate using spawnFunction.
if (isStatic) {
- #globalFunctions[name] = f;
functions.push(getterStubName);
}
prototype[getterStubName] = f;
@@ -795,7 +741,6 @@
if (!#mangledGlobalNames) #mangledGlobalNames = map();
if (!#statics) #statics = map();
if (!#typeInformation) #typeInformation = map();
- if (!#globalFunctions) #globalFunctions = map();
if (#enabledInvokeOn)
if (!#interceptedNames) #interceptedNames = #interceptedNamesSet;
var libraries = #libraries;
diff --git a/pkg/compiler/lib/src/js_emitter/main_call_stub_generator.dart b/pkg/compiler/lib/src/js_emitter/main_call_stub_generator.dart
index e32b7cc..e20f889 100644
--- a/pkg/compiler/lib/src/js_emitter/main_call_stub_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/main_call_stub_generator.dart
@@ -6,44 +6,18 @@
import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
-import '../common_elements.dart';
import '../elements/entities.dart';
import '../js/js.dart' as jsAst;
import '../js/js.dart' show js;
-import '../js_backend/backend_usage.dart' show BackendUsage;
import 'code_emitter_task.dart' show Emitter;
class MainCallStubGenerator {
- final CommonElements _commonElements;
- final Emitter _emitter;
- final BackendUsage _backendUsage;
-
- MainCallStubGenerator(
- this._commonElements, this._emitter, this._backendUsage);
-
- /// Returns the code equivalent to:
- /// `function(args) { $.startRootIsolate(X.main$closure(), args); }`
- jsAst.Expression _buildIsolateSetupClosure(
- FunctionEntity appMain, FunctionEntity isolateMain) {
- jsAst.Expression mainAccess = _emitter.isolateStaticClosureAccess(appMain);
- // Since we pass the closurized version of the main method to
- // the isolate method, we must make sure that it exists.
- return js('function(a){ #(#, a); }',
- [_emitter.staticFunctionAccess(isolateMain), mainAccess]);
- }
-
- jsAst.Statement generateInvokeMain(FunctionEntity main) {
- jsAst.Expression mainCallClosure = null;
- if (_backendUsage.isIsolateInUse) {
- FunctionEntity isolateMain = _commonElements.startRootIsolate;
- mainCallClosure = _buildIsolateSetupClosure(main, isolateMain);
- } else {
- mainCallClosure = _emitter.staticFunctionAccess(main);
- }
-
+ static jsAst.Statement generateInvokeMain(
+ Emitter emitter, FunctionEntity main) {
+ jsAst.Expression mainCallClosure = emitter.staticFunctionAccess(main);
jsAst.Expression currentScriptAccess =
- _emitter.generateEmbeddedGlobalAccess(embeddedNames.CURRENT_SCRIPT);
+ emitter.generateEmbeddedGlobalAccess(embeddedNames.CURRENT_SCRIPT);
// This code finds the currently executing script by listening to the
// onload event of all script tags and getting the first script which
diff --git a/pkg/compiler/lib/src/js_emitter/model.dart b/pkg/compiler/lib/src/js_emitter/model.dart
index 3634ee2..a66b830 100644
--- a/pkg/compiler/lib/src/js_emitter/model.dart
+++ b/pkg/compiler/lib/src/js_emitter/model.dart
@@ -16,7 +16,6 @@
final List<Holder> holders;
final bool outputContainsConstantList;
final bool needsNativeSupport;
- final bool hasIsolateSupport;
final bool hasSoftDeferredClasses;
/// A map from load id to the list of fragments that need to be loaded.
@@ -40,11 +39,9 @@
this.typeToInterceptorMap, this._metadataCollector, this.finalizers,
{this.needsNativeSupport,
this.outputContainsConstantList,
- this.hasIsolateSupport,
this.hasSoftDeferredClasses}) {
assert(needsNativeSupport != null);
assert(outputContainsConstantList != null);
- assert(hasIsolateSupport != null);
}
/// Accessor for the list of metadata entries for a given [OutputUnit].
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
index 87667ed..3a78a8f 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder/program_builder.dart
@@ -277,7 +277,6 @@
_buildTypeToInterceptorMap(), _task.metadataCollector, finalizers,
needsNativeSupport: needsNativeSupport,
outputContainsConstantList: collector.outputContainsConstantList,
- hasIsolateSupport: _backendUsage.isIsolateInUse,
hasSoftDeferredClasses: _notSoftDeferred != null);
}
@@ -391,10 +390,8 @@
js.Statement _buildInvokeMain() {
if (_isMockCompilation) return js.js.comment("Mock compilation");
-
- MainCallStubGenerator generator = new MainCallStubGenerator(
- _commonElements, _task.emitter, _backendUsage);
- return generator.generateInvokeMain(_mainFunction);
+ return MainCallStubGenerator.generateInvokeMain(
+ _task.emitter, _mainFunction);
}
DeferredFragment _buildDeferredFragment(LibrariesMap librariesMap) {
@@ -687,7 +684,6 @@
_rtiChecks,
_rtiEncoder,
_jsInteropAnalysis,
- _options.useKernel,
_options.strongMode);
void visitMember(MemberEntity member) {
@@ -744,6 +740,7 @@
if (!onlyForRti && !_elementEnvironment.isMixinApplication(cls)) {
List<MemberEntity> members = <MemberEntity>[];
_elementEnvironment.forEachLocalClassMember(cls, members.add);
+ _elementEnvironment.forEachInjectedClassMember(cls, members.add);
_elementEnvironment.forEachConstructorBody(cls, members.add);
_sorter.sortMembers(members).forEach(visitMember);
}
diff --git a/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart b/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
index a277091..b483325 100644
--- a/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
+++ b/pkg/compiler/lib/src/js_emitter/runtime_type_generator.dart
@@ -106,7 +106,6 @@
final RuntimeTypesChecks _rtiChecks;
final RuntimeTypesEncoder _rtiEncoder;
final JsInteropAnalysis _jsInteropAnalysis;
- final bool _useKernel;
final bool _strongMode;
RuntimeTypeGenerator(
@@ -118,7 +117,6 @@
this._rtiChecks,
this._rtiEncoder,
this._jsInteropAnalysis,
- this._useKernel,
this._strongMode);
/**
@@ -169,7 +167,7 @@
if (classFunctionType.signatureFunction != null) {
// Use precomputed signature function if live.
} else {
- assert(!_useKernel || !_strongMode);
+ assert(!_strongMode);
// Generate the signature on the fly. This is only supported for
// Dart 1.
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart
index 4d150cc..29fb797 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart
@@ -5,7 +5,7 @@
library dart2js.js_emitter.startup_emitter;
import 'package:js_runtime/shared/embedded_names.dart'
- show JsBuiltin, METADATA, STATIC_FUNCTION_NAME_TO_CLOSURE, TYPES;
+ show JsBuiltin, METADATA, TYPES;
import '../../common.dart';
import '../../compiler.dart' show Compiler;
@@ -162,11 +162,6 @@
String typesAccess = _emitter.generateEmbeddedGlobalAccessString(TYPES);
return js.js.expressionTemplateFor("$typesAccess[#]");
- case JsBuiltin.createDartClosureFromNameOfStaticFunction:
- String functionAccess = _emitter.generateEmbeddedGlobalAccessString(
- STATIC_FUNCTION_NAME_TO_CLOSURE);
- return js.js.expressionTemplateFor("$functionAccess(#)");
-
default:
reporter.internalError(
NO_LOCATION_SPANNABLE, "Unhandled Builtin: $builtin");
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 b47e96d..9bb77ff 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
@@ -1399,75 +1399,6 @@
js.string(TYPE_TO_INTERCEPTOR_MAP), program.typeToInterceptorMap));
}
- if (program.hasIsolateSupport) {
- String staticStateName = namer.staticStateHolder;
- // TODO(floitsch): this doesn't create a new isolate, but just reuses
- // the current static state. Since we don't run multiple isolates in the
- // same JavaScript context (except for testing) this shouldn't have any
- // impact on real-world programs, though.
- globals.add(new js.Property(js.string(CREATE_NEW_ISOLATE),
- js.js('function () { return $staticStateName; }')));
-
- js.Expression nameToClosureFunction = js.js('''
- // First fetch the static function. From there we can execute its
- // getter function which builds a Dart closure.
- function(name) {
- var staticFunction = getGlobalFromName(name);
- var getterFunction = staticFunction.$tearOffPropertyName;
- return getterFunction();
- }''');
- globals.add(new js.Property(
- js.string(STATIC_FUNCTION_NAME_TO_CLOSURE), nameToClosureFunction));
-
- globals.add(new js.Property(js.string(CLASS_ID_EXTRACTOR),
- js.js('function(o) { return o.constructor.name; }')));
-
- js.Expression extractFieldsFunction = js.js('''
- function(o) {
- var constructor = o.constructor;
- var fieldNames = constructor.$cachedClassFieldNames;
- if (!fieldNames) {
- // Extract the fields from an empty unmodified object.
- var empty = new constructor();
- // This gives us the keys that the constructor sets.
- fieldNames = constructor.$cachedClassFieldNames = Object.keys(empty);
- }
- var result = new Array(fieldNames.length);
- for (var i = 0; i < fieldNames.length; i++) {
- result[i] = o[fieldNames[i]];
- }
- return result;
- }''');
- globals.add(new js.Property(
- js.string(CLASS_FIELDS_EXTRACTOR), extractFieldsFunction));
-
- js.Expression createInstanceFromClassIdFunction = js.js('''
- function(name) {
- var constructor = getGlobalFromName(name);
- return new constructor();
- }
- ''');
- globals.add(new js.Property(js.string(INSTANCE_FROM_CLASS_ID),
- createInstanceFromClassIdFunction));
-
- js.Expression initializeEmptyInstanceFunction = js.js('''
- function(name, o, fields) {
- var constructor = o.constructor;
- // By construction the object `o` is an empty object with the same
- // keys as the one we used in the extract-fields function.
- var fieldNames = Object.keys(o);
- if (fieldNames.length != fields.length) {
- throw new Error("Mismatch during deserialization.");
- }
- for (var i = 0; i < fields.length; i++) {
- o[fieldNames[i]] = fields[i];
- }
- return o;
- }''');
- globals.add(new js.Property(js.string(INITIALIZE_EMPTY_INSTANCE),
- initializeEmptyInstanceFunction));
- }
-
globals.add(emitMangledGlobalNames());
// The [MANGLED_NAMES] table must contain the mapping for const symbols.
diff --git a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
index 5c5933a..f2ba354 100644
--- a/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
+++ b/pkg/compiler/lib/src/js_emitter/startup_emitter/model_emitter.dart
@@ -9,17 +9,12 @@
import 'package:js_runtime/shared/embedded_names.dart'
show
- CLASS_FIELDS_EXTRACTOR,
- CLASS_ID_EXTRACTOR,
- CREATE_NEW_ISOLATE,
DEFERRED_INITIALIZED,
DEFERRED_LIBRARY_PARTS,
DEFERRED_PART_URIS,
DEFERRED_PART_HASHES,
GET_TYPE_FROM_NAME,
- INITIALIZE_EMPTY_INSTANCE,
INITIALIZE_LOADED_HUNK,
- INSTANCE_FROM_CLASS_ID,
INTERCEPTORS_BY_TAG,
IS_HUNK_INITIALIZED,
IS_HUNK_LOADED,
@@ -28,7 +23,6 @@
MANGLED_NAMES,
METADATA,
NATIVE_SUPERCLASS_TAG_NAME,
- STATIC_FUNCTION_NAME_TO_CLOSURE,
TYPE_TO_INTERCEPTOR_MAP,
TYPES;
@@ -228,12 +222,11 @@
/// Generates a simple header that provides the compiler's build id.
js.Comment buildGeneratedBy() {
StringBuffer flavor = new StringBuffer();
- flavor.write(compiler.options.useKernel ? 'kernel FE' : 'ast FE');
+ flavor.write('fast startup emitter');
if (compiler.options.strongMode) flavor.write(', strong');
if (compiler.options.trustPrimitives) flavor.write(', trust primitives');
if (compiler.options.trustTypeAnnotations) flavor.write(', trust types');
if (compiler.options.omitImplicitChecks) flavor.write(', omit checks');
- flavor.write(', fast startup emitter');
if (compiler.options.useContentSecurityPolicy) flavor.write(', CSP');
return new js.Comment(generatedBy(compiler, flavor: '$flavor'));
}
diff --git a/pkg/compiler/lib/src/js_model/elements.dart b/pkg/compiler/lib/src/js_model/elements.dart
index fdda596..43e81b6 100644
--- a/pkg/compiler/lib/src/js_model/elements.dart
+++ b/pkg/compiler/lib/src/js_model/elements.dart
@@ -143,6 +143,10 @@
return new JConstructorBody(constructor);
}
+ JGeneratorBody createGeneratorBody(FunctionEntity function) {
+ return new JGeneratorBody(function);
+ }
+
IndexedFunction createGetter(LibraryEntity library,
ClassEntity enclosingClass, Name name, AsyncMarker asyncMarker,
{bool isStatic, bool isExternal, bool isAbstract}) {
@@ -498,6 +502,19 @@
String get _kind => 'method';
}
+class JGeneratorBody extends JFunction {
+ final FunctionEntity function;
+ final int hashCode;
+
+ JGeneratorBody(this.function)
+ : hashCode = function.hashCode + 1, // Hack stabilize sort order.
+ super(function.library, function.enclosingClass, function.memberName,
+ function.parameterStructure, function.asyncMarker,
+ isStatic: function.isStatic, isExternal: false);
+
+ String get _kind => 'generator_body';
+}
+
class JGetter extends JFunction {
final bool isAbstract;
diff --git a/pkg/compiler/lib/src/js_model/js_strategy.dart b/pkg/compiler/lib/src/js_model/js_strategy.dart
index 11fa8ee..c4c47a1 100644
--- a/pkg/compiler/lib/src/js_model/js_strategy.dart
+++ b/pkg/compiler/lib/src/js_model/js_strategy.dart
@@ -391,7 +391,6 @@
requiresPreamble: backendUsage.requiresPreamble,
isInvokeOnUsed: backendUsage.isInvokeOnUsed,
isRuntimeTypeUsed: backendUsage.isRuntimeTypeUsed,
- isIsolateInUse: backendUsage.isIsolateInUse,
isFunctionApplyUsed: backendUsage.isFunctionApplyUsed,
isMirrorsUsed: backendUsage.isMirrorsUsed,
isNoSuchMethodUsed: backendUsage.isNoSuchMethodUsed);
diff --git a/pkg/compiler/lib/src/js_model/locals.dart b/pkg/compiler/lib/src/js_model/locals.dart
index 8c7e543..1c1d2f6 100644
--- a/pkg/compiler/lib/src/js_model/locals.dart
+++ b/pkg/compiler/lib/src/js_model/locals.dart
@@ -14,6 +14,8 @@
import '../kernel/element_map.dart';
import '../kernel/indexed.dart';
+import '../js_model/elements.dart' show JGeneratorBody;
+
class GlobalLocalsMap {
Map<MemberEntity, KernelToLocalsMap> _localsMaps =
<MemberEntity, KernelToLocalsMap>{};
@@ -419,7 +421,9 @@
/// True if this local represents a local parameter.
final bool isRegularParameter;
- JLocal(this.name, this.memberContext, {this.isRegularParameter: false});
+ JLocal(this.name, this.memberContext, {this.isRegularParameter: false}) {
+ assert(memberContext is! JGeneratorBody);
+ }
String get _kind => 'local';
diff --git a/pkg/compiler/lib/src/kernel/element_map.dart b/pkg/compiler/lib/src/kernel/element_map.dart
index d6167ba..fe468dd 100644
--- a/pkg/compiler/lib/src/kernel/element_map.dart
+++ b/pkg/compiler/lib/src/kernel/element_map.dart
@@ -17,6 +17,7 @@
import '../js_backend/native_data.dart';
import '../js_emitter/code_emitter_task.dart';
import '../js_model/closure.dart' show JRecordField, KernelScopeInfo;
+import '../js_model/elements.dart' show JGeneratorBody;
import '../native/native.dart' as native;
import '../ssa/type_builder.dart';
import '../types/types.dart';
@@ -124,6 +125,7 @@
/// Interface that translates between Kernel IR nodes and entities used for
/// computing the [WorldImpact] for members.
abstract class KernelToElementMapForImpact extends KernelToElementMap {
+ ElementEnvironment get elementEnvironment;
NativeBasicData get nativeBasicData;
/// Adds libraries in [component] to the set of libraries.
@@ -236,6 +238,9 @@
/// Returns the constructor body entity corresponding to [constructor].
FunctionEntity getConstructorBody(ir.Constructor node);
+ /// Returns the constructor body entity corresponding to [function].
+ JGeneratorBody getGeneratorBody(FunctionEntity function);
+
/// Make a record to ensure variables that are are declared in one scope and
/// modified in another get their values updated correctly.
Map<Local, JRecordField> makeRecordContainer(
@@ -261,6 +266,8 @@
// the closure class. It does not have a corresponding ir.Node or a method
// body.
signature,
+ // A separated body of a generator (sync*/async/async*) function.
+ generatorBody,
}
/// Definition information for a [MemberEntity].
diff --git a/pkg/compiler/lib/src/kernel/element_map_impl.dart b/pkg/compiler/lib/src/kernel/element_map_impl.dart
index 1a73d22..8a70896 100644
--- a/pkg/compiler/lib/src/kernel/element_map_impl.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_impl.dart
@@ -748,6 +748,13 @@
});
}
+ void _forEachInjectedClassMember(
+ IndexedClass cls, void f(MemberEntity member)) {
+ assert(checkFamily(cls));
+ throw new UnsupportedError(
+ 'KernelToElementMapBase._forEachInjectedClassMember');
+ }
+
void _forEachClassMember(
IndexedClass cls, void f(ClassEntity cls, MemberEntity member)) {
assert(checkFamily(cls));
@@ -1373,7 +1380,7 @@
/// Returns the element type of a async/sync*/async* function.
@override
DartType getFunctionAsyncOrSyncStarElementType(ir.FunctionNode functionNode) {
- DartType returnType = getFunctionType(functionNode).returnType;
+ DartType returnType = getDartType(functionNode.returnType);
switch (functionNode.asyncMarker) {
case ir.AsyncMarker.SyncStar:
return elementEnvironment.getAsyncOrSyncStarElementType(
@@ -1471,6 +1478,7 @@
@override
DartType getFunctionAsyncOrSyncStarElementType(FunctionEntity function) {
+ // TODO(sra): Should be getting the DartType from the node.
DartType returnType = getFunctionType(function).returnType;
return getAsyncOrSyncStarElementType(function.asyncMarker, returnType);
}
@@ -1581,6 +1589,12 @@
}
@override
+ void forEachInjectedClassMember(
+ ClassEntity cls, void f(MemberEntity member)) {
+ elementMap._forEachInjectedClassMember(cls, f);
+ }
+
+ @override
void forEachClassMember(
ClassEntity cls, void f(ClassEntity declarer, MemberEntity member)) {
elementMap._forEachClassMember(cls, f);
@@ -2257,6 +2271,12 @@
NativeBasicData nativeBasicData;
+ Map<FunctionEntity, JGeneratorBody> _generatorBodies =
+ <FunctionEntity, JGeneratorBody>{};
+
+ Map<ClassEntity, List<MemberEntity>> _injectedClassMembers =
+ <ClassEntity, List<MemberEntity>>{};
+
JsKernelToElementMap(
DiagnosticReporter reporter,
Environment environment,
@@ -2514,6 +2534,11 @@
env.forEachConstructorBody(f);
}
+ void _forEachInjectedClassMember(
+ IndexedClass cls, void f(MemberEntity member)) {
+ _injectedClassMembers[cls]?.forEach(f);
+ }
+
JRecordField _constructRecordFieldEntry(
InterfaceType memberThisType,
ir.VariableDeclaration variable,
@@ -2911,6 +2936,31 @@
String _getClosureVariableName(String name, int id) {
return "_captured_${name}_$id";
}
+
+ JGeneratorBody getGeneratorBody(covariant IndexedFunction function) {
+ FunctionData functionData = _members.getData(function);
+ ir.TreeNode node = functionData.definition.node;
+ // TODO(sra): Maybe store this in the FunctionData.
+ JGeneratorBody generatorBody = _generatorBodies[function];
+ if (generatorBody == null) {
+ generatorBody = createGeneratorBody(function);
+ _members.register<IndexedFunction, FunctionData>(
+ generatorBody,
+ new GeneratorBodyFunctionData(
+ functionData,
+ new SpecialMemberDefinition(
+ generatorBody, node, MemberKind.generatorBody)));
+
+ if (function.enclosingClass != null) {
+ // TODO(sra): Integrate this with ClassEnvImpl.addConstructorBody ?
+ (_injectedClassMembers[function.enclosingClass] ??= <MemberEntity>[])
+ .add(generatorBody);
+ }
+ }
+ return generatorBody;
+ }
+
+ JGeneratorBody createGeneratorBody(FunctionEntity function);
}
class KernelClassQueries extends ClassQueries {
diff --git a/pkg/compiler/lib/src/kernel/env.dart b/pkg/compiler/lib/src/kernel/env.dart
index da925b6..c9b9d93 100644
--- a/pkg/compiler/lib/src/kernel/env.dart
+++ b/pkg/compiler/lib/src/kernel/env.dart
@@ -829,6 +829,44 @@
}
}
+abstract class DelegatedFunctionData implements FunctionData {
+ final FunctionData baseData;
+
+ DelegatedFunctionData(this.baseData);
+
+ FunctionType getFunctionType(covariant KernelToElementMapBase elementMap) {
+ return baseData.getFunctionType(elementMap);
+ }
+
+ List<TypeVariableType> getFunctionTypeVariables(
+ KernelToElementMap elementMap) {
+ return baseData.getFunctionTypeVariables(elementMap);
+ }
+
+ void forEachParameter(KernelToElementMapForBuilding elementMap,
+ void f(DartType type, String name, ConstantValue defaultValue)) {
+ return baseData.forEachParameter(elementMap, f);
+ }
+
+ @override
+ Iterable<ConstantValue> getMetadata(KernelToElementMap elementMap) {
+ return const <ConstantValue>[];
+ }
+
+ InterfaceType getMemberThisType(KernelToElementMapForBuilding elementMap) {
+ return baseData.getMemberThisType(elementMap);
+ }
+
+ ClassTypeVariableAccess get classTypeVariableAccess =>
+ baseData.classTypeVariableAccess;
+}
+
+class GeneratorBodyFunctionData extends DelegatedFunctionData {
+ final MemberDefinition definition;
+ GeneratorBodyFunctionData(FunctionData baseData, this.definition)
+ : super(baseData);
+}
+
abstract class ConstructorData extends FunctionData {
ConstantConstructor getConstructorConstant(
KernelToElementMapBase elementMap, ConstructorEntity constructor);
diff --git a/pkg/compiler/lib/src/options.dart b/pkg/compiler/lib/src/options.dart
index 53fa292..dde23a9 100644
--- a/pkg/compiler/lib/src/options.dart
+++ b/pkg/compiler/lib/src/options.dart
@@ -226,20 +226,7 @@
/// Whether to generate code compliant with content security policy (CSP).
bool useContentSecurityPolicy = false;
- /// Preview the unified front-end and compilation from kernel.
- ///
- /// When enabled the compiler will use the unified front-end to compile
- /// sources to kernel, and then continue compilation from the kernel
- /// representation.
- ///
- /// When this flag is on, the compiler also accepts reading .dill files from
- /// disk. The compiler reads the sources differently depending on the
- /// extension format.
- bool useKernel = true;
-
/// Enables strong mode in dart2js.
- ///
- /// This is work-in-progress and will only be supported for [useKernel].
bool strongMode = false;
/// When obfuscating for minification, whether to use the frequency of a name
@@ -343,7 +330,6 @@
..trustTypeAnnotations = _hasOption(options, Flags.trustTypeAnnotations)
..useContentSecurityPolicy =
_hasOption(options, Flags.useContentSecurityPolicy)
- ..useKernel = !_hasOption(options, Flags.useOldFrontend)
..useFrequencyNamer =
!_hasOption(options, Flags.noFrequencyBasedMinification)
..useMultiSourceInfo = _hasOption(options, Flags.useMultiSourceInfo)
@@ -370,7 +356,7 @@
if (packageRoot != null && !packageRoot.path.endsWith("/")) {
throw new ArgumentError("[packageRoot] must end with a /");
}
- if (useKernel && platformBinaries == null) {
+ if (platformBinaries == null) {
throw new ArgumentError("Missing required ${Flags.platformBinaries}");
}
}
@@ -386,7 +372,8 @@
trustTypeAnnotations = true;
}
}
- if (useKernel) generateCodeWithCompileTimeErrors = false;
+ // TODO(johnniwinther): Should we support this in the future?
+ generateCodeWithCompileTimeErrors = false;
if (platformConfigUri == null) {
platformConfigUri = _resolvePlatformConfig(libraryRoot, null, const []);
}
diff --git a/pkg/compiler/lib/src/resolution/resolution_strategy.dart b/pkg/compiler/lib/src/resolution/resolution_strategy.dart
index 06718ca..0b51c6f 100644
--- a/pkg/compiler/lib/src/resolution/resolution_strategy.dart
+++ b/pkg/compiler/lib/src/resolution/resolution_strategy.dart
@@ -552,6 +552,10 @@
}
@override
+ void forEachInjectedClassMember(
+ covariant ClassElement cls, void f(MemberElement member)) {}
+
+ @override
void forEachClassMember(covariant ClassElement cls,
void f(ClassElement declarer, MemberElement member)) {
cls.ensureResolved(_resolution);
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
index a18d29f..2616b59 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -2837,23 +2837,10 @@
node, 'Too many arguments to JS_CURRENT_ISOLATE_CONTEXT.');
}
- if (!backendUsage.isIsolateInUse) {
- // If the isolate library is not used, we just generate code
- // to fetch the static state.
- String name = namer.staticStateHolder;
- push(new HForeignCode(
- js.js.parseForeignJS(name), commonMasks.dynamicType, <HInstruction>[],
- nativeBehavior: native.NativeBehavior.DEPENDS_OTHER));
- } else {
- // Call a helper method from the isolate library. The isolate
- // library uses its own isolate structure, that encapsulates
- // Leg's isolate.
- MethodElement element = commonElements.currentIsolate;
- if (element == null) {
- reporter.internalError(node, 'Isolate library and compiler mismatch.');
- }
- pushInvokeStatic(null, element, [], typeMask: commonMasks.dynamicType);
- }
+ String name = namer.staticStateHolder;
+ push(new HForeignCode(
+ js.js.parseForeignJS(name), commonMasks.dynamicType, <HInstruction>[],
+ nativeBehavior: native.NativeBehavior.DEPENDS_OTHER));
}
void handleForeignJsGetFlag(ast.Send node) {
@@ -3025,27 +3012,6 @@
stack.add(graph.addConstantNull(closedWorld));
}
- void handleForeignJsCallInIsolate(ast.Send node) {
- Link<ast.Node> link = node.arguments;
- if (!backendUsage.isIsolateInUse) {
- // If the isolate library is not used, we just invoke the
- // closure.
- visit(link.tail.head);
- push(new HInvokeClosure(new Selector.callClosure(0),
- <HInstruction>[pop()], commonMasks.dynamicType, const <DartType>[]));
- } else {
- // Call a helper method from the isolate library.
- MethodElement element = commonElements.callInIsolate;
- if (element == null) {
- reporter.internalError(node, 'Isolate library and compiler mismatch.');
- }
- List<HInstruction> inputs = <HInstruction>[];
- addGenericSendArgumentsToList(link, inputs);
- pushInvokeStatic(node, element, inputs,
- typeMask: commonMasks.dynamicType);
- }
- }
-
FunctionSignature handleForeignRawFunctionRef(ast.Send node, String name) {
if (node.arguments.isEmpty || !node.arguments.tail.isEmpty) {
reporter.internalError(
@@ -3115,8 +3081,6 @@
handleForeignJs(node);
} else if (name == 'JS_CURRENT_ISOLATE_CONTEXT') {
handleForeignJsCurrentIsolateContext(node);
- } else if (name == 'JS_CALL_IN_ISOLATE') {
- handleForeignJsCallInIsolate(node);
} else if (name == 'DART_CLOSURE_TO_JS') {
handleForeignDartClosureToJs(node, 'DART_CLOSURE_TO_JS');
} else if (name == 'RAW_DART_FUNCTION_REF') {
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index b22a63e..6836904 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -30,6 +30,7 @@
import '../js_emitter/js_emitter.dart' show NativeEmitter;
import '../js_model/locals.dart'
show forEachOrderedParameter, GlobalLocalsMap, JumpVisitor;
+import '../js_model/elements.dart' show JGeneratorBody;
import '../kernel/element_map.dart';
import '../kernel/kernel_backend_strategy.dart';
import '../native/native.dart' as native;
@@ -70,6 +71,7 @@
class KernelSsaGraphBuilder extends ir.Visitor
with GraphBuilder, SsaBuilderFieldMixin {
final MemberEntity targetElement;
+ final MemberEntity initialTargetElement;
final ClosedWorld closedWorld;
final CodegenWorldBuilder _worldBuilder;
@@ -124,7 +126,7 @@
StackFrame _currentFrame;
KernelSsaGraphBuilder(
- this.targetElement,
+ this.initialTargetElement,
InterfaceType instanceType,
this.compiler,
this._elementMap,
@@ -136,7 +138,8 @@
this.closureDataLookup,
this.nativeEmitter,
this._sourceInformationStrategy)
- : _infoReporter = compiler.dumpInfoTask {
+ : this.targetElement = _effectiveTargetElementFor(initialTargetElement),
+ _infoReporter = compiler.dumpInfoTask {
_enterFrame(targetElement);
this.loopHandler = new KernelLoopHandler(this);
typeBuilder = new KernelTypeBuilder(this, _elementMap, _globalLocalsMap);
@@ -157,6 +160,11 @@
SourceInformationBuilder get _sourceInformationBuilder =>
_currentFrame.sourceInformationBuilder;
+ static MemberEntity _effectiveTargetElementFor(MemberEntity member) {
+ if (member is JGeneratorBody) return member.function;
+ return member;
+ }
+
void _enterFrame(MemberEntity member) {
AsyncMarker asyncMarker = AsyncMarker.SYNC;
ir.FunctionNode function = getFunctionNode(_elementMap, member);
@@ -183,7 +191,7 @@
// TODO(het): no reason to do this here...
HInstruction.idCounter = 0;
MemberDefinition definition =
- _elementMap.getMemberDefinition(targetElement);
+ _elementMap.getMemberDefinition(initialTargetElement);
switch (definition.kind) {
case MemberKind.regular:
@@ -247,6 +255,10 @@
}
buildMethodSignature(originalClosureNode);
break;
+ case MemberKind.generatorBody:
+ buildGeneratorBody(
+ initialTargetElement, _functionNodeOf(definition.node));
+ break;
}
assert(graph.isValid());
@@ -269,6 +281,13 @@
});
}
+ ir.FunctionNode _functionNodeOf(ir.TreeNode node) {
+ if (node is ir.Member) return node.function;
+ if (node is ir.FunctionDeclaration) return node.function;
+ if (node is ir.FunctionExpression) return node.function;
+ return null;
+ }
+
ir.FunctionNode _ensureDefaultArgumentValues(ir.FunctionNode function) {
// Register all [function]'s default argument values.
//
@@ -386,8 +405,8 @@
// Unused, so bind to `dynamic`.
param = graph.addConstantNull(closedWorld);
}
- localsHandler.directLocals[
- localsHandler.getTypeVariableAsLocal(typeVariableType)] = param;
+ Local local = localsHandler.getTypeVariableAsLocal(typeVariableType);
+ localsHandler.directLocals[local] = param;
});
}
@@ -414,11 +433,14 @@
// Unused, so bind to `dynamic`.
param = graph.addConstantNull(closedWorld);
}
- localsHandler.directLocals[
- localsHandler.getTypeVariableAsLocal(typeVariableType)] = param;
+ Local local = localsHandler.getTypeVariableAsLocal(typeVariableType);
+ localsHandler.directLocals[local] = param;
+ functionTypeParameterLocals.add(local);
});
}
+ List<Local> functionTypeParameterLocals = <Local>[];
+
/// Builds a generative constructor.
///
/// Generative constructors are built in stages, in effect inlining the
@@ -622,7 +644,6 @@
void _invokeConstructorBody(ir.Constructor constructor,
List<HInstruction> inputs, SourceInformation sourceInformation) {
- // TODO(sra): Inline the constructor body.
MemberEntity constructorBody = _elementMap.getConstructorBody(constructor);
HInvokeConstructorBody invoke = new HInvokeConstructorBody(
constructorBody, inputs, commonMasks.nonNullType, sourceInformation);
@@ -941,6 +962,11 @@
/// Procedures.
void buildFunctionNode(
FunctionEntity function, ir.FunctionNode functionNode) {
+ if (functionNode.asyncMarker != ir.AsyncMarker.Sync) {
+ buildGenerator(function, functionNode);
+ return;
+ }
+
openFunction(function, functionNode);
// If [functionNode] is `operator==` we explicitly add a null check at the
@@ -968,6 +994,78 @@
closeFunction();
}
+ /// Builds a SSA graph for a sync*/async/async* generator.
+ void buildGenerator(FunctionEntity function, ir.FunctionNode functionNode) {
+ // TODO(sra): Optimize by generating a merged entry + body when (1) there
+ // are no checks in the entry and (2) the element type is simple.
+ if (true == true) {
+ buildGeneratorEntry(function, functionNode);
+ } else {
+ openFunction(function, functionNode);
+ functionNode.body.accept(this);
+ closeFunction();
+ }
+ }
+
+ /// Builds a SSA graph for a sync*/async/async* generator body.
+ void buildGeneratorEntry(
+ FunctionEntity function, ir.FunctionNode functionNode) {
+ graph.isGeneratorEntry = true;
+
+ // TODO(sra): Omit entry checks.
+ openFunction(function, functionNode);
+
+ // Generate type argument for generator class.
+
+ // Tail-call body.
+ JGeneratorBody body = _elementMap.getGeneratorBody(function);
+ backend.outputUnitData.registerColocatedMembers(function, body);
+
+ // Is 'buildAsyncBody' the best location for the entry?
+ var sourceInformation = _sourceInformationBuilder.buildAsyncBody();
+
+ // Forward all the parameters.
+ List<HInstruction> inputs = <HInstruction>[];
+ if (graph.thisInstruction != null) {
+ inputs.add(graph.thisInstruction);
+ }
+ if (graph.explicitReceiverParameter != null) {
+ inputs.add(graph.explicitReceiverParameter);
+ }
+ for (Local local in parameters.keys) {
+ inputs.add(localsHandler.readLocal(local));
+ }
+ for (Local local in functionTypeParameterLocals) {
+ inputs.add(localsHandler.readLocal(local));
+ }
+
+ // Add the type parameter for the generator's element type.
+ DartType elementType = _elementMap.elementEnvironment
+ .getAsyncOrSyncStarElementType(function.asyncMarker, _returnType);
+ inputs.add(typeBuilder.analyzeTypeArgument(elementType, function));
+
+ push(new HInvokeGeneratorBody(
+ body,
+ inputs,
+ commonMasks.dynamicType, // TODO: better type.
+ sourceInformation));
+
+ closeAndGotoExit(
+ new HReturn(abstractValueDomain, pop(), sourceInformation));
+
+ closeFunction();
+ }
+
+ /// Builds a SSA graph for a sync*/async/async* generator body.
+ void buildGeneratorBody(
+ JGeneratorBody function, ir.FunctionNode functionNode) {
+ // TODO(sra): Omit entry checks.
+ FunctionEntity entry = function.function;
+ openFunction(entry, functionNode);
+ functionNode.body.accept(this);
+ closeFunction();
+ }
+
void _potentiallyAddFunctionParameterTypeChecks(ir.FunctionNode function) {
// Put the type checks in the first successor of the entry,
// because that is where the type guards will also be inserted.
@@ -999,7 +1097,8 @@
}
void checkTypeVariableBounds(FunctionEntity method) {
- if (rtiNeed.methodNeedsTypeArguments(method)) {
+ if (rtiNeed.methodNeedsTypeArguments(method) &&
+ options.parameterCheckPolicy.isEmitted) {
ir.FunctionNode function = getFunctionNode(_elementMap, method);
for (ir.TypeParameter typeParameter in function.typeParameters) {
Local local = localsMap.getLocalTypeVariable(
@@ -3104,6 +3203,13 @@
return;
}
FunctionEntity function = _elementMap.getMember(target);
+
+ if (options.strongMode &&
+ function == _commonElements.extractTypeArguments &&
+ handleExtractTypeArguments(node, sourceInformation)) {
+ return;
+ }
+
TypeMask typeMask = _typeInferenceMap.getReturnTypeOf(function);
List<DartType> typeArguments =
@@ -3306,15 +3412,78 @@
}
}
+ /// Replace calls to `extractTypeArguments` with equivalent code. Returns
+ /// `true` if `extractTypeArguments` is handled.
+ bool handleExtractTypeArguments(
+ ir.StaticInvocation invocation, SourceInformation sourceInformation) {
+ // Expand calls as follows:
+ //
+ // r = extractTypeArguments<Map>(e, f)
+ // -->
+ // interceptor = getInterceptor(e);
+ // T1 = getRuntimeTypeArgumentIntercepted(interceptor, e, 'Map', 0);
+ // T2 = getRuntimeTypeArgumentIntercepted(interceptor, e, 'Map', 1);
+ // r = f<T1, T2>();
+ //
+ // TODO(sra): Should we add a check before the variable extraction? We could
+ // add a type check (which would permit `null`), or add an is-check with an
+ // explicit throw.
+
+ if (invocation.arguments.positional.length != 2) return false;
+ if (invocation.arguments.named.isNotEmpty) return false;
+ var types = invocation.arguments.types;
+ if (types.length != 1) return false;
+
+ // The type should be a single type name.
+ ir.DartType type = types.first;
+ DartType typeValue =
+ localsHandler.substInContext(_elementMap.getDartType(type));
+ if (typeValue is! InterfaceType) return false;
+ InterfaceType interfaceType = typeValue;
+ if (!interfaceType.treatAsRaw) return false;
+
+ ClassEntity cls = interfaceType.element;
+ InterfaceType thisType = _elementMap.elementEnvironment.getThisType(cls);
+
+ List<HInstruction> arguments =
+ _visitPositionalArguments(invocation.arguments);
+
+ HInstruction object = arguments[0];
+ HInstruction closure = arguments[1];
+ HInstruction interceptor = _interceptorFor(object, sourceInformation);
+
+ List<HInstruction> inputs = <HInstruction>[closure];
+ List<DartType> typeArguments = <DartType>[];
+
+ thisType.typeArguments.forEach((_typeVariable) {
+ TypeVariableType variable = _typeVariable;
+ typeArguments.add(variable);
+ HInstruction readType = new HTypeInfoReadVariable.intercepted(
+ variable, interceptor, object, commonMasks.dynamicType);
+ add(readType);
+ inputs.add(readType);
+ });
+
+ // TODO(sra): In compliance mode, insert a check that [closure] is a
+ // function of N type arguments.
+
+ Selector selector =
+ new Selector.callClosure(0, const <String>[], typeArguments.length);
+ push(new HInvokeClosure(
+ selector, inputs, commonMasks.dynamicType, typeArguments));
+
+ return true;
+ }
+
void handleInvokeStaticForeign(
ir.StaticInvocation invocation, ir.Procedure target) {
String name = target.name.name;
if (name == 'JS') {
handleForeignJs(invocation);
} else if (name == 'JS_CURRENT_ISOLATE_CONTEXT') {
+ // TODO(sigmund): delete. The only reference left to this foreign function
+ // is from the deprecated dart:mirrors code.
handleForeignJsCurrentIsolateContext(invocation);
- } else if (name == 'JS_CALL_IN_ISOLATE') {
- handleForeignJsCallInIsolate(invocation);
} else if (name == 'DART_CLOSURE_TO_JS') {
handleForeignDartClosureToJs(invocation, 'DART_CLOSURE_TO_JS');
} else if (name == 'RAW_DART_FUNCTION_REF') {
@@ -3427,57 +3596,12 @@
return;
}
- if (!backendUsage.isIsolateInUse) {
- // If the isolate library is not used, we just generate code
- // to fetch the static state.
- String name = namer.staticStateHolder;
- push(new HForeignCode(
- js.js.parseForeignJS(name), commonMasks.dynamicType, <HInstruction>[],
- nativeBehavior: native.NativeBehavior.DEPENDS_OTHER));
- } else {
- // Call a helper method from the isolate library. The isolate library uses
- // its own isolate structure that encapsulates the isolate structure used
- // for binding to methods.
- FunctionEntity target = _commonElements.currentIsolate;
- if (target == null) {
- reporter.internalError(
- _elementMap.getSpannable(targetElement, invocation),
- 'Isolate library and compiler mismatch.');
- }
- _pushStaticInvocation(target, <HInstruction>[], commonMasks.dynamicType,
- const <DartType>[]);
- }
- }
-
- void handleForeignJsCallInIsolate(ir.StaticInvocation invocation) {
- if (_unexpectedForeignArguments(invocation,
- minPositional: 2, maxPositional: 2)) {
- // Result expected on stack.
- stack.add(graph.addConstantNull(closedWorld));
- return;
- }
-
- List<HInstruction> inputs = _visitPositionalArguments(invocation.arguments);
-
- if (!backendUsage.isIsolateInUse) {
- // If the isolate library is not used, we ignore the isolate argument and
- // just invoke the closure.
- push(new HInvokeClosure(
- new Selector.callClosure(0),
- <HInstruction>[inputs[1]],
- commonMasks.dynamicType,
- const <DartType>[]));
- } else {
- // Call a helper method from the isolate library.
- FunctionEntity callInIsolate = _commonElements.callInIsolate;
- if (callInIsolate == null) {
- reporter.internalError(
- _elementMap.getSpannable(targetElement, invocation),
- 'Isolate library and compiler mismatch.');
- }
- _pushStaticInvocation(
- callInIsolate, inputs, commonMasks.dynamicType, const <DartType>[]);
- }
+ // Isolates cannot be spawned, so we just generate code to fetch the static
+ // state.
+ String name = namer.staticStateHolder;
+ push(new HForeignCode(
+ js.js.parseForeignJS(name), commonMasks.dynamicType, <HInstruction>[],
+ nativeBehavior: native.NativeBehavior.DEPENDS_OTHER));
}
void handleForeignDartClosureToJs(
diff --git a/pkg/compiler/lib/src/ssa/codegen.dart b/pkg/compiler/lib/src/ssa/codegen.dart
index fc0c71b..49cf09b 100644
--- a/pkg/compiler/lib/src/ssa/codegen.dart
+++ b/pkg/compiler/lib/src/ssa/codegen.dart
@@ -23,6 +23,7 @@
import '../js_backend/namer.dart';
import '../js_backend/runtime_types.dart';
import '../js_emitter/code_emitter_task.dart';
+import '../js_model/elements.dart' show JGeneratorBody;
import '../native/native.dart' as native;
import '../options.dart';
import '../types/abstract_value_domain.dart';
@@ -47,20 +48,24 @@
String get name => 'SSA code generator';
- js.Fun buildJavaScriptFunction(
- FunctionEntity element, List<js.Parameter> parameters, js.Block body) {
- js.AsyncModifier asyncModifier = element.asyncMarker.isAsync
+ js.Fun buildJavaScriptFunction(bool isGeneratorEntry, FunctionEntity element,
+ List<js.Parameter> parameters, js.Block body) {
+ js.Fun finish(js.AsyncModifier asyncModifier) {
+ return new js.Fun(parameters, body, asyncModifier: asyncModifier)
+ .withSourceInformation(sourceInformationFactory
+ .createBuilderForContext(element)
+ .buildDeclaration(element));
+ }
+
+ if (isGeneratorEntry) return finish(const js.AsyncModifier.sync());
+
+ return finish(element.asyncMarker.isAsync
? (element.asyncMarker.isYielding
? const js.AsyncModifier.asyncStar()
: const js.AsyncModifier.async())
: (element.asyncMarker.isYielding
? const js.AsyncModifier.syncStar()
- : const js.AsyncModifier.sync());
-
- return new js.Fun(parameters, body, asyncModifier: asyncModifier)
- .withSourceInformation(sourceInformationFactory
- .createBuilderForContext(element)
- .buildDeclaration(element));
+ : const js.AsyncModifier.sync()));
}
js.Expression generateCode(
@@ -118,8 +123,8 @@
work);
codegen.visitGraph(graph);
backend.tracer.traceGraph("codegen", graph);
- return buildJavaScriptFunction(
- work.element, codegen.parameters, codegen.body);
+ return buildJavaScriptFunction(graph.isGeneratorEntry, work.element,
+ codegen.parameters, codegen.body);
});
}
}
@@ -1782,6 +1787,27 @@
node.element, new CallStructure.unnamed(arguments.length)));
}
+ void visitInvokeGeneratorBody(HInvokeGeneratorBody node) {
+ JGeneratorBody element = node.element;
+ if (element.isInstanceMember) {
+ use(node.inputs[0]);
+ js.Expression object = pop();
+ List<js.Expression> arguments = visitArguments(node.inputs);
+ js.Name methodName = _namer.instanceMethodName(element);
+ push(js
+ .propertyCall(object, methodName, arguments)
+ .withSourceInformation(node.sourceInformation));
+ } else {
+ push(_emitter.staticFunctionAccess(element));
+ List<js.Expression> arguments = visitArguments(node.inputs, start: 0);
+ push(new js.Call(pop(), arguments,
+ sourceInformation: node.sourceInformation));
+ }
+
+ _registry
+ .registerStaticUse(new StaticUse.generatorBodyInvoke(node.element));
+ }
+
void visitOneShotInterceptor(HOneShotInterceptor node) {
List<js.Expression> arguments = visitArguments(node.inputs);
var isolate = new js.VariableUse(
diff --git a/pkg/compiler/lib/src/ssa/kernel_impact.dart b/pkg/compiler/lib/src/ssa/kernel_impact.dart
index 735c58e..7b93861 100644
--- a/pkg/compiler/lib/src/ssa/kernel_impact.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_impact.dart
@@ -397,6 +397,11 @@
handleNew(node, node.target, isConst: node.isConst);
} else {
FunctionEntity target = elementMap.getMethod(node.target);
+ if (_options.strongMode &&
+ target == commonElements.extractTypeArguments) {
+ _handleExtractTypeArguments(node, target);
+ return;
+ }
List<DartType> typeArguments = _visitArguments(node.arguments);
impactBuilder.registerStaticUse(new StaticUse.staticInvoke(
target, elementMap.getCallStructure(node.arguments), typeArguments));
@@ -426,6 +431,35 @@
}
}
+ void _handleExtractTypeArguments(
+ ir.StaticInvocation node, FunctionEntity target) {
+ // extractTypeArguments<Map>(obj, fn) has additional impacts:
+ //
+ // 1. All classes implementing Map need to carry type arguments (similar
+ // to checking `o is Map<K, V>`).
+ //
+ // 2. There is an invocation of fn with some number of type arguments.
+ //
+ List<DartType> typeArguments = _visitArguments(node.arguments);
+ impactBuilder.registerStaticUse(new StaticUse.staticInvoke(
+ target, elementMap.getCallStructure(node.arguments), typeArguments));
+
+ if (typeArguments.length != 1) return;
+ DartType matchedType = typeArguments.first;
+
+ if (matchedType is! InterfaceType) return;
+ InterfaceType interfaceType = matchedType;
+ ClassEntity cls = interfaceType.element;
+ InterfaceType thisType = elementMap.elementEnvironment.getThisType(cls);
+
+ impactBuilder.registerTypeUse(new TypeUse.isCheck(thisType));
+
+ Selector selector = new Selector.callClosure(
+ 0, const <String>[], thisType.typeArguments.length);
+ impactBuilder.registerDynamicUse(
+ new ConstrainedDynamicUse(selector, null, thisType.typeArguments));
+ }
+
@override
void visitStaticGet(ir.StaticGet node) {
ir.Member target = node.target;
diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart
index a42c238..7d6720a 100644
--- a/pkg/compiler/lib/src/ssa/nodes.dart
+++ b/pkg/compiler/lib/src/ssa/nodes.dart
@@ -60,6 +60,7 @@
R visitInvokeStatic(HInvokeStatic node);
R visitInvokeSuper(HInvokeSuper node);
R visitInvokeConstructorBody(HInvokeConstructorBody node);
+ R visitInvokeGeneratorBody(HInvokeGeneratorBody node);
R visitIs(HIs node);
R visitIsViaInterceptor(HIsViaInterceptor node);
R visitLazyStatic(HLazyStatic node);
@@ -206,10 +207,15 @@
HBasicBlock exit;
HThis thisInstruction;
+ /// `true` if a sync*/async/async* method is split into an entry and a body
+ /// and this graph is for the entry, which should not be rewritten.
+ bool isGeneratorEntry = false;
+
/// Receiver parameter, set for methods using interceptor calling convention.
HParameterValue explicitReceiverParameter;
bool isRecursiveMethod = false;
bool calledInLoop = false;
+
final List<HBasicBlock> blocks = <HBasicBlock>[];
/// Nodes containing list allocations for which there is a known fixed length.
@@ -414,6 +420,8 @@
visitInvokeClosure(HInvokeClosure node) => visitInvokeDynamic(node);
visitInvokeConstructorBody(HInvokeConstructorBody node) =>
visitInvokeStatic(node);
+ visitInvokeGeneratorBody(HInvokeGeneratorBody node) =>
+ visitInvokeStatic(node);
visitInvokeDynamicMethod(HInvokeDynamicMethod node) =>
visitInvokeDynamic(node);
visitInvokeDynamicGetter(HInvokeDynamicGetter node) =>
@@ -1821,6 +1829,25 @@
accept(HVisitor visitor) => visitor.visitInvokeConstructorBody(this);
}
+class HInvokeGeneratorBody extends HInvokeStatic {
+ // Directly call the JGeneratorBody method. The generator body can be a static
+ // method or a member. The target is directly called.
+ // The 'inputs' are
+ // [arg1, ..., argN] or
+ // [receiver, arg1, ..., argN] or
+ // [interceptor, receiver, arg1, ... argN].
+ // The 'inputs' may or may not have an additional type argument used for
+ // creating the generator (T for new Completer<T>() inside the body).
+ HInvokeGeneratorBody(FunctionEntity element, List<HInstruction> inputs,
+ AbstractValue type, SourceInformation sourceInformation)
+ : super(element, inputs, type, const <DartType>[]) {
+ this.sourceInformation = sourceInformation;
+ }
+
+ String toString() => 'HInvokeGeneratorBody(${element.name})';
+ accept(HVisitor visitor) => visitor.visitInvokeGeneratorBody(this);
+}
+
abstract class HFieldAccess extends HInstruction {
final FieldEntity element;
diff --git a/pkg/compiler/lib/src/ssa/ssa.dart b/pkg/compiler/lib/src/ssa/ssa.dart
index f9c45ea..def9ec7 100644
--- a/pkg/compiler/lib/src/ssa/ssa.dart
+++ b/pkg/compiler/lib/src/ssa/ssa.dart
@@ -45,7 +45,7 @@
optimizer.optimize(work, graph, closedWorld);
MemberEntity element = work.element;
js.Expression result = generator.generateCode(work, graph, closedWorld);
- if (element is FunctionEntity) {
+ if (element is FunctionEntity && !graph.isGeneratorEntry) {
SourceInformationBuilder sourceInformationBuilder =
backend.sourceInformationStrategy.createBuilderForContext(element);
result = backend.rewriteAsync(
diff --git a/pkg/compiler/lib/src/ssa/ssa_tracer.dart b/pkg/compiler/lib/src/ssa/ssa_tracer.dart
index f7956fb..413c044 100644
--- a/pkg/compiler/lib/src/ssa/ssa_tracer.dart
+++ b/pkg/compiler/lib/src/ssa/ssa_tracer.dart
@@ -350,6 +350,11 @@
return handleGenericInvoke("InvokeConstructorBody", target, invoke.inputs);
}
+ String visitInvokeGeneratorBody(HInvokeGeneratorBody invoke) {
+ String target = invoke.element.name;
+ return handleGenericInvoke("InvokeGeneratorBody", target, invoke.inputs);
+ }
+
String visitForeignCode(HForeignCode node) {
var template = node.codeTemplate;
String code = '${template.ast}';
diff --git a/pkg/compiler/lib/src/ssa/type_builder.dart b/pkg/compiler/lib/src/ssa/type_builder.dart
index ac340805..c9b456e 100644
--- a/pkg/compiler/lib/src/ssa/type_builder.dart
+++ b/pkg/compiler/lib/src/ssa/type_builder.dart
@@ -4,7 +4,6 @@
import 'graph_builder.dart';
import 'nodes.dart';
-import '../common.dart';
import '../elements/entities.dart';
import '../elements/types.dart';
import '../io/source_information.dart';
@@ -115,9 +114,8 @@
HInstruction addTypeVariableReference(
TypeVariableType type, MemberEntity member,
{SourceInformation sourceInformation}) {
- assert(assertTypeInContext(type));
if (type.element.typeDeclaration is! ClassEntity &&
- (!builder.options.strongMode || !builder.options.useKernel)) {
+ !builder.options.strongMode) {
// GENERIC_METHODS: We currently don't reify method type variables.
return builder.graph.addConstantNull(builder.closedWorld);
}
@@ -204,25 +202,9 @@
return representation;
}
- /// Check that [type] is valid in the context of `localsHandler.contextClass`.
- /// This should only be called in assertions.
- bool assertTypeInContext(DartType type, [Spannable spannable]) {
- if (builder.compiler.options.useKernel) return true;
- ClassEntity contextClass = DartTypes.getClassContext(type);
- assert(
- contextClass == null ||
- contextClass == builder.localsHandler.instanceType?.element,
- failedAt(
- spannable ?? CURRENT_ELEMENT_SPANNABLE,
- "Type '$type' is not valid context of "
- "${builder.localsHandler.instanceType?.element}."));
- return true;
- }
-
HInstruction analyzeTypeArgument(
DartType argument, MemberEntity sourceElement,
{SourceInformation sourceInformation}) {
- assert(assertTypeInContext(argument));
argument = argument.unaliased;
if (argument.treatAsDynamic) {
// Represent [dynamic] as [null].
@@ -237,7 +219,7 @@
List<HInstruction> inputs = <HInstruction>[];
argument.forEachTypeVariable((TypeVariableType variable) {
if (variable.element.typeDeclaration is ClassEntity ||
- (builder.options.strongMode && builder.options.useKernel)) {
+ builder.options.strongMode) {
// TODO(johnniwinther): Also make this conditional on whether we have
// calculated we need that particular method signature.
inputs.add(analyzeTypeArgument(variable, sourceElement));
@@ -280,7 +262,6 @@
}
}
type = type.unaliased;
- assert(assertTypeInContext(type, original));
if (type.isInterfaceType && !type.treatAsRaw) {
InterfaceType interfaceType = type;
TypeMask subtype =
diff --git a/pkg/compiler/lib/src/universe/resolution_world_builder.dart b/pkg/compiler/lib/src/universe/resolution_world_builder.dart
index 7983684..ed3c1b9 100644
--- a/pkg/compiler/lib/src/universe/resolution_world_builder.dart
+++ b/pkg/compiler/lib/src/universe/resolution_world_builder.dart
@@ -378,7 +378,6 @@
final ClassQueries classQueries;
bool hasRuntimeTypeSupport = false;
- bool hasIsolateSupport = false;
bool hasFunctionApplySupport = false;
bool _closed = false;
diff --git a/pkg/compiler/lib/src/universe/selector.dart b/pkg/compiler/lib/src/universe/selector.dart
index 263d4ac..3d03614 100644
--- a/pkg/compiler/lib/src/universe/selector.dart
+++ b/pkg/compiler/lib/src/universe/selector.dart
@@ -170,9 +170,10 @@
factory Selector.call(Name name, CallStructure callStructure) =>
new Selector(SelectorKind.CALL, name, callStructure);
- factory Selector.callClosure(int arity, [List<String> namedArguments]) =>
+ factory Selector.callClosure(int arity,
+ [List<String> namedArguments, int typeArgumentCount = 0]) =>
new Selector(SelectorKind.CALL, Names.call,
- new CallStructure(arity, namedArguments));
+ new CallStructure(arity, namedArguments, typeArgumentCount));
factory Selector.callClosureFrom(Selector selector) =>
new Selector(SelectorKind.CALL, Names.call, selector.callStructure);
diff --git a/pkg/compiler/lib/src/universe/use.dart b/pkg/compiler/lib/src/universe/use.dart
index 9e105084..d5c894e 100644
--- a/pkg/compiler/lib/src/universe/use.dart
+++ b/pkg/compiler/lib/src/universe/use.dart
@@ -305,6 +305,12 @@
callStructure: callStructure);
}
+ /// Direct invocation of a generator (body) [element], as a static call or
+ /// through a this or super constructor call.
+ factory StaticUse.generatorBodyInvoke(FunctionEntity element) {
+ return new StaticUse.internal(element, StaticUseKind.INVOKE);
+ }
+
/// Direct invocation of a method [element] with the given [callStructure].
factory StaticUse.directInvoke(FunctionEntity element,
CallStructure callStructure, List<DartType> typeArguments) {
diff --git a/pkg/compiler/lib/src/util/emptyset.dart b/pkg/compiler/lib/src/util/emptyset.dart
index d37b0c4..1fa3dba 100644
--- a/pkg/compiler/lib/src/util/emptyset.dart
+++ b/pkg/compiler/lib/src/util/emptyset.dart
@@ -9,12 +9,10 @@
class ImmutableEmptySet<E> extends IterableBase<E> implements Set<E> {
const ImmutableEmptySet();
- Set<R> cast<R>() {
- Set<Object> self = this;
- return self is Set<R> ? self : this.retype<R>();
- }
+ Set<R> cast<R>() => new ImmutableEmptySet<R>();
- Set<R> retype<R>() => new ImmutableEmptySet<R>();
+ @Deprecated("Use cast instead.")
+ Set<R> retype<R>() => cast<R>();
get iterator => const _EmptySetIterator();
int get length => 0;
diff --git a/pkg/compiler/lib/src/util/setlet.dart b/pkg/compiler/lib/src/util/setlet.dart
index 27e7a86..08195f0 100644
--- a/pkg/compiler/lib/src/util/setlet.dart
+++ b/pkg/compiler/lib/src/util/setlet.dart
@@ -29,7 +29,10 @@
static Set<R> _newSet<R>() => new Setlet<R>();
- Set<R> retype<R>() => Set.castFrom<E, R>(this, newSet: _newSet);
+ Set<R> cast<R>() => Set.castFrom<E, R>(this, newSet: _newSet);
+
+ @Deprecated("Use cast instead.")
+ Set<R> retype<R>() => cast<R>();
Iterator<E> get iterator {
if (_extra == null) {
diff --git a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
index c7c523d..c2acf4f 100644
--- a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
@@ -3642,10 +3642,25 @@
var result = _emitForeignJS(node, e);
if (result != null) return result;
- if (e?.name == 'extensionSymbol' && isSdkInternalRuntime(e.library)) {
- var args = node.argumentList.arguments;
- var firstArg = args.length == 1 ? args[0] : null;
- if (firstArg is StringLiteral) {
+ // Optimize some internal SDK calls.
+ if (e != null &&
+ isSdkInternalRuntime(e.library) &&
+ node.argumentList.arguments.length == 1) {
+ var firstArg = node.argumentList.arguments[0];
+ if (e.name == 'getGenericClass' && firstArg is SimpleIdentifier) {
+ var typeElem = firstArg.staticElement;
+ if (typeElem is TypeDefiningElement &&
+ typeElem.type is ParameterizedType) {
+ return _emitTopLevelNameNoInterop(typeElem, suffix: '\$');
+ }
+ }
+ if (e.name == 'unwrapType' && firstArg is SimpleIdentifier) {
+ var typeElem = firstArg.staticElement;
+ if (typeElem is TypeDefiningElement) {
+ return _emitType(fillDynamicTypeArgs(typeElem.type));
+ }
+ }
+ if (e.name == 'extensionSymbol' && firstArg is StringLiteral) {
return _getExtensionSymbolInternal(firstArg.stringValue);
}
}
@@ -4059,27 +4074,6 @@
}
}
- JS.Expression visitTemplateArg(Expression arg) {
- if (arg is InvocationExpression) {
- var e = arg is MethodInvocation
- ? arg.methodName.staticElement
- : (arg as FunctionExpressionInvocation).staticElement;
- if (e?.name == 'getGenericClass' &&
- e.library.name == 'dart._runtime' &&
- arg.argumentList.arguments.length == 1) {
- var typeArg = arg.argumentList.arguments[0];
- if (typeArg is SimpleIdentifier) {
- var typeElem = typeArg.staticElement;
- if (typeElem is TypeDefiningElement &&
- typeElem.type is ParameterizedType) {
- return _emitTopLevelNameNoInterop(typeElem, suffix: '\$');
- }
- }
- }
- }
- return _visitExpression(arg);
- }
-
// TODO(rnystrom): The JS() calls are almost never nested, and probably
// really shouldn't be, but there are at least a couple of calls in the
// HTML library where an argument to JS() is itself a JS() call. If those
@@ -4088,7 +4082,7 @@
// wrapped Type object.
var wasInForeignJS = _isInForeignJS;
_isInForeignJS = true;
- var jsArgs = templateArgs.map(visitTemplateArg).toList();
+ var jsArgs = templateArgs.map(_visitExpression).toList();
_isInForeignJS = wasInForeignJS;
var result = js.parseForeignJS(source).instantiate(jsArgs);
diff --git a/pkg/dev_compiler/lib/src/kernel/compiler.dart b/pkg/dev_compiler/lib/src/kernel/compiler.dart
index bc50ca2..819227d 100644
--- a/pkg/dev_compiler/lib/src/kernel/compiler.dart
+++ b/pkg/dev_compiler/lib/src/kernel/compiler.dart
@@ -4378,11 +4378,21 @@
if (isInlineJS(target)) return _emitInlineJSCode(node) as JS.Expression;
if (target.isFactory) return _emitFactoryInvocation(node);
- if (target.name.name == 'extensionSymbol' &&
- isSdkInternalRuntime(target.enclosingLibrary)) {
- var args = node.arguments;
- var firstArg = args.positional.length == 1 ? args.positional[0] : null;
- if (firstArg is StringLiteral) {
+ // Optimize some internal SDK calls.
+ if (isSdkInternalRuntime(target.enclosingLibrary) &&
+ node.arguments.positional.length == 1) {
+ var name = target.name.name;
+ var firstArg = node.arguments.positional[0];
+ if (name == 'getGenericClass' && firstArg is TypeLiteral) {
+ var type = firstArg.type;
+ if (type is InterfaceType) {
+ return _emitTopLevelNameNoInterop(type.classNode, suffix: '\$');
+ }
+ }
+ if (name == 'unwrapType' && firstArg is TypeLiteral) {
+ return _emitType(firstArg.type);
+ }
+ if (name == 'extensionSymbol' && firstArg is StringLiteral) {
return _getExtensionSymbolInternal(firstArg.value);
}
}
@@ -4531,25 +4541,6 @@
}
}
- JS.Expression visitTemplateArg(Expression arg) {
- if (arg is StaticInvocation) {
- var target = arg.target;
- var positional = arg.arguments.positional;
- if (target.name.name == 'getGenericClass' &&
- isSdkInternalRuntime(target.enclosingLibrary) &&
- positional.length == 1) {
- var typeArg = positional[0];
- if (typeArg is TypeLiteral) {
- var type = typeArg.type;
- if (type is InterfaceType) {
- return _emitTopLevelNameNoInterop(type.classNode, suffix: '\$');
- }
- }
- }
- }
- return _visitExpression(arg);
- }
-
// TODO(rnystrom): The JS() calls are almost never nested, and probably
// really shouldn't be, but there are at least a couple of calls in the
// HTML library where an argument to JS() is itself a JS() call. If those
@@ -4558,7 +4549,7 @@
// wrapped Type object.
var wasInForeignJS = _isInForeignJS;
_isInForeignJS = true;
- var jsArgs = templateArgs.map(visitTemplateArg).toList();
+ var jsArgs = templateArgs.map(_visitExpression).toList();
_isInForeignJS = wasInForeignJS;
var result = js.parseForeignJS(source).instantiate(jsArgs);
@@ -5034,7 +5025,7 @@
@override
visitFunctionExpression(FunctionExpression node) {
var fn = _emitArrowFunction(node);
- if (!_reifyFunctionType(_currentFunction)) return fn;
+ if (!_reifyFunctionType(node.function)) return fn;
return _emitFunctionTagged(fn, node.getStaticType(types) as FunctionType);
}
@@ -5140,7 +5131,7 @@
isBuiltinAnnotation(a, '_js_helper', 'ReifyFunctionTypes');
while (parent != null) {
var a = findAnnotation(parent, reifyFunctionTypes);
- if (a != null && a is ConstructorInvocation) {
+ if (a is ConstructorInvocation) {
var args = a.arguments.positional;
if (args.length == 1) {
var arg = args[0];
diff --git a/pkg/dev_compiler/test/nullable_inference_test.dart b/pkg/dev_compiler/test/nullable_inference_test.dart
index 742508b..be94da4 100644
--- a/pkg/dev_compiler/test/nullable_inference_test.dart
+++ b/pkg/dev_compiler/test/nullable_inference_test.dart
@@ -223,7 +223,13 @@
s.trim();
s.trimLeft();
s.trimRight();
- s.compareTo(s);
+
+ // compareTo relies on the interface target being String.compareTo
+ // except that method does not exist unless we insert too many
+ // forwarding stubs.
+ //
+ // s.compareTo(s);
+
s.toString();
// Pattern methods (allMatches, matchAsPrefix) are not recognized.
}''');
@@ -413,27 +419,25 @@
useAnnotations = false;
});
var imports = "import 'package:meta/meta.dart';";
- group('(kernel annotation bug)', () {
- test('variable wihout initializer', () async {
- await expectNotNull('$imports main() { @notNull var x; print(x); }',
- ''); // should be: 'x'
+ group('(previously known kernel annotation bug)', () {
+ test('variable without initializer', () async {
+ await expectNotNull(
+ '$imports main() { @notNull var x; print(x); }', 'x');
});
test('variable with initializer', () async {
// TODO(jmesserly): this does not work in the Analyzer backend.
await expectNotNull(
- '$imports main() { @notNull var x = null; print(x); }',
- ''); // should be: 'x'
+ '$imports main() { @notNull var x = null; print(x); }', 'x');
});
test('parameters', () async {
await expectNotNull(
'$imports f(@notNull x, [@notNull y, @notNull z = 42]) '
'{ x; y; z; }',
- '42, z'); // should be: '42, x, y, z'
+ '42, x, y, z');
});
test('named parameters', () async {
await expectNotNull(
- '$imports f({@notNull x, @notNull y: 42}) { x; y; }',
- '42, y'); // should be: '42, x, y'
+ '$imports f({@notNull x, @notNull y: 42}) { x; y; }', '42, x, y');
});
});
diff --git a/pkg/dev_compiler/tool/input_sdk/patch/convert_patch.dart b/pkg/dev_compiler/tool/input_sdk/patch/convert_patch.dart
index 5ef68a4..18a077e 100644
--- a/pkg/dev_compiler/tool/input_sdk/patch/convert_patch.dart
+++ b/pkg/dev_compiler/tool/input_sdk/patch/convert_patch.dart
@@ -9,6 +9,7 @@
import 'dart:_interceptors' show JSExtendableArray;
import 'dart:_internal' show MappedIterable, ListIterable;
import 'dart:collection' show Maps, LinkedHashMap, MapBase;
+import 'dart:_native_typed_data' show NativeUint8List;
/**
* Parses [json] and builds the corresponding parsed JSON value.
@@ -399,6 +400,98 @@
@patch
static String _convertIntercepted(
bool allowMalformed, List<int> codeUnits, int start, int end) {
- return null; // This call was not intercepted.
+ // Test `codeUnits is NativeUint8List`. Dart's NativeUint8List is
+ // implemented by JavaScript's Uint8Array.
+ if (JS('bool', '# instanceof Uint8Array', codeUnits)) {
+ // JS 'cast' to avoid a downcast equivalent to the is-check we hand-coded.
+ NativeUint8List casted = JS('NativeUint8List', '#', codeUnits);
+ return _convertInterceptedUint8List(allowMalformed, casted, start, end);
+ }
}
+
+ static String _convertInterceptedUint8List(
+ bool allowMalformed, NativeUint8List codeUnits, int start, int end) {
+ if (allowMalformed) {
+ // TextDecoder with option {fatal: false} does not produce the same result
+ // as [Utf8Decoder]. It disagrees on the number of `U+FFFD` (REPLACEMENT
+ // CHARACTER) generated for some malformed sequences. We could use
+ // TextDecoder with option {fatal: true}, catch the error, and re-try
+ // without acceleration. That turns out to be extremely slow (the Error
+ // captures a stack trace).
+ // TODO(31370): Bring Utf8Decoder into alignment with TextDecoder.
+ // TODO(sra): If we can't do that, can we detect valid input fast enough
+ // to use a check like the [_unsafe] check below?
+ return null;
+ }
+
+ var decoder = _decoder;
+ if (decoder == null) return null;
+ if (0 == start && end == null) {
+ return _useTextDecoderChecked(decoder, codeUnits);
+ }
+
+ int length = codeUnits.length;
+ end = RangeError.checkValidRange(start, end, length);
+
+ if (0 == start && end == codeUnits.length) {
+ return _useTextDecoderChecked(decoder, codeUnits);
+ }
+
+ return _useTextDecoderChecked(decoder,
+ JS('NativeUint8List', '#.subarray(#, #)', codeUnits, start, end));
+ }
+
+ static String _useTextDecoderChecked(decoder, NativeUint8List codeUnits) {
+ if (_unsafe(codeUnits)) return null;
+ return _useTextDecoderUnchecked(decoder, codeUnits);
+ }
+
+ static String _useTextDecoderUnchecked(decoder, NativeUint8List codeUnits) {
+ // If the input is malformed, catch the exception and return `null` to fall
+ // back on unintercepted decoder. The fallback will either succeed in
+ // decoding, or report the problem better than TextDecoder.
+ try {
+ return JS('String', '#.decode(#)', decoder, codeUnits);
+ } catch (e) {}
+ return null;
+ }
+
+ /// Returns `true` if [codeUnits] contains problematic encodings.
+ ///
+ /// TextDecoder behaves differently to [Utf8Encoder] when the input encodes a
+ /// surrogate (U+D800 through U+DFFF). TextDecoder considers the surrogate to
+ /// be an encoding error and, depending on the `fatal` option, either throws
+ /// and Error or encodes the surrogate as U+FFFD. [Utf8Decoder] does not
+ /// consider the surrogate to be an error and returns the code unit encoded by
+ /// the surrogate.
+ ///
+ /// Throwing an `Error` captures the stack, whoch makes it so expensive that
+ /// it is worth checking the input for surrogates and avoiding TextDecoder in
+ /// this case.
+ static bool _unsafe(NativeUint8List codeUnits) {
+ // Surrogates encode as (hex) ED Ax xx or ED Bx xx.
+ int limit = codeUnits.length - 2;
+ for (int i = 0; i < limit; i++) {
+ int unit1 = codeUnits[i];
+ if (unit1 == 0xED) {
+ int unit2 = JS('!', '#', codeUnits[i + 1]);
+ if ((unit2 & 0xE0) == 0xA0) return true;
+ }
+ }
+ return false;
+ }
+
+ //// TextDecoder is not defined on some browsers and on the stand-alone d8 and
+ /// jsshell engines. Use a lazy initializer to do feature detection once.
+ static final _decoder = () {
+ try {
+ // Use `{fatal: true}`. 'fatal' does not correspond exactly to
+ // `!allowMalformed`: TextDecoder rejects unpaired surrogates which
+ // [Utf8Decoder] accepts. In non-fatal mode, TextDecoder translates
+ // unpaired surrogates to REPLACEMENT CHARACTER (U+FFFD) whereas
+ // [Utf8Decoder] leaves the surrogate intact.
+ return JS('', 'new TextDecoder("utf-8", {fatal: true})');
+ } catch (e) {}
+ return null;
+ }();
}
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart
index 0f0c078..163e26c 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/classes.dart
@@ -100,8 +100,13 @@
@JSExportName('implements')
final _implements = JS('', 'Symbol("implements")');
-getImplements(clazz) => JS('', 'Object.hasOwnProperty.call(#, #) ? #[#] : null',
- clazz, _implements, clazz, _implements);
+List Function() getImplements(clazz) => JS(
+ '',
+ 'Object.hasOwnProperty.call(#, #) ? #[#] : null',
+ clazz,
+ _implements,
+ clazz,
+ _implements);
/// The Symbol for storing type arguments on a specialized generic type.
final _typeArguments = JS('', 'Symbol("typeArguments")');
@@ -159,6 +164,14 @@
List getGenericArgs(type) =>
JS('List', '#', safeGetOwnProperty(type, _typeArguments));
+List<TypeVariable> getGenericTypeFormals(genericClass) {
+ return _typeFormalsFromFunction(getGenericTypeCtor(genericClass));
+}
+
+Object instantiateClass(Object genericClass, List<Object> typeArgs) {
+ return JS('', '#.apply(null, #)', genericClass, typeArgs);
+}
+
final _constructorSig = JS('', 'Symbol("sigCtor")');
final _methodSig = JS('', 'Symbol("sigMethod")');
final _fieldSig = JS('', 'Symbol("sigField")');
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart
index 4d2f78f..a6b3b01 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/errors.dart
@@ -17,6 +17,7 @@
JS('', 'dart.__ignoreWhitelistedErrors = #', flag);
}
+// TODO(jmesserly): remove this?
void ignoreAllErrors(bool flag) {
JS('', 'dart.__ignoreAllErrors = #', flag);
}
@@ -49,3 +50,38 @@
throw new NoSuchMethodError(
null, new Symbol('<Unexpected Null Value>'), null, null, null);
}
+
+castError(obj, expectedType, [bool typeError = undefined]) {
+ var actualType = getReifiedType(obj);
+ var message = _castErrorMessage(actualType, expectedType);
+ if (JS('!', 'dart.__ignoreAllErrors')) {
+ JS('', 'console.error(#)', message);
+ return obj;
+ }
+ if (JS('!', 'dart.__trapRuntimeErrors')) JS('', 'debugger');
+ var error = JS<bool>('!', '#', typeError)
+ ? new TypeErrorImpl(message)
+ : new CastErrorImpl(message);
+ throw error;
+}
+
+String _castErrorMessage(from, to) {
+ // If both types are generic classes, see if we can infer generic type
+ // arguments for `from` that would allow the subtype relation to work.
+ var fromClass = getGenericClass(from);
+ if (fromClass != null) {
+ var fromTypeFormals = getGenericTypeFormals(fromClass);
+ var fromType = instantiateClass(fromClass, fromTypeFormals);
+ var inferrer = new _TypeInferrer(fromTypeFormals);
+ if (inferrer.trySubtypeMatch(fromType, to)) {
+ var inferredTypes = inferrer.getInferredTypes();
+ if (inferredTypes != null) {
+ var inferred = instantiateClass(fromClass, inferredTypes);
+ return "Type '${typeName(from)}' should be '${typeName(inferred)}' "
+ "to implement expected type '${typeName(to)}'.";
+ }
+ }
+ }
+ return "Type '${typeName(from)}' is not a subtype of "
+ "expected type '${typeName(to)}'.";
+}
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
index b28594e..ca353ba 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/operations.dart
@@ -476,33 +476,9 @@
throw new BooleanConversionAssertionError();
void booleanConversionFailed(obj) {
- if (obj == null) {
- _throwBooleanConversionError();
- }
- var actual = getReifiedType(obj);
- var expected = JS('', '#', bool);
- throw new TypeErrorImplementation.fromMessage(
- "type '${typeName(actual)}' is not a subtype of "
- "type '${typeName(expected)}' in boolean expression");
-}
-
-castError(obj, type, bool isExplicit) {
- var objType = getReifiedType(obj);
- if (JS('bool', '!dart.__ignoreAllErrors')) {
- var errorInStrongMode = isSubtype(objType, type) == null;
-
- var actual = typeName(objType);
- var expected = typeName(type);
- if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger');
-
- var error = JS('bool', '#', isExplicit)
- ? new TypeErrorImplementation(obj, actual, expected, errorInStrongMode)
- : new CastErrorImplementation(obj, actual, expected, errorInStrongMode);
- throw error;
- }
- JS('', 'console.error(#)',
- 'Actual: ${typeName(objType)} Expected: ${typeName(type)}');
- return obj;
+ var actual = typeName(getReifiedType(test(obj)));
+ throw new TypeErrorImpl(
+ "type '$actual' is not a 'bool' in boolean expression");
}
asInt(obj) {
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart
index ea298ee..fd62cd8 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/runtime.dart
@@ -14,14 +14,10 @@
show
AssertionErrorImpl,
BooleanConversionAssertionError,
- CastErrorImplementation,
+ CastErrorImpl,
DartIterator,
getTraceFromException,
- Primitives,
- TypeErrorImplementation,
- StrongModeCastError,
- StrongModeErrorImplementation,
- StrongModeTypeError,
+ TypeErrorImpl,
JsLinkedHashMap,
ImmutableMap,
PrivateSymbol,
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart
index 48b35b0..c7a40c5 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart
@@ -66,7 +66,7 @@
check_T(object) => cast(object, this, true);
}
-class Dynamic extends TypeRep {
+class DynamicType extends TypeRep {
toString() => 'dynamic';
@JSExportName('is')
@@ -165,26 +165,26 @@
}
@JSExportName('dynamic')
-final _dynamic = new Dynamic();
+final _dynamic = new DynamicType();
-class Void extends TypeRep {
+class VoidType extends TypeRep {
toString() => 'void';
}
@JSExportName('void')
-final void_ = new Void();
+final void_ = new VoidType();
-class Bottom extends TypeRep {
+class BottomType extends TypeRep {
toString() => 'bottom';
}
-final bottom = new Bottom();
+final bottom = new BottomType();
-class JSObject extends TypeRep {
+class JSObjectType extends TypeRep {
toString() => 'NativeJavaScriptObject';
}
-final jsobject = new JSObject();
+final jsobject = new JSObjectType();
class WrappedType extends Type {
final _wrappedType;
@@ -348,6 +348,25 @@
toString() => name;
+ int get requiredParameterCount => args.length;
+ int get positionalParameterCount => args.length + optionals.length;
+
+ getPositionalParameter(int i) {
+ int n = args.length;
+ return i < n ? args[i] : optionals[i + n];
+ }
+
+ Map<String, Object> getNamedParameters() {
+ var result = <String, Object>{};
+ var names = getOwnPropertyNames(named);
+ JS('', '#.sort()', names);
+ for (var i = 0; JS('bool', '# < #.length', i, names); ++i) {
+ String name = JS('!', '#[#]', names, i);
+ result[name] = JS('', '#[#]', named, name);
+ }
+ return result;
+ }
+
get name {
if (_stringValue != null) return _stringValue;
@@ -490,29 +509,7 @@
List<TypeVariable> get typeFormals {
if (_typeFormals != null) return _typeFormals;
-
- // Extract parameter names from the function parameters.
- //
- // This is not robust in general for user-defined JS functions, but it
- // should handle the functions generated by our compiler.
- //
- // TODO(jmesserly): names of TypeVariables are only used for display
- // purposes, such as when an error happens or if someone calls
- // `Type.toString()`. So we could recover them lazily rather than eagerly.
- // Alternatively we could synthesize new names.
- String str = JS('!', '#.toString()', _instantiateTypeParts);
- var hasParens = str[0] == '(';
- var end = str.indexOf(hasParens ? ')' : '=>');
- if (hasParens) {
- _typeFormals = str
- .substring(1, end)
- .split(',')
- .map((n) => new TypeVariable(n.trim()))
- .toList();
- } else {
- _typeFormals = [new TypeVariable(str.substring(0, end).trim())];
- }
- return _typeFormals;
+ return _typeFormals = _typeFormalsFromFunction(_instantiateTypeParts);
}
checkBounds(List typeArgs) {
@@ -658,6 +655,30 @@
}
}
+List<TypeVariable> _typeFormalsFromFunction(Object typeConstructor) {
+ // Extract parameter names from the function parameters.
+ //
+ // This is not robust in general for user-defined JS functions, but it
+ // should handle the functions generated by our compiler.
+ //
+ // TODO(jmesserly): names of TypeVariables are only used for display
+ // purposes, such as when an error happens or if someone calls
+ // `Type.toString()`. So we could recover them lazily rather than eagerly.
+ // Alternatively we could synthesize new names.
+ String str = JS('!', '#.toString()', typeConstructor);
+ var hasParens = str[0] == '(';
+ var end = str.indexOf(hasParens ? ')' : '=>');
+ if (hasParens) {
+ return str
+ .substring(1, end)
+ .split(',')
+ .map((n) => new TypeVariable(n.trim()))
+ .toList();
+ } else {
+ return [new TypeVariable(str.substring(0, end).trim())];
+ }
+}
+
Typedef typedef(name, AbstractFunctionType Function() closure) =>
new Typedef(name, closure);
@@ -735,7 +756,7 @@
/// If [isCovariant] is true, then we are checking subtyping in a covariant
/// position, and hence the direction of the check for function types
/// corresponds to the direction of the check according to the Dart spec.
-isFunctionSubtype(ft1, ft2, isCovariant) => JS('', '''(() => {
+_isFunctionSubtype(ft1, ft2, isCovariant) => JS('', '''(() => {
let ret1 = $ft1.returnType;
let ret2 = $ft2.returnType;
@@ -838,28 +859,28 @@
}
bool _isFutureOr(type) =>
- JS('bool', '# === #', getGenericClass(type), getGenericClass(FutureOr));
+ identical(getGenericClass(type), getGenericClass(FutureOr));
bool _isSubtype(t1, t2, isCovariant) => JS('', '''(() => {
if ($t1 === $t2) return true;
// Trivially true.
- if ($_isTop($t2) || $_isBottom($t1)) {
+ if (${_isTop(t2)} || ${_isBottom(t1)}) {
return true;
}
// Trivially false.
- if ($_isBottom($t2)) return null;
- if ($_isTop($t1)) {
+ if (${_isBottom(t2)}) return null;
+ if (${_isTop(t1)}) {
if ($t1 === $dynamic) return null;
return false;
}
// Handle FutureOr<T> union type.
- if ($_isFutureOr($t1)) {
- let t1TypeArg = $getGenericArgs($t1)[0];
- if ($_isFutureOr($t2)) {
- let t2TypeArg = $getGenericArgs($t2)[0];
+ if (${_isFutureOr(t1)}) {
+ let t1TypeArg = ${getGenericArgs(t1)}[0];
+ if (${_isFutureOr(t2)}) {
+ let t2TypeArg = ${getGenericArgs(t2)}[0];
// FutureOr<A> <: FutureOr<B> iff A <: B
return $_isSubtype(t1TypeArg, t2TypeArg, $isCovariant);
}
@@ -874,8 +895,8 @@
if ($_isFutureOr($t2)) {
// given t2 is Future<A> | A, then:
// t1 <: (Future<A> | A) iff t1 <: Future<A> or t1 <: A
- let t2TypeArg = $getGenericArgs($t2)[0];
- var t2Future = ${getGenericClass(Future)}(t2TypeArg);
+ let t2TypeArg = ${getGenericArgs(t2)}[0];
+ let t2Future = ${getGenericClass(Future)}(t2TypeArg);
let s1 = $_isSubtype($t1, t2Future, $isCovariant);
let s2 = $_isSubtype($t1, t2TypeArg, $isCovariant);
if (s1 === true || s2 === true) return true;
@@ -899,7 +920,7 @@
if ($t1 === $jsobject && $t2 instanceof $AnonymousJSType) return true;
// Compare two interface types:
- return $isClassSubType($t1, $t2, $isCovariant);
+ return ${_isInterfaceSubtype(t1, t2, isCovariant)};
}
// Function subtyping.
@@ -953,10 +974,10 @@
}
// Handle non-generic functions.
- return $isFunctionSubtype($t1, $t2, $isCovariant);
+ return ${_isFunctionSubtype(t1, t2, isCovariant)};
})()''');
-isClassSubType(t1, t2, isCovariant) => JS('', '''(() => {
+_isInterfaceSubtype(t1, t2, isCovariant) => JS('', '''(() => {
// We support Dart's covariant generics with the caveat that we do not
// substitute bottom for dynamic in subtyping rules.
// I.e., given T1, ..., Tn where at least one Ti != dynamic we disallow:
@@ -1006,7 +1027,7 @@
let indefinite = false;
function definitive(t1, t2) {
- let result = $isClassSubType(t1, t2, $isCovariant);
+ let result = $_isInterfaceSubtype(t1, t2, $isCovariant);
if (result == null) {
indefinite = true;
return false;
@@ -1050,73 +1071,373 @@
if (typeArguments.isEmpty) {
throw new ArgumentError('Cannot extract from non-generic type ($type).');
}
- List typeArgs = _extractTypes(getReifiedType(instance), type, typeArguments);
+ var supertype = _getMatchingSupertype(getReifiedType(instance), type);
// The signature of this method guarantees that instance is a T, so we
// should have a valid non-empty list at this point.
+ assert(supertype != null);
+ var typeArgs = getGenericArgs(supertype);
assert(typeArgs != null && typeArgs.isNotEmpty);
return dgcall(f, typeArgs, []);
}
-// Let t2 = T<T1, ..., Tn>
-// If t1 </: T<T1, ..., Tn>
-// - return null
-// If t1 <: T<T1, ..., Tn>
-// - return [S1, ..., Sn] such that there exists no Ri where
-// Ri != Si && Ri <: Si && t1 <: T<S1, ..., Ri, ..., Sn>
-//
-// Note: In Dart 1, there isn't necessarily a unique solution to the above -
-// t1 <: Foo<int> and t1 <: Foo<String> could both be true. Dart 2 will
-// statically disallow. Until then, this could return either [int] or
-// [String] depending on which it hits first.
-//
-// TODO(vsm): Consider merging with similar isClassSubType logic.
-List _extractTypes(Type t1, Type t2, List typeArguments2) => JS('', '''(() => {
- if ($t1 == $t2) return typeArguments2;
+/// Infers type variables based on a series of [trySubtypeMatch] calls, followed
+/// by [getInferredTypes] to return the type.
+class _TypeInferrer {
+ final Map<TypeVariable, TypeConstraint> _typeVariables;
- if ($t1 == $Object) return null;
+ /// Creates a [TypeConstraintGatherer] which is prepared to gather type
+ /// constraints for the given type parameters.
+ _TypeInferrer(Iterable<TypeVariable> typeVariables)
+ : _typeVariables = new Map.fromIterables(
+ typeVariables, typeVariables.map((_) => new TypeConstraint()));
- // If t1 is a JS Object, we may not hit core.Object.
- if ($t1 == null) return null;
-
- // Check if t1 and t2 have the same raw type. If so, check covariance on
- // type parameters.
- let raw1 = $getGenericClass($t1);
- let raw2 = $getGenericClass($t2);
- if (raw1 != null && raw1 == raw2) {
- let typeArguments1 = $getGenericArgs($t1);
- let length = typeArguments1.length;
- if (length == 0 || length != typeArguments2.length) $assertFailed();
- // TODO(vsm): Remove this subtyping check if/when we eliminate the ability
- // to implement multiple versions of the same interface
- // (e.g., Foo<int>, Foo<String>).
- for (let i = 0; i < length; ++i) {
- let result =
- $_isSubtype(typeArguments1[i], typeArguments2[i], true);
- if (!result) {
+ /// Returns the inferred types based on the current constraints.
+ List<Object> getInferredTypes() {
+ var result = new List<Object>();
+ for (var constraint in _typeVariables.values) {
+ // Prefer the known bound, if any.
+ if (constraint.lower != null) {
+ result.add(constraint.lower);
+ } else if (constraint.upper != null) {
+ result.add(constraint.upper);
+ } else {
return null;
}
}
- return typeArguments1;
+ return result;
}
- var result = $_extractTypes($t1.__proto__, $t2, $typeArguments2);
- if (result) return result;
+ /// Tries to match [subtype] against [supertype].
+ ///
+ /// If the match succeeds, the resulting type constraints are recorded for
+ /// later use by [computeConstraints]. If the match fails, the set of type
+ /// constraints is unchanged.
+ bool trySubtypeMatch(Object subtype, Object supertype) =>
+ _isSubtypeMatch(subtype, supertype);
+
+ void _constrainLower(TypeVariable parameter, Object lower) {
+ _typeVariables[parameter]._constrainLower(lower);
+ }
+
+ void _constrainUpper(TypeVariable parameter, Object upper) {
+ _typeVariables[parameter]._constrainUpper(upper);
+ }
+
+ bool _isFunctionSubtypeMatch(FunctionType subtype, FunctionType supertype) {
+ // A function type `(M0,..., Mn, [M{n+1}, ..., Mm]) -> R0` is a subtype
+ // match for a function type `(N0,..., Nk, [N{k+1}, ..., Nr]) -> R1` with
+ // respect to `L` under constraints `C0 + ... + Cr + C`
+ // - If `R0` is a subtype match for a type `R1` with respect to `L` under
+ // constraints `C`:
+ // - If `n <= k` and `r <= m`.
+ // - And for `i` in `0...r`, `Ni` is a subtype match for `Mi` with respect
+ // to `L` under constraints `Ci`.
+ // Function types with named parameters are treated analogously to the
+ // positional parameter case above.
+ // A generic function type `<T0 extends B0, ..., Tn extends Bn>F0` is a
+ // subtype match for a generic function type `<S0 extends B0, ..., Sn
+ // extends Bn>F1` with respect to `L` under constraints `Cl`:
+ // - If `F0[Z0/T0, ..., Zn/Tn]` is a subtype match for `F0[Z0/S0, ...,
+ // Zn/Sn]` with respect to `L` under constraints `C`, where each `Zi` is a
+ // fresh type variable with bound `Bi`.
+ // - And `Cl` is `C` with each constraint replaced with its closure with
+ // respect to `[Z0, ..., Zn]`.
+ if (subtype.requiredParameterCount > supertype.requiredParameterCount) {
+ return false;
+ }
+ if (subtype.positionalParameterCount < supertype.positionalParameterCount) {
+ return false;
+ }
+ // Test the return types.
+ if (supertype.returnType is! VoidType &&
+ !_isSubtypeMatch(subtype.returnType, supertype.returnType)) {
+ return false;
+ }
+
+ // Test the parameter types.
+ for (int i = 0, n = supertype.positionalParameterCount; i < n; ++i) {
+ if (!_isSubtypeMatch(supertype.getPositionalParameter(i),
+ subtype.getPositionalParameter(i))) {
+ return false;
+ }
+ }
+ var supertypeNamed = supertype.getNamedParameters();
+ var subtypeNamed = supertype.getNamedParameters();
+ for (var name in supertypeNamed.keys) {
+ var subtypeParamType = subtypeNamed[name];
+ if (subtypeParamType == null) return false;
+ if (!_isSubtypeMatch(supertypeNamed[name], subtypeParamType)) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ bool _isInterfaceSubtypeMatch(Object subtype, Object supertype) {
+ // A type `P<M0, ..., Mk>` is a subtype match for `P<N0, ..., Nk>` with
+ // respect to `L` under constraints `C0 + ... + Ck`:
+ // - If `Mi` is a subtype match for `Ni` with respect to `L` under
+ // constraints `Ci`.
+ // A type `P<M0, ..., Mk>` is a subtype match for `Q<N0, ..., Nj>` with
+ // respect to `L` under constraints `C`:
+ // - If `R<B0, ..., Bj>` is the superclass of `P<M0, ..., Mk>` and `R<B0,
+ // ..., Bj>` is a subtype match for `Q<N0, ..., Nj>` with respect to `L`
+ // under constraints `C`.
+ // - Or `R<B0, ..., Bj>` is one of the interfaces implemented by `P<M0, ...,
+ // Mk>` (considered in lexical order) and `R<B0, ..., Bj>` is a subtype
+ // match for `Q<N0, ..., Nj>` with respect to `L` under constraints `C`.
+ // - Or `R<B0, ..., Bj>` is a mixin into `P<M0, ..., Mk>` (considered in
+ // lexical order) and `R<B0, ..., Bj>` is a subtype match for `Q<N0, ...,
+ // Nj>` with respect to `L` under constraints `C`.
+
+ // Note that since kernel requires that no class may only appear in the set
+ // of supertypes of a given type more than once, the order of the checks
+ // above is irrelevant; we just need to find the matched superclass,
+ // substitute, and then iterate through type variables.
+ var matchingSupertype = _getMatchingSupertype(subtype, supertype);
+ if (matchingSupertype == null) return false;
+
+ var matchingTypeArgs = getGenericArgs(matchingSupertype);
+ var supertypeTypeArgs = getGenericArgs(supertype);
+ for (int i = 0; i < supertypeTypeArgs.length; i++) {
+ if (!_isSubtypeMatch(matchingTypeArgs[i], supertypeTypeArgs[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ bool _isNull(Object type) => identical(type, unwrapType(Null));
+
+ /// Attempts to match [subtype] as a subtype of [supertype], gathering any
+ /// constraints discovered in the process.
+ ///
+ /// If a set of constraints was found, `true` is returned and the caller
+ /// may proceed to call [computeConstraints]. Otherwise, `false` is returned.
+ ///
+ /// In the case where `false` is returned, some bogus constraints may have
+ /// been added to [_protoConstraints]. It is the caller's responsibility to
+ /// discard them if necessary.
+ bool _isSubtypeMatch(Object subtype, Object supertype) {
+ // A type variable `T` in `L` is a subtype match for any type schema `Q`:
+ // - Under constraint `T <: Q`.
+ if (subtype is TypeVariable && _typeVariables.containsKey(subtype)) {
+ _constrainUpper(subtype, supertype);
+ return true;
+ }
+ // A type schema `Q` is a subtype match for a type variable `T` in `L`:
+ // - Under constraint `Q <: T`.
+ if (supertype is TypeVariable && _typeVariables.containsKey(supertype)) {
+ _constrainLower(supertype, subtype);
+ return true;
+ }
+ // Any two equal types `P` and `Q` are subtype matches under no constraints.
+ // Note: to avoid making the algorithm quadratic, we just check for
+ // identical(). If P and Q are equal but not identical, recursing through
+ // the types will give the proper result.
+ if (identical(subtype, supertype)) return true;
+ // Any type `P` is a subtype match for `dynamic`, `Object`, or `void` under
+ // no constraints.
+ if (_isTop(supertype)) return true;
+ // `Null` is a subtype match for any type `Q` under no constraints.
+ // Note that nullable types will change this.
+ if (_isNull(subtype)) return true;
+
+ // Handle FutureOr<T> union type.
+ if (_isFutureOr(subtype)) {
+ var subtypeArg = getGenericArgs(subtype)[0];
+ if (_isFutureOr(supertype)) {
+ // `FutureOr<P>` is a subtype match for `FutureOr<Q>` with respect to `L`
+ // under constraints `C`:
+ // - If `P` is a subtype match for `Q` with respect to `L` under constraints
+ // `C`.
+ var supertypeArg = getGenericArgs(supertype)[0];
+ return _isSubtypeMatch(subtypeArg, supertypeArg);
+ }
+
+ // `FutureOr<P>` is a subtype match for `Q` with respect to `L` under
+ // constraints `C0 + C1`:
+ // - If `Future<P>` is a subtype match for `Q` with respect to `L` under
+ // constraints `C0`.
+ // - And `P` is a subtype match for `Q` with respect to `L` under
+ // constraints `C1`.
+ var subtypeFuture = JS('!', '#(#)', getGenericClass(Future), subtypeArg);
+ return _isSubtypeMatch(subtypeFuture, supertype) &&
+ _isSubtypeMatch(subtypeArg, supertype);
+ }
+
+ if (_isFutureOr(supertype)) {
+ // `P` is a subtype match for `FutureOr<Q>` with respect to `L` under
+ // constraints `C`:
+ // - If `P` is a subtype match for `Future<Q>` with respect to `L` under
+ // constraints `C`.
+ // - Or `P` is not a subtype match for `Future<Q>` with respect to `L` under
+ // constraints `C`
+ // - And `P` is a subtype match for `Q` with respect to `L` under
+ // constraints `C`
+ var supertypeArg = getGenericArgs(supertype)[0];
+ var supertypeFuture =
+ JS('!', '#(#)', getGenericClass(Future), supertypeArg);
+ return _isSubtypeMatch(subtype, supertypeFuture) ||
+ _isSubtypeMatch(subtype, supertypeArg);
+ }
+
+ // A type variable `T` not in `L` with bound `P` is a subtype match for the
+ // same type variable `T` with bound `Q` with respect to `L` under
+ // constraints `C`:
+ // - If `P` is a subtype match for `Q` with respect to `L` under constraints
+ // `C`.
+ if (subtype is TypeVariable) {
+ return supertype is TypeVariable && identical(subtype, supertype);
+ }
+ if (subtype is GenericFunctionType) {
+ if (supertype is GenericFunctionType) {
+ // Given generic functions g1 and g2, g1 <: g2 iff:
+ //
+ // g1<TFresh> <: g2<TFresh>
+ //
+ // where TFresh is a list of fresh type variables that both g1 and g2 will
+ // be instantiated with.
+ var formalCount = subtype.formalCount;
+ if (formalCount != supertype.formalCount) return false;
+
+ // Using either function's type formals will work as long as they're
+ // both instantiated with the same ones. The instantiate operation is
+ // guaranteed to avoid capture because it does not depend on its
+ // TypeVariable objects, rather it uses JS function parameters to ensure
+ // correct binding.
+ var fresh = supertype.typeFormals;
+
+ // Check the bounds of the type parameters of g1 and g2.
+ // given a type parameter `T1 extends U1` from g1, and a type parameter
+ // `T2 extends U2` from g2, we must ensure that:
+ //
+ // U2 <: U1
+ //
+ // (Note the reversal of direction -- type formal bounds are
+ // contravariant, similar to the function's formal parameter types).
+ //
+ var t1Bounds = subtype.instantiateTypeBounds(fresh);
+ var t2Bounds = supertype.instantiateTypeBounds(fresh);
+ // TODO(jmesserly): we could optimize for the common case of no bounds.
+ for (var i = 0; i < formalCount; i++) {
+ if (!_isSubtypeMatch(t2Bounds[i], t1Bounds[i])) {
+ return false;
+ }
+ }
+ return _isFunctionSubtypeMatch(
+ subtype.instantiate(fresh), supertype.instantiate(fresh));
+ } else {
+ return false;
+ }
+ } else if (supertype is GenericFunctionType) {
+ return false;
+ }
+
+ // A type `P` is a subtype match for `Function` with respect to `L` under no
+ // constraints:
+ // - If `P` implements a call method.
+ // - Or if `P` is a function type.
+ // TODO(paulberry): implement this case.
+ // A type `P` is a subtype match for a type `Q` with respect to `L` under
+ // constraints `C`:
+ // - If `P` is an interface type which implements a call method of type `F`,
+ // and `F` is a subtype match for a type `Q` with respect to `L` under
+ // constraints `C`.
+ // TODO(paulberry): implement this case.
+ if (subtype is FunctionType) {
+ if (supertype is! FunctionType) {
+ if (identical(supertype, unwrapType(Function)) ||
+ identical(supertype, unwrapType(Object))) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+ if (supertype is FunctionType) {
+ return _isFunctionSubtypeMatch(subtype, supertype);
+ }
+ }
+ return _isInterfaceSubtypeMatch(subtype, supertype);
+ }
+
+ bool _isTop(Object type) =>
+ identical(type, _dynamic) ||
+ identical(type, void_) ||
+ identical(type, unwrapType(Object));
+}
+
+/// A constraint on a type parameter that we're inferring.
+class TypeConstraint {
+ /// The lower bound of the type being constrained. This bound must be a
+ /// subtype of the type being constrained.
+ Object lower;
+
+ /// The upper bound of the type being constrained. The type being constrained
+ /// must be a subtype of this bound.
+ Object upper;
+
+ void _constrainLower(Object type) {
+ if (lower != null) {
+ if (isSubtype(lower, type)) {
+ // nothing to do, existing lower bound is lower than the new one.
+ return;
+ }
+ if (!isSubtype(type, lower)) {
+ // Neither bound is lower and we don't have GLB, so use bottom type.
+ type = unwrapType(Null);
+ }
+ }
+ lower = type;
+ }
+
+ void _constrainUpper(Object type) {
+ if (upper != null) {
+ if (isSubtype(type, upper)) {
+ // nothing to do, existing upper bound is higher than the new one.
+ return;
+ }
+ if (!isSubtype(upper, type)) {
+ // Neither bound is higher and we don't have LUB, so use top type.
+ type = unwrapType(Object);
+ }
+ }
+ upper = type;
+ }
+
+ String toString() => '${typeName(lower)} <: <type> <: ${typeName(upper)}';
+}
+
+/// Finds a supertype of [subtype] that matches the class [supertype], but may
+/// contain different generic type arguments.
+Object _getMatchingSupertype(Object subtype, Object supertype) {
+ if (identical(subtype, supertype)) return supertype;
+ if (subtype == null || subtype == unwrapType(Object)) return null;
+
+ var subclass = getGenericClass(subtype);
+ var superclass = getGenericClass(supertype);
+ if (subclass != null && identical(subclass, superclass)) {
+ return subtype; // matching supertype found!
+ }
+
+ var result = _getMatchingSupertype(JS('', '#.__proto__', subtype), supertype);
+ if (result != null) return result;
// Check mixin.
- let m1 = $getMixin($t1);
- if (m1 != null) {
- result = $_extractTypes(m1, $t2, $typeArguments2);
- if (result) return result;
+ var mixin = getMixin(subtype);
+ if (mixin != null) {
+ result = _getMatchingSupertype(mixin, supertype);
+ if (result != null) return result;
}
// Check interfaces.
- let getInterfaces = $getImplements($t1);
- if (getInterfaces) {
- for (let i1 of getInterfaces()) {
- result = $_extractTypes(i1, $t2, $typeArguments2);
- if (result) return result;
+ var getInterfaces = getImplements(subtype);
+ if (getInterfaces != null) {
+ for (var iface in getInterfaces()) {
+ result = _getMatchingSupertype(iface, supertype);
+ if (result != null) return result;
}
}
return null;
-})()''');
+}
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/utils.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/utils.dart
index d913dfa8..87b3cbb 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/utils.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/utils.dart
@@ -40,7 +40,7 @@
/// assertion failure (TypeError) or CastError.
void throwTypeError(String message) {
if (JS('bool', 'dart.__trapRuntimeErrors')) JS('', 'debugger');
- throw new TypeErrorImplementation.fromMessage(message);
+ throw new TypeErrorImpl(message);
}
/// This error indicates a bug in the runtime or the compiler.
diff --git a/pkg/dev_compiler/tool/input_sdk/private/js_array.dart b/pkg/dev_compiler/tool/input_sdk/private/js_array.dart
index abcf157..3cac8a5 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/js_array.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/js_array.dart
@@ -66,12 +66,10 @@
}
}
- List<R> cast<R>() {
- List<Object> self = this;
- return self is List<R> ? self : List.castFrom<E, R>(this);
- }
+ List<R> cast<R>() => List.castFrom<E, R>(this);
- List<R> retype<R>() => List.castFrom<E, R>(this);
+ @Deprecated("Use cast instead.")
+ List<R> retype<R>() => cast<R>();
void add(E value) {
checkGrowable('add');
diff --git a/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart b/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
index e7e7bd6..738db86 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
@@ -737,46 +737,25 @@
// TODO(lrn): These exceptions should be implemented in core.
// When they are, remove the 'Implementation' here.
-/** Thrown by type assertions that fail. */
-class TypeErrorImplementation extends Error implements TypeError {
+/// Thrown by type assertions that fail.
+class TypeErrorImpl extends Error implements TypeError {
final String message;
- /**
- * Normal type error caused by a failed subtype test.
- */
- // TODO(sra): Include [value] in message.
- TypeErrorImplementation(Object value, Object actualType, Object expectedType,
- bool strongModeError)
- : message = "Type '${actualType}' is not a subtype "
- "of type '${expectedType}'" +
- (strongModeError ? " in strong mode" : "");
-
- TypeErrorImplementation.fromMessage(String this.message);
+ TypeErrorImpl(this.message);
String toString() => message;
}
-/** Thrown by the 'as' operator if the cast isn't valid. */
-class CastErrorImplementation extends Error implements CastError {
- // TODO(lrn): Rename to CastError (and move implementation into core).
+/// Thrown by the 'as' operator if the cast isn't valid.
+class CastErrorImpl extends Error implements CastError {
final String message;
- /**
- * Normal cast error caused by a failed type cast.
- */
- // TODO(sra): Include [value] in message.
- CastErrorImplementation(Object value, Object actualType, Object expectedType,
- bool strongModeError)
- : message = "CastError: Casting value of type '$actualType' to"
- " type '$expectedType' which is incompatible" +
- (strongModeError ? " in strong mode": "");
+ CastErrorImpl(this.message);
String toString() => message;
}
-
class FallThroughErrorImplementation extends FallThroughError {
- FallThroughErrorImplementation();
String toString() => "Switch case fall-through.";
}
diff --git a/pkg/front_end/lib/src/base/instrumentation.dart b/pkg/front_end/lib/src/base/instrumentation.dart
index 4f537c7..c87b07e 100644
--- a/pkg/front_end/lib/src/base/instrumentation.dart
+++ b/pkg/front_end/lib/src/base/instrumentation.dart
@@ -46,9 +46,6 @@
var buffer = new StringBuffer();
void writeParameter(VariableDeclaration parameter) {
var covariances = <String>[];
- if (parameter.isGenericCovariantInterface) {
- covariances.add('genericInterface');
- }
if (parameter.isGenericCovariantImpl) {
covariances.add('genericImpl');
}
@@ -91,9 +88,6 @@
if (i != 0) buffer.write(', ');
var typeParameter = function.typeParameters[i];
var covariances = <String>[];
- if (typeParameter.isGenericCovariantInterface) {
- covariances.add('genericInterface');
- }
if (typeParameter.isGenericCovariantImpl) {
covariances.add('genericImpl');
}
diff --git a/pkg/front_end/lib/src/fasta/dill/built_type_builder.dart b/pkg/front_end/lib/src/fasta/dill/built_type_builder.dart
deleted file mode 100644
index 3b170eb..0000000
--- a/pkg/front_end/lib/src/fasta/dill/built_type_builder.dart
+++ /dev/null
@@ -1,48 +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.
-
-library fasta.built_type_builder;
-
-import 'package:kernel/ast.dart' show DartType, Supertype;
-
-import '../kernel/kernel_builder.dart'
- show KernelTypeBuilder, LibraryBuilder, TypeBuilder;
-
-import '../problems.dart' show unimplemented, unsupported;
-
-class BuiltTypeBuilder extends KernelTypeBuilder {
- final DartType builtType;
-
- BuiltTypeBuilder(this.builtType);
-
- DartType build(LibraryBuilder library) => builtType;
-
- Supertype buildSupertype(
- LibraryBuilder library, int charOffset, Uri fileUri) {
- return unimplemented("buildSupertype", -1, null);
- }
-
- Supertype buildMixedInType(
- LibraryBuilder library, int charOffset, Uri fileUri) {
- return unimplemented("buildMixedInType", -1, null);
- }
-
- buildInvalidType(int charOffset, Uri fileUri) {
- return unimplemented("buildInvalidType", -1, null);
- }
-
- String get debugName => "BuiltTypeBuilder";
-
- StringBuffer printOn(StringBuffer buffer) {
- return buffer..write(builtType.toString());
- }
-
- String get name {
- return unimplemented("name", -1, null);
- }
-
- BuiltTypeBuilder clone(List<TypeBuilder> newTypes) {
- return unsupported("clone", -1, null);
- }
-}
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 02d9745..252270f 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -62,10 +62,6 @@
import 'constness.dart' show Constness;
-import 'fangorn.dart' show Fangorn;
-
-import 'forest.dart' show Forest;
-
import 'frontend_accessors.dart' show buildIsNull;
import 'redirecting_factory_body.dart'
@@ -81,15 +77,18 @@
import 'kernel_api.dart';
-import 'kernel_ast_api.dart';
+import 'kernel_ast_api.dart' hide Expression, Statement;
+
+import 'kernel_ast_api.dart' as kernel show Expression, Statement;
import 'kernel_builder.dart';
// TODO(ahe): Remove this and ensure all nodes have a location.
const noLocation = null;
-class BodyBuilder<Arguments> extends ScopeListener<JumpTarget>
- implements BuilderHelper<Arguments> {
+abstract class BodyBuilder<Expression, Statement, Arguments>
+ extends ScopeListener<JumpTarget>
+ implements BuilderHelper<Expression, Statement, Arguments> {
@override
final KernelLibraryBuilder library;
@@ -162,9 +161,9 @@
int functionNestingLevel = 0;
- Statement compileTimeErrorInTry;
+ kernel.Statement compileTimeErrorInTry;
- Statement compileTimeErrorInLoopOrSwitch;
+ kernel.Statement compileTimeErrorInLoopOrSwitch;
Scope switchScope;
@@ -182,10 +181,6 @@
/// and where that was.
Map<String, int> initializedFields;
- // TODO(ahe): Update type parameters.
- @override
- Forest<dynamic, dynamic, Token, dynamic> forest;
-
BodyBuilder(
KernelLibraryBuilder library,
this.member,
@@ -196,8 +191,7 @@
this.classBuilder,
this.isInstanceMember,
this.uri,
- this._typeInferrer,
- [this.forest = const Fangorn()])
+ this._typeInferrer)
: enclosingScope = scope,
library = library,
enableNative =
@@ -238,7 +232,7 @@
@override
Expression toValue(Object node) {
if (node is FastaAccessor) {
- return node.buildSimpleRead();
+ return toExpression(node.buildSimpleRead());
} else if (node is Expression) {
return node;
} else if (node is PrefixBuilder) {
@@ -255,7 +249,7 @@
}
Expression toEffect(Object node) {
- if (node is FastaAccessor) return node.buildForEffect();
+ if (node is FastaAccessor) return toExpression(node.buildForEffect());
return toValue(node);
}
@@ -278,13 +272,13 @@
}
Block popBlock(int count, Token beginToken) {
- List<dynamic /*Statement | List<Statement>*/ > statements =
- popList(count) ?? <Statement>[];
- List<Statement> copy;
+ List<dynamic /*kernel.Statement | List<kernel.Statement>*/ > statements =
+ popList(count) ?? <kernel.Statement>[];
+ List<kernel.Statement> copy;
for (int i = 0; i < statements.length; i++) {
var statement = statements[i];
if (statement is List) {
- copy ??= new List<Statement>.from(statements.getRange(0, i));
+ copy ??= new List<kernel.Statement>.from(statements.getRange(0, i));
// TODO(sigmund): remove this assignment (issue #28651)
Iterable subStatements = statement;
copy.addAll(subStatements);
@@ -296,16 +290,16 @@
..fileOffset = offsetForToken(beginToken);
}
- Statement popStatementIfNotNull(Object value) {
+ kernel.Statement popStatementIfNotNull(Object value) {
return value == null ? null : popStatement();
}
- Statement popStatement() {
+ kernel.Statement popStatement() {
var statement = pop();
if (statement is List) {
- return new Block(new List<Statement>.from(statement));
+ return new Block(new List<kernel.Statement>.from(statement));
} else if (statement is VariableDeclaration) {
- return new Block(<Statement>[statement]);
+ return new Block(<kernel.Statement>[statement]);
} else {
return statement;
}
@@ -327,7 +321,7 @@
.forEach((String name, Builder builder) {
if (outerSwitchScope == null) {
JumpTarget target = builder;
- for (Statement statement in target.users) {
+ for (kernel.Statement statement in target.users) {
statement.parent.replaceChild(
statement,
wrapInCompileTimeErrorStatement(statement,
@@ -349,13 +343,14 @@
int offset = variable.fileOffset;
Message message = template.withArguments(name);
if (variable.initializer == null) {
- variable.initializer =
- buildCompileTimeError(message, offset, name.length, context: context)
- ..parent = variable;
+ variable.initializer = toKernelExpression(
+ buildCompileTimeError(message, offset, name.length, context: context))
+ ..parent = variable;
} else {
- variable.initializer = wrapInLocatedCompileTimeError(
- variable.initializer, message.withLocation(uri, offset, name.length),
- context: context)
+ variable.initializer = toKernelExpression(wrapInLocatedCompileTimeError(
+ toExpression(variable.initializer),
+ message.withLocation(uri, offset, name.length),
+ context: context))
..parent = variable;
}
}
@@ -490,7 +485,7 @@
_typeInferrer.inferFieldInitializer(
this,
field.hasTypeInferredFromInitializer ? null : field.builtType,
- initializer);
+ toKernelExpression(initializer));
}
}
pop(); // Type.
@@ -505,7 +500,7 @@
field = fields[i].target;
cloner ??= new CloneVisitor();
for (Expression annotation in annotations) {
- field.addAnnotation(cloner.clone(annotation));
+ field.addAnnotation(cloner.clone(toKernelExpression(annotation)));
}
}
}
@@ -549,8 +544,11 @@
formal.charOffset),
formal.charOffset);
} else {
- initializer = buildFieldInitializer(true, formal.name,
- formal.charOffset, new VariableGet(formal.declaration));
+ initializer = buildFieldInitializer(
+ true,
+ formal.name,
+ formal.charOffset,
+ toExpression(new VariableGet(formal.declaration)));
}
member.addInitializer(initializer, _typeInferrer);
}
@@ -605,8 +603,8 @@
initializer = buildSuperInitializer(
false,
node.target,
- node.arguments
- as dynamic, // TODO(ahe): Remove this cast when buildSuperInitializer is moved to [Forest].
+ node.arguments as dynamic, // TODO(ahe): Remove this cast when
+ // buildSuperInitializer is moved to [Forest].
token.charOffset);
} else {
Expression value = toValue(node);
@@ -636,7 +634,7 @@
@override
void finishFunction(List annotations, FormalParameters formals,
- AsyncMarker asyncModifier, Statement body) {
+ AsyncMarker asyncModifier, kernel.Statement body) {
debugEvent("finishFunction");
typePromoter.finished();
@@ -652,9 +650,10 @@
// TODO(ahe): Should store: realParameter.fileOffset
// https://github.com/dart-lang/sdk/issues/32289
null);
- realParameter.initializer = initializer..parent = realParameter;
+ realParameter.initializer = toKernelExpression(initializer)
+ ..parent = realParameter;
_typeInferrer.inferParameterInitializer(
- this, initializer, realParameter.type);
+ this, toKernelExpression(initializer), realParameter.type);
}
}
@@ -674,7 +673,7 @@
if (builder.formals != null) {
// Illegal parameters were removed by the function builder.
// Add them as local variable to put them in scope of the body.
- List<Statement> statements = <Statement>[];
+ List<kernel.Statement> statements = <kernel.Statement>[];
for (KernelFormalParameterBuilder parameter in builder.formals) {
statements.add(parameter.target);
}
@@ -696,7 +695,7 @@
Member target = builder.target;
_typeInferrer.inferMetadata(this, annotations);
for (Expression annotation in annotations ?? const []) {
- target.addAnnotation(annotation);
+ target.addAnnotation(toKernelExpression(annotation));
}
if (builder is KernelConstructorBuilder) {
finishConstructor(builder, asyncModifier);
@@ -709,8 +708,8 @@
}
@override
- List<Expression> finishMetadata() {
- List<Expression> expressions = pop();
+ List<kernel.Expression> finishMetadata() {
+ List<kernel.Expression> expressions = pop();
_typeInferrer.inferMetadata(this, expressions);
return expressions;
}
@@ -743,12 +742,13 @@
.withLocation(uri, eof.charOffset, eof.length));
}
- ShadowReturnStatement fakeReturn = new ShadowReturnStatement(expression);
+ ShadowReturnStatement fakeReturn =
+ new ShadowReturnStatement(toKernelExpression(expression));
_typeInferrer.inferFunctionBody(
this, const DynamicType(), AsyncMarker.Sync, fakeReturn);
- return fakeReturn.expression;
+ return toExpression(fakeReturn.expression);
}
void finishConstructor(
@@ -806,7 +806,7 @@
@override
void endExpressionStatement(Token token) {
debugEvent("ExpressionStatement");
- push(new ShadowExpressionStatement(popForEffect()));
+ push(new ShadowExpressionStatement(toKernelExpression(popForEffect())));
}
@override
@@ -824,8 +824,8 @@
if (i > firstNamedArgumentIndex) {
arguments[i] = new NamedExpression(
"#$i",
- deprecated_buildCompileTimeError(
- "Expected named argument.", arguments[i].fileOffset))
+ toKernelExpression(deprecated_buildCompileTimeError(
+ "Expected named argument.", arguments[i].fileOffset)))
..fileOffset = beginToken.charOffset;
}
}
@@ -840,9 +840,9 @@
named = <NamedExpression>[
new NamedExpression(
named[1].name,
- deprecated_buildCompileTimeError(
+ toKernelExpression(deprecated_buildCompileTimeError(
"Duplicated named argument '${named[1].name}'.",
- named[1].fileOffset))
+ named[1].fileOffset)))
];
}
} else if (named.length > 2) {
@@ -852,9 +852,10 @@
if (seenNames.containsKey(expression.name)) {
hasProblem = true;
var prevNamedExpression = seenNames[expression.name];
- prevNamedExpression.value = deprecated_buildCompileTimeError(
- "Duplicated named argument '${expression.name}'.",
- expression.fileOffset)
+ prevNamedExpression.value = toKernelExpression(
+ deprecated_buildCompileTimeError(
+ "Duplicated named argument '${expression.name}'.",
+ expression.fileOffset))
..parent = prevNamedExpression;
} else {
seenNames[expression.name] = expression;
@@ -873,7 +874,8 @@
@override
void handleParenthesizedExpression(Token token) {
debugEvent("ParenthesizedExpression");
- push(new ParenthesizedExpression(this, popForValue(), token.endGroup));
+ push(new ParenthesizedExpression(
+ this, toKernelExpression(popForValue()), token.endGroup));
}
@override
@@ -923,7 +925,7 @@
expression.extend();
} else {
VariableDeclaration variable = new ShadowVariableDeclaration.forValue(
- expression, functionNestingLevel);
+ toKernelExpression(expression), functionNestingLevel);
push(new ShadowCascadeExpression(variable));
push(new VariableAccessor(this, token, variable));
}
@@ -934,7 +936,7 @@
debugEvent("endCascade");
Expression expression = popForEffect();
ShadowCascadeExpression cascadeReceiver = pop();
- cascadeReceiver.finalize(expression);
+ cascadeReceiver.finalize(toKernelExpression(expression));
push(cascadeReceiver);
}
@@ -957,7 +959,8 @@
void beginBinaryExpression(Token token) {
if (optional("&&", token) || optional("||", token)) {
Expression lhs = popForValue();
- typePromoter.enterLogicalExpression(lhs, token.stringValue);
+ typePromoter.enterLogicalExpression(
+ toKernelExpression(lhs), token.stringValue);
push(lhs);
}
}
@@ -1009,10 +1012,13 @@
void doLogicalExpression(Token token) {
Expression argument = popForValue();
Expression receiver = pop();
- var logicalExpression =
- new ShadowLogicalExpression(receiver, token.stringValue, argument)
- ..fileOffset = offsetForToken(token);
- typePromoter.exitLogicalExpression(argument, logicalExpression);
+ var logicalExpression = new ShadowLogicalExpression(
+ toKernelExpression(receiver),
+ token.stringValue,
+ toKernelExpression(argument))
+ ..fileOffset = offsetForToken(token);
+ typePromoter.exitLogicalExpression(
+ toKernelExpression(argument), logicalExpression);
push(logicalExpression);
}
@@ -1020,12 +1026,13 @@
void doIfNull(Token token) {
Expression b = popForValue();
Expression a = popForValue();
- VariableDeclaration variable = new VariableDeclaration.forValue(a);
+ VariableDeclaration variable =
+ new VariableDeclaration.forValue(toKernelExpression(a));
push(new ShadowIfNullExpression(
variable,
new ConditionalExpression(
buildIsNull(new VariableGet(variable), offsetForToken(token)),
- b,
+ toKernelExpression(b),
new VariableGet(variable),
null))
..fileOffset = offsetForToken(token));
@@ -1122,14 +1129,16 @@
return buildCompileTimeError(message, charOffset, noLength,
context: context);
} else {
- Expression error = library.loader.instantiateNoSuchMethodError(
- receiver, name, forest.castArguments(arguments), charOffset,
- isMethod: !isGetter && !isSetter,
- isGetter: isGetter,
- isSetter: isSetter,
- isStatic: isStatic,
- isTopLevel: !isStatic && !isSuper);
- return new ShadowSyntheticExpression(new Throw(error));
+ Expression error = toExpression(library.loader
+ .instantiateNoSuchMethodError(toKernelExpression(receiver), name,
+ forest.castArguments(arguments), charOffset,
+ isMethod: !isGetter && !isSetter,
+ isGetter: isGetter,
+ isSetter: isSetter,
+ isStatic: isStatic,
+ isTopLevel: !isStatic && !isSuper));
+ return toExpression(
+ new ShadowSyntheticExpression(new Throw(toKernelExpression(error))));
}
}
@@ -1535,7 +1544,9 @@
if (expressions == null) {
expressions = parts.sublist(0, i);
}
- expressions.addAll(part.expressions);
+ for (kernel.Expression expression in part.expressions) {
+ expressions.add(toExpression(expression));
+ }
} else {
if (expressions != null) {
expressions.add(part);
@@ -1577,7 +1588,7 @@
push(deprecated_buildCompileTimeErrorStatement(
"Can't return from a constructor.", beginToken.charOffset));
} else {
- push(new ShadowReturnStatement(expression)
+ push(new ShadowReturnStatement(toKernelExpression(expression))
..fileOffset = beginToken.charOffset);
}
}
@@ -1585,7 +1596,7 @@
@override
void beginThenStatement(Token token) {
Expression condition = popForValue();
- typePromoter.enterThen(condition);
+ typePromoter.enterThen(toKernelExpression(condition));
push(condition);
super.beginThenStatement(token);
}
@@ -1598,12 +1609,13 @@
@override
void endIfStatement(Token ifToken, Token elseToken) {
- Statement elsePart = popStatementIfNotNull(elseToken);
- Statement thenPart = popStatement();
+ kernel.Statement elsePart = popStatementIfNotNull(elseToken);
+ kernel.Statement thenPart = popStatement();
Expression condition = pop();
typePromoter.exitConditional();
- push(new ShadowIfStatement(condition, thenPart, elsePart)
- ..fileOffset = ifToken.charOffset);
+ push(
+ new ShadowIfStatement(toKernelExpression(condition), thenPart, elsePart)
+ ..fileOffset = ifToken.charOffset);
}
@override
@@ -1641,7 +1653,7 @@
bool isFinal = (currentLocalVariableModifiers & finalMask) != 0;
assert(isConst == (constantContext == ConstantContext.inferred));
push(new ShadowVariableDeclaration(identifier.name, functionNestingLevel,
- initializer: initializer,
+ initializer: toKernelExpression(initializer),
type: currentLocalVariableType,
isFinal: isFinal,
isConst: isConst)
@@ -1699,7 +1711,14 @@
constantContext = pop();
currentLocalVariableType = pop();
currentLocalVariableModifiers = pop();
- pop(); // Metadata.
+ List<Expression> annotations = pop();
+ if (annotations != null) {
+ for (VariableDeclaration variable in variables) {
+ for (Expression annotation in annotations) {
+ variable.addAnnotation(toKernelExpression(annotation));
+ }
+ }
+ }
if (variables.length != 1) {
push(variables);
} else {
@@ -1731,7 +1750,7 @@
offsetForToken(token), lengthForToken(token)));
} else {
push(new DelayedAssignment(
- this, token, accessor, value, token.stringValue));
+ this, token, accessor, toKernelExpression(value), token.stringValue));
}
}
@@ -1747,7 +1766,7 @@
}
}
- void exitLoopOrSwitch(Statement statement) {
+ void exitLoopOrSwitch(kernel.Statement statement) {
if (compileTimeErrorInLoopOrSwitch != null) {
push(compileTimeErrorInLoopOrSwitch);
compileTimeErrorInLoopOrSwitch = null;
@@ -1772,7 +1791,7 @@
return <VariableDeclaration>[];
} else if (variableOrExpression is Expression) {
VariableDeclaration variable = new ShadowVariableDeclaration.forEffect(
- variableOrExpression, functionNestingLevel);
+ toKernelExpression(variableOrExpression), functionNestingLevel);
return <VariableDeclaration>[variable];
} else if (variableOrExpression is ExpressionStatement) {
VariableDeclaration variable = new ShadowVariableDeclaration.forEffect(
@@ -1786,12 +1805,12 @@
void endForStatement(Token forKeyword, Token leftParen, Token leftSeparator,
int updateExpressionCount, Token endToken) {
debugEvent("ForStatement");
- Statement body = popStatement();
+ kernel.Statement body = popStatement();
List<Expression> updates = popListForEffect(updateExpressionCount);
- Statement conditionStatement = popStatement();
+ kernel.Statement conditionStatement = popStatement();
Expression condition = null;
if (conditionStatement is ExpressionStatement) {
- condition = conditionStatement.expression;
+ condition = toExpression(conditionStatement.expression);
} else {
assert(conditionStatement is EmptyStatement);
}
@@ -1809,9 +1828,9 @@
body = new ShadowLabeledStatement(body);
continueTarget.resolveContinues(body);
}
- Statement result =
- new ShadowForStatement(variables, condition, updates, body)
- ..fileOffset = forKeyword.charOffset;
+ kernel.Statement result = new ShadowForStatement(variables,
+ toKernelExpression(condition), toKernelExpressionList(updates), body)
+ ..fileOffset = forKeyword.charOffset;
if (breakTarget.hasUsers) {
result = new ShadowLabeledStatement(result);
breakTarget.resolveBreaks(result);
@@ -1833,7 +1852,7 @@
@override
void handleLiteralList(
- int count, Token beginToken, Token constKeyword, Token endToken) {
+ int count, Token leftBracket, Token constKeyword, Token rightBracket) {
debugEvent("LiteralList");
List<Expression> expressions = popListForValue(count);
Object typeArguments = pop();
@@ -1842,8 +1861,8 @@
if (forest.getTypeCount(typeArguments) > 1) {
addProblem(
fasta.messageListLiteralTooManyTypeArguments,
- offsetForToken(beginToken),
- lengthOfSpan(beginToken, beginToken.endGroup));
+ offsetForToken(leftBracket),
+ lengthOfSpan(leftBracket, leftBracket.endGroup));
} else {
typeArgument = forest.getTypeAt(typeArguments, 0);
if (library.loader.target.strongMode) {
@@ -1857,9 +1876,9 @@
constKeyword != null || constantContext == ConstantContext.inferred,
typeArgument,
typeArguments,
- beginToken,
+ leftBracket,
expressions,
- endToken));
+ rightBracket));
}
@override
@@ -1884,7 +1903,7 @@
@override
void handleLiteralMap(
- int count, Token beginToken, Token constKeyword, Token endToken) {
+ int count, Token leftBrace, Token constKeyword, Token rightBrace) {
debugEvent("LiteralMap");
List entries = forest.mapEntryList(count);
popList(count, entries);
@@ -1895,8 +1914,8 @@
if (forest.getTypeCount(typeArguments) != 2) {
addProblem(
fasta.messageListLiteralTypeArgumentMismatch,
- offsetForToken(beginToken),
- lengthOfSpan(beginToken, beginToken.endGroup));
+ offsetForToken(leftBrace),
+ lengthOfSpan(leftBrace, leftBrace.endGroup));
} else {
keyType = forest.getTypeAt(typeArguments, 0);
valueType = forest.getTypeAt(typeArguments, 1);
@@ -1913,9 +1932,9 @@
keyType,
valueType,
typeArguments,
- beginToken,
+ leftBrace,
entries,
- endToken));
+ rightBrace));
}
@override
@@ -2057,8 +2076,8 @@
bool isInverted = not != null;
Expression isExpression = forest.isExpression(operand, operator, not, type);
if (operand is VariableGet) {
- typePromoter.handleIsCheck(isExpression, isInverted, operand.variable,
- type, functionNestingLevel);
+ typePromoter.handleIsCheck(toKernelExpression(isExpression), isInverted,
+ operand.variable, type, functionNestingLevel);
}
if (constantContext != ConstantContext.none) {
push(deprecated_buildCompileTimeError(
@@ -2071,7 +2090,7 @@
@override
void beginConditionalExpression(Token question) {
Expression condition = popForValue();
- typePromoter.enterThen(condition);
+ typePromoter.enterThen(toKernelExpression(condition));
push(condition);
super.beginConditionalExpression(question);
}
@@ -2103,8 +2122,8 @@
push(deprecated_buildCompileTimeError(
"Not a constant expression.", throwToken.charOffset));
} else {
- push(
- new ShadowThrow(expression)..fileOffset = offsetForToken(throwToken));
+ push(new ShadowThrow(toKernelExpression(expression))
+ ..fileOffset = offsetForToken(throwToken));
}
}
@@ -2134,7 +2153,7 @@
}
bool isConst = (modifiers & constMask) != 0;
bool isFinal = (modifiers & finalMask) != 0;
- ignore(Unhandled.Metadata);
+ List<Expression> annotations = pop();
VariableDeclaration variable;
if (!inCatchClause &&
functionNestingLevel == 0 &&
@@ -2162,6 +2181,14 @@
variable.fileOffset = offsetForToken(name.token);
}
}
+ if (annotations != null) {
+ if (functionNestingLevel == 0) {
+ _typeInferrer.inferMetadata(this, toKernelExpressionList(annotations));
+ }
+ for (Expression annotation in annotations) {
+ variable.addAnnotation(toKernelExpression(annotation));
+ }
+ }
push(variable);
}
@@ -2215,7 +2242,8 @@
debugEvent("ValuedFormalParameter");
Expression initializer = popForValue();
Identifier name = pop();
- push(new InitializedIdentifier(name.token, initializer));
+ push(
+ new InitializedIdentifier(name.token, toKernelExpression(initializer)));
}
@override
@@ -2290,7 +2318,7 @@
}
if (catchParameters.required.length > 2 ||
catchParameters.optional != null) {
- body = new Block(<Statement>[
+ body = new Block(<kernel.Statement>[
compileTimeErrorInTry ??= deprecated_buildCompileTimeErrorStatement(
"Invalid catch arguments.", catchKeyword.next.charOffset)
]);
@@ -2302,9 +2330,9 @@
@override
void endTryStatement(int catchCount, Token tryKeyword, Token finallyKeyword) {
- Statement finallyBlock = popStatementIfNotNull(finallyKeyword);
+ kernel.Statement finallyBlock = popStatementIfNotNull(finallyKeyword);
List<Catch> catches = popList(catchCount);
- Statement tryBlock = popStatement();
+ kernel.Statement tryBlock = popStatement();
if (compileTimeErrorInTry == null) {
if (catches != null) {
tryBlock = new ShadowTryCatch(tryBlock, catches);
@@ -2335,12 +2363,17 @@
push(new SuperIndexAccessor(
this,
openSquareBracket,
- index,
+ toKernelExpression(index),
lookupInstanceMember(indexGetName, isSuper: true),
lookupInstanceMember(indexSetName, isSuper: true)));
} else {
push(IndexAccessor.make(
- this, openSquareBracket, toValue(receiver), index, null, null));
+ this,
+ openSquareBracket,
+ toKernelExpression(toValue(receiver)),
+ toKernelExpression(index),
+ null,
+ null));
}
}
@@ -2531,10 +2564,10 @@
return deprecated_buildCompileTimeError(
"Not a const constructor.", charOffset);
}
- return new ShadowConstructorInvocation(target, targetTypeArguments,
- initialTarget, forest.castArguments(arguments),
+ return toExpression(new ShadowConstructorInvocation(target,
+ targetTypeArguments, initialTarget, forest.castArguments(arguments),
isConst: isConst)
- ..fileOffset = charOffset;
+ ..fileOffset = charOffset);
} else {
Procedure procedure = target;
if (procedure.isFactory) {
@@ -2545,15 +2578,15 @@
return deprecated_buildCompileTimeError(
"Not a const factory.", charOffset);
}
- return new ShadowFactoryConstructorInvocation(target,
+ return toExpression(new ShadowFactoryConstructorInvocation(target,
targetTypeArguments, initialTarget, forest.castArguments(arguments),
isConst: isConst)
- ..fileOffset = charOffset;
+ ..fileOffset = charOffset);
} else {
- return new ShadowStaticInvocation(
+ return toExpression(new ShadowStaticInvocation(
target, forest.castArguments(arguments),
isConst: isConst)
- ..fileOffset = charOffset;
+ ..fileOffset = charOffset);
}
}
}
@@ -2764,13 +2797,14 @@
} else if (b.isConstructor) {
initialTarget = b.target;
if (type.isAbstract) {
- return new ShadowSyntheticExpression(evaluateArgumentsBefore(
- arguments,
- buildAbstractClassInstantiationError(
- fasta.templateAbstractClassInstantiation
- .withArguments(type.name),
- type.name,
- nameToken.charOffset)));
+ return toExpression(new ShadowSyntheticExpression(toKernelExpression(
+ evaluateArgumentsBefore(
+ arguments,
+ buildAbstractClassInstantiationError(
+ fasta.templateAbstractClassInstantiation
+ .withArguments(type.name),
+ type.name,
+ nameToken.charOffset)))));
} else {
target = initialTarget;
}
@@ -2786,13 +2820,14 @@
"Cyclic definition of factory '${name}'.", nameToken.charOffset);
}
if (target is Constructor && target.enclosingClass.isAbstract) {
- return new ShadowSyntheticExpression(evaluateArgumentsBefore(
- arguments,
- buildAbstractClassInstantiationError(
- fasta.templateAbstractRedirectedClassInstantiation
- .withArguments(target.enclosingClass.name),
- target.enclosingClass.name,
- nameToken.charOffset)));
+ return toExpression(new ShadowSyntheticExpression(toKernelExpression(
+ evaluateArgumentsBefore(
+ arguments,
+ buildAbstractClassInstantiationError(
+ fasta.templateAbstractRedirectedClassInstantiation
+ .withArguments(target.enclosingClass.name),
+ target.enclosingClass.name,
+ nameToken.charOffset)))));
}
RedirectingFactoryBody body = getRedirectingFactoryBody(target);
if (body != null) {
@@ -2865,7 +2900,7 @@
debugEvent("NamedArgument");
Expression value = popForValue();
Identifier identifier = pop();
- push(new NamedExpression(identifier.name, value)
+ push(new NamedExpression(identifier.name, toKernelExpression(value))
..fileOffset = offsetForToken(identifier.token));
}
@@ -2932,7 +2967,7 @@
}
void pushNamedFunction(Token token, bool isFunctionExpression) {
- Statement body = popStatement();
+ kernel.Statement body = popStatement();
AsyncMarker asyncModifier = pop();
exitLocalScope();
FormalParameters formals = pop();
@@ -2942,8 +2977,9 @@
returnType ??= const DynamicType();
exitFunction();
List<TypeParameter> typeParameters = typeVariableBuildersToKernel(pop());
+ List<Expression> annotations;
if (!isFunctionExpression) {
- pop(); // Metadata.
+ annotations = pop(); // Metadata.
}
FunctionNode function = formals.addToFunction(new FunctionNode(body,
typeParameters: typeParameters,
@@ -2954,26 +2990,33 @@
if (declaration is FunctionDeclaration) {
VariableDeclaration variable = declaration.variable;
+ if (annotations != null) {
+ for (Expression annotation in annotations) {
+ variable.addAnnotation(toKernelExpression(annotation));
+ }
+ }
ShadowFunctionDeclaration.setHasImplicitReturnType(
declaration, hasImplicitReturnType);
variable.type = function.functionType;
if (isFunctionExpression) {
- Expression oldInitializer = variable.initializer;
+ Expression oldInitializer = toExpression(variable.initializer);
variable.initializer = new ShadowFunctionExpression(function)
..parent = variable
..fileOffset = formals.charOffset;
exitLocalScope();
- Expression expression = new ShadowNamedFunctionExpression(variable);
+ Expression expression =
+ toExpression(new ShadowNamedFunctionExpression(variable));
if (oldInitializer != null) {
// This must have been a compile-time error.
- assert(isErroneousNode(oldInitializer));
+ assert(isErroneousNode(toKernelExpression(oldInitializer)));
push(new Let(
- new VariableDeclaration.forValue(oldInitializer)
- ..fileOffset = expression.fileOffset,
- expression)
- ..fileOffset = expression.fileOffset);
+ new VariableDeclaration.forValue(
+ toKernelExpression(oldInitializer))
+ ..fileOffset = forest.readOffset(expression),
+ toKernelExpression(expression))
+ ..fileOffset = forest.readOffset(expression));
} else {
push(expression);
}
@@ -2984,7 +3027,7 @@
// This must have been a compile-time error.
assert(isErroneousNode(variable.initializer));
- push(new Block(<Statement>[
+ push(new Block(<kernel.Statement>[
new ExpressionStatement(variable.initializer),
declaration
])
@@ -3015,7 +3058,7 @@
@override
void endFunctionExpression(Token beginToken, Token token) {
debugEvent("FunctionExpression");
- Statement body = popStatement();
+ kernel.Statement body = popStatement();
AsyncMarker asyncModifier = pop();
exitLocalScope();
FormalParameters formals = pop();
@@ -3039,15 +3082,16 @@
Token doKeyword, Token whileKeyword, Token endToken) {
debugEvent("DoWhileStatement");
Expression condition = popForValue();
- Statement body = popStatement();
+ kernel.Statement body = popStatement();
JumpTarget continueTarget = exitContinueTarget();
JumpTarget breakTarget = exitBreakTarget();
if (continueTarget.hasUsers) {
body = new ShadowLabeledStatement(body);
continueTarget.resolveContinues(body);
}
- Statement result = new ShadowDoStatement(body, condition)
- ..fileOffset = doKeyword.charOffset;
+ kernel.Statement result =
+ new ShadowDoStatement(body, toKernelExpression(condition))
+ ..fileOffset = doKeyword.charOffset;
if (breakTarget.hasUsers) {
result = new ShadowLabeledStatement(result);
breakTarget.resolveBreaks(result);
@@ -3072,7 +3116,7 @@
void endForIn(Token awaitToken, Token forToken, Token leftParenthesis,
Token inKeyword, Token endToken) {
debugEvent("ForIn");
- Statement body = popStatement();
+ kernel.Statement body = popStatement();
Expression expression = popForValue();
var lvalue = pop();
exitLocalScope();
@@ -3114,12 +3158,16 @@
body = combineStatements(
new ShadowLoopAssignmentStatement(syntheticAssignment), body);
} else {
- variable = new VariableDeclaration.forValue(
+ variable = new VariableDeclaration.forValue(toKernelExpression(
deprecated_buildCompileTimeError("Expected lvalue, but got ${lvalue}",
- forToken.next.next.charOffset));
+ forToken.next.next.charOffset)));
}
- Statement result = new ShadowForInStatement(
- variable, expression, body, declaresVariable, syntheticAssignment,
+ kernel.Statement result = new ShadowForInStatement(
+ variable,
+ toKernelExpression(expression),
+ body,
+ declaresVariable,
+ syntheticAssignment,
isAsync: awaitToken != null)
..fileOffset = awaitToken?.charOffset ?? forToken.charOffset
..bodyOffset = body.fileOffset;
@@ -3153,7 +3201,7 @@
@override
void endLabeledStatement(int labelCount) {
debugEvent("LabeledStatement");
- Statement statement = popStatement();
+ kernel.Statement statement = popStatement();
LabelTarget target = pop();
exitLocalScope();
if (target.breakTarget.hasUsers) {
@@ -3193,7 +3241,7 @@
@override
void endWhileStatement(Token whileKeyword, Token endToken) {
debugEvent("WhileStatement");
- Statement body = popStatement();
+ kernel.Statement body = popStatement();
Expression condition = popForValue();
JumpTarget continueTarget = exitContinueTarget();
JumpTarget breakTarget = exitBreakTarget();
@@ -3201,8 +3249,9 @@
body = new ShadowLabeledStatement(body);
continueTarget.resolveContinues(body);
}
- Statement result = new ShadowWhileStatement(condition, body)
- ..fileOffset = whileKeyword.charOffset;
+ kernel.Statement result =
+ new ShadowWhileStatement(toKernelExpression(condition), body)
+ ..fileOffset = whileKeyword.charOffset;
if (breakTarget.hasUsers) {
result = new ShadowLabeledStatement(result);
breakTarget.resolveBreaks(result);
@@ -3266,10 +3315,11 @@
}
}
- AssertStatement statement = new ShadowAssertStatement(condition,
+ AssertStatement statement = new ShadowAssertStatement(
+ toKernelExpression(condition),
conditionStartOffset: startOffset,
conditionEndOffset: endOffset,
- message: message);
+ message: toKernelExpression(message));
switch (kind) {
case Assert.Statement:
push(statement);
@@ -3291,7 +3341,8 @@
@override
void endYieldStatement(Token yieldToken, Token starToken, Token endToken) {
debugEvent("YieldStatement");
- push(new ShadowYieldStatement(popForValue(), isYieldStar: starToken != null)
+ push(new ShadowYieldStatement(toKernelExpression(popForValue()),
+ isYieldStar: starToken != null)
..fileOffset = yieldToken.charOffset);
}
@@ -3357,9 +3408,10 @@
List<Expression> expressions = pop();
List<int> expressionOffsets = <int>[];
for (Expression expression in expressions) {
- expressionOffsets.add(expression.fileOffset);
+ expressionOffsets.add(forest.readOffset(expression));
}
- push(new SwitchCase(expressions, expressionOffsets, block,
+ push(new SwitchCase(
+ toKernelExpressionList(expressions), expressionOffsets, block,
isDefault: defaultKeyword != null)
..fileOffset = firstToken.charOffset);
push(labels);
@@ -3374,8 +3426,9 @@
exitSwitchScope();
exitLocalScope();
Expression expression = popForValue();
- Statement result = new ShadowSwitchStatement(expression, cases)
- ..fileOffset = switchKeyword.charOffset;
+ kernel.Statement result =
+ new ShadowSwitchStatement(toKernelExpression(expression), cases)
+ ..fileOffset = switchKeyword.charOffset;
if (target.hasUsers) {
result = new ShadowLabeledStatement(result);
target.resolveBreaks(result);
@@ -3419,8 +3472,8 @@
lastNode is! Rethrow &&
lastNode is! ReturnStatement &&
lastNode is! Throw) {
- block.addStatement(
- new ExpressionStatement(buildFallThroughError(current.fileOffset)));
+ block.addStatement(new ExpressionStatement(
+ toKernelExpression(buildFallThroughError(current.fileOffset))));
}
}
@@ -3545,8 +3598,7 @@
debugEvent("TypeVariable");
DartType bound = pop();
Identifier name = pop();
- // TODO(ahe): Do not discard metadata.
- pop(); // Metadata.
+ List<Expression> annotations = pop();
KernelTypeVariableBuilder variable;
Object inScope = scopeLookup(scope, name.name, token);
if (inScope is TypeDeclarationAccessor) {
@@ -3558,6 +3610,12 @@
name.name, library, offsetForToken(name.token), null);
}
variable.parameter.bound = bound;
+ if (annotations != null) {
+ _typeInferrer.inferMetadata(this, toKernelExpressionList(annotations));
+ for (Expression annotation in annotations) {
+ variable.parameter.addAnnotation(toKernelExpression(annotation));
+ }
+ }
push(variable
..finish(library, library.loader.target.objectClassBuilder,
library.loader.target.dynamicType));
@@ -3607,7 +3665,7 @@
@override
void handleInvalidStatement(Token token, Message message) {
- Statement statement = pop();
+ kernel.Statement statement = pop();
push(wrapInCompileTimeErrorStatement(statement, message));
}
@@ -3623,15 +3681,15 @@
{List<LocatedMessage> context}) {
library.addCompileTimeError(message, charOffset, length, uri,
wasHandled: true, context: context);
- return new ShadowSyntheticExpression(library.loader
+ return toExpression(new ShadowSyntheticExpression(library.loader
.throwCompileConstantError(library.loader
- .buildCompileTimeError(message, charOffset, length, uri)));
+ .buildCompileTimeError(message, charOffset, length, uri))));
}
Expression wrapInCompileTimeError(Expression expression, Message message,
{List<LocatedMessage> context}) {
- return wrapInLocatedCompileTimeError(
- expression, message.withLocation(uri, expression.fileOffset, noLength),
+ return wrapInLocatedCompileTimeError(expression,
+ message.withLocation(uri, forest.readOffset(expression), noLength),
context: context);
}
@@ -3640,17 +3698,19 @@
{List<LocatedMessage> context}) {
// TODO(askesc): Produce explicit error expression wrapping the original.
// See [issue 29717](https://github.com/dart-lang/sdk/issues/29717)
- return new Let(
- new VariableDeclaration.forValue(buildCompileTimeError(
- message.messageObject, message.charOffset, message.length,
- context: context))
- ..fileOffset = expression.fileOffset,
+ return toExpression(new Let(
+ new VariableDeclaration.forValue(toKernelExpression(
+ buildCompileTimeError(
+ message.messageObject, message.charOffset, message.length,
+ context: context)))
+ ..fileOffset = forest.readOffset(expression),
new Let(
- new VariableDeclaration.forValue(expression)
- ..fileOffset = expression.fileOffset,
- storeOffset(forest.literalNull(null), expression.fileOffset))
- ..fileOffset = expression.fileOffset)
- ..fileOffset = expression.fileOffset;
+ new VariableDeclaration.forValue(toKernelExpression(expression))
+ ..fileOffset = forest.readOffset(expression),
+ toKernelExpression(storeOffset(
+ forest.literalNull(null), forest.readOffset(expression))))
+ ..fileOffset = forest.readOffset(expression))
+ ..fileOffset = forest.readOffset(expression));
}
Expression buildFallThroughError(int charOffset) {
@@ -3662,14 +3722,14 @@
// TODO(ahe): Compute a LocatedMessage above instead?
Location location = messages.getLocationFromUri(uri, charOffset);
- return new Throw(buildStaticInvocation(
+ return toExpression(new Throw(toKernelExpression(buildStaticInvocation(
library.loader.coreTypes.fallThroughErrorUrlAndLineConstructor,
forest.arguments(<Expression>[
storeOffset(forest.literalString("${location?.file ?? uri}", null),
charOffset),
storeOffset(forest.literalInt(location?.line ?? 0, null), charOffset),
], noLocation),
- charOffset: charOffset));
+ charOffset: charOffset))));
}
Expression buildAbstractClassInstantiationError(
@@ -3678,27 +3738,29 @@
addProblemErrorIfConst(message, charOffset, className.length);
// TODO(ahe): The following doesn't make sense to Analyzer AST.
Builder constructor = library.loader.getAbstractClassInstantiationError();
- return new Throw(buildStaticInvocation(
+ return toExpression(new Throw(toKernelExpression(buildStaticInvocation(
constructor.target,
forest.arguments(<Expression>[
storeOffset(forest.literalString(className, null), charOffset)
- ], noLocation)));
+ ], noLocation)))));
}
- Statement deprecated_buildCompileTimeErrorStatement(error,
+ kernel.Statement deprecated_buildCompileTimeErrorStatement(error,
[int charOffset = -1]) {
- return new ShadowExpressionStatement(
- deprecated_buildCompileTimeError(error, charOffset));
+ return new ShadowExpressionStatement(toKernelExpression(
+ deprecated_buildCompileTimeError(error, charOffset)));
}
- Statement buildCompileTimeErrorStatement(Message message, int charOffset,
+ kernel.Statement buildCompileTimeErrorStatement(
+ Message message, int charOffset,
{List<LocatedMessage> context}) {
- return new ShadowExpressionStatement(
- buildCompileTimeError(message, charOffset, noLength, context: context));
+ return new ShadowExpressionStatement(toKernelExpression(
+ buildCompileTimeError(message, charOffset, noLength,
+ context: context)));
}
- Statement wrapInCompileTimeErrorStatement(
- Statement statement, Message message) {
+ kernel.Statement wrapInCompileTimeErrorStatement(
+ kernel.Statement statement, Message message) {
// TODO(askesc): Produce explicit error statement wrapping the original.
// See [issue 29717](https://github.com/dart-lang/sdk/issues/29717)
return buildCompileTimeErrorStatement(message, statement.fileOffset);
@@ -3709,7 +3771,7 @@
[int charOffset = -1]) {
needsImplicitSuperInitializer = false;
return new ShadowInvalidInitializer(
- new VariableDeclaration.forValue(expression))
+ new VariableDeclaration.forValue(toKernelExpression(expression)))
..fileOffset = charOffset;
}
@@ -3752,15 +3814,16 @@
Builder constructor =
library.loader.getDuplicatedFieldInitializerError();
return buildInvalidInitializer(
- new Throw(buildStaticInvocation(
+ toExpression(new Throw(toKernelExpression(buildStaticInvocation(
constructor.target,
forest.arguments(<Expression>[
storeOffset(forest.literalString(name, null), offset)
], noLocation),
- charOffset: offset)),
+ charOffset: offset)))),
offset);
} else {
- return new ShadowFieldInitializer(builder.field, expression)
+ return new ShadowFieldInitializer(
+ builder.field, toKernelExpression(expression))
..fileOffset = offset
..isSynthetic = isSynthetic;
}
@@ -3835,7 +3898,7 @@
if (member.isNative) {
push(NullValue.FunctionBody);
} else {
- push(new Block(<Statement>[
+ push(new Block(<kernel.Statement>[
deprecated_buildCompileTimeErrorStatement(
"Expected '{'.", token.charOffset)
]));
@@ -3869,12 +3932,13 @@
List<Expression> expressions =
new List<Expression>.from(forest.argumentsPositional(arguments));
for (NamedExpression named in forest.argumentsNamed(arguments)) {
- expressions.add(named.value);
+ expressions.add(toExpression(named.value));
}
for (Expression argument in expressions.reversed) {
- expression = new Let(
- new VariableDeclaration.forValue(argument, isFinal: true),
- expression);
+ expression = toExpression(new Let(
+ new VariableDeclaration.forValue(toKernelExpression(argument),
+ isFinal: true),
+ toKernelExpression(expression)));
}
return expression;
}
@@ -3910,36 +3974,40 @@
offset,
name.name.length);
}
- return new ShadowSuperMethodInvocation(
+ return toExpression(new ShadowSuperMethodInvocation(
name, forest.castArguments(arguments), target)
- ..fileOffset = offset;
+ ..fileOffset = offset);
}
- receiver = new ShadowSuperPropertyGet(name, target)..fileOffset = offset;
- return new ShadowMethodInvocation(
- receiver, callName, forest.castArguments(arguments),
+ receiver = toExpression(
+ new ShadowSuperPropertyGet(name, target)..fileOffset = offset);
+ return toExpression(new ShadowMethodInvocation(
+ toKernelExpression(receiver),
+ callName,
+ forest.castArguments(arguments),
isImplicitCall: true)
- ..fileOffset = forest.readOffset(arguments);
+ ..fileOffset = forest.readOffset(arguments));
}
if (isNullAware) {
- VariableDeclaration variable = new VariableDeclaration.forValue(receiver);
- return new ShadowNullAwareMethodInvocation(
+ VariableDeclaration variable =
+ new VariableDeclaration.forValue(toKernelExpression(receiver));
+ return toExpression(new ShadowNullAwareMethodInvocation(
variable,
new ConditionalExpression(
buildIsNull(new VariableGet(variable), offset),
- storeOffset(forest.literalNull(null), offset),
+ toKernelExpression(storeOffset(forest.literalNull(null), offset)),
new MethodInvocation(new VariableGet(variable), name,
forest.castArguments(arguments), interfaceTarget)
..fileOffset = offset,
null)
..fileOffset = offset)
- ..fileOffset = offset;
+ ..fileOffset = offset);
} else {
- return new ShadowMethodInvocation(
- receiver, name, forest.castArguments(arguments),
+ return toExpression(new ShadowMethodInvocation(
+ toKernelExpression(receiver), name, forest.castArguments(arguments),
isImplicitCall: isImplicitCall, interfaceTarget: interfaceTarget)
- ..fileOffset = offset;
+ ..fileOffset = offset);
}
}
@@ -3983,18 +4051,34 @@
Expression wrapInDeferredCheck(
Expression expression, KernelPrefixBuilder prefix, int charOffset) {
var check = new VariableDeclaration.forValue(
- forest.checkLibraryIsLoaded(prefix.dependency))
+ toKernelExpression(forest.checkLibraryIsLoaded(prefix.dependency)))
..fileOffset = charOffset;
- return new ShadowDeferredCheck(check, expression);
+ return toExpression(
+ new ShadowDeferredCheck(check, toKernelExpression(expression)));
}
+ // TODO(ahe): Remove this method once Forest API is complete.
@override
T storeOffset<T>(T object, int offset) {
- TreeNode node = object as TreeNode;
+ TreeNode node = object as dynamic;
node.fileOffset = offset;
return object;
}
+ // TODO(ahe): Remove this method once Forest API is complete.
+ kernel.Expression toKernelExpression(Expression expression) {
+ return expression as dynamic;
+ }
+
+ // TODO(ahe): Remove this method once Forest API is complete.
+ Expression toExpression(kernel.Expression expression) {
+ return expression as dynamic;
+ }
+
+ List<kernel.Expression> toKernelExpressionList(List<Expression> expressions) {
+ return expressions as dynamic;
+ }
+
bool isErroneousNode(TreeNode node) {
return library.loader.handledErrors.isNotEmpty &&
forest.isErroneousNode(node);
@@ -4007,7 +4091,7 @@
Identifier(this.token);
- Expression get initializer => null;
+ kernel.Expression get initializer => null;
String toString() => "identifier($name)";
}
@@ -4023,7 +4107,7 @@
}
class InitializedIdentifier extends Identifier {
- final Expression initializer;
+ final kernel.Expression initializer;
InitializedIdentifier(Token token, this.initializer) : super(token);
@@ -4052,25 +4136,27 @@
return unsupported("plainNameForRead", token.charOffset, helper.uri);
}
- Expression doInvocation(int charOffset, Arguments arguments) {
+ kernel.Expression doInvocation(int charOffset, Arguments arguments) {
return unhandled("${runtimeType}", "doInvocation", charOffset, uri);
}
- Expression buildSimpleRead();
+ kernel.Expression buildSimpleRead();
- Expression buildForEffect();
+ kernel.Expression buildForEffect();
- Expression buildAssignment(Expression value, {bool voidContext: false}) {
- return makeInvalidWrite(value);
- }
-
- Expression buildNullAwareAssignment(
- Expression value, DartType type, int offset,
+ kernel.Expression buildAssignment(kernel.Expression value,
{bool voidContext: false}) {
return makeInvalidWrite(value);
}
- Expression buildCompoundAssignment(Name binaryOperator, Expression value,
+ kernel.Expression buildNullAwareAssignment(
+ kernel.Expression value, DartType type, int offset,
+ {bool voidContext: false}) {
+ return makeInvalidWrite(value);
+ }
+
+ kernel.Expression buildCompoundAssignment(
+ Name binaryOperator, kernel.Expression value,
{int offset: TreeNode.noOffset,
bool voidContext: false,
Procedure interfaceTarget,
@@ -4078,14 +4164,14 @@
return makeInvalidWrite(value);
}
- Expression buildPrefixIncrement(Name binaryOperator,
+ kernel.Expression buildPrefixIncrement(Name binaryOperator,
{int offset: TreeNode.noOffset,
bool voidContext: false,
Procedure interfaceTarget}) {
return makeInvalidWrite(null);
}
- Expression buildPostfixIncrement(Name binaryOperator,
+ kernel.Expression buildPostfixIncrement(Name binaryOperator,
{int offset: TreeNode.noOffset,
bool voidContext: false,
Procedure interfaceTarget}) {
@@ -4096,7 +4182,7 @@
return unsupported("makeInvalidRead", token.charOffset, helper.uri);
}
- Expression makeInvalidWrite(Expression value) {
+ kernel.Expression makeInvalidWrite(kernel.Expression value) {
return helper.deprecated_buildCompileTimeError(
"Can't be used as left-hand side of assignment.",
offsetForToken(token));
@@ -4104,7 +4190,7 @@
}
class DelayedAssignment<Arguments> extends ContextAccessor<Arguments> {
- final Expression value;
+ final kernel.Expression value;
final String assignmentOperator;
@@ -4112,15 +4198,15 @@
this.value, this.assignmentOperator)
: super(helper, token, accessor);
- Expression buildSimpleRead() {
+ kernel.Expression buildSimpleRead() {
return handleAssignment(false);
}
- Expression buildForEffect() {
+ kernel.Expression buildForEffect() {
return handleAssignment(true);
}
- Expression handleAssignment(bool voidContext) {
+ kernel.Expression handleAssignment(bool voidContext) {
if (helper.constantContext != ConstantContext.none) {
return helper.deprecated_buildCompileTimeError(
"Not a constant expression.", offsetForToken(token));
@@ -4190,14 +4276,14 @@
FastaAccessor accessor, this.binaryOperator, this.interfaceTarget)
: super(helper, token, accessor);
- Expression buildSimpleRead() {
+ kernel.Expression buildSimpleRead() {
return accessor.buildPostfixIncrement(binaryOperator,
offset: offsetForToken(token),
voidContext: false,
interfaceTarget: interfaceTarget);
}
- Expression buildForEffect() {
+ kernel.Expression buildForEffect() {
return accessor.buildPostfixIncrement(binaryOperator,
offset: offsetForToken(token),
voidContext: true,
@@ -4206,7 +4292,7 @@
}
class JumpTarget extends Builder {
- final List<Statement> users = <Statement>[];
+ final List<kernel.Statement> users = <kernel.Statement>[];
final JumpTargetKind kind;
@@ -4283,7 +4369,7 @@
bool get hasUsers => breakTarget.hasUsers || continueTarget.hasUsers;
- List<Statement> get users => unsupported("users", charOffset, fileUri);
+ List<kernel.Statement> get users => unsupported("users", charOffset, fileUri);
JumpTargetKind get kind => unsupported("kind", charOffset, fileUri);
@@ -4415,13 +4501,13 @@
/// }
///
/// If [body] is a [Block], it's returned with [statement] prepended to it.
-Block combineStatements(Statement statement, Statement body) {
+Block combineStatements(kernel.Statement statement, kernel.Statement body) {
if (body is Block) {
body.statements.insert(0, statement);
statement.parent = body;
return body;
} else {
- return new Block(<Statement>[statement, body]);
+ return new Block(<kernel.Statement>[statement, body]);
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/fangorn.dart b/pkg/front_end/lib/src/fasta/kernel/fangorn.dart
index 45c842e..7dbebfe 100644
--- a/pkg/front_end/lib/src/fasta/kernel/fangorn.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/fangorn.dart
@@ -172,11 +172,10 @@
int readOffset(TreeNode node) => node.fileOffset;
@override
- int getTypeCount(Object typeArguments) => (typeArguments as List).length;
+ int getTypeCount(List typeArguments) => typeArguments.length;
@override
- DartType getTypeAt(Object typeArguments, int index) =>
- (typeArguments as List)[index];
+ DartType getTypeAt(List typeArguments, int index) => typeArguments[index];
@override
Expression loadLibrary(LibraryDependency dependency) {
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 81521a1..25ddc28 100644
--- a/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
@@ -56,7 +56,9 @@
import 'frontend_accessors.dart' show Accessor;
-import 'kernel_ast_api.dart';
+import 'kernel_ast_api.dart' hide Expression, Statement;
+
+import 'kernel_ast_api.dart' as kernel show Expression, Statement;
import 'kernel_builder.dart'
show
@@ -73,7 +75,7 @@
PrefixBuilder,
TypeDeclarationBuilder;
-abstract class BuilderHelper<Arguments> {
+abstract class BuilderHelper<Expression, Statement, Arguments> {
LibraryBuilder get library;
Uri get uri;
@@ -84,8 +86,7 @@
ConstantContext get constantContext;
- // TODO(ahe): Update type parameters.
- Forest<dynamic, dynamic, Token, dynamic> get forest;
+ Forest<Expression, Statement, Token, Arguments> get forest;
Constructor lookupConstructor(Name name, {bool isSuper});
@@ -98,7 +99,8 @@
finishSend(Object receiver, Arguments arguments, int offset);
- Expression buildCompileTimeError(Message message, int charOffset, int length);
+ Expression buildCompileTimeError(Message message, int charOffset, int length,
+ {List<LocatedMessage> context});
Expression wrapInCompileTimeError(Expression expression, Message message);
@@ -212,7 +214,9 @@
abstract class FastaAccessor<Arguments> implements Accessor<Arguments> {
BuilderHelper get helper;
- Forest<Expression, Statement, Token, Arguments> get forest => helper.forest;
+ // TODO(ahe): Change type arguments.
+ Forest<kernel.Expression, kernel.Statement, Token, Arguments> get forest =>
+ helper.forest;
String get plainNameForRead;
@@ -226,7 +230,7 @@
return helper.storeOffset(node, offset);
}
- Expression buildForEffect() => buildSimpleRead();
+ kernel.Expression buildForEffect() => buildSimpleRead();
Initializer buildFieldInitializer(Map<String, int> initializedFields) {
int offset = offsetForToken(token);
@@ -236,22 +240,22 @@
offset);
}
- Expression makeInvalidRead() {
+ kernel.Expression makeInvalidRead() {
return buildThrowNoSuchMethodError(
forest.literalNull(token), forest.argumentsEmpty(noLocation),
isGetter: true);
}
- Expression makeInvalidWrite(Expression value) {
+ kernel.Expression makeInvalidWrite(kernel.Expression value) {
return buildThrowNoSuchMethodError(forest.literalNull(token),
- forest.arguments(<Expression>[value], noLocation),
+ forest.arguments(<kernel.Expression>[value], noLocation),
isSetter: true);
}
- /* Expression | FastaAccessor | Initializer */ doInvocation(
+ /* kernel.Expression | FastaAccessor | Initializer */ doInvocation(
int offset, Arguments arguments);
- /* Expression | FastaAccessor */ buildPropertyAccess(
+ /* kernel.Expression | FastaAccessor */ buildPropertyAccess(
IncompleteSend send, int operatorOffset, bool isNullAware) {
if (send is SendAccessor) {
return helper.buildMethodInvocation(buildSimpleRead(), send.name,
@@ -275,8 +279,8 @@
return const InvalidType();
}
- /* Expression | FastaAccessor */ buildThrowNoSuchMethodError(
- Expression receiver, Arguments arguments,
+ /* kernel.Expression | FastaAccessor */ buildThrowNoSuchMethodError(
+ kernel.Expression receiver, Arguments arguments,
{bool isSuper: false,
bool isGetter: false,
bool isSetter: false,
@@ -296,7 +300,7 @@
bool get isThisPropertyAccessor => false;
@override
- ShadowComplexAssignment startComplexAssignment(Expression rhs) =>
+ ShadowComplexAssignment startComplexAssignment(kernel.Expression rhs) =>
new ShadowIllegalAssignment(rhs);
}
@@ -304,7 +308,7 @@
/// Pass [arguments] that must be evaluated before throwing an error. At
/// most one of [isGetter] and [isSetter] should be true and they're passed
/// to [BuilderHelper.buildThrowNoSuchMethodError] if it is used.
- Expression buildError(Arguments arguments,
+ kernel.Expression buildError(Arguments arguments,
{bool isGetter: false, bool isSetter: false, int offset});
DartType buildErroneousTypeNotAPrefix(Identifier suffix);
@@ -334,7 +338,7 @@
}
@override
- buildThrowNoSuchMethodError(Expression receiver, Arguments arguments,
+ buildThrowNoSuchMethodError(kernel.Expression receiver, Arguments arguments,
{bool isSuper: false,
bool isGetter: false,
bool isSetter: false,
@@ -346,68 +350,70 @@
}
@override
- Expression buildAssignment(Expression value, {bool voidContext: false}) {
- return buildError(forest.arguments(<Expression>[value], noLocation),
+ kernel.Expression buildAssignment(kernel.Expression value,
+ {bool voidContext: false}) {
+ return buildError(forest.arguments(<kernel.Expression>[value], noLocation),
isSetter: true);
}
@override
- Expression buildCompoundAssignment(Name binaryOperator, Expression value,
+ kernel.Expression buildCompoundAssignment(
+ Name binaryOperator, kernel.Expression value,
{int offset: TreeNode.noOffset,
bool voidContext: false,
Procedure interfaceTarget,
bool isPreIncDec: false}) {
- return buildError(forest.arguments(<Expression>[value], token),
+ return buildError(forest.arguments(<kernel.Expression>[value], token),
isGetter: true);
}
@override
- Expression buildPrefixIncrement(Name binaryOperator,
+ kernel.Expression buildPrefixIncrement(Name binaryOperator,
{int offset: TreeNode.noOffset,
bool voidContext: false,
Procedure interfaceTarget}) {
// TODO(ahe): For the Analyzer, we probably need to build a prefix
// increment node that wraps an error.
return buildError(
- forest.arguments(
- <Expression>[storeOffset(forest.literalInt(1, null), offset)],
- noLocation),
+ forest.arguments(<kernel.Expression>[
+ storeOffset(forest.literalInt(1, null), offset)
+ ], noLocation),
isGetter: true);
}
@override
- Expression buildPostfixIncrement(Name binaryOperator,
+ kernel.Expression buildPostfixIncrement(Name binaryOperator,
{int offset: TreeNode.noOffset,
bool voidContext: false,
Procedure interfaceTarget}) {
// TODO(ahe): For the Analyzer, we probably need to build a post increment
// node that wraps an error.
return buildError(
- forest.arguments(
- <Expression>[storeOffset(forest.literalInt(1, null), offset)],
- noLocation),
+ forest.arguments(<kernel.Expression>[
+ storeOffset(forest.literalInt(1, null), offset)
+ ], noLocation),
isGetter: true);
}
@override
- Expression buildNullAwareAssignment(
- Expression value, DartType type, int offset,
+ kernel.Expression buildNullAwareAssignment(
+ kernel.Expression value, DartType type, int offset,
{bool voidContext: false}) {
- return buildError(forest.arguments(<Expression>[value], noLocation),
+ return buildError(forest.arguments(<kernel.Expression>[value], noLocation),
isSetter: true);
}
@override
- Expression buildSimpleRead() =>
+ kernel.Expression buildSimpleRead() =>
buildError(forest.argumentsEmpty(noLocation), isGetter: true);
@override
- Expression makeInvalidRead() =>
+ kernel.Expression makeInvalidRead() =>
buildError(forest.argumentsEmpty(noLocation), isGetter: true);
@override
- Expression makeInvalidWrite(Expression value) {
- return buildError(forest.arguments(<Expression>[value], noLocation),
+ kernel.Expression makeInvalidWrite(kernel.Expression value) {
+ return buildError(forest.arguments(<kernel.Expression>[value], noLocation),
isSetter: true);
}
}
@@ -429,7 +435,7 @@
offsetForToken(token), uri);
}
- Expression buildSimpleRead() {
+ kernel.Expression buildSimpleRead() {
if (!isSuper) {
return forest.thisExpression(token);
} else {
@@ -525,17 +531,19 @@
}
}
- Expression buildAssignment(Expression value, {bool voidContext: false}) {
- return buildAssignmentError();
- }
-
- Expression buildNullAwareAssignment(
- Expression value, DartType type, int offset,
+ kernel.Expression buildAssignment(kernel.Expression value,
{bool voidContext: false}) {
return buildAssignmentError();
}
- Expression buildCompoundAssignment(Name binaryOperator, Expression value,
+ kernel.Expression buildNullAwareAssignment(
+ kernel.Expression value, DartType type, int offset,
+ {bool voidContext: false}) {
+ return buildAssignmentError();
+ }
+
+ kernel.Expression buildCompoundAssignment(
+ Name binaryOperator, kernel.Expression value,
{int offset: TreeNode.noOffset,
bool voidContext: false,
Procedure interfaceTarget,
@@ -543,21 +551,21 @@
return buildAssignmentError();
}
- Expression buildPrefixIncrement(Name binaryOperator,
+ kernel.Expression buildPrefixIncrement(Name binaryOperator,
{int offset: TreeNode.noOffset,
bool voidContext: false,
Procedure interfaceTarget}) {
return buildAssignmentError();
}
- Expression buildPostfixIncrement(Name binaryOperator,
+ kernel.Expression buildPostfixIncrement(Name binaryOperator,
{int offset: TreeNode.noOffset,
bool voidContext: false,
Procedure interfaceTarget}) {
return buildAssignmentError();
}
- Expression buildAssignmentError() {
+ kernel.Expression buildAssignmentError() {
String message =
isSuper ? "Can't assign to 'super'." : "Can't assign to 'this'.";
return helper.deprecated_buildCompileTimeError(
@@ -593,7 +601,7 @@
: super(helper, token, null);
@override
- Expression buildError(Arguments arguments,
+ kernel.Expression buildError(Arguments arguments,
{bool isGetter: false, bool isSetter: false, int offset}) {
int length = noLength;
if (offset == null) {
@@ -628,11 +636,12 @@
String get plainNameForRead => name.name;
- Expression buildSimpleRead() {
+ kernel.Expression buildSimpleRead() {
return unsupported("buildSimpleRead", offsetForToken(token), uri);
}
- Expression buildAssignment(Expression value, {bool voidContext: false}) {
+ kernel.Expression buildAssignment(kernel.Expression value,
+ {bool voidContext: false}) {
return unsupported("buildAssignment", offsetForToken(token), uri);
}
@@ -657,13 +666,14 @@
isNullAware: isNullAware);
}
- Expression buildNullAwareAssignment(
- Expression value, DartType type, int offset,
+ kernel.Expression buildNullAwareAssignment(
+ kernel.Expression value, DartType type, int offset,
{bool voidContext: false}) {
return unsupported("buildNullAwareAssignment", offset, uri);
}
- Expression buildCompoundAssignment(Name binaryOperator, Expression value,
+ kernel.Expression buildCompoundAssignment(
+ Name binaryOperator, kernel.Expression value,
{int offset,
bool voidContext: false,
Procedure interfaceTarget,
@@ -672,19 +682,19 @@
"buildCompoundAssignment", offset ?? offsetForToken(token), uri);
}
- Expression buildPrefixIncrement(Name binaryOperator,
+ kernel.Expression buildPrefixIncrement(Name binaryOperator,
{int offset, bool voidContext: false, Procedure interfaceTarget}) {
return unsupported(
"buildPrefixIncrement", offset ?? offsetForToken(token), uri);
}
- Expression buildPostfixIncrement(Name binaryOperator,
+ kernel.Expression buildPostfixIncrement(Name binaryOperator,
{int offset, bool voidContext: false, Procedure interfaceTarget}) {
return unsupported(
"buildPostfixIncrement", offset ?? offsetForToken(token), uri);
}
- Expression doInvocation(int offset, Arguments arguments) {
+ kernel.Expression doInvocation(int offset, Arguments arguments) {
return unsupported("doInvocation", offset, uri);
}
@@ -700,11 +710,12 @@
String get plainNameForRead => name.name;
- Expression buildSimpleRead() {
+ kernel.Expression buildSimpleRead() {
return unsupported("buildSimpleRead", offsetForToken(token), uri);
}
- Expression buildAssignment(Expression value, {bool voidContext: false}) {
+ kernel.Expression buildAssignment(kernel.Expression value,
+ {bool voidContext: false}) {
return unsupported("buildAssignment", offsetForToken(token), uri);
}
@@ -728,13 +739,14 @@
helper, token, helper.toValue(receiver), name, null, null, isNullAware);
}
- Expression buildNullAwareAssignment(
- Expression value, DartType type, int offset,
+ kernel.Expression buildNullAwareAssignment(
+ kernel.Expression value, DartType type, int offset,
{bool voidContext: false}) {
return unsupported("buildNullAwareAssignment", offset, uri);
}
- Expression buildCompoundAssignment(Name binaryOperator, Expression value,
+ kernel.Expression buildCompoundAssignment(
+ Name binaryOperator, kernel.Expression value,
{int offset,
bool voidContext: false,
Procedure interfaceTarget,
@@ -743,19 +755,19 @@
"buildCompoundAssignment", offset ?? offsetForToken(token), uri);
}
- Expression buildPrefixIncrement(Name binaryOperator,
+ kernel.Expression buildPrefixIncrement(Name binaryOperator,
{int offset, bool voidContext: false, Procedure interfaceTarget}) {
return unsupported(
"buildPrefixIncrement", offset ?? offsetForToken(token), uri);
}
- Expression buildPostfixIncrement(Name binaryOperator,
+ kernel.Expression buildPostfixIncrement(Name binaryOperator,
{int offset, bool voidContext: false, Procedure interfaceTarget}) {
return unsupported(
"buildPostfixIncrement", offset ?? offsetForToken(token), uri);
}
- Expression doInvocation(int offset, Arguments arguments) {
+ kernel.Expression doInvocation(int offset, Arguments arguments) {
return unsupported("doInvocation", offset, uri);
}
@@ -769,15 +781,15 @@
with FastaAccessor<Arguments> {
final BuilderHelper helper;
- IndexAccessor.internal(this.helper, Token token, Expression receiver,
- Expression index, Procedure getter, Procedure setter)
+ IndexAccessor.internal(this.helper, Token token, kernel.Expression receiver,
+ kernel.Expression index, Procedure getter, Procedure setter)
: super.internal(helper, receiver, index, getter, setter, token);
String get plainNameForRead => "[]";
String get plainNameForWrite => "[]=";
- Expression doInvocation(int offset, Arguments arguments) {
+ kernel.Expression doInvocation(int offset, Arguments arguments) {
return helper.buildMethodInvocation(
buildSimpleRead(), callName, arguments, forest.readOffset(arguments),
isImplicitCall: true);
@@ -788,8 +800,8 @@
static FastaAccessor make(
BuilderHelper helper,
Token token,
- Expression receiver,
- Expression index,
+ kernel.Expression receiver,
+ kernel.Expression index,
Procedure getter,
Procedure setter) {
if (receiver is ThisExpression) {
@@ -801,7 +813,7 @@
}
@override
- ShadowComplexAssignment startComplexAssignment(Expression rhs) =>
+ ShadowComplexAssignment startComplexAssignment(kernel.Expression rhs) =>
new ShadowIndexAssign(receiver, index, rhs);
}
@@ -809,15 +821,15 @@
with FastaAccessor<Arguments> {
final BuilderHelper helper;
- PropertyAccessor.internal(this.helper, Token token, Expression receiver,
- Name name, Member getter, Member setter)
+ PropertyAccessor.internal(this.helper, Token token,
+ kernel.Expression receiver, Name name, Member getter, Member setter)
: super.internal(helper, receiver, name, getter, setter, token);
String get plainNameForRead => name.name;
bool get isThisPropertyAccessor => receiver is ThisExpression;
- Expression doInvocation(int offset, Arguments arguments) {
+ kernel.Expression doInvocation(int offset, Arguments arguments) {
return helper.buildMethodInvocation(receiver, name, arguments, offset);
}
@@ -826,7 +838,7 @@
static FastaAccessor make(
BuilderHelper helper,
Token token,
- Expression receiver,
+ kernel.Expression receiver,
Name name,
Member getter,
Member setter,
@@ -843,7 +855,7 @@
}
@override
- ShadowComplexAssignment startComplexAssignment(Expression rhs) =>
+ ShadowComplexAssignment startComplexAssignment(kernel.Expression rhs) =>
new ShadowPropertyAssign(receiver, rhs);
}
@@ -879,7 +891,7 @@
String get plainNameForRead => (readTarget ?? writeTarget).name.name;
- Expression doInvocation(int offset, Arguments arguments) {
+ kernel.Expression doInvocation(int offset, Arguments arguments) {
if (helper.constantContext != ConstantContext.none &&
!helper.isIdentical(readTarget)) {
helper.deprecated_addCompileTimeError(
@@ -901,7 +913,7 @@
toString() => "StaticAccessor()";
@override
- ShadowComplexAssignment startComplexAssignment(Expression rhs) =>
+ ShadowComplexAssignment startComplexAssignment(kernel.Expression rhs) =>
new ShadowStaticAssignment(rhs);
}
@@ -913,7 +925,7 @@
String get plainNameForRead => 'loadLibrary';
- Expression doInvocation(int offset, Arguments arguments) {
+ kernel.Expression doInvocation(int offset, Arguments arguments) {
if (forest.argumentsPositional(arguments).length > 0 ||
forest.argumentsNamed(arguments).length > 0) {
helper.addProblemErrorIfConst(
@@ -943,7 +955,7 @@
if (propertyAccess is FastaAccessor) {
return new DeferredAccessor(helper, token, builder, propertyAccess);
} else {
- Expression expression = propertyAccess;
+ kernel.Expression expression = propertyAccess;
return helper.wrapInDeferredCheck(expression, builder, token.charOffset);
}
}
@@ -961,7 +973,7 @@
return const InvalidType();
}
- Expression doInvocation(int offset, Arguments arguments) {
+ kernel.Expression doInvocation(int offset, Arguments arguments) {
return helper.wrapInDeferredCheck(
accessor.doInvocation(offset, arguments), builder, token.charOffset);
}
@@ -975,7 +987,7 @@
String get plainNameForRead => name.name;
- Expression doInvocation(int offset, Arguments arguments) {
+ kernel.Expression doInvocation(int offset, Arguments arguments) {
if (helper.constantContext != ConstantContext.none) {
helper.deprecated_addCompileTimeError(
offset, "Not a constant expression.");
@@ -997,13 +1009,13 @@
toString() => "SuperPropertyAccessor()";
@override
- ShadowComplexAssignment startComplexAssignment(Expression rhs) =>
+ ShadowComplexAssignment startComplexAssignment(kernel.Expression rhs) =>
new ShadowPropertyAssign(null, rhs, isSuper: true);
}
class ThisIndexAccessor<Arguments> extends kernel.ThisIndexAccessor<Arguments>
with FastaAccessor<Arguments> {
- ThisIndexAccessor(BuilderHelper helper, Token token, Expression index,
+ ThisIndexAccessor(BuilderHelper helper, Token token, kernel.Expression index,
Procedure getter, Procedure setter)
: super(helper, index, getter, setter, token);
@@ -1011,7 +1023,7 @@
String get plainNameForWrite => "[]=";
- Expression doInvocation(int offset, Arguments arguments) {
+ kernel.Expression doInvocation(int offset, Arguments arguments) {
return helper.buildMethodInvocation(
buildSimpleRead(), callName, arguments, offset,
isImplicitCall: true);
@@ -1020,13 +1032,13 @@
toString() => "ThisIndexAccessor()";
@override
- ShadowComplexAssignment startComplexAssignment(Expression rhs) =>
+ ShadowComplexAssignment startComplexAssignment(kernel.Expression rhs) =>
new ShadowIndexAssign(null, index, rhs);
}
class SuperIndexAccessor<Arguments> extends kernel.SuperIndexAccessor<Arguments>
with FastaAccessor<Arguments> {
- SuperIndexAccessor(BuilderHelper helper, Token token, Expression index,
+ SuperIndexAccessor(BuilderHelper helper, Token token, kernel.Expression index,
Member getter, Member setter)
: super(helper, index, getter, setter, token);
@@ -1034,7 +1046,7 @@
String get plainNameForWrite => "[]=";
- Expression doInvocation(int offset, Arguments arguments) {
+ kernel.Expression doInvocation(int offset, Arguments arguments) {
return helper.buildMethodInvocation(
buildSimpleRead(), callName, arguments, offset,
isImplicitCall: true);
@@ -1043,7 +1055,7 @@
toString() => "SuperIndexAccessor()";
@override
- ShadowComplexAssignment startComplexAssignment(Expression rhs) =>
+ ShadowComplexAssignment startComplexAssignment(kernel.Expression rhs) =>
new ShadowIndexAssign(null, index, rhs, isSuper: true);
}
@@ -1059,7 +1071,7 @@
bool get isThisPropertyAccessor => true;
- Expression doInvocation(int offset, Arguments arguments) {
+ kernel.Expression doInvocation(int offset, Arguments arguments) {
Member interfaceTarget = getter;
if (interfaceTarget == null) {
helper.warnUnresolvedMethod(name, offset);
@@ -1077,7 +1089,7 @@
toString() => "ThisPropertyAccessor()";
@override
- ShadowComplexAssignment startComplexAssignment(Expression rhs) =>
+ ShadowComplexAssignment startComplexAssignment(kernel.Expression rhs) =>
new ShadowPropertyAssign(null, rhs);
}
@@ -1085,20 +1097,26 @@
.NullAwarePropertyAccessor<Arguments> with FastaAccessor<Arguments> {
final BuilderHelper helper;
- NullAwarePropertyAccessor(this.helper, Token token, Expression receiver,
- Name name, Member getter, Member setter, DartType type)
+ NullAwarePropertyAccessor(
+ this.helper,
+ Token token,
+ kernel.Expression receiver,
+ Name name,
+ Member getter,
+ Member setter,
+ DartType type)
: super(helper, receiver, name, getter, setter, type, token);
String get plainNameForRead => name.name;
- Expression doInvocation(int offset, Arguments arguments) {
+ kernel.Expression doInvocation(int offset, Arguments arguments) {
return unimplemented("doInvocation", offset, uri);
}
toString() => "NullAwarePropertyAccessor()";
@override
- ShadowComplexAssignment startComplexAssignment(Expression rhs) =>
+ ShadowComplexAssignment startComplexAssignment(kernel.Expression rhs) =>
new ShadowPropertyAssign(receiverExpression, rhs);
}
@@ -1117,7 +1135,7 @@
String get plainNameForRead => variable.name;
- Expression doInvocation(int offset, Arguments arguments) {
+ kernel.Expression doInvocation(int offset, Arguments arguments) {
return helper.buildMethodInvocation(buildSimpleRead(), callName, arguments,
adjustForImplicitCall(plainNameForRead, offset),
isImplicitCall: true);
@@ -1126,7 +1144,7 @@
toString() => "VariableAccessor()";
@override
- ShadowComplexAssignment startComplexAssignment(Expression rhs) =>
+ ShadowComplexAssignment startComplexAssignment(kernel.Expression rhs) =>
new ShadowVariableAssignment(rhs);
}
@@ -1134,11 +1152,11 @@
with FastaAccessor<Arguments> {
final String plainNameForRead;
- ReadOnlyAccessor(BuilderHelper helper, Expression expression,
+ ReadOnlyAccessor(BuilderHelper helper, kernel.Expression expression,
this.plainNameForRead, Token token)
: super(helper, expression, token);
- Expression doInvocation(int offset, Arguments arguments) {
+ kernel.Expression doInvocation(int offset, Arguments arguments) {
return helper.buildMethodInvocation(buildSimpleRead(), callName, arguments,
adjustForImplicitCall(plainNameForRead, offset),
isImplicitCall: true);
@@ -1152,22 +1170,23 @@
LargeIntAccessor(BuilderHelper helper, Token token) : super(helper, token);
@override
- Expression buildError() {
+ kernel.Expression buildError() {
return helper.buildCompileTimeError(
templateIntegerLiteralIsOutOfRange.withArguments(token),
offsetForToken(token),
lengthForToken(token));
}
- Expression doInvocation(int offset, Arguments arguments) => buildError();
+ kernel.Expression doInvocation(int offset, Arguments arguments) =>
+ buildError();
}
class ParenthesizedExpression<Arguments> extends ReadOnlyAccessor<Arguments> {
ParenthesizedExpression(
- BuilderHelper helper, Expression expression, Token token)
+ BuilderHelper helper, kernel.Expression expression, Token token)
: super(helper, expression, null, token);
- Expression makeInvalidWrite(Expression value) {
+ kernel.Expression makeInvalidWrite(kernel.Expression value) {
return helper.deprecated_buildCompileTimeError(
"Can't assign to a parenthesized expression.", offsetForToken(token));
}
@@ -1193,7 +1212,7 @@
Token token)
: super(helper, null, plainNameForRead, token);
- Expression get expression {
+ kernel.Expression get expression {
if (super.expression == null) {
int offset = offsetForToken(token);
if (declaration is KernelInvalidTypeBuilder) {
@@ -1212,11 +1231,11 @@
return super.expression;
}
- Expression makeInvalidWrite(Expression value) {
+ kernel.Expression makeInvalidWrite(kernel.Expression value) {
return buildThrowNoSuchMethodError(
forest.literalNull(token),
- storeOffset(
- forest.arguments(<Expression>[value], null), value.fileOffset),
+ storeOffset(forest.arguments(<kernel.Expression>[value], null),
+ value.fileOffset),
isSetter: true);
}
@@ -1320,7 +1339,7 @@
}
@override
- Expression doInvocation(int offset, Arguments arguments) {
+ kernel.Expression doInvocation(int offset, Arguments arguments) {
return helper.buildConstructorInvocation(declaration, token, arguments, "",
null, token.charOffset, Constness.implicit);
}
@@ -1339,7 +1358,7 @@
UnresolvedAccessor(this.helper, this.name, this.token);
- Expression doInvocation(int charOffset, Arguments arguments) {
+ kernel.Expression doInvocation(int charOffset, Arguments arguments) {
return buildError(arguments, offset: charOffset);
}
@@ -1354,7 +1373,7 @@
}
@override
- Expression buildError(Arguments arguments,
+ kernel.Expression buildError(Arguments arguments,
{bool isGetter: false, bool isSetter: false, int offset}) {
offset ??= offsetForToken(this.token);
return helper.throwNoSuchMethodError(
diff --git a/pkg/front_end/lib/src/fasta/kernel/forest.dart b/pkg/front_end/lib/src/fasta/kernel/forest.dart
index 49d9333..c194492 100644
--- a/pkg/front_end/lib/src/fasta/kernel/forest.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/forest.dart
@@ -5,8 +5,7 @@
library fasta.forest;
// TODO(ahe): Remove this import.
-import 'package:kernel/ast.dart' as kernel show Arguments;
-import 'package:kernel/ast.dart';
+import 'package:kernel/ast.dart' as kernel show Arguments, DartType;
/// A tree factory.
///
@@ -43,16 +42,15 @@
/// Return a representation of a list literal. The [constKeyword] is the
/// location of the `const` keyword, or `null` if there is no keyword. The
- /// [isConst] is `true` if either the `const` keyword is not-`null` or if the
- /// list literal is in a const context. The [typeArgument] is the
- /// representation of the single valid type argument preceding the list
- /// literal, or `null` if there is no type argument, there is more than one
- /// type argument, or if the type argument cannot be resolved. The
- /// [typeArguments] is the representation of all of the type arguments
- /// preceding the list literal, or `null` if there are no type arguments. The
- /// [leftBracket] is the location of the `[`. The list of [expressions] is a
- /// list of the representations of the list elements. The [rightBracket] is
- /// the location of the `]`.
+ /// [isConst] is `true` if the literal is either explicitly or implicitly a
+ /// constant. The [typeArgument] is the representation of the single valid
+ /// type argument preceding the list literal, or `null` if there is no type
+ /// argument, there is more than one type argument, or if the type argument
+ /// cannot be resolved. The [typeArguments] is the representation of all of
+ /// the type arguments preceding the list literal, or `null` if there are no
+ /// type arguments. The [leftBracket] is the location of the `[`. The list of
+ /// [expressions] is a list of the representations of the list elements. The
+ /// [rightBracket] is the location of the `]`.
Expression literalList(
Location constKeyword,
bool isConst,
@@ -64,18 +62,17 @@
/// Return a representation of a map literal. The [constKeyword] is the
/// location of the `const` keyword, or `null` if there is no keyword. The
- /// [isConst] is `true` if either the `const` keyword is not-`null` or if the
- /// map literal is in a const context. The [keyType] is the representation of
- /// the first type argument preceding the map literal, or `null` if there are
- /// not exactly two type arguments or if the first type argument cannot be
- /// resolved. The [valueType] is the representation of the second type
- /// argument preceding the map literal, or `null` if there are not exactly two
- /// type arguments or if the second type argument cannot be resolved. The
- /// [typeArguments] is the representation of all of the type arguments
- /// preceding the map literal, or `null` if there are no type arguments. The
- /// [leftBracket] is the location of the `{`. The list of [entries] is a
- /// list of the representations of the map entries. The [rightBracket] is
- /// the location of the `}`.
+ /// [isConst] is `true` if the literal is either explicitly or implicitly a
+ /// constant. The [keyType] is the representation of the first type argument
+ /// preceding the map literal, or `null` if there are not exactly two type
+ /// arguments or if the first type argument cannot be resolved. The
+ /// [valueType] is the representation of the second type argument preceding
+ /// the map literal, or `null` if there are not exactly two type arguments or
+ /// if the second type argument cannot be resolved. The [typeArguments] is the
+ /// representation of all of the type arguments preceding the map literal, or
+ /// `null` if there are no type arguments. The [leftBracket] is the location
+ /// of the `{`. The list of [entries] is a list of the representations of the
+ /// map entries. The [rightBracket] is the location of the `}`.
Expression literalMap(
Location constKeyword,
bool isConst,
@@ -112,11 +109,11 @@
/// Given a representation of a list of [typeArguments], return the number of
/// type arguments in the list.
- int getTypeCount(Object typeArguments);
+ int getTypeCount(covariant typeArguments);
/// Given a representation of a list of [typeArguments], return the type
/// associated with the argument at the given [index].
- DartType getTypeAt(Object typeArguments, int index);
+ kernel.DartType getTypeAt(covariant typeArguments, int index);
Expression loadLibrary(covariant dependency);
@@ -128,9 +125,10 @@
Expression awaitExpression(Expression operand, Location location);
/// Return a representation of a conditional expression. The [condition] is
- /// the condition. The [question] is the `?`. The [thenExpression] is the
- /// expression following the question mark. The [colon] is the `:`. The
- /// [elseExpression] is the expression following the colon.
+ /// the expression preceding the question mark. The [question] is the `?`. The
+ /// [thenExpression] is the expression following the question mark. The
+ /// [colon] is the `:`. The [elseExpression] is the expression following the
+ /// colon.
Expression conditionalExpression(Expression condition, Location question,
Expression thenExpression, Location colon, Expression elseExpression);
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_ast_api.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_ast_api.dart
index d384b5a..b2cad0c 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_ast_api.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_ast_api.dart
@@ -83,7 +83,6 @@
ShadowIllegalAssignment,
ShadowIndexAssign,
ShadowInvalidInitializer,
- ShadowIsNotExpression,
ShadowLabeledStatement,
ShadowLogicalExpression,
ShadowLoopAssignmentStatement,
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_body_builder.dart
new file mode 100644
index 0000000..e825cf4
--- /dev/null
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_body_builder.dart
@@ -0,0 +1,42 @@
+// Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library fasta.kernel_body_builder;
+
+import 'package:kernel/ast.dart' show Arguments, Expression, Statement;
+
+import '../scanner.dart' show Token;
+
+import '../type_inference/type_inferrer.dart' show TypeInferrer;
+
+import 'body_builder.dart' show BodyBuilder;
+
+import 'fangorn.dart' show Fangorn;
+
+import 'forest.dart' show Forest;
+
+import 'kernel_api.dart' show ClassHierarchy, CoreTypes;
+
+import 'kernel_builder.dart'
+ show KernelClassBuilder, KernelLibraryBuilder, ModifierBuilder, Scope;
+
+class KernelBodyBuilder extends BodyBuilder<Expression, Statement, Arguments> {
+ @override
+ final Forest<Expression, Statement, Token, Arguments> forest =
+ const Fangorn();
+
+ KernelBodyBuilder(
+ KernelLibraryBuilder library,
+ ModifierBuilder member,
+ Scope scope,
+ Scope formalParameterScope,
+ ClassHierarchy hierarchy,
+ CoreTypes coreTypes,
+ KernelClassBuilder classBuilder,
+ bool isInstanceMember,
+ Uri uri,
+ TypeInferrer typeInferrer)
+ : super(library, member, scope, formalParameterScope, hierarchy,
+ coreTypes, classBuilder, isInstanceMember, uri, typeInferrer);
+}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_field_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_field_builder.dart
index 0e60a3e..4c7ec10 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_field_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_field_builder.dart
@@ -22,7 +22,7 @@
import '../source/source_library_builder.dart' show SourceLibraryBuilder;
-import 'body_builder.dart' show BodyBuilder;
+import 'kernel_body_builder.dart' show KernelBodyBuilder;
import 'kernel_builder.dart'
show Builder, FieldBuilder, KernelTypeBuilder, MetadataBuilder;
@@ -95,7 +95,7 @@
var typeInferrer = typeInferenceEngine.createTopLevelTypeInferrer(
field.enclosingClass?.thisType, field);
if (hasInitializer) {
- var bodyBuilder = new BodyBuilder(
+ KernelBodyBuilder bodyBuilder = new KernelBodyBuilder(
library,
this,
memberScope,
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 b4c9192..71372b9 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
@@ -34,6 +34,7 @@
import 'package:front_end/src/fasta/type_inference/type_schema_elimination.dart';
import 'package:front_end/src/fasta/type_inference/type_schema_environment.dart';
import 'package:kernel/ast.dart' hide InvalidExpression, InvalidInitializer;
+import 'package:kernel/clone.dart' show CloneVisitor;
import 'package:kernel/frontend/accessors.dart';
import 'package:kernel/type_algebra.dart';
@@ -879,6 +880,7 @@
}
inferrer.inferStatement(body);
if (_declaresVariable) {
+ inferrer.inferMetadataKeepingHelper(variable.annotations);
var tempVar =
new VariableDeclaration(null, type: inferredType, isFinal: true);
var variableGet = new VariableGet(tempVar)
@@ -941,6 +943,7 @@
@override
void _inferStatement(ShadowTypeInferrer inferrer) {
+ inferrer.inferMetadataKeepingHelper(variable.annotations);
inferrer.inferLocalFunction(
function,
null,
@@ -2270,6 +2273,26 @@
@override
void _inferStatement(ShadowTypeInferrer inferrer) {
+ inferrer.inferMetadataKeepingHelper(annotations);
+
+ // After the inference was done on the annotations, we may clone them for
+ // this instance of VariableDeclaration in order to avoid having the same
+ // annotation node for two VariableDeclaration nodes in a situation like
+ // the following:
+ //
+ // class Foo { const Foo(List<String> list); }
+ //
+ // @Foo(const [])
+ // var x, y;
+ CloneVisitor cloner = new CloneVisitor();
+ for (int i = 0; i < annotations.length; ++i) {
+ Expression annotation = annotations[i];
+ if (annotation.parent != this) {
+ annotations[i] = cloner.clone(annotation);
+ annotations[i].parent = this;
+ }
+ }
+
var declaredType = _implicitlyTyped ? const UnknownType() : type;
DartType inferredType;
DartType initializerType;
diff --git a/pkg/front_end/lib/src/fasta/parser/identifier_context.dart b/pkg/front_end/lib/src/fasta/parser/identifier_context.dart
index 9d57e58..b9bbf76 100644
--- a/pkg/front_end/lib/src/fasta/parser/identifier_context.dart
+++ b/pkg/front_end/lib/src/fasta/parser/identifier_context.dart
@@ -88,13 +88,12 @@
isContinuation: true);
/// Identifier is the type name being declared by an enum declaration.
- static const enumDeclaration = const IdentifierContext('enumDeclaration',
- inDeclaration: true, isBuiltInIdentifierAllowed: false);
+ static const enumDeclaration = const EnumDeclarationIdentifierContext();
/// Identifier is an enumerated value name being declared by an enum
/// declaration.
static const enumValueDeclaration =
- const IdentifierContext('enumValueDeclaration', inDeclaration: true);
+ const EnumValueDeclarationIdentifierContext();
/// Identifier is the name being declared by a class declaration or a named
/// mixin application, for example, `Foo` in `class Foo = X with Y;`.
@@ -121,9 +120,8 @@
const TypeReferenceIdentifierContext.continuation();
/// Identifier is a name being declared by a top level variable declaration.
- static const topLevelVariableDeclaration = const IdentifierContext(
- 'topLevelVariableDeclaration',
- inDeclaration: true);
+ static const topLevelVariableDeclaration =
+ const TopLevelVariableIdentifierContext();
/// Identifier is a name being declared by a field declaration.
static const fieldDeclaration = const FieldDeclarationIdentifierContext();
diff --git a/pkg/front_end/lib/src/fasta/parser/identifier_context_impl.dart b/pkg/front_end/lib/src/fasta/parser/identifier_context_impl.dart
index 99a9c48..f18b2ac 100644
--- a/pkg/front_end/lib/src/fasta/parser/identifier_context_impl.dart
+++ b/pkg/front_end/lib/src/fasta/parser/identifier_context_impl.dart
@@ -15,7 +15,7 @@
import 'type_info.dart'
show insertSyntheticIdentifierAfter, isValidTypeReference;
-import 'util.dart' show optional, skipMetadata;
+import 'util.dart' show optional;
/// See [IdentifierContext.classOrNamedMixinDeclaration].
class ClassOrNamedMixinIdentifierContext extends IdentifierContext {
@@ -39,7 +39,7 @@
message: fasta.templateExpectedIdentifier.withArguments(identifier));
} else if (identifier.type.isBuiltIn) {
parser.reportRecoverableErrorWithToken(
- identifier, fasta.templateBuiltInIdentifierAsType);
+ identifier, fasta.templateBuiltInIdentifierInDeclaration);
} else {
parser.reportRecoverableErrorWithToken(
identifier, fasta.templateExpectedIdentifier);
@@ -95,6 +95,69 @@
}
}
+/// See [IdentifierContext.enumDeclaration].
+class EnumDeclarationIdentifierContext extends IdentifierContext {
+ const EnumDeclarationIdentifierContext()
+ : super('enumDeclaration',
+ inDeclaration: true, isBuiltInIdentifierAllowed: false);
+
+ @override
+ Token ensureIdentifier(Token token, Parser parser) {
+ Token identifier = token.next;
+ assert(identifier.kind != IDENTIFIER_TOKEN);
+ if (identifier.type.isPseudo) {
+ return identifier;
+ }
+
+ // Recovery
+ if (looksLikeStartOfNextTopLevelDeclaration(identifier) ||
+ isOneOfOrEof(identifier, const ['{'])) {
+ identifier = parser.insertSyntheticIdentifier(token, this,
+ message: fasta.templateExpectedIdentifier.withArguments(identifier));
+ } else if (identifier.type.isBuiltIn) {
+ parser.reportRecoverableErrorWithToken(
+ identifier, fasta.templateBuiltInIdentifierInDeclaration);
+ } else {
+ parser.reportRecoverableErrorWithToken(
+ identifier, fasta.templateExpectedIdentifier);
+ if (!identifier.isKeywordOrIdentifier) {
+ // When in doubt, consume the token to ensure we make progress
+ // but insert a synthetic identifier to satisfy listeners.
+ identifier = insertSyntheticIdentifierAfter(identifier, parser);
+ }
+ }
+ return identifier;
+ }
+}
+
+/// See [IdentifierContext.enumValueDeclaration].
+class EnumValueDeclarationIdentifierContext extends IdentifierContext {
+ const EnumValueDeclarationIdentifierContext()
+ : super('enumValueDeclaration', inDeclaration: true);
+
+ @override
+ Token ensureIdentifier(Token token, Parser parser) {
+ Token identifier = token.next;
+ assert(identifier.kind != IDENTIFIER_TOKEN);
+ if (identifier.isIdentifier) {
+ return identifier;
+ }
+
+ // Recovery
+ parser.reportRecoverableErrorWithToken(
+ identifier, fasta.templateExpectedIdentifier);
+ if (looksLikeStartOfNextTopLevelDeclaration(identifier) ||
+ isOneOfOrEof(identifier, const [',', '}'])) {
+ return insertSyntheticIdentifierAfter(token, parser);
+ } else if (!identifier.isKeywordOrIdentifier) {
+ // When in doubt, consume the token to ensure we make progress
+ // but insert a synthetic identifier to satisfy listeners.
+ return insertSyntheticIdentifierAfter(identifier, parser);
+ }
+ return identifier;
+ }
+}
+
/// See [IdentifierContext.expression].
class ExpressionIdentifierContext extends IdentifierContext {
const ExpressionIdentifierContext()
@@ -248,10 +311,12 @@
Token ensureIdentifier(Token token, Parser parser) {
Token identifier = token.next;
assert(identifier.kind != IDENTIFIER_TOKEN);
+ const followingValues = const ['.', ';'];
+
if (identifier.isIdentifier) {
Token next = identifier.next;
- if (isOneOfOrEof(next, const ['.', ';']) ||
- !looksLikeStartOfNextTopLevelDeclaration(identifier)) {
+ if (!looksLikeStartOfNextTopLevelDeclaration(identifier) ||
+ isOneOfOrEof(next, followingValues)) {
return identifier;
}
// Although this is a valid library name, the library declaration
@@ -260,7 +325,7 @@
}
// Recovery
- if (isOneOfOrEof(identifier, const ['.', ';']) ||
+ if (isOneOfOrEof(identifier, followingValues) ||
looksLikeStartOfNextTopLevelDeclaration(identifier)) {
identifier = parser.insertSyntheticIdentifier(token, this,
message: fasta.templateExpectedIdentifier.withArguments(identifier));
@@ -348,6 +413,49 @@
}
}
+/// See [IdentifierContext.topLevelVariableDeclaration].
+class TopLevelVariableIdentifierContext extends IdentifierContext {
+ const TopLevelVariableIdentifierContext()
+ : super('topLevelVariableDeclaration', inDeclaration: true);
+
+ @override
+ Token ensureIdentifier(Token token, Parser parser) {
+ Token identifier = token.next;
+ assert(identifier.kind != IDENTIFIER_TOKEN);
+ const followingValues = const [';', '=', ','];
+
+ if (identifier.isIdentifier) {
+ Token next = identifier.next;
+ if (!looksLikeStartOfNextTopLevelDeclaration(identifier) ||
+ isOneOfOrEof(next, followingValues)) {
+ return identifier;
+ }
+ // Although this is a valid top level var name, the var declaration
+ // is invalid and this looks like the start of the next declaration.
+ // In this situation, fall through to insert a synthetic var name.
+ }
+
+ // Recovery
+ if (looksLikeStartOfNextTopLevelDeclaration(identifier) ||
+ isOneOfOrEof(identifier, followingValues)) {
+ identifier = parser.insertSyntheticIdentifier(token, this,
+ message: fasta.templateExpectedIdentifier.withArguments(identifier));
+ } else if (identifier.type.isBuiltIn) {
+ parser.reportRecoverableErrorWithToken(
+ identifier, fasta.templateBuiltInIdentifierInDeclaration);
+ } else {
+ parser.reportRecoverableErrorWithToken(
+ identifier, fasta.templateExpectedIdentifier);
+ if (!identifier.isKeywordOrIdentifier) {
+ // When in doubt, consume the token to ensure we make progress
+ // but insert a synthetic identifier to satisfy listeners.
+ identifier = insertSyntheticIdentifierAfter(identifier, parser);
+ }
+ }
+ return identifier;
+ }
+}
+
/// See [IdentifierContext].typedefDeclaration
class TypedefDeclarationIdentifierContext extends IdentifierContext {
const TypedefDeclarationIdentifierContext()
@@ -409,20 +517,6 @@
assert(next.kind != IDENTIFIER_TOKEN);
if (isValidTypeReference(next)) {
return next;
- }
-
- // Recovery: skip over any annotations
- while (optional('@', next)) {
- // TODO(danrubel): Improve this error message to indicate that an
- // annotation is not allowed before type arguments.
- parser.reportRecoverableErrorWithToken(
- next, fasta.templateUnexpectedToken);
- token = skipMetadata(token);
- next = token.next;
- }
-
- if (isValidTypeReference(next)) {
- return next;
} else if (next.isKeywordOrIdentifier) {
if (optional("void", next)) {
parser.reportRecoverableError(next, fasta.messageInvalidVoid);
diff --git a/pkg/front_end/lib/src/fasta/parser/listener.dart b/pkg/front_end/lib/src/fasta/parser/listener.dart
index 79786ca..5c3e99c 100644
--- a/pkg/front_end/lib/src/fasta/parser/listener.dart
+++ b/pkg/front_end/lib/src/fasta/parser/listener.dart
@@ -1047,12 +1047,12 @@
}
void handleLiteralList(
- int count, Token beginToken, Token constKeyword, Token endToken) {
+ int count, Token leftBracket, Token constKeyword, Token rightBracket) {
logEvent("LiteralList");
}
void handleLiteralMap(
- int count, Token beginToken, Token constKeyword, Token endToken) {
+ int count, Token leftBrace, Token constKeyword, Token rightBrace) {
logEvent("LiteralMap");
}
diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
index 2ef4384..53154e7 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -87,6 +87,7 @@
show
TypeInfo,
TypeParamOrArgInfo,
+ computeMethodTypeArguments,
computeType,
computeTypeParamOrArg,
isGeneralizedFunctionType,
@@ -94,8 +95,6 @@
noType,
noTypeParamOrArg;
-import 'type_info_impl.dart' show skipTypeVariables;
-
import 'util.dart' show optional;
/// An event generating parser of Dart programs. This parser expects all tokens
@@ -332,9 +331,12 @@
listener.endTopLevelDeclaration(token.next);
count++;
if (start == token.next) {
+ // Recovery:
// If progress has not been made reaching the end of the token stream,
// then report an error and skip the current token.
token = token.next;
+ listener.beginMetadataStar(token);
+ listener.endMetadataStar(0);
reportRecoverableErrorWithToken(
token, fasta.templateExpectedDeclaration);
listener.handleInvalidTopLevelDeclaration(token);
@@ -443,15 +445,26 @@
return parseScript(token);
}
token = parseMetadataStar(token);
- if (token.next.isTopLevelKeyword) {
+ Token next = token.next;
+ if (next.isTopLevelKeyword) {
return parseTopLevelKeywordDeclaration(token, null, directiveState);
}
Token start = token;
// Skip modifiers to find a top level keyword or identifier
- while (token.next.isModifier) {
- token = token.next;
+ if (next.isModifier) {
+ if (optional('var', next) ||
+ ((optional('const', next) || optional('final', next)) &&
+ // Ignore `const class` and `final class` so that it is reported
+ // below as an invalid modifier on a class.
+ !optional('class', next.next))) {
+ directiveState?.checkDeclaration();
+ return parseTopLevelMemberImpl(token);
+ }
+ while (token.next.isModifier) {
+ token = token.next;
+ }
}
- Token next = token.next;
+ next = token.next;
if (next.isTopLevelKeyword) {
Token beforeAbstractToken;
Token beforeModifier = start;
@@ -915,10 +928,10 @@
/// ```
Token parseTypeList(Token token) {
listener.beginTypeList(token.next);
- token = parseType(token);
+ token = computeType(token, true).ensureTypeOrVoid(token, this);
int count = 1;
while (optional(',', token.next)) {
- token = parseType(token.next);
+ token = computeType(token.next, true).ensureTypeOrVoid(token.next, this);
count++;
}
listener.endTypeList(count);
@@ -1006,7 +1019,7 @@
if (optional("<", token.next)) {
reportRecoverableError(token.next, fasta.messageMetadataTypeArguments);
}
- token = parseTypeArgumentsOpt(token);
+ token = computeTypeParamOrArg(token).parseArguments(token, this);
Token period = null;
if (optional('.', token.next)) {
period = token.next;
@@ -1508,22 +1521,6 @@
return token;
}
- /// Returns `true` if [token] matches '<' type (',' type)* '>' '(', and
- /// otherwise returns `false`. The final '(' is not part of the grammar
- /// construct `typeArguments`, but it is required here such that type
- /// arguments in generic method invocations can be recognized, and as few as
- /// possible other constructs will pass (e.g., 'a < C, D > 3').
- bool isValidMethodTypeArguments(Token token) {
- // TODO(danrubel): Replace call with a call to computeTypeVar.
- if (optional('<', token)) {
- Token endGroup = skipTypeVariables(token);
- if (endGroup != null && optional('(', endGroup.next)) {
- return true;
- }
- }
- return false;
- }
-
/// ```
/// qualified:
/// identifier qualifiedRest*
@@ -1614,7 +1611,12 @@
break;
} else {
// Recovery
- if (next.isIdentifier) {
+ Token endGroup = leftBrace.endGroup;
+ if (endGroup.isSynthetic) {
+ // The scanner did not place the synthetic '}' correctly.
+ token = rewriter.moveSynthetic(token, endGroup);
+ break;
+ } else if (next.isIdentifier) {
// If the next token is an identifier, assume a missing comma.
// TODO(danrubel): Consider improved recovery for missing `}`
// both here and when the scanner inserts a synthetic `}`
@@ -1929,14 +1931,7 @@
token = next;
} else {
reportRecoverableErrorWithToken(next, context.recoveryTemplate);
- if (context == IdentifierContext.topLevelVariableDeclaration) {
- // Since the token is not a keyword or identifier, consume it to
- // ensure forward progress in parseField.
- token = next.next;
- // Supply a non-empty method name so that it does not accidentally
- // match the default constructor.
- token = insertSyntheticIdentifier(next, context);
- } else if (context == IdentifierContext.constructorReference) {
+ if (context == IdentifierContext.constructorReference) {
token = insertSyntheticIdentifier(token, context);
} else {
token = next;
@@ -2008,10 +2003,6 @@
followingValues = [';'];
} else if (context == IdentifierContext.constructorReferenceContinuation) {
followingValues = ['.', ',', '(', ')', '[', ']', '}', ';'];
- } else if (context == IdentifierContext.enumDeclaration) {
- followingValues = ['{'];
- } else if (context == IdentifierContext.enumValueDeclaration) {
- followingValues = [',', '}'];
} else if (context == IdentifierContext.formalParameterDeclaration) {
followingValues = [':', '=', ',', '(', ')', '[', ']', '{', '}'];
} else if (context == IdentifierContext.labelDeclaration) {
@@ -2026,8 +2017,6 @@
followingValues = ['.', '(', '{', '=>'];
} else if (context == IdentifierContext.topLevelFunctionDeclaration) {
followingValues = ['(', '{', '=>'];
- } else if (context == IdentifierContext.topLevelVariableDeclaration) {
- followingValues = [';', '=', ','];
} else if (context == IdentifierContext.typeVariableDeclaration) {
followingValues = ['<', '>', ';', '}'];
} else {
@@ -2082,9 +2071,7 @@
// could create a method to test whether a given token matches one of the
// patterns.
List<String> initialKeywords;
- if (context == IdentifierContext.enumDeclaration) {
- initialKeywords = topLevelKeywords();
- } else if (context == IdentifierContext.formalParameterDeclaration) {
+ if (context == IdentifierContext.formalParameterDeclaration) {
initialKeywords = topLevelKeywords()
..addAll(classMemberKeywords())
..addAll(statementKeywords())
@@ -2100,8 +2087,6 @@
initialKeywords = statementKeywords();
} else if (context == IdentifierContext.topLevelFunctionDeclaration) {
initialKeywords = topLevelKeywords();
- } else if (context == IdentifierContext.topLevelVariableDeclaration) {
- initialKeywords = topLevelKeywords();
} else if (context == IdentifierContext.typeVariableDeclaration) {
initialKeywords = topLevelKeywords()
..addAll(classMemberKeywords())
@@ -2522,14 +2507,23 @@
next = token.next;
}
if (isModifier(next)) {
- ModifierRecoveryContext context = new ModifierRecoveryContext(this);
- token = context.parseTopLevelModifiers(token,
- externalToken: externalToken, varFinalOrConst: varFinalOrConst);
- next = token.next;
+ // Recovery
+ if (varFinalOrConst != null &&
+ (optional('final', next) ||
+ optional('var', next) ||
+ optional('const', next))) {
+ // If another `var`, `final`, or `const` then fall through
+ // to parse that as part of the next top level declaration.
+ } else {
+ ModifierRecoveryContext context = new ModifierRecoveryContext(this);
+ token = context.parseTopLevelModifiers(token,
+ externalToken: externalToken, varFinalOrConst: varFinalOrConst);
+ next = token.next;
- externalToken = context.externalToken;
- varFinalOrConst = context.varFinalOrConst;
- context = null;
+ externalToken = context.externalToken;
+ varFinalOrConst = context.varFinalOrConst;
+ context = null;
+ }
}
}
}
@@ -2746,7 +2740,7 @@
token = parseExpression(next);
listener.endFieldInitializer(assignment, token.next);
} else {
- if (varFinalOrConst != null) {
+ if (varFinalOrConst != null && !name.isSynthetic) {
if (optional("const", varFinalOrConst)) {
reportRecoverableError(
name,
@@ -3572,7 +3566,7 @@
listener.beginConstructorReference(start);
token = parseQualifiedRestOpt(
start, IdentifierContext.constructorReferenceContinuation);
- token = parseTypeArgumentsOpt(token);
+ token = computeTypeParamOrArg(token).parseArguments(token, this);
Token period = null;
if (optional('.', token.next)) {
period = token.next;
@@ -4115,9 +4109,8 @@
TokenType type = next.type;
int tokenLevel = type.precedence;
Token typeArguments;
- TypeParamOrArgInfo typeArg = computeTypeParamOrArg(token);
- if (typeArg != noTypeParamOrArg &&
- optional('(', typeArg.skip(token).next)) {
+ TypeParamOrArgInfo typeArg = computeMethodTypeArguments(token);
+ if (typeArg != noTypeParamOrArg) {
// For example a(b)<T>(c), where token is before '<'.
typeArguments = next;
token = typeArg.parseArguments(token, this);
@@ -4224,10 +4217,11 @@
listener.endBinaryExpression(period);
}
Token typeArguments;
- if (isValidMethodTypeArguments(next)) {
+ TypeParamOrArgInfo typeArg = computeMethodTypeArguments(token);
+ if (typeArg != noTypeParamOrArg) {
// For example a(b)..<T>(c), where token is '<'.
typeArguments = next;
- token = parseTypeArgumentsOpt(token);
+ token = typeArg.parseArguments(token, this);
next = token.next;
assert(optional('(', next));
}
@@ -4327,12 +4321,7 @@
next = token.next;
} else if (optional('(', next)) {
if (typeArguments == null) {
- if (isValidMethodTypeArguments(next)) {
- token = parseTypeArgumentsOpt(token);
- next = token.next;
- } else {
- listener.handleNoTypeArguments(next);
- }
+ listener.handleNoTypeArguments(next);
}
token = parseArguments(token);
next = token.next;
@@ -4646,7 +4635,7 @@
token = parseTypeVariablesOpt(token);
return parseLiteralFunctionSuffix(token);
} else {
- token = parseTypeArgumentsOpt(token);
+ token = computeTypeParamOrArg(token).parseArguments(token, this);
Token next = token.next;
if (optional('{', next)) {
return parseLiteralMapSuffix(token, constKeyword);
@@ -4918,8 +4907,9 @@
Token parseSend(Token token, IdentifierContext context) {
Token beginToken = token = ensureIdentifier(token, context);
- if (isValidMethodTypeArguments(token.next)) {
- token = parseTypeArgumentsOpt(token);
+ TypeParamOrArgInfo typeArg = computeMethodTypeArguments(token);
+ if (typeArg != noTypeParamOrArg) {
+ token = typeArg.parseArguments(token, this);
} else {
listener.handleNoTypeArguments(token.next);
}
diff --git a/pkg/front_end/lib/src/fasta/parser/token_stream_rewriter.dart b/pkg/front_end/lib/src/fasta/parser/token_stream_rewriter.dart
index b80a0a9..d5b8eae 100644
--- a/pkg/front_end/lib/src/fasta/parser/token_stream_rewriter.dart
+++ b/pkg/front_end/lib/src/fasta/parser/token_stream_rewriter.dart
@@ -83,7 +83,8 @@
// A no-op rewriter could simply return `>>` here.
- Token gt1 = new SimpleToken(TokenType.GT, gtgt.charOffset);
+ Token gt1 =
+ new SimpleToken(TokenType.GT, gtgt.charOffset, gtgt.precedingComments);
Token gt2 = gt1.setNext(new SimpleToken(TokenType.GT, gt1.charOffset + 1));
gt2.setNext(gtgt.next);
diff --git a/pkg/front_end/lib/src/fasta/parser/type_info.dart b/pkg/front_end/lib/src/fasta/parser/type_info.dart
index 0addae0..b70a1e2 100644
--- a/pkg/front_end/lib/src/fasta/parser/type_info.dart
+++ b/pkg/front_end/lib/src/fasta/parser/type_info.dart
@@ -150,7 +150,8 @@
if ((!identical('get', value) &&
!identical('set', value) &&
!identical('factory', value) &&
- !identical('operator', value))) {
+ !identical('operator', value) &&
+ !(identical('typedef', value) && next.next.isIdentifier))) {
return new ComplexTypeInfo(token, typeParamOrArg)
.computeBuiltinAsType(required);
}
@@ -279,3 +280,15 @@
// TODO(danrubel): Consider adding additional const for common situations.
return new ComplexTypeParamOrArgInfo(token).compute(innerEndGroup);
}
+
+/// Called by the parser to obtain information about a possible group of type
+/// type arguments that follow [token] and that are followed by '('.
+/// Returns the type arguments if [token] matches '<' type (',' type)* '>' '(',
+/// and otherwise returns [noTypeParamOrArg]. The final '(' is not part of the
+/// grammar construct `typeArguments`, but it is required here such that type
+/// arguments in generic method invocations can be recognized, and as few as
+/// possible other constructs will pass (e.g., 'a < C, D > 3').
+TypeParamOrArgInfo computeMethodTypeArguments(Token token) {
+ TypeParamOrArgInfo typeArg = computeTypeParamOrArg(token);
+ return optional('(', typeArg.skip(token).next) ? typeArg : noTypeParamOrArg;
+}
diff --git a/pkg/front_end/lib/src/fasta/parser/type_info_impl.dart b/pkg/front_end/lib/src/fasta/parser/type_info_impl.dart
index 4120e05..376d485 100644
--- a/pkg/front_end/lib/src/fasta/parser/type_info_impl.dart
+++ b/pkg/front_end/lib/src/fasta/parser/type_info_impl.dart
@@ -8,6 +8,8 @@
import '../fasta_codes.dart' as fasta;
+import '../scanner/token_constants.dart' show IDENTIFIER_TOKEN;
+
import '../util/link.dart' show Link;
import 'identifier_context.dart' show IdentifierContext;
@@ -214,7 +216,13 @@
}
bool looksLikeName(Token token) =>
- token.isIdentifier || optional('this', token);
+ token.kind == IDENTIFIER_TOKEN ||
+ optional('this', token) ||
+ (token.isIdentifier &&
+ // Although `typedef` is a legal identifier,
+ // type `typedef` identifier is not legal and in this situation
+ // `typedef` is probably a separate declaration.
+ (!optional('typedef', token) || !token.next.isIdentifier));
Token skipTypeVariables(Token token) {
assert(optional('<', token));
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 3f9ee22..5cf8451 100644
--- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
@@ -24,7 +24,7 @@
import '../fasta_codes.dart'
show Message, messageExpectedBlockToSkip, templateInternalProblemNotFound;
-import '../kernel/body_builder.dart' show BodyBuilder;
+import '../kernel/kernel_body_builder.dart' show KernelBodyBuilder;
import '../parser.dart' show IdentifierContext, MemberKind, Parser, optional;
@@ -536,8 +536,17 @@
ConstantContext constantContext = builder.isConstructor && builder.isConst
? ConstantContext.inferred
: ConstantContext.none;
- return new BodyBuilder(library, builder, memberScope, formalParameterScope,
- hierarchy, coreTypes, currentClass, isInstanceMember, uri, typeInferrer)
+ return new KernelBodyBuilder(
+ library,
+ builder,
+ memberScope,
+ formalParameterScope,
+ hierarchy,
+ coreTypes,
+ currentClass,
+ isInstanceMember,
+ uri,
+ typeInferrer)
..constantContext = constantContext;
}
diff --git a/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart b/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
index 25e961f..06f8279 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
@@ -232,14 +232,8 @@
: substitution.substituteType(type).accept(needsCheckVisitor);
for (int i = 0; i < interfacePositionalParameters.length; i++) {
var parameter = interfacePositionalParameters[i];
- var isGenericCovariantInterface = needsCheck(parameter.type);
- if (isGenericCovariantInterface !=
- parameter.isGenericCovariantInterface) {
- fixes.add((FunctionNode function) => function.positionalParameters[i]
- .isGenericCovariantInterface = isGenericCovariantInterface);
- }
var isGenericCovariantImpl =
- isGenericCovariantInterface || parameter.isGenericCovariantImpl;
+ parameter.isGenericCovariantImpl || needsCheck(parameter.type);
var isCovariant = parameter.isCovariant;
var superParameter = parameter;
for (int j = _start; j < _end; j++) {
@@ -275,14 +269,8 @@
}
for (int i = 0; i < interfaceNamedParameters.length; i++) {
var parameter = interfaceNamedParameters[i];
- var isGenericCovariantInterface = needsCheck(parameter.type);
- if (isGenericCovariantInterface !=
- parameter.isGenericCovariantInterface) {
- fixes.add((FunctionNode function) => function.namedParameters[i]
- .isGenericCovariantInterface = isGenericCovariantInterface);
- }
var isGenericCovariantImpl =
- isGenericCovariantInterface || parameter.isGenericCovariantImpl;
+ parameter.isGenericCovariantImpl || needsCheck(parameter.type);
var isCovariant = parameter.isCovariant;
var superParameter = parameter;
for (int j = _start; j < _end; j++) {
@@ -317,14 +305,8 @@
}
for (int i = 0; i < interfaceTypeParameters.length; i++) {
var typeParameter = interfaceTypeParameters[i];
- var isGenericCovariantInterface = needsCheck(typeParameter.bound);
- if (isGenericCovariantInterface !=
- typeParameter.isGenericCovariantInterface) {
- fixes.add((FunctionNode function) => function.typeParameters[i]
- .isGenericCovariantInterface = isGenericCovariantInterface);
- }
- var isGenericCovariantImpl =
- isGenericCovariantInterface || typeParameter.isGenericCovariantImpl;
+ var isGenericCovariantImpl = typeParameter.isGenericCovariantImpl ||
+ needsCheck(typeParameter.bound);
var superTypeParameter = typeParameter;
for (int j = _start; j < _end; j++) {
var otherMember = _finalizedCandidate(j);
@@ -431,8 +413,7 @@
return new VariableDeclaration(parameter.name,
type: substitution.substituteType(parameter.type),
isCovariant: parameter.isCovariant)
- ..isGenericCovariantImpl = parameter.isGenericCovariantImpl
- ..isGenericCovariantInterface = parameter.isGenericCovariantInterface;
+ ..isGenericCovariantImpl = parameter.isGenericCovariantImpl;
}
var targetTypeParameters = target.function.typeParameters;
@@ -444,9 +425,7 @@
for (int i = 0; i < targetTypeParameters.length; i++) {
var targetTypeParameter = targetTypeParameters[i];
var typeParameter = new TypeParameter(targetTypeParameter.name, null)
- ..isGenericCovariantImpl = targetTypeParameter.isGenericCovariantImpl
- ..isGenericCovariantInterface =
- targetTypeParameter.isGenericCovariantInterface;
+ ..isGenericCovariantImpl = targetTypeParameter.isGenericCovariantImpl;
typeParameters[i] = typeParameter;
additionalSubstitution[targetTypeParameter] =
new TypeParameterType(typeParameter);
@@ -1136,10 +1115,9 @@
void _recordInstrumentation(Class class_) {
var uri = class_.fileUri;
void recordCovariance(int fileOffset, bool isExplicitlyCovariant,
- bool isGenericCovariantInterface, bool isGenericCovariantImpl) {
+ bool isGenericCovariantImpl) {
var covariance = <String>[];
if (isExplicitlyCovariant) covariance.add('explicit');
- if (isGenericCovariantInterface) covariance.add('genericInterface');
if (!isExplicitlyCovariant && isGenericCovariantImpl) {
covariance.add('genericImpl');
}
@@ -1157,14 +1135,11 @@
}
void recordFormalAnnotations(VariableDeclaration formal) {
recordCovariance(formal.fileOffset, formal.isCovariant,
- formal.isGenericCovariantInterface, formal.isGenericCovariantImpl);
+ formal.isGenericCovariantImpl);
}
void recordTypeParameterAnnotations(TypeParameter typeParameter) {
- recordCovariance(
- typeParameter.fileOffset,
- false,
- typeParameter.isGenericCovariantInterface,
+ recordCovariance(typeParameter.fileOffset, false,
typeParameter.isGenericCovariantImpl);
}
@@ -1174,8 +1149,8 @@
}
for (var field in class_.fields) {
if (field.isStatic) continue;
- recordCovariance(field.fileOffset, field.isCovariant,
- field.isGenericCovariantInterface, field.isGenericCovariantImpl);
+ recordCovariance(
+ field.fileOffset, field.isCovariant, field.isGenericCovariantImpl);
}
}
@@ -1217,12 +1192,10 @@
// information is propagated to the getter/setter during type inference.
var type = member.type;
var isGenericCovariantImpl = member.isGenericCovariantImpl;
- var isGenericCovariantInterface = member.isGenericCovariantInterface;
var isCovariant = member.isCovariant;
if (setter) {
var valueParam = new VariableDeclaration('_', type: type)
..isGenericCovariantImpl = isGenericCovariantImpl
- ..isGenericCovariantInterface = isGenericCovariantInterface
..isCovariant = isCovariant;
var function = new FunctionNode(null,
positionalParameters: [valueParam], returnType: const VoidType());
@@ -1344,13 +1317,5 @@
}
@override
- bool get isGenericCovariantInterface => _field.isGenericCovariantInterface;
-
- @override
- void set isGenericCovariantInterface(bool value) {
- _field.isGenericCovariantInterface = value;
- }
-
- @override
DartType get type => _field.type;
}
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_constraint_gatherer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_constraint_gatherer.dart
index d278b10..a6f0aee 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_constraint_gatherer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_constraint_gatherer.dart
@@ -42,7 +42,7 @@
/// Tries to match [subtype] against [supertype].
///
- /// If the match suceeds, the resulting type constraints are recorded for
+ /// If the match succeeds, the resulting type constraints are recorded for
/// later use by [computeConstraints]. If the match fails, the set of type
/// constraints is unchanged.
bool trySubtypeMatch(DartType subtype, DartType supertype) {
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index 4971952..719ca60 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -337,6 +337,10 @@
/// Performs type inference on the given metadata annotations.
void inferMetadata(BuilderHelper helper, List<Expression> annotations);
+ /// Performs type inference on the given metadata annotations keeping the
+ /// existing helper if possible.
+ void inferMetadataKeepingHelper(List<Expression> annotations);
+
/// Performs type inference on the given function parameter initializer
/// expression.
void inferParameterInitializer(
@@ -374,6 +378,9 @@
void inferMetadata(BuilderHelper helper, List<Expression> annotations) {}
@override
+ void inferMetadataKeepingHelper(List<Expression> annotations) {}
+
+ @override
void inferParameterInitializer(
BuilderHelper helper, Expression initializer, DartType declaredType) {}
}
@@ -1100,6 +1107,7 @@
var positionalParameters = function.positionalParameters;
for (var i = 0; i < positionalParameters.length; i++) {
var parameter = positionalParameters[i];
+ inferMetadataKeepingHelper(parameter.annotations);
if (i >= function.requiredParameterCount &&
parameter.initializer == null) {
parameter.initializer = new ShadowNullLiteral()..parent = parameter;
@@ -1109,6 +1117,7 @@
}
}
for (var parameter in function.namedParameters) {
+ inferMetadataKeepingHelper(parameter.annotations);
if (parameter.initializer == null) {
parameter.initializer = new ShadowNullLiteral()..parent = parameter;
}
@@ -1239,14 +1248,25 @@
void inferMetadata(BuilderHelper helper, List<Expression> annotations) {
if (annotations != null) {
this.helper = helper;
+ inferMetadataKeepingHelper(annotations);
+ this.helper = null;
+ }
+ }
+
+ @override
+ void inferMetadataKeepingHelper(List<Expression> annotations) {
+ if (annotations != null) {
// Place annotations in a temporary list literal so that they will have a
// parent. This is necessary in case any of the annotations need to get
// replaced during type inference.
+ var parents = annotations.map((e) => e.parent).toList();
new ListLiteral(annotations);
for (var annotation in annotations) {
inferExpression(annotation, const UnknownType(), false);
}
- this.helper = null;
+ for (int i = 0; i < annotations.length; ++i) {
+ annotations[i].parent = parents[i];
+ }
}
}
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 932840e..f18ea4d 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -10,7 +10,9 @@
# 2. A suggestion for how to correct the problem (tip).
#
# 3. Examples that produce the message (one of expression, statement,
-# declaration, member, script, or bytes).
+# declaration, member, script, bytes or external). Note that 'external'
+# should be the path to an external test. The external test will not be run,
+# but the existance of the file will be verified.
#
# A message shouldn't indicate which kind of diagnostic it is, for example,
# warning or error. Tools are expected to prepend "Warning: ", or "Error: ",
@@ -43,6 +45,9 @@
# Long term, the analyzer and front-end need to share the same error codes. So
# eventually all error codes should have an `analyzerCode` field.
#
+# In some cases a mesage is internal to the frontend, and no meaningful dart2js
+# nor analyzer code can be provided. In such cases set `frontendInternal: true`.
+#
# ## Parameter Substitution in Template and Tip
#
# The fields `template` and `tip` are subject to parameter substitution. When
@@ -537,13 +542,9 @@
- "external foo; main(){}"
- "final class C {}"
- "abstract enum foo {bar}"
- - "const enum foo {bar}"
- - "final enum foo {bar}"
- "abstract void foo() {}"
- "static void foo() {}"
- "abstract typedef foo();"
- - "const typedef foo();"
- - "final typedef foo();"
- "static typedef foo();"
FinalAndCovariant:
diff --git a/pkg/front_end/test/fasta/messages_test.dart b/pkg/front_end/test/fasta/messages_test.dart
index 16f96a5..334a62f 100644
--- a/pkg/front_end/test/fasta/messages_test.dart
+++ b/pkg/front_end/test/fasta/messages_test.dart
@@ -83,6 +83,8 @@
List<String> unknownKeys = <String>[];
List<Example> examples = <Example>[];
+ String externalTest;
+ bool frontendInternal = false;
String analyzerCode;
String dart2jsCode;
Severity severity;
@@ -103,6 +105,10 @@
}
break;
+ case "frontendInternal":
+ frontendInternal = value;
+ break;
+
case "analyzerCode":
analyzerCode = value;
break;
@@ -170,6 +176,10 @@
}
break;
+ case "external":
+ externalTest = node.value;
+ break;
+
default:
unknownKeys.add(key);
}
@@ -213,16 +223,29 @@
severity != Severity.internalProblem);
yield createDescription(
+ "externalexample",
+ null,
+ exampleAndAnalyzerCodeRequired &&
+ externalTest != null &&
+ !(new File(externalTest).existsSync())
+ ? "Given external example for $name points to a nonexisting file."
+ : null);
+
+ yield createDescription(
"example",
null,
- exampleAndAnalyzerCodeRequired && examples.isEmpty
+ exampleAndAnalyzerCodeRequired &&
+ examples.isEmpty &&
+ externalTest == null
? "No example for $name, please add at least one example."
: null);
yield createDescription(
"analyzerCode",
null,
- exampleAndAnalyzerCodeRequired && analyzerCode == null
+ exampleAndAnalyzerCodeRequired &&
+ !frontendInternal &&
+ analyzerCode == null
? "No analyzer code for $name."
"\nTry running"
" <BUILDDIR>/dart-sdk/bin/dartanalyzer --format=machine"
@@ -234,6 +257,7 @@
"dart2jsCode",
null,
exampleAndAnalyzerCodeRequired &&
+ !frontendInternal &&
analyzerCode != null &&
dart2jsCode == null
? "No dart2js code for $name."
diff --git a/pkg/front_end/test/fasta/type_inference/interface_resolver_test.dart b/pkg/front_end/test/fasta/type_inference/interface_resolver_test.dart
index 7aca4b1..679349d 100644
--- a/pkg/front_end/test/fasta/type_inference/interface_resolver_test.dart
+++ b/pkg/front_end/test/fasta/type_inference/interface_resolver_test.dart
@@ -609,12 +609,9 @@
var resolvedMethod = node.finalize();
expect(resolvedMethod, same(method));
expect(u.isGenericCovariantImpl, isTrue);
- expect(u.isGenericCovariantInterface, isTrue);
expect(x.isGenericCovariantImpl, isTrue);
- expect(x.isGenericCovariantInterface, isTrue);
expect(x.isCovariant, isFalse);
expect(y.isGenericCovariantImpl, isTrue);
- expect(y.isGenericCovariantInterface, isTrue);
expect(y.isCovariant, isFalse);
}
@@ -627,7 +624,6 @@
var resolvedAccessor = node.finalize() as SyntheticAccessor;
expect(SyntheticAccessor.getField(resolvedAccessor), same(field));
expect(field.isGenericCovariantImpl, isTrue);
- expect(field.isGenericCovariantInterface, isTrue);
expect(field.isCovariant, isFalse);
}
@@ -641,14 +637,12 @@
var resolvedAccessor = node.finalize() as SyntheticAccessor;
expect(SyntheticAccessor.getField(resolvedAccessor), same(fieldB));
expect(fieldB.isGenericCovariantImpl, isFalse);
- expect(fieldB.isGenericCovariantInterface, isFalse);
expect(fieldB.isCovariant, isTrue);
}
void test_field_isGenericCovariantImpl_inherited() {
var typeParameter = new TypeParameter('T', objectType);
var fieldA = makeField(type: new TypeParameterType(typeParameter))
- ..isGenericCovariantInterface = true
..isGenericCovariantImpl = true;
var fieldB = makeField(type: numType);
var a =
@@ -662,7 +656,6 @@
var resolvedAccessor = node.finalize() as SyntheticAccessor;
expect(SyntheticAccessor.getField(resolvedAccessor), same(fieldB));
expect(fieldB.isGenericCovariantImpl, isTrue);
- expect(fieldB.isGenericCovariantInterface, isFalse);
expect(fieldB.isCovariant, isFalse);
}
@@ -734,11 +727,9 @@
var stub = node.finalize();
var x = stub.function.positionalParameters[0];
expect(x.isGenericCovariantImpl, isFalse);
- expect(x.isGenericCovariantInterface, isFalse);
expect(x.isCovariant, isTrue);
var y = stub.function.namedParameters[0];
expect(y.isGenericCovariantImpl, isFalse);
- expect(y.isGenericCovariantInterface, isFalse);
expect(y.isCovariant, isTrue);
expect(stub.forwardingStubInterfaceTarget, same(methodA));
expect(getStubTarget(stub), same(methodA));
@@ -756,17 +747,14 @@
var methodB = makeEmptyMethod(typeParameters: [
new TypeParameter('U', new TypeParameterType(typeParameterB))
..isGenericCovariantImpl = true
- ..isGenericCovariantInterface = true
], positionalParameters: [
new ShadowVariableDeclaration('x', 0,
type: new TypeParameterType(typeParameterB))
..isGenericCovariantImpl = true
- ..isGenericCovariantInterface = true
], namedParameters: [
new ShadowVariableDeclaration('y', 0,
type: new TypeParameterType(typeParameterB))
..isGenericCovariantImpl = true
- ..isGenericCovariantInterface = true
]);
var a = makeClass(name: 'A', procedures: [methodA]);
var b = makeClass(
@@ -779,14 +767,11 @@
var stub = node.finalize();
var u = stub.function.typeParameters[0];
expect(u.isGenericCovariantImpl, isTrue);
- expect(u.isGenericCovariantInterface, isFalse);
var x = stub.function.positionalParameters[0];
expect(x.isGenericCovariantImpl, isTrue);
- expect(x.isGenericCovariantInterface, isFalse);
expect(x.isCovariant, isFalse);
var y = stub.function.namedParameters[0];
expect(y.isGenericCovariantImpl, isTrue);
- expect(y.isGenericCovariantInterface, isFalse);
expect(y.isCovariant, isFalse);
expect(stub.forwardingStubInterfaceTarget, same(methodA));
expect(getStubTarget(stub), same(methodA));
@@ -1008,7 +993,6 @@
var methodB = makeEmptyMethod(positionalParameters: [
new ShadowVariableDeclaration('x', 0,
type: new TypeParameterType(typeParamB))
- ..isGenericCovariantInterface = true
..isGenericCovariantImpl = true
]);
var methodC = makeEmptyMethod(positionalParameters: [
diff --git a/pkg/front_end/testcases/annotation_variable_declaration.dart b/pkg/front_end/testcases/annotation_variable_declaration.dart
new file mode 100644
index 0000000..c64fad7
--- /dev/null
+++ b/pkg/front_end/testcases/annotation_variable_declaration.dart
@@ -0,0 +1,50 @@
+// Copyright (c) 2018, 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.
+
+const int foo = 42;
+
+class Bar {
+ const Bar();
+ const Bar.named(x);
+}
+
+class Baz {
+ Baz(@foo constructorFormal);
+
+ factory Baz.bazFactory(@foo factoryFormal) => null;
+
+ fisk(@foo formal1, @Bar() formal2, @Bar.named(foo) formal3,
+ @foo @Bar.named(foo) formal4,
+ [@foo optional]) {
+ @foo
+ var local1;
+
+ @Bar()
+ var local2;
+
+ @Bar.named(foo)
+ var local3;
+
+ @foo
+ @Bar.named(foo)
+ var local4;
+
+ @foo
+ var localWithInitializer = "hello";
+
+ @foo
+ @Bar.named(foo)
+ var localGroupPart1, localGroupPart2;
+
+ naebdyr(@foo nestedFormal) => null;
+
+ var roedmus = (@foo closureFormal) => null;
+ }
+
+ hest({@foo named}) => null;
+}
+
+typedef hest_t({@foo named});
+
+main() {}
diff --git a/pkg/front_end/testcases/annotation_variable_declaration.dart.direct.expect b/pkg/front_end/testcases/annotation_variable_declaration.dart.direct.expect
new file mode 100644
index 0000000..95f1aa8
--- /dev/null
+++ b/pkg/front_end/testcases/annotation_variable_declaration.dart.direct.expect
@@ -0,0 +1,36 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef hest_t = ({named: dynamic}) → dynamic;
+class Bar extends core::Object {
+ const constructor •() → void
+ : super core::Object::•()
+ ;
+ const constructor named(dynamic x) → void
+ : super core::Object::•()
+ ;
+}
+class Baz extends core::Object {
+ constructor •(@self::foo dynamic constructorFormal) → void
+ : super core::Object::•()
+ ;
+ static factory bazFactory(@self::foo dynamic factoryFormal) → self::Baz
+ return null;
+ method fisk(@self::foo dynamic formal1, @self::Bar::•() dynamic formal2, @self::Bar::named(self::foo) dynamic formal3, @self::foo @self::Bar::named(self::foo) dynamic formal4, [@self::foo dynamic optional = null]) → dynamic {
+ @self::foo dynamic local1;
+ @self::Bar::•() dynamic local2;
+ @self::Bar::named(self::foo) dynamic local3;
+ @self::foo @self::Bar::named(self::foo) dynamic local4;
+ @self::foo dynamic localWithInitializer = "hello";
+ @self::foo @self::Bar::named(self::foo) dynamic localGroupPart1;
+ @self::foo @self::Bar::named(self::foo) dynamic localGroupPart2;
+ function naebdyr(@self::foo dynamic nestedFormal) → dynamic
+ return null;
+ dynamic roedmus = (@self::foo dynamic closureFormal) → dynamic => null;
+ }
+ method hest({@self::foo dynamic named = null}) → dynamic
+ return null;
+}
+static const field core::int foo = 42;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/annotation_variable_declaration.dart.direct.transformed.expect b/pkg/front_end/testcases/annotation_variable_declaration.dart.direct.transformed.expect
new file mode 100644
index 0000000..95f1aa8
--- /dev/null
+++ b/pkg/front_end/testcases/annotation_variable_declaration.dart.direct.transformed.expect
@@ -0,0 +1,36 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef hest_t = ({named: dynamic}) → dynamic;
+class Bar extends core::Object {
+ const constructor •() → void
+ : super core::Object::•()
+ ;
+ const constructor named(dynamic x) → void
+ : super core::Object::•()
+ ;
+}
+class Baz extends core::Object {
+ constructor •(@self::foo dynamic constructorFormal) → void
+ : super core::Object::•()
+ ;
+ static factory bazFactory(@self::foo dynamic factoryFormal) → self::Baz
+ return null;
+ method fisk(@self::foo dynamic formal1, @self::Bar::•() dynamic formal2, @self::Bar::named(self::foo) dynamic formal3, @self::foo @self::Bar::named(self::foo) dynamic formal4, [@self::foo dynamic optional = null]) → dynamic {
+ @self::foo dynamic local1;
+ @self::Bar::•() dynamic local2;
+ @self::Bar::named(self::foo) dynamic local3;
+ @self::foo @self::Bar::named(self::foo) dynamic local4;
+ @self::foo dynamic localWithInitializer = "hello";
+ @self::foo @self::Bar::named(self::foo) dynamic localGroupPart1;
+ @self::foo @self::Bar::named(self::foo) dynamic localGroupPart2;
+ function naebdyr(@self::foo dynamic nestedFormal) → dynamic
+ return null;
+ dynamic roedmus = (@self::foo dynamic closureFormal) → dynamic => null;
+ }
+ method hest({@self::foo dynamic named = null}) → dynamic
+ return null;
+}
+static const field core::int foo = 42;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/annotation_variable_declaration.dart.outline.expect b/pkg/front_end/testcases/annotation_variable_declaration.dart.outline.expect
new file mode 100644
index 0000000..6382194
--- /dev/null
+++ b/pkg/front_end/testcases/annotation_variable_declaration.dart.outline.expect
@@ -0,0 +1,24 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef hest_t = ({named: dynamic}) → dynamic;
+class Bar extends core::Object {
+ const constructor •() → void
+ ;
+ const constructor named(dynamic x) → void
+ ;
+}
+class Baz extends core::Object {
+ constructor •(dynamic constructorFormal) → void
+ ;
+ static factory bazFactory(dynamic factoryFormal) → self::Baz
+ ;
+ method fisk(dynamic formal1, dynamic formal2, dynamic formal3, dynamic formal4, [dynamic optional]) → dynamic
+ ;
+ method hest({dynamic named}) → dynamic
+ ;
+}
+static const field core::int foo;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/annotation_variable_declaration.dart.strong.expect b/pkg/front_end/testcases/annotation_variable_declaration.dart.strong.expect
new file mode 100644
index 0000000..9ab4cb7
--- /dev/null
+++ b/pkg/front_end/testcases/annotation_variable_declaration.dart.strong.expect
@@ -0,0 +1,36 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef hest_t = ({named: dynamic}) → dynamic;
+class Bar extends core::Object {
+ const constructor •() → void
+ : super core::Object::•()
+ ;
+ const constructor named(dynamic x) → void
+ : super core::Object::•()
+ ;
+}
+class Baz extends core::Object {
+ constructor •(@self::foo dynamic constructorFormal) → void
+ : super core::Object::•()
+ ;
+ static factory bazFactory(@self::foo dynamic factoryFormal) → self::Baz
+ return null;
+ method fisk(@self::foo dynamic formal1, @self::Bar::•() dynamic formal2, @self::Bar::named(self::foo) dynamic formal3, @self::foo @self::Bar::named(self::foo) dynamic formal4, [@self::foo dynamic optional = null]) → dynamic {
+ @self::foo dynamic local1;
+ @self::Bar::•() dynamic local2;
+ @self::Bar::named(self::foo) dynamic local3;
+ @self::foo @self::Bar::named(self::foo) dynamic local4;
+ @self::foo core::String localWithInitializer = "hello";
+ @self::foo @self::Bar::named(self::foo) dynamic localGroupPart1;
+ @self::foo @self::Bar::named(self::foo) dynamic localGroupPart2;
+ function naebdyr(@self::foo dynamic nestedFormal) → core::Null
+ return null;
+ (dynamic) → core::Null roedmus = (@self::foo dynamic closureFormal) → core::Null => null;
+ }
+ method hest({@self::foo dynamic named = null}) → dynamic
+ return null;
+}
+static const field core::int foo = 42;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/annotation_variable_declaration.dart.strong.transformed.expect b/pkg/front_end/testcases/annotation_variable_declaration.dart.strong.transformed.expect
new file mode 100644
index 0000000..9ab4cb7
--- /dev/null
+++ b/pkg/front_end/testcases/annotation_variable_declaration.dart.strong.transformed.expect
@@ -0,0 +1,36 @@
+library;
+import self as self;
+import "dart:core" as core;
+
+typedef hest_t = ({named: dynamic}) → dynamic;
+class Bar extends core::Object {
+ const constructor •() → void
+ : super core::Object::•()
+ ;
+ const constructor named(dynamic x) → void
+ : super core::Object::•()
+ ;
+}
+class Baz extends core::Object {
+ constructor •(@self::foo dynamic constructorFormal) → void
+ : super core::Object::•()
+ ;
+ static factory bazFactory(@self::foo dynamic factoryFormal) → self::Baz
+ return null;
+ method fisk(@self::foo dynamic formal1, @self::Bar::•() dynamic formal2, @self::Bar::named(self::foo) dynamic formal3, @self::foo @self::Bar::named(self::foo) dynamic formal4, [@self::foo dynamic optional = null]) → dynamic {
+ @self::foo dynamic local1;
+ @self::Bar::•() dynamic local2;
+ @self::Bar::named(self::foo) dynamic local3;
+ @self::foo @self::Bar::named(self::foo) dynamic local4;
+ @self::foo core::String localWithInitializer = "hello";
+ @self::foo @self::Bar::named(self::foo) dynamic localGroupPart1;
+ @self::foo @self::Bar::named(self::foo) dynamic localGroupPart2;
+ function naebdyr(@self::foo dynamic nestedFormal) → core::Null
+ return null;
+ (dynamic) → core::Null roedmus = (@self::foo dynamic closureFormal) → core::Null => null;
+ }
+ method hest({@self::foo dynamic named = null}) → dynamic
+ return null;
+}
+static const field core::int foo = 42;
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/ast_builder.status b/pkg/front_end/testcases/ast_builder.status
index 0007d0b..cbb6e2d 100644
--- a/pkg/front_end/testcases/ast_builder.status
+++ b/pkg/front_end/testcases/ast_builder.status
@@ -11,13 +11,7 @@
inference/abstract_class_instantiation: Fail
inference/constructors_too_many_positional_arguments: Fail
inference/downwards_inference_annotations: Crash
-inference/downwards_inference_annotations_for_loop_variable: Fail
-inference/downwards_inference_annotations_locals: Fail
-inference/downwards_inference_annotations_locals_referring_to_locals: Fail
-inference/downwards_inference_annotations_parameter: Fail
-inference/downwards_inference_annotations_parameter_local: Fail
inference/downwards_inference_annotations_type_variable: Fail
-inference/downwards_inference_annotations_type_variable_local: Fail
inference/downwards_inference_annotations_typedef: Crash
inference/downwards_inference_on_function_of_t_using_the_t: Fail
inference/downwards_inference_yield_yield_star: Fail
diff --git a/pkg/front_end/testcases/incremental_initialize_from_dill/status.status b/pkg/front_end/testcases/incremental_initialize_from_dill/status.status
index 79a60b5..f3d01d2 100644
--- a/pkg/front_end/testcases/incremental_initialize_from_dill/status.status
+++ b/pkg/front_end/testcases/incremental_initialize_from_dill/status.status
@@ -3,5 +3,3 @@
# BSD-style license that can be found in the LICENSE.md file.
# Status file for the test suite ../test/incremental_load_from_dill_yaml_test.dart.
-
-strongmode_mixins_2: Crash
diff --git a/pkg/front_end/testcases/inference/async_await.dart.strong.expect b/pkg/front_end/testcases/inference/async_await.dart.strong.expect
index 79222e9..0865e85 100644
--- a/pkg/front_end/testcases/inference/async_await.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/async_await.dart.strong.expect
@@ -7,7 +7,6 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract forwarding-stub method timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<core::int> onTimeout}) → asy::Future<core::int>;
}
static method test() → void async {
core::int x0;
diff --git a/pkg/front_end/testcases/inference/async_await.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/async_await.dart.strong.transformed.expect
index 0c4ef21..2e07d8f 100644
--- a/pkg/front_end/testcases/inference/async_await.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/async_await.dart.strong.transformed.expect
@@ -7,7 +7,6 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract forwarding-stub method timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<core::int> onTimeout}) → asy::Future<core::int>;
}
static method test() → void /* originally async */ {
final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
diff --git a/pkg/front_end/testcases/inference/callable_generic_class.dart.strong.expect b/pkg/front_end/testcases/inference/callable_generic_class.dart.strong.expect
index bce5d96..aa889bc 100644
--- a/pkg/front_end/testcases/inference/callable_generic_class.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/callable_generic_class.dart.strong.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method call([generic-covariant-impl generic-covariant-interface self::ActionDispatcher::P value = null]) → void {}
+ method call([generic-covariant-impl self::ActionDispatcher::P value = null]) → void {}
}
class Bar extends core::Object {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/inference/callable_generic_class.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/callable_generic_class.dart.strong.transformed.expect
index bce5d96..aa889bc 100644
--- a/pkg/front_end/testcases/inference/callable_generic_class.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/callable_generic_class.dart.strong.transformed.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method call([generic-covariant-impl generic-covariant-interface self::ActionDispatcher::P value = null]) → void {}
+ method call([generic-covariant-impl self::ActionDispatcher::P value = null]) → void {}
}
class Bar extends core::Object {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments.dart.strong.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments.dart.strong.expect
index 80cb335..2994746 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments.dart.strong.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T t;
+ generic-covariant-impl field self::C::T t;
constructor •(self::C::T t) → void
: self::C::t = t, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments.dart.strong.transformed.expect
index d1bb8ee..3669a89 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments.dart.strong.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T t;
+ generic-covariant-impl field self::C::T t;
constructor •(self::C::T t) → void
: self::C::t = t, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.strong.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.strong.expect
index 72af9d8..39dec86 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.strong.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T t = null;
+ generic-covariant-impl field self::C::T t = null;
constructor _() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.strong.transformed.expect
index cd824ab..6259db5 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory.dart.strong.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T t = null;
+ generic-covariant-impl field self::C::T t = null;
constructor _() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.strong.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.strong.expect
index 4989080..2b26179 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.strong.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class A<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::A<self::A::T> f = new self::A::•<self::A::T>();
+ generic-covariant-impl field self::A<self::A::T> f = new self::A::•<self::A::T>();
constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.strong.transformed.expect
index 4989080..2b26179 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_factory_calls_constructor.dart.strong.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class A<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::A<self::A::T> f = new self::A::•<self::A::T>();
+ generic-covariant-impl field self::A<self::A::T> f = new self::A::•<self::A::T>();
constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.strong.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.strong.expect
index b0115e5..e62e839 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.strong.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T t = null;
+ generic-covariant-impl field self::C::T t = null;
constructor named(core::List<self::C::T> t) → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.strong.transformed.expect
index b0115e5..e62e839 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named.dart.strong.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T t = null;
+ generic-covariant-impl field self::C::T t = null;
constructor named(core::List<self::C::T> t) → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.strong.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.strong.expect
index 9fd81aa..d2511f2 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.strong.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T t = null;
+ generic-covariant-impl field self::C::T t = null;
constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.strong.transformed.expect
index 9fd81aa..d2511f2 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_named_factory.dart.strong.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T t = null;
+ generic-covariant-impl field self::C::T t = null;
constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.strong.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.strong.expect
index b2a5c1a..9ea221c 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.strong.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T t;
+ generic-covariant-impl field self::C::T t;
constructor •(self::C::T t) → void
: self::C::t = t, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.strong.transformed.expect
index b2a5c1a..9ea221c 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting.dart.strong.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T t;
+ generic-covariant-impl field self::C::T t;
constructor •(self::C::T t) → void
: self::C::t = t, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.strong.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.strong.expect
index 54b4372..4ff0a8c 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.strong.expect
@@ -5,12 +5,12 @@
abstract class C<T extends core::Object = dynamic> extends core::Object {
static field dynamic _redirecting# = <dynamic>[self::C::•];
abstract get t() → self::C::T;
- abstract set t(generic-covariant-impl generic-covariant-interface self::C::T x) → void;
+ abstract set t(generic-covariant-impl self::C::T x) → void;
static factory •<T extends core::Object = dynamic>(self::C::•::T t) → self::C<self::C::•::T>
let dynamic #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
}
class CImpl<T extends core::Object = dynamic> extends core::Object implements self::C<self::CImpl::T> {
- generic-covariant-impl generic-covariant-interface field self::CImpl::T t;
+ generic-covariant-impl field self::CImpl::T t;
constructor •(self::CImpl::T t) → void
: self::CImpl::t = t, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.strong.transformed.expect
index 2289573..4d782c8 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory.dart.strong.transformed.expect
@@ -5,12 +5,12 @@
abstract class C<T extends core::Object = dynamic> extends core::Object {
static field dynamic _redirecting# = <dynamic>[self::C::•];
abstract get t() → self::C::T;
- abstract set t(generic-covariant-impl generic-covariant-interface self::C::T x) → void;
+ abstract set t(generic-covariant-impl self::C::T x) → void;
static factory •<T extends core::Object = dynamic>(self::C::•::T t) → self::C<self::C::•::T>
let<BottomType> #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
}
class CImpl<T extends core::Object = dynamic> extends core::Object implements self::C<self::CImpl::T> {
- generic-covariant-impl generic-covariant-interface field self::CImpl::T t;
+ generic-covariant-impl field self::CImpl::T t;
constructor •(self::CImpl::T t) → void
: self::CImpl::t = t, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.strong.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.strong.expect
index 111277c..ede1a6e 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.strong.expect
@@ -5,12 +5,12 @@
abstract class C<T extends core::Object = dynamic> extends core::Object {
static field dynamic _redirecting# = <dynamic>[self::C::•];
abstract get t() → self::C::T;
- abstract set t(generic-covariant-impl generic-covariant-interface self::C::T x) → void;
+ abstract set t(generic-covariant-impl self::C::T x) → void;
static factory •<T extends core::Object = dynamic>(self::C::•::T t) → self::C<self::C::•::T>
let dynamic #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
}
class CImpl<T extends core::Object = dynamic> extends core::Object implements self::C<self::CImpl::T> {
- generic-covariant-impl generic-covariant-interface field self::CImpl::T t;
+ generic-covariant-impl field self::CImpl::T t;
constructor _(self::CImpl::T t) → void
: self::CImpl::t = t, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.strong.transformed.expect
index 14d4ed3..2840887 100644
--- a/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/constructors_infer_from_arguments_redirecting_factory_to_factory.dart.strong.transformed.expect
@@ -5,12 +5,12 @@
abstract class C<T extends core::Object = dynamic> extends core::Object {
static field dynamic _redirecting# = <dynamic>[self::C::•];
abstract get t() → self::C::T;
- abstract set t(generic-covariant-impl generic-covariant-interface self::C::T x) → void;
+ abstract set t(generic-covariant-impl self::C::T x) → void;
static factory •<T extends core::Object = dynamic>(self::C::•::T t) → self::C<self::C::•::T>
let <T extends core::Object = dynamic>(self::CImpl::•::T) → self::CImpl<self::CImpl::•::T> #redirecting_factory = self::CImpl::• in let self::C::•::T #typeArg0 = null in invalid-expression;
}
class CImpl<T extends core::Object = dynamic> extends core::Object implements self::C<self::CImpl::T> {
- generic-covariant-impl generic-covariant-interface field self::CImpl::T t;
+ generic-covariant-impl field self::CImpl::T t;
constructor _(self::CImpl::T t) → void
: self::CImpl::t = t, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_inference_f_bounded.dart.strong.expect b/pkg/front_end/testcases/inference/constructors_inference_f_bounded.dart.strong.expect
index d22785f..bf5d7a9 100644
--- a/pkg/front_end/testcases/inference/constructors_inference_f_bounded.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/constructors_inference_f_bounded.dart.strong.expect
@@ -8,8 +8,8 @@
;
}
class Pair<T extends self::Clonable<self::Pair::T> = self::Clonable<dynamic>, U extends self::Clonable<self::Pair::U> = self::Clonable<dynamic>> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::Pair::T t;
- generic-covariant-impl generic-covariant-interface field self::Pair::U u;
+ generic-covariant-impl field self::Pair::T t;
+ generic-covariant-impl field self::Pair::U u;
constructor •(self::Pair::T t, self::Pair::U u) → void
: self::Pair::t = t, self::Pair::u = u, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_inference_f_bounded.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_inference_f_bounded.dart.strong.transformed.expect
index d22785f..bf5d7a9 100644
--- a/pkg/front_end/testcases/inference/constructors_inference_f_bounded.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/constructors_inference_f_bounded.dart.strong.transformed.expect
@@ -8,8 +8,8 @@
;
}
class Pair<T extends self::Clonable<self::Pair::T> = self::Clonable<dynamic>, U extends self::Clonable<self::Pair::U> = self::Clonable<dynamic>> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::Pair::T t;
- generic-covariant-impl generic-covariant-interface field self::Pair::U u;
+ generic-covariant-impl field self::Pair::T t;
+ generic-covariant-impl field self::Pair::U u;
constructor •(self::Pair::T t, self::Pair::U u) → void
: self::Pair::t = t, self::Pair::u = u, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_reverse_type_parameters.dart.strong.expect b/pkg/front_end/testcases/inference/constructors_reverse_type_parameters.dart.strong.expect
index 777d093..52a04f7 100644
--- a/pkg/front_end/testcases/inference/constructors_reverse_type_parameters.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/constructors_reverse_type_parameters.dart.strong.expect
@@ -3,8 +3,8 @@
import "dart:core" as core;
class Pair<T extends core::Object = dynamic, U extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::Pair::T t;
- generic-covariant-impl generic-covariant-interface field self::Pair::U u;
+ generic-covariant-impl field self::Pair::T t;
+ generic-covariant-impl field self::Pair::U u;
constructor •(self::Pair::T t, self::Pair::U u) → void
: self::Pair::t = t, self::Pair::u = u, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/constructors_reverse_type_parameters.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/constructors_reverse_type_parameters.dart.strong.transformed.expect
index 777d093..52a04f7 100644
--- a/pkg/front_end/testcases/inference/constructors_reverse_type_parameters.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/constructors_reverse_type_parameters.dart.strong.transformed.expect
@@ -3,8 +3,8 @@
import "dart:core" as core;
class Pair<T extends core::Object = dynamic, U extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::Pair::T t;
- generic-covariant-impl generic-covariant-interface field self::Pair::U u;
+ generic-covariant-impl field self::Pair::T t;
+ generic-covariant-impl field self::Pair::U u;
constructor •(self::Pair::T t, self::Pair::U u) → void
: self::Pair::t = t, self::Pair::u = u, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.expect b/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.expect
index 7fa4e4d..14e65f8 100644
--- a/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.expect
@@ -4,7 +4,7 @@
typedef Function2<S extends core::Object = dynamic, T extends core::Object = dynamic> = (S) → T;
class A<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field (self::A::T) → self::A::T x;
+ generic-covariant-impl field (self::A::T) → self::A::T x;
constructor •((self::A::T) → self::A::T x) → void
: self::A::x = x, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.transformed.expect
index 7fa4e4d..14e65f8 100644
--- a/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/downward_inference_miscellaneous.dart.strong.transformed.expect
@@ -4,7 +4,7 @@
typedef Function2<S extends core::Object = dynamic, T extends core::Object = dynamic> = (S) → T;
class A<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field (self::A::T) → self::A::T x;
+ generic-covariant-impl field (self::A::T) → self::A::T x;
constructor •((self::A::T) → self::A::T x) → void
: self::A::x = x, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_for_loop_variable.dart.direct.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_for_loop_variable.dart.direct.expect
index 84e4744..c7a86c1 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_annotations_for_loop_variable.dart.direct.expect
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_for_loop_variable.dart.direct.expect
@@ -8,9 +8,9 @@
;
}
static method test() → void {
- for (core::int i = 0; i.<(1); i = i.+(1)) {
+ for (@self::Foo::•(const <dynamic>[]) core::int i = 0; i.<(1); i = i.+(1)) {
}
- for (core::int i in <dynamic>[0]) {
+ for (@self::Foo::•(const <dynamic>[]) core::int i in <dynamic>[0]) {
}
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_for_loop_variable.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_for_loop_variable.dart.direct.transformed.expect
index 84e4744..c7a86c1 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_annotations_for_loop_variable.dart.direct.transformed.expect
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_for_loop_variable.dart.direct.transformed.expect
@@ -8,9 +8,9 @@
;
}
static method test() → void {
- for (core::int i = 0; i.<(1); i = i.+(1)) {
+ for (@self::Foo::•(const <dynamic>[]) core::int i = 0; i.<(1); i = i.+(1)) {
}
- for (core::int i in <dynamic>[0]) {
+ for (@self::Foo::•(const <dynamic>[]) core::int i in <dynamic>[0]) {
}
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_for_loop_variable.dart.strong.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_for_loop_variable.dart.strong.expect
new file mode 100644
index 0000000..e4d43d3
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_for_loop_variable.dart.strong.expect
@@ -0,0 +1,16 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+static method test() → void {
+ for (@self::Foo::•(const <core::String>[]) core::int i = 0; i.{core::num::<}(1); i = i.{core::num::+}(1)) {
+ }
+ for (@self::Foo::•(const <core::String>[]) core::int i in <core::int>[0]) {
+ }
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_for_loop_variable.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_for_loop_variable.dart.strong.transformed.expect
new file mode 100644
index 0000000..e4d43d3
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_for_loop_variable.dart.strong.transformed.expect
@@ -0,0 +1,16 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+static method test() → void {
+ for (@self::Foo::•(const <core::String>[]) core::int i = 0; i.{core::num::<}(1); i = i.{core::num::+}(1)) {
+ }
+ for (@self::Foo::•(const <core::String>[]) core::int i in <core::int>[0]) {
+ }
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_locals.dart.strong.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_locals.dart.strong.expect
new file mode 100644
index 0000000..70f1ea3
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_locals.dart.strong.expect
@@ -0,0 +1,15 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+static method test() → void {
+ @self::Foo::•(const <core::String>[]) dynamic x;
+ @self::Foo::•(const <core::String>[])
+ function f() → void {}
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_locals.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_locals.dart.strong.transformed.expect
new file mode 100644
index 0000000..70f1ea3
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_locals.dart.strong.transformed.expect
@@ -0,0 +1,15 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+static method test() → void {
+ @self::Foo::•(const <core::String>[]) dynamic x;
+ @self::Foo::•(const <core::String>[])
+ function f() → void {}
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart b/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart
index 9d389ca..b28b2ed 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart
@@ -14,6 +14,11 @@
@Foo(/*@typeArgs=int*/ const [x])
var /*@type=dynamic*/ y;
+
+ @Foo(/*@typeArgs=int*/ const [x])
+ void bar() {}
+
+ void baz(@Foo(/*@typeArgs=int*/ const [x]) dynamic formal) {}
}
main() {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart.direct.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart.direct.expect
index d3afdb6..a0385be 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart.direct.expect
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart.direct.expect
@@ -9,6 +9,9 @@
}
static method test() → void {
const dynamic x = 0;
- dynamic y;
+ @self::Foo::•(const <dynamic>[x]) dynamic y;
+ @self::Foo::•(const <dynamic>[x])
+ function bar() → void {}
+ function baz(@self::Foo::•(const <dynamic>[x]) dynamic formal) → void {}
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart.direct.transformed.expect
index d3afdb6..a0385be 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart.direct.transformed.expect
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart.direct.transformed.expect
@@ -9,6 +9,9 @@
}
static method test() → void {
const dynamic x = 0;
- dynamic y;
+ @self::Foo::•(const <dynamic>[x]) dynamic y;
+ @self::Foo::•(const <dynamic>[x])
+ function bar() → void {}
+ function baz(@self::Foo::•(const <dynamic>[x]) dynamic formal) → void {}
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart.strong.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart.strong.expect
new file mode 100644
index 0000000..eac77b2
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart.strong.expect
@@ -0,0 +1,17 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(dynamic l) → void
+ : super core::Object::•()
+ ;
+}
+static method test() → void {
+ const core::int x = 0;
+ @self::Foo::•(const <core::int>[x]) dynamic y;
+ @self::Foo::•(const <core::int>[x])
+ function bar() → void {}
+ function baz(@self::Foo::•(const <core::int>[x]) dynamic formal) → void {}
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart.strong.transformed.expect
new file mode 100644
index 0000000..eac77b2
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_locals_referring_to_locals.dart.strong.transformed.expect
@@ -0,0 +1,17 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(dynamic l) → void
+ : super core::Object::•()
+ ;
+}
+static method test() → void {
+ const core::int x = 0;
+ @self::Foo::•(const <core::int>[x]) dynamic y;
+ @self::Foo::•(const <core::int>[x])
+ function bar() → void {}
+ function baz(@self::Foo::•(const <core::int>[x]) dynamic formal) → void {}
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter.dart.direct.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter.dart.direct.expect
index 306b574..9d2c6e3 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter.dart.direct.expect
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter.dart.direct.expect
@@ -11,7 +11,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method m(dynamic x) → void {}
+ method m(@self::Foo::•(const <dynamic>[]) dynamic x) → void {}
}
-static method f(dynamic x) → void {}
+static method f(@self::Foo::•(const <dynamic>[]) dynamic x) → void {}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter.dart.direct.transformed.expect
index 306b574..9d2c6e3 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter.dart.direct.transformed.expect
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter.dart.direct.transformed.expect
@@ -11,7 +11,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method m(dynamic x) → void {}
+ method m(@self::Foo::•(const <dynamic>[]) dynamic x) → void {}
}
-static method f(dynamic x) → void {}
+static method f(@self::Foo::•(const <dynamic>[]) dynamic x) → void {}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter.dart.strong.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter.dart.strong.expect
new file mode 100644
index 0000000..7775e23
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter.dart.strong.expect
@@ -0,0 +1,17 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method m(@self::Foo::•(const <core::String>[]) dynamic x) → void {}
+}
+static method f(@self::Foo::•(const <core::String>[]) dynamic x) → void {}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter.dart.strong.transformed.expect
new file mode 100644
index 0000000..7775e23
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter.dart.strong.transformed.expect
@@ -0,0 +1,17 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+class C extends core::Object {
+ synthetic constructor •() → void
+ : super core::Object::•()
+ ;
+ method m(@self::Foo::•(const <core::String>[]) dynamic x) → void {}
+}
+static method f(@self::Foo::•(const <core::String>[]) dynamic x) → void {}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart
index 6cc32b3..e3198ae 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart
@@ -11,7 +11,7 @@
void test() {
void f(@Foo(/*@typeArgs=String*/ const []) /*@type=dynamic*/ x) {}
- var /*@type=(dynamic) -> Null*/ x = /*@returnType=Null*/ (/*@type=dynamic*/ @Foo(/*@typeArgs=String*/ const [])
+ var /*@type=(dynamic) -> Null*/ x = /*@returnType=Null*/ (@Foo(/*@typeArgs=String*/ const []) /*@type=dynamic*/
x) {};
}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart.direct.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart.direct.expect
index d53d84c..9163b9d 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart.direct.expect
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart.direct.expect
@@ -8,7 +8,7 @@
;
}
static method test() → void {
- function f(dynamic x) → void {}
- dynamic x = (dynamic x) → dynamic {};
+ function f(@self::Foo::•(const <dynamic>[]) dynamic x) → void {}
+ dynamic x = (@self::Foo::•(const <dynamic>[]) dynamic x) → dynamic {};
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart.direct.transformed.expect
index d53d84c..9163b9d 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart.direct.transformed.expect
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart.direct.transformed.expect
@@ -8,7 +8,7 @@
;
}
static method test() → void {
- function f(dynamic x) → void {}
- dynamic x = (dynamic x) → dynamic {};
+ function f(@self::Foo::•(const <dynamic>[]) dynamic x) → void {}
+ dynamic x = (@self::Foo::•(const <dynamic>[]) dynamic x) → dynamic {};
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart.strong.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart.strong.expect
new file mode 100644
index 0000000..90d59e7
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart.strong.expect
@@ -0,0 +1,14 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+static method test() → void {
+ function f(@self::Foo::•(const <core::String>[]) dynamic x) → void {}
+ (dynamic) → core::Null x = (@self::Foo::•(const <core::String>[]) dynamic x) → core::Null {};
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart.strong.transformed.expect
new file mode 100644
index 0000000..90d59e7
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_parameter_local.dart.strong.transformed.expect
@@ -0,0 +1,14 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+static method test() → void {
+ function f(@self::Foo::•(const <core::String>[]) dynamic x) → void {}
+ (dynamic) → core::Null x = (@self::Foo::•(const <core::String>[]) dynamic x) → core::Null {};
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart b/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart
index 3ec0b43..b048a1b 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart
@@ -11,7 +11,7 @@
void test() {
void f<@Foo(/*@typeArgs=String*/ const []) T>() {}
- var /*@type=<T extends Object>() -> Null*/ x =
+ var /*@type=<@Foo::•(const <String>[]) T extends Object = dynamic>() -> Null*/ x =
<@Foo(/*@typeArgs=String*/ const []) T> /*@returnType=Null*/ () {};
}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart.direct.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart.direct.expect
index 7f49df8..d94bf7a 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart.direct.expect
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart.direct.expect
@@ -8,7 +8,7 @@
;
}
static method test() → void {
- function f<T extends core::Object = dynamic>() → void {}
- dynamic x = <T extends core::Object = dynamic>() → dynamic {};
+ function f<@self::Foo::•(const <dynamic>[]) T extends core::Object = dynamic>() → void {}
+ dynamic x = <@self::Foo::•(const <dynamic>[]) T extends core::Object = dynamic>() → dynamic {};
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart.direct.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart.direct.transformed.expect
index 7f49df8..d94bf7a 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart.direct.transformed.expect
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart.direct.transformed.expect
@@ -8,7 +8,7 @@
;
}
static method test() → void {
- function f<T extends core::Object = dynamic>() → void {}
- dynamic x = <T extends core::Object = dynamic>() → dynamic {};
+ function f<@self::Foo::•(const <dynamic>[]) T extends core::Object = dynamic>() → void {}
+ dynamic x = <@self::Foo::•(const <dynamic>[]) T extends core::Object = dynamic>() → dynamic {};
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart.strong.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart.strong.expect
new file mode 100644
index 0000000..657f6f6
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart.strong.expect
@@ -0,0 +1,14 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+static method test() → void {
+ function f<@self::Foo::•(const <core::String>[]) T extends core::Object = dynamic>() → void {}
+ <@self::Foo::•(const <core::String>[]) T extends core::Object = dynamic>() → core::Null x = <@self::Foo::•(const <core::String>[]) T extends core::Object = dynamic>() → core::Null {};
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart.strong.transformed.expect
new file mode 100644
index 0000000..657f6f6
--- /dev/null
+++ b/pkg/front_end/testcases/inference/downwards_inference_annotations_type_variable_local.dart.strong.transformed.expect
@@ -0,0 +1,14 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class Foo extends core::Object {
+ const constructor •(core::List<core::String> l) → void
+ : super core::Object::•()
+ ;
+}
+static method test() → void {
+ function f<@self::Foo::•(const <core::String>[]) T extends core::Object = dynamic>() → void {}
+ <@self::Foo::•(const <core::String>[]) T extends core::Object = dynamic>() → core::Null x = <@self::Foo::•(const <core::String>[]) T extends core::Object = dynamic>() → core::Null {};
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/downwards_inference_on_instance_creations_infer_downwards.dart.strong.expect b/pkg/front_end/testcases/inference/downwards_inference_on_instance_creations_infer_downwards.dart.strong.expect
index 5fc98c7..148939a 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_on_instance_creations_infer_downwards.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/downwards_inference_on_instance_creations_infer_downwards.dart.strong.expect
@@ -3,8 +3,8 @@
import "dart:core" as core;
class A<S extends core::Object = dynamic, T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::A::S x;
- generic-covariant-impl generic-covariant-interface field self::A::T y;
+ generic-covariant-impl field self::A::S x;
+ generic-covariant-impl field self::A::T y;
constructor •(self::A::S x, self::A::T y) → void
: self::A::x = x, self::A::y = y, super core::Object::•()
;
@@ -35,7 +35,6 @@
constructor named(self::D::T a) → void
: super self::B::named(a, 3)
;
- abstract forwarding-stub set x(generic-covariant-impl core::int _) → void;
}
class E<S extends core::Object = dynamic, T extends core::Object = dynamic> extends self::A<self::C<self::E::S>, self::E::T> {
constructor •(self::E::T a) → void
diff --git a/pkg/front_end/testcases/inference/downwards_inference_on_instance_creations_infer_downwards.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/downwards_inference_on_instance_creations_infer_downwards.dart.strong.transformed.expect
index 1100687..4e52169 100644
--- a/pkg/front_end/testcases/inference/downwards_inference_on_instance_creations_infer_downwards.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/downwards_inference_on_instance_creations_infer_downwards.dart.strong.transformed.expect
@@ -3,8 +3,8 @@
import "dart:core" as core;
class A<S extends core::Object = dynamic, T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::A::S x;
- generic-covariant-impl generic-covariant-interface field self::A::T y;
+ generic-covariant-impl field self::A::S x;
+ generic-covariant-impl field self::A::T y;
constructor •(self::A::S x, self::A::T y) → void
: self::A::x = x, self::A::y = y, super core::Object::•()
;
@@ -35,7 +35,6 @@
constructor named(self::D::T a) → void
: super self::B::named(a, 3)
;
- abstract forwarding-stub set x(generic-covariant-impl core::int _) → void;
}
class E<S extends core::Object = dynamic, T extends core::Object = dynamic> extends self::A<self::C<self::E::S>, self::E::T> {
constructor •(self::E::T a) → void
diff --git a/pkg/front_end/testcases/inference/future_then.dart.strong.expect b/pkg/front_end/testcases/inference/future_then.dart.strong.expect
index 59ff30a..e39f077 100644
--- a/pkg/front_end/testcases/inference/future_then.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_then.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then.dart.strong.transformed.expect
index 5f0f486..7c6f301 100644
--- a/pkg/front_end/testcases/inference/future_then.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_2.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_2.dart.strong.expect
index c4514a8..4a812f5 100644
--- a/pkg/front_end/testcases/inference/future_then_2.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_then_2.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_2.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_2.dart.strong.transformed.expect
index 4d6c659..73bad2f 100644
--- a/pkg/front_end/testcases/inference/future_then_2.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_2.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_3.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_3.dart.strong.expect
index 41dd64d..c317b12 100644
--- a/pkg/front_end/testcases/inference/future_then_3.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_then_3.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_3.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_3.dart.strong.transformed.expect
index 90396a6..87a94a2 100644
--- a/pkg/front_end/testcases/inference/future_then_3.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_3.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_4.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_4.dart.strong.expect
index fb3eb9f..a2ad76f 100644
--- a/pkg/front_end/testcases/inference/future_then_4.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_then_4.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_4.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_4.dart.strong.transformed.expect
index ff00d40..8457b85 100644
--- a/pkg/front_end/testcases/inference/future_then_4.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_4.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_5.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_5.dart.strong.expect
index 369cd48..44f49a0 100644
--- a/pkg/front_end/testcases/inference/future_then_5.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_then_5.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_5.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_5.dart.strong.transformed.expect
index 3aba981..a90f007 100644
--- a/pkg/front_end/testcases/inference/future_then_5.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_5.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_6.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_6.dart.strong.expect
index 51d8ee3..9beae3a 100644
--- a/pkg/front_end/testcases/inference/future_then_6.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_then_6.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_6.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_6.dart.strong.transformed.expect
index 2e7cc96..b6243b1 100644
--- a/pkg/front_end/testcases/inference/future_then_6.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_6.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_conditional.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_conditional.dart.strong.expect
index 1d68a0b..fbba4bf 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_conditional.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional.dart.strong.transformed.expect
index a1d8145..40bc63d 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_conditional_2.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_conditional_2.dart.strong.expect
index 0d784ca..d571a7d 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional_2.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional_2.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_conditional_2.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional_2.dart.strong.transformed.expect
index 10610b3..6ce1dea 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional_2.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional_2.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_conditional_3.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_conditional_3.dart.strong.expect
index d153459..3497766 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional_3.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional_3.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_conditional_3.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional_3.dart.strong.transformed.expect
index b2e6ed0..a4ca1ff 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional_3.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional_3.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_conditional_4.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_conditional_4.dart.strong.expect
index a6160a6..af913b3 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional_4.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional_4.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_conditional_4.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional_4.dart.strong.transformed.expect
index 1262645..cae896d 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional_4.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional_4.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_conditional_5.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_conditional_5.dart.strong.expect
index 0fe0dcd..06319b5 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional_5.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional_5.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_conditional_5.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional_5.dart.strong.transformed.expect
index de8bd3e..6d3f557 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional_5.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional_5.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_conditional_6.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_conditional_6.dart.strong.expect
index 55f02eb..4b0e44c 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional_6.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional_6.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_conditional_6.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_conditional_6.dart.strong.transformed.expect
index 1dd34b9..5d100b9 100644
--- a/pkg/front_end/testcases/inference/future_then_conditional_6.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_conditional_6.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_ifNull.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_ifNull.dart.strong.expect
index 5bef4dd..9e96f13 100644
--- a/pkg/front_end/testcases/inference/future_then_ifNull.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_then_ifNull.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_ifNull.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_ifNull.dart.strong.transformed.expect
index a07f3c4..aeb0d5a 100644
--- a/pkg/front_end/testcases/inference/future_then_ifNull.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_ifNull.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_upwards.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_upwards.dart.strong.expect
index b8334ef..544b68b 100644
--- a/pkg/front_end/testcases/inference/future_then_upwards.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_then_upwards.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method main() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_upwards.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_upwards.dart.strong.transformed.expect
index ae2f1fe..671d8b5 100644
--- a/pkg/front_end/testcases/inference/future_then_upwards.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_upwards.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method main() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_upwards_2.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_upwards_2.dart.strong.expect
index 3557d61..dec6374 100644
--- a/pkg/front_end/testcases/inference/future_then_upwards_2.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_then_upwards_2.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method main() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_upwards_2.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_upwards_2.dart.strong.transformed.expect
index 13d7235..70bf88a 100644
--- a/pkg/front_end/testcases/inference/future_then_upwards_2.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_upwards_2.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method main() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_upwards_3.dart.strong.expect b/pkg/front_end/testcases/inference/future_then_upwards_3.dart.strong.expect
index ef64c92..e5af8f4 100644
--- a/pkg/front_end/testcases/inference/future_then_upwards_3.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_then_upwards_3.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_then_upwards_3.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_then_upwards_3.dart.strong.transformed.expect
index 163b552..2a2356f 100644
--- a/pkg/front_end/testcases/inference/future_then_upwards_3.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_then_upwards_3.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method test() → void {
diff --git a/pkg/front_end/testcases/inference/future_union_async_conditional.dart.strong.expect b/pkg/front_end/testcases/inference/future_union_async_conditional.dart.strong.expect
index fc102e4..011546b 100644
--- a/pkg/front_end/testcases/inference/future_union_async_conditional.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_union_async_conditional.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method g1(core::bool x) → asy::Future<core::int> async {
diff --git a/pkg/front_end/testcases/inference/future_union_async_conditional.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_union_async_conditional.dart.strong.transformed.expect
index 6385881..ed67f60 100644
--- a/pkg/front_end/testcases/inference/future_union_async_conditional.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_union_async_conditional.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method g1(core::bool x) → asy::Future<core::int> /* originally async */ {
diff --git a/pkg/front_end/testcases/inference/future_union_async_conditional_2.dart.strong.expect b/pkg/front_end/testcases/inference/future_union_async_conditional_2.dart.strong.expect
index b2ae474..a5c2511 100644
--- a/pkg/front_end/testcases/inference/future_union_async_conditional_2.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_union_async_conditional_2.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method g1(core::bool x) → asy::Future<core::int> async {
diff --git a/pkg/front_end/testcases/inference/future_union_async_conditional_2.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_union_async_conditional_2.dart.strong.transformed.expect
index ad3c572..611b1c4 100644
--- a/pkg/front_end/testcases/inference/future_union_async_conditional_2.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_union_async_conditional_2.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static method g1(core::bool x) → asy::Future<core::int> /* originally async */ {
diff --git a/pkg/front_end/testcases/inference/future_union_downwards.dart.strong.expect b/pkg/front_end/testcases/inference/future_union_downwards.dart.strong.expect
index 07071bc..ab7fd1f 100644
--- a/pkg/front_end/testcases/inference/future_union_downwards.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_union_downwards.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static field self::MyFuture<dynamic> f;
diff --git a/pkg/front_end/testcases/inference/future_union_downwards.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_union_downwards.dart.strong.transformed.expect
index 2086318..97f2740 100644
--- a/pkg/front_end/testcases/inference/future_union_downwards.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_union_downwards.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static field self::MyFuture<dynamic> f;
diff --git a/pkg/front_end/testcases/inference/future_union_downwards_2.dart.strong.expect b/pkg/front_end/testcases/inference/future_union_downwards_2.dart.strong.expect
index 83706a9..ff63cfd 100644
--- a/pkg/front_end/testcases/inference/future_union_downwards_2.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_union_downwards_2.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static field self::MyFuture<dynamic> f;
diff --git a/pkg/front_end/testcases/inference/future_union_downwards_2.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_union_downwards_2.dart.strong.transformed.expect
index 6134e15..9a1784c 100644
--- a/pkg/front_end/testcases/inference/future_union_downwards_2.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_union_downwards_2.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static field self::MyFuture<dynamic> f;
diff --git a/pkg/front_end/testcases/inference/future_union_downwards_3.dart.strong.expect b/pkg/front_end/testcases/inference/future_union_downwards_3.dart.strong.expect
index ed51407..74ed3dc 100644
--- a/pkg/front_end/testcases/inference/future_union_downwards_3.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_union_downwards_3.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static field asy::Future<dynamic> f;
diff --git a/pkg/front_end/testcases/inference/future_union_downwards_3.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_union_downwards_3.dart.strong.transformed.expect
index 4dbee3a..e53a2b4 100644
--- a/pkg/front_end/testcases/inference/future_union_downwards_3.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_union_downwards_3.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static field asy::Future<dynamic> f;
diff --git a/pkg/front_end/testcases/inference/future_union_downwards_4.dart.strong.expect b/pkg/front_end/testcases/inference/future_union_downwards_4.dart.strong.expect
index 65901ec..afa05ba 100644
--- a/pkg/front_end/testcases/inference/future_union_downwards_4.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/future_union_downwards_4.dart.strong.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static field asy::Future<dynamic> f;
diff --git a/pkg/front_end/testcases/inference/future_union_downwards_4.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/future_union_downwards_4.dart.strong.transformed.expect
index af8f590..1234c31 100644
--- a/pkg/front_end/testcases/inference/future_union_downwards_4.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/future_union_downwards_4.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
return null;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ catchError(core::Function onError, {(core::Object) → core::bool test = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ whenComplete(() → asy::FutureOr<dynamic> action) → asy::Future<self::MyFuture::T>;
- abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl generic-covariant-interface () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
+ abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ timeout(core::Duration timeLimit, {generic-covariant-impl () → asy::FutureOr<self::MyFuture::T> onTimeout = null}) → asy::Future<self::MyFuture::T>;
abstract no-such-method-forwarder method /* from org-dartlang-testcase-sdk:///sdk/lib/async/future.dart */ asStream() → asy::Stream<self::MyFuture::T>;
}
static field asy::Future<dynamic> f;
diff --git a/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.strong.expect b/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.strong.expect
index f365fb5..9daa0ae 100644
--- a/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/generic_methods_correctly_recognize_generic_upper_bound.dart.strong.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method method<generic-covariant-impl generic-covariant-interface U extends self::Foo::T = dynamic>(self::Foo::method::U u) → self::Foo::method::U
+ method method<generic-covariant-impl U extends self::Foo::T = dynamic>(self::Foo::method::U u) → self::Foo::method::U
return u;
}
static method main() → dynamic {
diff --git a/pkg/front_end/testcases/inference/infer_field_override_with_substitution.dart.strong.expect b/pkg/front_end/testcases/inference/infer_field_override_with_substitution.dart.strong.expect
index 3139312..0a8975f 100644
--- a/pkg/front_end/testcases/inference/infer_field_override_with_substitution.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/infer_field_override_with_substitution.dart.strong.expect
@@ -3,12 +3,12 @@
import "dart:core" as core;
abstract class A<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field core::List<self::A::T> z = null;
+ generic-covariant-impl field core::List<self::A::T> z = null;
synthetic constructor •() → void
: super core::Object::•()
;
abstract get x() → core::List<self::A::T>;
- abstract set y(generic-covariant-impl generic-covariant-interface core::List<self::A::T> value) → void;
+ abstract set y(generic-covariant-impl core::List<self::A::T> value) → void;
}
class B extends self::A<core::int> {
field core::List<core::int> x = null;
diff --git a/pkg/front_end/testcases/inference/infer_field_override_with_substitution.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/infer_field_override_with_substitution.dart.strong.transformed.expect
index 3139312..0a8975f 100644
--- a/pkg/front_end/testcases/inference/infer_field_override_with_substitution.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/infer_field_override_with_substitution.dart.strong.transformed.expect
@@ -3,12 +3,12 @@
import "dart:core" as core;
abstract class A<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field core::List<self::A::T> z = null;
+ generic-covariant-impl field core::List<self::A::T> z = null;
synthetic constructor •() → void
: super core::Object::•()
;
abstract get x() → core::List<self::A::T>;
- abstract set y(generic-covariant-impl generic-covariant-interface core::List<self::A::T> value) → void;
+ abstract set y(generic-covariant-impl core::List<self::A::T> value) → void;
}
class B extends self::A<core::int> {
field core::List<core::int> x = null;
diff --git a/pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart.strong.expect b/pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart.strong.expect
index df2a21a..f7edc12 100644
--- a/pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart.strong.expect
@@ -3,13 +3,13 @@
import "dart:core" as core;
class A<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::A::T x = null;
+ generic-covariant-impl field self::A::T x = null;
synthetic constructor •() → void
: super core::Object::•()
;
}
class B<E extends core::Object = dynamic> extends self::A<self::B::E> {
- generic-covariant-impl generic-covariant-interface field self::B::E y = null;
+ generic-covariant-impl field self::B::E y = null;
synthetic constructor •() → void
: super self::A::•()
;
diff --git a/pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart.strong.transformed.expect
index 06e2b22..dbde06b 100644
--- a/pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/infer_types_on_generic_instantiations_4.dart.strong.transformed.expect
@@ -3,13 +3,13 @@
import "dart:core" as core;
class A<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::A::T x = null;
+ generic-covariant-impl field self::A::T x = null;
synthetic constructor •() → void
: super core::Object::•()
;
}
class B<E extends core::Object = dynamic> extends self::A<self::B::E> {
- generic-covariant-impl generic-covariant-interface field self::B::E y = null;
+ generic-covariant-impl field self::B::E y = null;
synthetic constructor •() → void
: super self::A::•()
;
diff --git a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.expect b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.expect
index 0b9e781..f156e4b 100644
--- a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method foo(generic-covariant-impl generic-covariant-interface self::Bar::T t) → void {
+ method foo(generic-covariant-impl self::Bar::T t) → void {
for (core::String i in t) {
core::int x = let final dynamic #t1 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart:15:44: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.core::int'.
Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
@@ -25,7 +25,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method foo(generic-covariant-impl generic-covariant-interface self::Baz::S t) → void {
+ method foo(generic-covariant-impl self::Baz::S t) → void {
for (self::Baz::T i in t) {
core::int x = let final dynamic #t3 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart:23:44: Error: A value of type 'test::Baz::T' can't be assigned to a variable of type 'dart.core::int'.
Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
diff --git a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.transformed.expect
index 2f136bc..6d6bba4 100644
--- a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart.strong.transformed.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method foo(generic-covariant-impl generic-covariant-interface self::Bar::T t) → void {
+ method foo(generic-covariant-impl self::Bar::T t) → void {
for (core::String i in t) {
core::int x = let final dynamic #t1 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart:15:44: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.core::int'.
Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
@@ -25,7 +25,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method foo(generic-covariant-impl generic-covariant-interface self::Baz::S t) → void {
+ method foo(generic-covariant-impl self::Baz::S t) → void {
for (self::Baz::T i in t) {
core::int x = let final dynamic #t3 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop.dart:23:44: Error: A value of type 'test::Baz::T' can't be assigned to a variable of type 'dart.core::int'.
Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
diff --git a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.expect b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.expect
index 43e0fad..5e12f30 100644
--- a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.expect
@@ -13,7 +13,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method foo(generic-covariant-impl generic-covariant-interface self::Bar::T t) → dynamic async {
+ method foo(generic-covariant-impl self::Bar::T t) → dynamic async {
await for (core::String i in t) {
core::int x = let final dynamic #t1 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:17:44: Error: A value of type 'dart.core::String' can't be assigned to a variable of type 'dart.core::int'.
Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
@@ -26,7 +26,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method foo(generic-covariant-impl generic-covariant-interface self::Baz::S t) → dynamic async {
+ method foo(generic-covariant-impl self::Baz::S t) → dynamic async {
await for (self::Baz::T i in t) {
core::int x = let final dynamic #t3 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart:25:44: Error: A value of type 'test::Baz::T' can't be assigned to a variable of type 'dart.core::int'.
Try changing the type of the left hand side, or casting the right hand side to 'dart.core::int'.
diff --git a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.transformed.expect
index bb29f89..9b52d11 100644
--- a/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/infer_types_on_loop_indices_for_each_loop_async.dart.strong.transformed.expect
@@ -13,7 +13,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method foo(generic-covariant-impl generic-covariant-interface self::Bar::T t) → dynamic /* originally async */ {
+ method foo(generic-covariant-impl self::Bar::T t) → dynamic /* originally async */ {
final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
asy::FutureOr<dynamic> :return_value;
dynamic :async_stack_trace;
@@ -71,7 +71,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method foo(generic-covariant-impl generic-covariant-interface self::Baz::S t) → dynamic /* originally async */ {
+ method foo(generic-covariant-impl self::Baz::S t) → dynamic /* originally async */ {
final asy::Completer<dynamic> :completer = asy::Completer::sync<dynamic>();
asy::FutureOr<dynamic> :return_value;
dynamic :async_stack_trace;
diff --git a/pkg/front_end/testcases/inference/local_constructor_from_arguments.dart.strong.expect b/pkg/front_end/testcases/inference/local_constructor_from_arguments.dart.strong.expect
index 68853a4..a8b5a97 100644
--- a/pkg/front_end/testcases/inference/local_constructor_from_arguments.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/local_constructor_from_arguments.dart.strong.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T t;
+ generic-covariant-impl field self::C::T t;
constructor •(self::C::T t) → void
: self::C::t = t, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/local_constructor_from_arguments.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/local_constructor_from_arguments.dart.strong.transformed.expect
index 68853a4..a8b5a97 100644
--- a/pkg/front_end/testcases/inference/local_constructor_from_arguments.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/local_constructor_from_arguments.dart.strong.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T t;
+ generic-covariant-impl field self::C::T t;
constructor •(self::C::T t) → void
: self::C::t = t, super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/property_set.dart.strong.expect b/pkg/front_end/testcases/inference/property_set.dart.strong.expect
index 97ca7fe..7dc30e5 100644
--- a/pkg/front_end/testcases/inference/property_set.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/property_set.dart.strong.expect
@@ -3,11 +3,11 @@
import "dart:core" as core;
class A<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field core::List<self::A::T> x = null;
+ generic-covariant-impl field core::List<self::A::T> x = null;
synthetic constructor •() → void
: super core::Object::•()
;
- set y(generic-covariant-impl generic-covariant-interface core::List<self::A::T> value) → void {}
+ set y(generic-covariant-impl core::List<self::A::T> value) → void {}
}
static method test() → dynamic {
self::A<core::int> a_int = new self::A::•<core::int>();
diff --git a/pkg/front_end/testcases/inference/property_set.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/property_set.dart.strong.transformed.expect
index 97ca7fe..7dc30e5 100644
--- a/pkg/front_end/testcases/inference/property_set.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/property_set.dart.strong.transformed.expect
@@ -3,11 +3,11 @@
import "dart:core" as core;
class A<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field core::List<self::A::T> x = null;
+ generic-covariant-impl field core::List<self::A::T> x = null;
synthetic constructor •() → void
: super core::Object::•()
;
- set y(generic-covariant-impl generic-covariant-interface core::List<self::A::T> value) → void {}
+ set y(generic-covariant-impl core::List<self::A::T> value) → void {}
}
static method test() → dynamic {
self::A<core::int> a_int = new self::A::•<core::int>();
diff --git a/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_double.dart.strong.expect b/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_double.dart.strong.expect
index 88e493b..2cc58d7 100644
--- a/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_double.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_double.dart.strong.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::num = core::num> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T a = null;
+ generic-covariant-impl field self::C::T a = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_double.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_double.dart.strong.transformed.expect
index 88e493b..2cc58d7 100644
--- a/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_double.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_double.dart.strong.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::num = core::num> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T a = null;
+ generic-covariant-impl field self::C::T a = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_int.dart.strong.expect b/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_int.dart.strong.expect
index 97ae897..8b98b06 100644
--- a/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_int.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_int.dart.strong.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::num = core::num> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T a = null;
+ generic-covariant-impl field self::C::T a = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_int.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_int.dart.strong.transformed.expect
index 97ae897..8b98b06 100644
--- a/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_int.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_int.dart.strong.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class C<T extends core::num = core::num> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T a = null;
+ generic-covariant-impl field self::C::T a = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_t.dart.strong.expect b/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_t.dart.strong.expect
index a33fa5e..0f7e150 100644
--- a/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_t.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_t.dart.strong.expect
@@ -3,16 +3,16 @@
import "dart:core" as core;
class C<T extends core::num = core::num> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T a = null;
+ generic-covariant-impl field self::C::T a = null;
synthetic constructor •() → void
: super core::Object::•()
;
- method op(generic-covariant-impl generic-covariant-interface self::C::T b) → void {
+ method op(generic-covariant-impl self::C::T b) → void {
self::C::T r1 = this.{self::C::a}.{core::num::+}(b) as{TypeError} self::C::T;
self::C::T r2 = this.{self::C::a}.{core::num::-}(b) as{TypeError} self::C::T;
self::C::T r3 = this.{self::C::a}.{core::num::*}(b) as{TypeError} self::C::T;
}
- method opEq(generic-covariant-impl generic-covariant-interface self::C::T b) → void {
+ method opEq(generic-covariant-impl self::C::T b) → void {
this.{self::C::a} = this.{self::C::a}.{core::num::+}(b) as{TypeError} self::C::T;
this.{self::C::a} = this.{self::C::a}.{core::num::-}(b) as{TypeError} self::C::T;
this.{self::C::a} = this.{self::C::a}.{core::num::*}(b) as{TypeError} self::C::T;
diff --git a/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_t.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_t.dart.strong.transformed.expect
index a33fa5e..0f7e150 100644
--- a/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_t.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/refine_binary_expression_type_type_parameter_t_t.dart.strong.transformed.expect
@@ -3,16 +3,16 @@
import "dart:core" as core;
class C<T extends core::num = core::num> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T a = null;
+ generic-covariant-impl field self::C::T a = null;
synthetic constructor •() → void
: super core::Object::•()
;
- method op(generic-covariant-impl generic-covariant-interface self::C::T b) → void {
+ method op(generic-covariant-impl self::C::T b) → void {
self::C::T r1 = this.{self::C::a}.{core::num::+}(b) as{TypeError} self::C::T;
self::C::T r2 = this.{self::C::a}.{core::num::-}(b) as{TypeError} self::C::T;
self::C::T r3 = this.{self::C::a}.{core::num::*}(b) as{TypeError} self::C::T;
}
- method opEq(generic-covariant-impl generic-covariant-interface self::C::T b) → void {
+ method opEq(generic-covariant-impl self::C::T b) → void {
this.{self::C::a} = this.{self::C::a}.{core::num::+}(b) as{TypeError} self::C::T;
this.{self::C::a} = this.{self::C::a}.{core::num::-}(b) as{TypeError} self::C::T;
this.{self::C::a} = this.{self::C::a}.{core::num::*}(b) as{TypeError} self::C::T;
diff --git a/pkg/front_end/testcases/inference/super_index_set_substitution.dart.strong.expect b/pkg/front_end/testcases/inference/super_index_set_substitution.dart.strong.expect
index 3f4ad5b..94c942a 100644
--- a/pkg/front_end/testcases/inference/super_index_set_substitution.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/super_index_set_substitution.dart.strong.expect
@@ -7,7 +7,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- operator []=(generic-covariant-impl generic-covariant-interface core::Map<core::int, self::B::T> x, generic-covariant-impl generic-covariant-interface core::List<self::B::T> y) → void {}
+ operator []=(generic-covariant-impl core::Map<core::int, self::B::T> x, generic-covariant-impl core::List<self::B::T> y) → void {}
}
class C<U extends core::Object = dynamic> extends self::B<asy::Future<self::C::U>> {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/inference/super_index_set_substitution.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/super_index_set_substitution.dart.strong.transformed.expect
index 3f4ad5b..94c942a 100644
--- a/pkg/front_end/testcases/inference/super_index_set_substitution.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/super_index_set_substitution.dart.strong.transformed.expect
@@ -7,7 +7,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- operator []=(generic-covariant-impl generic-covariant-interface core::Map<core::int, self::B::T> x, generic-covariant-impl generic-covariant-interface core::List<self::B::T> y) → void {}
+ operator []=(generic-covariant-impl core::Map<core::int, self::B::T> x, generic-covariant-impl core::List<self::B::T> y) → void {}
}
class C<U extends core::Object = dynamic> extends self::B<asy::Future<self::C::U>> {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/inference/super_method_invocation_substitution.dart.strong.expect b/pkg/front_end/testcases/inference/super_method_invocation_substitution.dart.strong.expect
index d492a07..e6c9733 100644
--- a/pkg/front_end/testcases/inference/super_method_invocation_substitution.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/super_method_invocation_substitution.dart.strong.expect
@@ -17,7 +17,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method g(generic-covariant-impl generic-covariant-interface self::E<self::B::T> x) → self::D<self::B::T>
+ method g(generic-covariant-impl self::E<self::B::T> x) → self::D<self::B::T>
return null;
}
class C<U extends core::Object = dynamic> extends self::B<asy::Future<self::C::U>> {
diff --git a/pkg/front_end/testcases/inference/super_method_invocation_substitution.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/super_method_invocation_substitution.dart.strong.transformed.expect
index d492a07..e6c9733 100644
--- a/pkg/front_end/testcases/inference/super_method_invocation_substitution.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/super_method_invocation_substitution.dart.strong.transformed.expect
@@ -17,7 +17,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method g(generic-covariant-impl generic-covariant-interface self::E<self::B::T> x) → self::D<self::B::T>
+ method g(generic-covariant-impl self::E<self::B::T> x) → self::D<self::B::T>
return null;
}
class C<U extends core::Object = dynamic> extends self::B<asy::Future<self::C::U>> {
diff --git a/pkg/front_end/testcases/inference/super_property_get_substitution.dart.strong.expect b/pkg/front_end/testcases/inference/super_property_get_substitution.dart.strong.expect
index f8bd96c..91d89be 100644
--- a/pkg/front_end/testcases/inference/super_property_get_substitution.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/super_property_get_substitution.dart.strong.expect
@@ -14,7 +14,7 @@
;
}
class B<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::D<self::B::T> x = null;
+ generic-covariant-impl field self::D<self::B::T> x = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/super_property_get_substitution.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/super_property_get_substitution.dart.strong.transformed.expect
index f8bd96c..91d89be 100644
--- a/pkg/front_end/testcases/inference/super_property_get_substitution.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/super_property_get_substitution.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
;
}
class B<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::D<self::B::T> x = null;
+ generic-covariant-impl field self::D<self::B::T> x = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/super_property_set_substitution.dart.strong.expect b/pkg/front_end/testcases/inference/super_property_set_substitution.dart.strong.expect
index db2885e..822c304 100644
--- a/pkg/front_end/testcases/inference/super_property_set_substitution.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/super_property_set_substitution.dart.strong.expect
@@ -14,7 +14,7 @@
;
}
class B<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::D<self::B::T> x = null;
+ generic-covariant-impl field self::D<self::B::T> x = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference/super_property_set_substitution.dart.strong.transformed.expect b/pkg/front_end/testcases/inference/super_property_set_substitution.dart.strong.transformed.expect
index db2885e..822c304 100644
--- a/pkg/front_end/testcases/inference/super_property_set_substitution.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference/super_property_set_substitution.dart.strong.transformed.expect
@@ -14,7 +14,7 @@
;
}
class B<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::D<self::B::T> x = null;
+ generic-covariant-impl field self::D<self::B::T> x = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart.strong.expect b/pkg/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart.strong.expect
index a9953b5..35a241f 100644
--- a/pkg/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart.strong.expect
+++ b/pkg/front_end/testcases/inference_new/infer_assign_to_index_super_upwards.dart.strong.expect
@@ -8,10 +8,10 @@
;
operator [](core::String s) → self::Base::T
return this.{self::Base::getValue}(s);
- operator []=(core::String s, generic-covariant-impl generic-covariant-interface self::Base::U v) → void
+ operator []=(core::String s, generic-covariant-impl self::Base::U v) → void
return this.{self::Base::setValue}(s, v);
abstract method getValue(core::String s) → self::Base::T;
- abstract method setValue(core::String s, generic-covariant-impl generic-covariant-interface self::Base::U v) → void;
+ abstract method setValue(core::String s, generic-covariant-impl self::Base::U v) → void;
}
abstract class Test1 extends self::Base<core::int, core::int> {
synthetic constructor •() → void
@@ -27,8 +27,6 @@
core::int v10 = let final core::String #t21 = "x" in let final core::int #t22 = super.{self::Base::[]}(#t21).{core::num::+}(1) in let final void #t23 = super.{self::Base::[]=}(#t21, #t22) in #t22;
core::int v11 = let final core::String #t24 = "x" in let final core::int #t25 = super.{self::Base::[]}(#t24) in let final void #t26 = super.{self::Base::[]=}(#t24, #t25.{core::num::+}(1)) in #t25;
}
- abstract forwarding-stub operator []=(core::String s, generic-covariant-impl core::int v) → void;
- abstract forwarding-stub method setValue(core::String s, generic-covariant-impl core::int v) → void;
}
abstract class Test2 extends self::Base<core::int, core::num> {
synthetic constructor •() → void
@@ -47,8 +45,6 @@
core::int v10 = let final core::String #t57 = "x" in let final core::int #t58 = super.{self::Base::[]}(#t57).{core::num::+}(1) in let final void #t59 = super.{self::Base::[]=}(#t57, #t58) in #t58;
core::int v11 = let final core::String #t60 = "x" in let final core::int #t61 = super.{self::Base::[]}(#t60) in let final void #t62 = super.{self::Base::[]=}(#t60, #t61.{core::num::+}(1)) in #t61;
}
- abstract forwarding-stub operator []=(core::String s, generic-covariant-impl core::num v) → void;
- abstract forwarding-stub method setValue(core::String s, generic-covariant-impl core::num v) → void;
}
abstract class Test3 extends self::Base<core::int, core::double> {
synthetic constructor •() → void
@@ -74,8 +70,6 @@
var /*@type=int*/ v11 = super /*@target=Base::[]=*/ ['x']++;
^" in let final dynamic #t97 = #t94.{core::num::+}(1) in null) in #t94;
}
- abstract forwarding-stub operator []=(core::String s, generic-covariant-impl core::double v) → void;
- abstract forwarding-stub method setValue(core::String s, generic-covariant-impl core::double v) → void;
}
abstract class Test4 extends self::Base<core::num, core::int> {
synthetic constructor •() → void
@@ -91,8 +85,6 @@
core::num v10 = let final core::String #t118 = "x" in let final core::num #t119 = super.{self::Base::[]}(#t118).{core::num::+}(1) as{TypeError} core::int in let final void #t120 = super.{self::Base::[]=}(#t118, #t119) in #t119;
core::num v11 = let final core::String #t121 = "x" in let final core::num #t122 = super.{self::Base::[]}(#t121) in let final void #t123 = super.{self::Base::[]=}(#t121, #t122.{core::num::+}(1) as{TypeError} core::int) in #t122;
}
- abstract forwarding-stub operator []=(core::String s, generic-covariant-impl core::int v) → void;
- abstract forwarding-stub method setValue(core::String s, generic-covariant-impl core::int v) → void;
}
abstract class Test5 extends self::Base<core::num, core::num> {
synthetic constructor •() → void
@@ -111,8 +103,6 @@
core::num v10 = let final core::String #t154 = "x" in let final core::num #t155 = super.{self::Base::[]}(#t154).{core::num::+}(1) in let final void #t156 = super.{self::Base::[]=}(#t154, #t155) in #t155;
core::num v11 = let final core::String #t157 = "x" in let final core::num #t158 = super.{self::Base::[]}(#t157) in let final void #t159 = super.{self::Base::[]=}(#t157, #t158.{core::num::+}(1)) in #t158;
}
- abstract forwarding-stub operator []=(core::String s, generic-covariant-impl core::num v) → void;
- abstract forwarding-stub method setValue(core::String s, generic-covariant-impl core::num v) → void;
}
abstract class Test6 extends self::Base<core::num, core::double> {
synthetic constructor •() → void
@@ -129,8 +119,6 @@
core::num v10 = let final core::String #t183 = "x" in let final core::num #t184 = super.{self::Base::[]}(#t183).{core::num::+}(1) as{TypeError} core::double in let final void #t185 = super.{self::Base::[]=}(#t183, #t184) in #t184;
core::num v11 = let final core::String #t186 = "x" in let final core::num #t187 = super.{self::Base::[]}(#t186) in let final void #t188 = super.{self::Base::[]=}(#t186, #t187.{core::num::+}(1) as{TypeError} core::double) in #t187;
}
- abstract forwarding-stub operator []=(core::String s, generic-covariant-impl core::double v) → void;
- abstract forwarding-stub method setValue(core::String s, generic-covariant-impl core::double v) → void;
}
abstract class Test7 extends self::Base<core::double, core::int> {
synthetic constructor •() → void
@@ -158,8 +146,6 @@
var /*@type=double*/ v11 = super /*@target=Base::[]=*/ ['x']++;
^" in let final dynamic #t222 = #t219.{core::double::+}(1) in null) in #t219;
}
- abstract forwarding-stub operator []=(core::String s, generic-covariant-impl core::int v) → void;
- abstract forwarding-stub method setValue(core::String s, generic-covariant-impl core::int v) → void;
}
abstract class Test8 extends self::Base<core::double, core::num> {
synthetic constructor •() → void
@@ -178,8 +164,6 @@
core::double v10 = let final core::String #t253 = "x" in let final core::double #t254 = super.{self::Base::[]}(#t253).{core::double::+}(1) in let final void #t255 = super.{self::Base::[]=}(#t253, #t254) in #t254;
core::double v11 = let final core::String #t256 = "x" in let final core::double #t257 = super.{self::Base::[]}(#t256) in let final void #t258 = super.{self::Base::[]=}(#t256, #t257.{core::double::+}(1)) in #t257;
}
- abstract forwarding-stub operator []=(core::String s, generic-covariant-impl core::num v) → void;
- abstract forwarding-stub method setValue(core::String s, generic-covariant-impl core::num v) → void;
}
abstract class Test9 extends self::Base<core::double, core::double> {
synthetic constructor •() → void
@@ -196,8 +180,6 @@
core::double v10 = let final core::String #t282 = "x" in let final core::double #t283 = super.{self::Base::[]}(#t282).{core::double::+}(1) in let final void #t284 = super.{self::Base::[]=}(#t282, #t283) in #t283;
core::double v11 = let final core::String #t285 = "x" in let final core::double #t286 = super.{self::Base::[]}(#t285) in let final void #t287 = super.{self::Base::[]=}(#t285, #t286.{core::double::+}(1)) in #t286;
}
- abstract forwarding-stub operator []=(core::String s, generic-covariant-impl core::double v) → void;
- abstract forwarding-stub method setValue(core::String s, generic-covariant-impl core::double v) → void;
}
static method getInt() → core::int
return 0;
diff --git a/pkg/front_end/testcases/inference_new/infer_assign_to_index_upwards.dart.strong.expect b/pkg/front_end/testcases/inference_new/infer_assign_to_index_upwards.dart.strong.expect
index 6b1a389..00c1fb0 100644
--- a/pkg/front_end/testcases/inference_new/infer_assign_to_index_upwards.dart.strong.expect
+++ b/pkg/front_end/testcases/inference_new/infer_assign_to_index_upwards.dart.strong.expect
@@ -7,7 +7,7 @@
: super core::Object::•()
;
abstract operator [](core::String s) → self::Test::T;
- abstract operator []=(core::String s, generic-covariant-impl generic-covariant-interface self::Test::U v) → void;
+ abstract operator []=(core::String s, generic-covariant-impl self::Test::U v) → void;
}
static method getInt() → core::int
return 0;
diff --git a/pkg/front_end/testcases/inference_new/super_index_get_substitution.dart.strong.expect b/pkg/front_end/testcases/inference_new/super_index_get_substitution.dart.strong.expect
index b94dffa..262f007 100644
--- a/pkg/front_end/testcases/inference_new/super_index_get_substitution.dart.strong.expect
+++ b/pkg/front_end/testcases/inference_new/super_index_get_substitution.dart.strong.expect
@@ -17,7 +17,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- operator [](generic-covariant-impl generic-covariant-interface self::E<self::B::T> x) → self::D<self::B::T>
+ operator [](generic-covariant-impl self::E<self::B::T> x) → self::D<self::B::T>
return null;
}
class C<U extends core::Object = dynamic> extends self::B<asy::Future<self::C::U>> {
diff --git a/pkg/front_end/testcases/inference_new/super_index_get_substitution.dart.strong.transformed.expect b/pkg/front_end/testcases/inference_new/super_index_get_substitution.dart.strong.transformed.expect
index b94dffa..262f007 100644
--- a/pkg/front_end/testcases/inference_new/super_index_get_substitution.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/inference_new/super_index_get_substitution.dart.strong.transformed.expect
@@ -17,7 +17,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- operator [](generic-covariant-impl generic-covariant-interface self::E<self::B::T> x) → self::D<self::B::T>
+ operator [](generic-covariant-impl self::E<self::B::T> x) → self::D<self::B::T>
return null;
}
class C<U extends core::Object = dynamic> extends self::B<asy::Future<self::C::U>> {
diff --git a/pkg/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.strong.expect b/pkg/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.strong.expect
index 3600b5a..16b24db 100644
--- a/pkg/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.strong.expect
+++ b/pkg/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.strong.expect
@@ -8,11 +8,11 @@
;
}
class C<T extends self::A = self::A> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T _field = null;
+ generic-covariant-impl field self::C::T _field = null;
synthetic constructor •() → void
: super core::Object::•()
;
- method foo(generic-covariant-impl generic-covariant-interface self::C::T x) → dynamic {
+ method foo(generic-covariant-impl self::C::T x) → dynamic {
this.{self::C::_field} = x;
}
}
@@ -20,18 +20,13 @@
synthetic constructor •() → void
: super self::C::•()
;
- abstract forwarding-stub method foo(generic-covariant-impl self::B x) → dynamic;
- abstract forwarding-stub set _field(generic-covariant-impl self::B _) → void;
}
abstract class _Foo&Object&C = core::Object with self::C<self::B> {
- abstract forwarding-stub method foo(generic-covariant-impl self::B x) → dynamic;
- abstract forwarding-stub set _field(generic-covariant-impl self::B _) → void;
}
class Foo extends self::_Foo&Object&C {
synthetic constructor •() → void
: super core::Object::•()
;
- abstract forwarding-stub set _field(generic-covariant-impl self::B _) → void;
}
class B extends self::A {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.strong.transformed.expect b/pkg/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.strong.transformed.expect
index 94cb3e5..7695db9 100644
--- a/pkg/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/mixin_inherited_setter_for_mixed_in_field.dart.strong.transformed.expect
@@ -8,11 +8,11 @@
;
}
class C<T extends self::A = self::A> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T _field = null;
+ generic-covariant-impl field self::C::T _field = null;
synthetic constructor •() → void
: super core::Object::•()
;
- method foo(generic-covariant-impl generic-covariant-interface self::C::T x) → dynamic {
+ method foo(generic-covariant-impl self::C::T x) → dynamic {
this.{self::C::_field} = x;
}
}
@@ -20,8 +20,6 @@
synthetic constructor •() → void
: super self::C::•()
;
- abstract forwarding-stub method foo(generic-covariant-impl self::B x) → dynamic;
- abstract forwarding-stub set _field(generic-covariant-impl self::B _) → void;
}
abstract class _Foo&Object&C extends core::Object implements self::C<self::B> {
generic-covariant-impl field self::B _field = null;
@@ -36,7 +34,6 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract forwarding-stub set _field(generic-covariant-impl self::B _) → void;
}
class B extends self::A {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/override_check_two_substitutions.dart.strong.expect b/pkg/front_end/testcases/override_check_two_substitutions.dart.strong.expect
index 3d2edc0..28b4a22 100644
--- a/pkg/front_end/testcases/override_check_two_substitutions.dart.strong.expect
+++ b/pkg/front_end/testcases/override_check_two_substitutions.dart.strong.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f<U extends core::Object = dynamic>(generic-covariant-impl generic-covariant-interface core::Map<self::A::T, self::A::f::U> m) → void {}
+ method f<U extends core::Object = dynamic>(generic-covariant-impl core::Map<self::A::T, self::A::f::U> m) → void {}
}
class B extends self::A<core::String> {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/override_check_two_substitutions.dart.strong.transformed.expect b/pkg/front_end/testcases/override_check_two_substitutions.dart.strong.transformed.expect
index 3d2edc0..28b4a22 100644
--- a/pkg/front_end/testcases/override_check_two_substitutions.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/override_check_two_substitutions.dart.strong.transformed.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f<U extends core::Object = dynamic>(generic-covariant-impl generic-covariant-interface core::Map<self::A::T, self::A::f::U> m) → void {}
+ method f<U extends core::Object = dynamic>(generic-covariant-impl core::Map<self::A::T, self::A::f::U> m) → void {}
}
class B extends self::A<core::String> {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/rasta/mixin_library.dart.strong.expect b/pkg/front_end/testcases/rasta/mixin_library.dart.strong.expect
index 06badae..431a0e1 100644
--- a/pkg/front_end/testcases/rasta/mixin_library.dart.strong.expect
+++ b/pkg/front_end/testcases/rasta/mixin_library.dart.strong.expect
@@ -6,13 +6,13 @@
field dynamic x = self::f();
field dynamic y = null;
field dynamic z = null;
- generic-covariant-impl generic-covariant-interface field self::Mixin::T t = null;
+ generic-covariant-impl field self::Mixin::T t = null;
synthetic constructor •() → void
: super core::Object::•()
;
method foo() → dynamic
return super.foo().+(self::f());
- method g(generic-covariant-impl generic-covariant-interface self::Mixin::T a) → self::Mixin::T
+ method g(generic-covariant-impl self::Mixin::T a) → self::Mixin::T
return null;
method h() → dynamic
return self::V();
diff --git a/pkg/front_end/testcases/rasta/super_mixin.dart.strong.expect b/pkg/front_end/testcases/rasta/super_mixin.dart.strong.expect
index abb198d..5cbd7ca 100644
--- a/pkg/front_end/testcases/rasta/super_mixin.dart.strong.expect
+++ b/pkg/front_end/testcases/rasta/super_mixin.dart.strong.expect
@@ -20,14 +20,11 @@
;
}
abstract class _D&Super&Mixin = self::Super<dynamic> with mix::Mixin<dynamic> {
- abstract forwarding-stub method g(generic-covariant-impl dynamic a) → dynamic;
- abstract forwarding-stub set t(generic-covariant-impl dynamic _) → void;
}
class D extends self::_D&Super&Mixin {
synthetic constructor •() → void
: super self::Super::•()
;
- abstract forwarding-stub set t(generic-covariant-impl dynamic _) → void;
}
class C2<V extends core::Object = dynamic> = self::Super<self::C2::V> with mix::Mixin<self::C2::V> {
synthetic constructor •() → void
@@ -38,8 +35,6 @@
synthetic constructor •() → void
: super self::Super::•()
;
- abstract forwarding-stub method g(generic-covariant-impl dynamic a) → dynamic;
- abstract forwarding-stub set t(generic-covariant-impl dynamic _) → void;
}
static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/rasta/mixin_library.dart:16:18: Error: Superclass has no method named 'foo'.
foo() => super.foo() + f();
diff --git a/pkg/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.strong.expect b/pkg/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.strong.expect
index ad19bc0..fd5af02 100644
--- a/pkg/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.strong.expect
+++ b/pkg/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.strong.expect
@@ -8,7 +8,7 @@
;
}
class Foo<T extends self::X = self::X> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::Foo::T x;
+ generic-covariant-impl field self::Foo::T x;
constructor fromX(self::X _init) → void
: this self::Foo::_internal(x: _init as{TypeError} self::Foo::T)
;
diff --git a/pkg/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.strong.transformed.expect b/pkg/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.strong.transformed.expect
index ad19bc0..fd5af02 100644
--- a/pkg/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/redirecting_initializer_arguments_assignable_test.dart.strong.transformed.expect
@@ -8,7 +8,7 @@
;
}
class Foo<T extends self::X = self::X> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::Foo::T x;
+ generic-covariant-impl field self::Foo::T x;
constructor fromX(self::X _init) → void
: this self::Foo::_internal(x: _init as{TypeError} self::Foo::T)
;
diff --git a/pkg/front_end/testcases/redirecting_initializer_arguments_test.dart.strong.expect b/pkg/front_end/testcases/redirecting_initializer_arguments_test.dart.strong.expect
index b07315d..6b348e6 100644
--- a/pkg/front_end/testcases/redirecting_initializer_arguments_test.dart.strong.expect
+++ b/pkg/front_end/testcases/redirecting_initializer_arguments_test.dart.strong.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class Foo<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::Foo::T x;
+ generic-covariant-impl field self::Foo::T x;
constructor from(core::String _init) → void
: this self::Foo::_internal(x: let final dynamic #t1 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/redirecting_initializer_arguments_test.dart:12:46: Error: A value of type 'dart.core::String' can't be assigned to a variable of type '#lib1::Foo::T'.
Try changing the type of the left hand side, or casting the right hand side to '#lib1::Foo::T'.
diff --git a/pkg/front_end/testcases/redirecting_initializer_arguments_test.dart.strong.transformed.expect b/pkg/front_end/testcases/redirecting_initializer_arguments_test.dart.strong.transformed.expect
index b07315d..6b348e6 100644
--- a/pkg/front_end/testcases/redirecting_initializer_arguments_test.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/redirecting_initializer_arguments_test.dart.strong.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class Foo<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::Foo::T x;
+ generic-covariant-impl field self::Foo::T x;
constructor from(core::String _init) → void
: this self::Foo::_internal(x: let final dynamic #t1 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/redirecting_initializer_arguments_test.dart:12:46: Error: A value of type 'dart.core::String' can't be assigned to a variable of type '#lib1::Foo::T'.
Try changing the type of the left hand side, or casting the right hand side to '#lib1::Foo::T'.
diff --git a/pkg/front_end/testcases/regress/issue_31190.dart.strong.expect b/pkg/front_end/testcases/regress/issue_31190.dart.strong.expect
index 38248c76..9387690 100644
--- a/pkg/front_end/testcases/regress/issue_31190.dart.strong.expect
+++ b/pkg/front_end/testcases/regress/issue_31190.dart.strong.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class Typed<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::Typed::T v = null;
+ generic-covariant-impl field self::Typed::T v = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/regress/issue_31190.dart.strong.transformed.expect b/pkg/front_end/testcases/regress/issue_31190.dart.strong.transformed.expect
index 38248c76..9387690 100644
--- a/pkg/front_end/testcases/regress/issue_31190.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/regress/issue_31190.dart.strong.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class Typed<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::Typed::T v = null;
+ generic-covariant-impl field self::Typed::T v = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart b/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart
index 93f520f..4cb62d5 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart
@@ -9,7 +9,7 @@
class C<T> {
F<T> y;
- void f(T /*@covariance=genericInterface, genericImpl*/ value) {
+ void f(T /*@covariance=genericImpl*/ value) {
this.y(value);
}
}
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart.strong.expect
index 0d90e29..df79537 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart.strong.expect
@@ -8,7 +8,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f(generic-covariant-impl generic-covariant-interface self::C::T value) → void {
+ method f(generic-covariant-impl self::C::T value) → void {
this.{self::C::y}(value);
}
}
diff --git a/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart.strong.transformed.expect
index 0d90e29..df79537 100644
--- a/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/contravariant_getter.dart.strong.transformed.expect
@@ -8,7 +8,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f(generic-covariant-impl generic-covariant-interface self::C::T value) → void {
+ method f(generic-covariant-impl self::C::T value) → void {
this.{self::C::y}(value);
}
}
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart b/pkg/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart
index c3749e6..bbe2c24 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart
@@ -6,8 +6,8 @@
library test;
class C<T> {
- void f< /*@covariance=genericInterface, genericImpl*/ U extends T>(U x) {}
- void g1< /*@covariance=genericInterface, genericImpl*/ U extends T>() {
+ void f< /*@covariance=genericImpl*/ U extends T>(U x) {}
+ void g1< /*@covariance=genericImpl*/ U extends T>() {
this.f<U>(1.5);
}
}
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.strong.expect
index 26fb1d3..b8a0214 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.strong.expect
@@ -6,8 +6,8 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f<generic-covariant-impl generic-covariant-interface U extends self::C::T = dynamic>(self::C::f::U x) → void {}
- method g1<generic-covariant-impl generic-covariant-interface U extends self::C::T = dynamic>() → void {
+ method f<generic-covariant-impl U extends self::C::T = dynamic>(self::C::f::U x) → void {}
+ method g1<generic-covariant-impl U extends self::C::T = dynamic>() → void {
this.{self::C::f}<self::C::g1::U>(let final dynamic #t1 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart:11:15: Error: A value of type 'dart.core::double' can't be assigned to a variable of type 'test::C::g1::U'.
Try changing the type of the left hand side, or casting the right hand side to 'test::C::g1::U'.
this.f<U>(1.5);
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.strong.transformed.expect
index d43df56..91a46da 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart.strong.transformed.expect
@@ -6,8 +6,8 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f<generic-covariant-impl generic-covariant-interface U extends self::C::T = dynamic>(self::C::f::U x) → void {}
- method g1<generic-covariant-impl generic-covariant-interface U extends self::C::T = dynamic>() → void {
+ method f<generic-covariant-impl U extends self::C::T = dynamic>(self::C::f::U x) → void {}
+ method g1<generic-covariant-impl U extends self::C::T = dynamic>() → void {
this.{self::C::f}<self::C::g1::U>(let final dynamic #t1 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks/covariant_generic_method_type_parameter.dart:11:15: Error: A value of type 'dart.core::double' can't be assigned to a variable of type 'test::C::g1::U'.
Try changing the type of the left hand side, or casting the right hand side to 'test::C::g1::U'.
this.f<U>(1.5);
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter.dart b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter.dart
index d0348f1..f263624 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter.dart
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter.dart
@@ -6,7 +6,7 @@
library test;
class C<T> {
- void f(T /*@covariance=genericInterface, genericImpl*/ x) {}
+ void f(T /*@covariance=genericImpl*/ x) {}
}
void g1(C<num> c) {
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.strong.expect
index 5552a2d..bc445d9 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.strong.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f(generic-covariant-impl generic-covariant-interface self::C::T x) → void {}
+ method f(generic-covariant-impl self::C::T x) → void {}
}
static method g1(self::C<core::num> c) → void {
c.{self::C::f}(1.5);
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.strong.transformed.expect
index 5552a2d..bc445d9 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter.dart.strong.transformed.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f(generic-covariant-impl generic-covariant-interface self::C::T x) → void {}
+ method f(generic-covariant-impl self::C::T x) → void {}
}
static method g1(self::C<core::num> c) → void {
c.{self::C::f}(1.5);
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart
index 32a20ca..f8341a0 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart
@@ -7,13 +7,13 @@
class C<T> {
// List<T> is covariant in T so it needs checking
- void f1(List<T> /*@covariance=genericInterface, genericImpl*/ x) {}
+ void f1(List<T> /*@covariance=genericImpl*/ x) {}
// () -> T is covariant in T so it needs checking
- void f2(T /*@covariance=genericInterface, genericImpl*/ callback()) {}
+ void f2(T /*@covariance=genericImpl*/ callback()) {}
// (T) -> T is partially covariant in T so it needs checking
- void f3(T /*@covariance=genericInterface, genericImpl*/ callback(T x)) {}
+ void f3(T /*@covariance=genericImpl*/ callback(T x)) {}
// (T) -> void is contravariant in T so it doesn't need checking
void f4(void callback(T x)) {}
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.strong.expect
index 79250d9..469d404 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.strong.expect
@@ -6,9 +6,9 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f1(generic-covariant-impl generic-covariant-interface core::List<self::C::T> x) → void {}
- method f2(generic-covariant-impl generic-covariant-interface () → self::C::T callback) → void {}
- method f3(generic-covariant-impl generic-covariant-interface (self::C::T) → self::C::T callback) → void {}
+ method f1(generic-covariant-impl core::List<self::C::T> x) → void {}
+ method f2(generic-covariant-impl () → self::C::T callback) → void {}
+ method f3(generic-covariant-impl (self::C::T) → self::C::T callback) → void {}
method f4((self::C::T) → void callback) → void {}
}
static method g1(self::C<core::num> c, core::List<core::num> l) → void {
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.strong.transformed.expect
index 79250d9..469d404 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_complex.dart.strong.transformed.expect
@@ -6,9 +6,9 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f1(generic-covariant-impl generic-covariant-interface core::List<self::C::T> x) → void {}
- method f2(generic-covariant-impl generic-covariant-interface () → self::C::T callback) → void {}
- method f3(generic-covariant-impl generic-covariant-interface (self::C::T) → self::C::T callback) → void {}
+ method f1(generic-covariant-impl core::List<self::C::T> x) → void {}
+ method f2(generic-covariant-impl () → self::C::T callback) → void {}
+ method f3(generic-covariant-impl (self::C::T) → self::C::T callback) → void {}
method f4((self::C::T) → void callback) → void {}
}
static method g1(self::C<core::num> c, core::List<core::num> l) → void {
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart
index 66b3256..67ebc4d 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart
@@ -6,20 +6,20 @@
library test;
abstract class I<T> {
- void f1(T /*@covariance=genericInterface, genericImpl*/ x);
- void f2(T /*@covariance=genericInterface, genericImpl*/ x);
+ void f1(T /*@covariance=genericImpl*/ x);
+ void f2(T /*@covariance=genericImpl*/ x);
}
class C<U> implements I<int> {
void f1(int /*@covariance=genericImpl*/ x) {}
void f2(int /*@covariance=genericImpl*/ x,
- [U /*@covariance=genericInterface, genericImpl*/ y]) {}
+ [U /*@covariance=genericImpl*/ y]) {}
}
class D<U> extends C<U> {
void f1(int /*@covariance=genericImpl*/ x) {}
void f2(int /*@covariance=genericImpl*/ x,
- [U /*@covariance=genericInterface, genericImpl*/ y]) {}
+ [U /*@covariance=genericImpl*/ y]) {}
}
void g1(C<num> c) {
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.strong.expect
index 97d183c..9a3a345 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.strong.expect
@@ -6,22 +6,22 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract method f1(generic-covariant-impl generic-covariant-interface self::I::T x) → void;
- abstract method f2(generic-covariant-impl generic-covariant-interface self::I::T x) → void;
+ abstract method f1(generic-covariant-impl self::I::T x) → void;
+ abstract method f2(generic-covariant-impl self::I::T x) → void;
}
class C<U extends core::Object = dynamic> extends core::Object implements self::I<core::int> {
synthetic constructor •() → void
: super core::Object::•()
;
method f1(generic-covariant-impl core::int x) → void {}
- method f2(generic-covariant-impl core::int x, [generic-covariant-impl generic-covariant-interface self::C::U y = null]) → void {}
+ method f2(generic-covariant-impl core::int x, [generic-covariant-impl self::C::U y = null]) → void {}
}
class D<U extends core::Object = dynamic> extends self::C<self::D::U> {
synthetic constructor •() → void
: super self::C::•()
;
method f1(generic-covariant-impl core::int x) → void {}
- method f2(generic-covariant-impl core::int x, [generic-covariant-impl generic-covariant-interface self::D::U y = null]) → void {}
+ method f2(generic-covariant-impl core::int x, [generic-covariant-impl self::D::U y = null]) → void {}
}
static method g1(self::C<core::num> c) → void {
c.{self::C::f1}(1);
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.strong.transformed.expect
index 97d183c..9a3a345 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface.dart.strong.transformed.expect
@@ -6,22 +6,22 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract method f1(generic-covariant-impl generic-covariant-interface self::I::T x) → void;
- abstract method f2(generic-covariant-impl generic-covariant-interface self::I::T x) → void;
+ abstract method f1(generic-covariant-impl self::I::T x) → void;
+ abstract method f2(generic-covariant-impl self::I::T x) → void;
}
class C<U extends core::Object = dynamic> extends core::Object implements self::I<core::int> {
synthetic constructor •() → void
: super core::Object::•()
;
method f1(generic-covariant-impl core::int x) → void {}
- method f2(generic-covariant-impl core::int x, [generic-covariant-impl generic-covariant-interface self::C::U y = null]) → void {}
+ method f2(generic-covariant-impl core::int x, [generic-covariant-impl self::C::U y = null]) → void {}
}
class D<U extends core::Object = dynamic> extends self::C<self::D::U> {
synthetic constructor •() → void
: super self::C::•()
;
method f1(generic-covariant-impl core::int x) → void {}
- method f2(generic-covariant-impl core::int x, [generic-covariant-impl generic-covariant-interface self::D::U y = null]) → void {}
+ method f2(generic-covariant-impl core::int x, [generic-covariant-impl self::D::U y = null]) → void {}
}
static method g1(self::C<core::num> c) → void {
c.{self::C::f1}(1);
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart
index 12c84c1..064a9d2 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart
@@ -10,7 +10,7 @@
}
abstract class I<T> {
- void f(T /*@covariance=genericInterface, genericImpl*/ x);
+ void f(T /*@covariance=genericImpl*/ x);
}
class M {
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.strong.expect
index d5ddea7..174c6b3 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.strong.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract method f(generic-covariant-impl generic-covariant-interface self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class M extends core::Object {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.strong.transformed.expect
index 1feabc7..2076939 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_mixin.dart.strong.transformed.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract method f(generic-covariant-impl generic-covariant-interface self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class M extends core::Object {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart
index 243b295..84127a1 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart
@@ -10,7 +10,7 @@
}
abstract class I<T> {
- void f(T /*@covariance=genericInterface, genericImpl*/ x);
+ void f(T /*@covariance=genericImpl*/ x);
}
class /*@forwardingStub=void f(covariance=(genericImpl) int x)*/ C extends B
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.strong.expect
index fb37f0a..b9f3df7 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.strong.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract method f(generic-covariant-impl generic-covariant-interface self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class C extends self::B implements self::I<core::int> {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.strong.transformed.expect
index fb37f0a..b9f3df7 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super.dart.strong.transformed.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract method f(generic-covariant-impl generic-covariant-interface self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class C extends self::B implements self::I<core::int> {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart
index 27ff92f..ea42a43 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart
@@ -10,7 +10,7 @@
}
abstract class I<T> {
- void f(T /*@covariance=genericInterface, genericImpl*/ x);
+ void f(T /*@covariance=genericImpl*/ x);
}
class M {}
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.strong.expect
index 710336f..185086f 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.strong.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract method f(generic-covariant-impl generic-covariant-interface self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class M extends core::Object {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.strong.transformed.expect
index 7d07c7b..03608fb 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_in_interface_super_mixin.dart.strong.transformed.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract method f(generic-covariant-impl generic-covariant-interface self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class M extends core::Object {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart
index 4c4138d..260dabe 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart
@@ -10,8 +10,8 @@
typedef U G<T, U>(T x);
class C<T> {
- void f1(T /*@covariance=genericInterface, genericImpl*/ x) {}
- T f2(List<T> /*@covariance=genericInterface, genericImpl*/ x) => x.first;
+ void f1(T /*@covariance=genericImpl*/ x) {}
+ T f2(List<T> /*@covariance=genericImpl*/ x) => x.first;
}
F<num> g1(C<num> c) {
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.strong.expect
index b36578d..9dea4dd 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.strong.expect
@@ -8,8 +8,8 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f1(generic-covariant-impl generic-covariant-interface self::C::T x) → void {}
- method f2(generic-covariant-impl generic-covariant-interface core::List<self::C::T> x) → self::C::T
+ method f1(generic-covariant-impl self::C::T x) → void {}
+ method f2(generic-covariant-impl core::List<self::C::T> x) → self::C::T
return x.{core::Iterable::first};
}
static method g1(self::C<core::num> c) → (core::num) → void {
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.strong.transformed.expect
index b36578d..9dea4dd 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_generic_parameter_tear_off.dart.strong.transformed.expect
@@ -8,8 +8,8 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f1(generic-covariant-impl generic-covariant-interface self::C::T x) → void {}
- method f2(generic-covariant-impl generic-covariant-interface core::List<self::C::T> x) → self::C::T
+ method f1(generic-covariant-impl self::C::T x) → void {}
+ method f2(generic-covariant-impl core::List<self::C::T> x) → self::C::T
return x.{core::Iterable::first};
}
static method g1(self::C<core::num> c) → (core::num) → void {
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_setter.dart b/pkg/front_end/testcases/runtime_checks/covariant_setter.dart
index 219d715..fc2b4f1 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_setter.dart
+++ b/pkg/front_end/testcases/runtime_checks/covariant_setter.dart
@@ -8,9 +8,9 @@
typedef void F<T>(T x);
class C<T> {
- T /*@covariance=genericInterface, genericImpl*/ x;
- void set y(T /*@covariance=genericInterface, genericImpl*/ value) {}
- void f(T /*@covariance=genericInterface, genericImpl*/ value) {
+ T /*@covariance=genericImpl*/ x;
+ void set y(T /*@covariance=genericImpl*/ value) {}
+ void f(T /*@covariance=genericImpl*/ value) {
this.x = value;
this.y = value;
}
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_setter.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/covariant_setter.dart.strong.expect
index 872b355..3169cd8 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_setter.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_setter.dart.strong.expect
@@ -4,12 +4,12 @@
typedef F<T extends core::Object = dynamic> = (T) → void;
class C<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T x = null;
+ generic-covariant-impl field self::C::T x = null;
synthetic constructor •() → void
: super core::Object::•()
;
- set y(generic-covariant-impl generic-covariant-interface self::C::T value) → void {}
- method f(generic-covariant-impl generic-covariant-interface self::C::T value) → void {
+ set y(generic-covariant-impl self::C::T value) → void {}
+ method f(generic-covariant-impl self::C::T value) → void {
this.{self::C::x} = value;
this.{self::C::y} = value;
}
diff --git a/pkg/front_end/testcases/runtime_checks/covariant_setter.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/covariant_setter.dart.strong.transformed.expect
index 872b355..3169cd8 100644
--- a/pkg/front_end/testcases/runtime_checks/covariant_setter.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/covariant_setter.dart.strong.transformed.expect
@@ -4,12 +4,12 @@
typedef F<T extends core::Object = dynamic> = (T) → void;
class C<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T x = null;
+ generic-covariant-impl field self::C::T x = null;
synthetic constructor •() → void
: super core::Object::•()
;
- set y(generic-covariant-impl generic-covariant-interface self::C::T value) → void {}
- method f(generic-covariant-impl generic-covariant-interface self::C::T value) → void {
+ set y(generic-covariant-impl self::C::T value) → void {}
+ method f(generic-covariant-impl self::C::T value) → void {
this.{self::C::x} = value;
this.{self::C::y} = value;
}
diff --git a/pkg/front_end/testcases/runtime_checks/dynamic_invocation.dart b/pkg/front_end/testcases/runtime_checks/dynamic_invocation.dart
index e8d1ea9..279e3ba 100644
--- a/pkg/front_end/testcases/runtime_checks/dynamic_invocation.dart
+++ b/pkg/front_end/testcases/runtime_checks/dynamic_invocation.dart
@@ -6,7 +6,7 @@
library test;
class C<T> {
- void f1(T /*@covariance=genericInterface, genericImpl*/ x) {}
+ void f1(T /*@covariance=genericImpl*/ x) {}
void f2(int x) {}
}
diff --git a/pkg/front_end/testcases/runtime_checks/dynamic_invocation.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/dynamic_invocation.dart.strong.expect
index 24e6b93..77a08e8 100644
--- a/pkg/front_end/testcases/runtime_checks/dynamic_invocation.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/dynamic_invocation.dart.strong.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f1(generic-covariant-impl generic-covariant-interface self::C::T x) → void {}
+ method f1(generic-covariant-impl self::C::T x) → void {}
method f2(core::int x) → void {}
}
class D extends self::C<core::num> {
diff --git a/pkg/front_end/testcases/runtime_checks/dynamic_invocation.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/dynamic_invocation.dart.strong.transformed.expect
index 24e6b93..77a08e8 100644
--- a/pkg/front_end/testcases/runtime_checks/dynamic_invocation.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/dynamic_invocation.dart.strong.transformed.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f1(generic-covariant-impl generic-covariant-interface self::C::T x) → void {}
+ method f1(generic-covariant-impl self::C::T x) → void {}
method f2(core::int x) → void {}
}
class D extends self::C<core::num> {
diff --git a/pkg/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart b/pkg/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart
index 803cd00..8f1f075 100644
--- a/pkg/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart
+++ b/pkg/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart
@@ -6,7 +6,7 @@
library test;
class C<T> {
- void f< /*@covariance=genericInterface, genericImpl*/ U extends T>(U x) {}
+ void f< /*@covariance=genericImpl*/ U extends T>(U x) {}
}
void g1(dynamic d) {
diff --git a/pkg/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.strong.expect
index 015a396..bddd915 100644
--- a/pkg/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.strong.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f<generic-covariant-impl generic-covariant-interface U extends self::C::T = dynamic>(self::C::f::U x) → void {}
+ method f<generic-covariant-impl U extends self::C::T = dynamic>(self::C::f::U x) → void {}
}
static method g1(dynamic d) → void {
d.f<core::num>(1.5);
diff --git a/pkg/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.strong.transformed.expect
index 015a396..bddd915 100644
--- a/pkg/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/dynamic_invocation_generic.dart.strong.transformed.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f<generic-covariant-impl generic-covariant-interface U extends self::C::T = dynamic>(self::C::f::U x) → void {}
+ method f<generic-covariant-impl U extends self::C::T = dynamic>(self::C::f::U x) → void {}
}
static method g1(dynamic d) → void {
d.f<core::num>(1.5);
diff --git a/pkg/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart b/pkg/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart
index 3cd5b84..554eeae 100644
--- a/pkg/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart
+++ b/pkg/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart
@@ -6,7 +6,7 @@
library test;
class B<T> {
- T /*@covariance=genericInterface, genericImpl*/ x;
+ T /*@covariance=genericImpl*/ x;
}
class C {
diff --git a/pkg/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.strong.expect
index ad33099..ab70a8d 100644
--- a/pkg/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.strong.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class B<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::B::T x = null;
+ generic-covariant-impl field self::B::T x = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.strong.transformed.expect
index ad33099..ab70a8d 100644
--- a/pkg/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/field_forwarding_stub_generic_covariant.dart.strong.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class B<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::B::T x = null;
+ generic-covariant-impl field self::B::T x = null;
synthetic constructor •() → void
: super core::Object::•()
;
diff --git a/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart b/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart
index 89615d8..b8607ea 100644
--- a/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart
+++ b/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart
@@ -23,8 +23,8 @@
}
abstract class I<T> {
- void f([T /*@covariance=genericInterface, genericImpl*/ x]);
- void g({T /*@covariance=genericInterface, genericImpl*/ x});
+ void f([T /*@covariance=genericImpl*/ x]);
+ void g({T /*@covariance=genericImpl*/ x});
}
class
diff --git a/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.strong.expect
index 3cd551d..3234a21 100644
--- a/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.strong.expect
@@ -23,8 +23,8 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract method f([generic-covariant-impl generic-covariant-interface self::I::T x = null]) → void;
- abstract method g({generic-covariant-impl generic-covariant-interface self::I::T x = null}) → void;
+ abstract method f([generic-covariant-impl self::I::T x = null]) → void;
+ abstract method g({generic-covariant-impl self::I::T x = null}) → void;
}
class C extends self::B implements self::I<core::num> {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.strong.transformed.expect
index 3cd551d..3234a21 100644
--- a/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_default_values.dart.strong.transformed.expect
@@ -23,8 +23,8 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract method f([generic-covariant-impl generic-covariant-interface self::I::T x = null]) → void;
- abstract method g({generic-covariant-impl generic-covariant-interface self::I::T x = null}) → void;
+ abstract method f([generic-covariant-impl self::I::T x = null]) → void;
+ abstract method g({generic-covariant-impl self::I::T x = null}) → void;
}
class C extends self::B implements self::I<core::num> {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart b/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart
index 4d3a9b9..2b22cac 100644
--- a/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart
+++ b/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart
@@ -10,7 +10,7 @@
}
abstract class I<T> {
- void f(T /*@covariance=genericInterface, genericImpl*/ x, int y);
+ void f(T /*@covariance=genericImpl*/ x, int y);
}
class /*@forwardingStub=void f(covariance=(genericImpl) int x, covariance=() int y)*/ C
diff --git a/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.strong.expect
index 71807009..fc360e3 100644
--- a/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.strong.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract method f(generic-covariant-impl generic-covariant-interface self::I::T x, core::int y) → void;
+ abstract method f(generic-covariant-impl self::I::T x, core::int y) → void;
}
class C extends self::B implements self::I<core::int> {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.strong.transformed.expect
index 71807009..fc360e3 100644
--- a/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/forwarding_stub_with_non_covariant_param.dart.strong.transformed.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract method f(generic-covariant-impl generic-covariant-interface self::I::T x, core::int y) → void;
+ abstract method f(generic-covariant-impl self::I::T x, core::int y) → void;
}
class C extends self::B implements self::I<core::int> {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart b/pkg/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart
index 9490a4c..b144c81 100644
--- a/pkg/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart
+++ b/pkg/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart
@@ -6,8 +6,8 @@
library test;
class C<T> {
- void set x(T /*@covariance=genericInterface, genericImpl*/ t) {}
- T /*@covariance=genericInterface, genericImpl*/ y;
+ void set x(T /*@covariance=genericImpl*/ t) {}
+ T /*@covariance=genericImpl*/ y;
}
class D implements C<num> {
diff --git a/pkg/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.strong.expect
index 94d01ed..1567f5d 100644
--- a/pkg/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.strong.expect
@@ -3,11 +3,11 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T y = null;
+ generic-covariant-impl field self::C::T y = null;
synthetic constructor •() → void
: super core::Object::•()
;
- set x(generic-covariant-impl generic-covariant-interface self::C::T t) → void {}
+ set x(generic-covariant-impl self::C::T t) → void {}
}
class D extends core::Object implements self::C<core::num> {
generic-covariant-impl field core::num x = null;
diff --git a/pkg/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.strong.transformed.expect
index 94d01ed..1567f5d 100644
--- a/pkg/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/generic_covariance_inheritance_setter_field.dart.strong.transformed.expect
@@ -3,11 +3,11 @@
import "dart:core" as core;
class C<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::C::T y = null;
+ generic-covariant-impl field self::C::T y = null;
synthetic constructor •() → void
: super core::Object::•()
;
- set x(generic-covariant-impl generic-covariant-interface self::C::T t) → void {}
+ set x(generic-covariant-impl self::C::T t) → void {}
}
class D extends core::Object implements self::C<core::num> {
generic-covariant-impl field core::num x = null;
diff --git a/pkg/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart b/pkg/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart
index 93dbb11..6558f2d 100644
--- a/pkg/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart
+++ b/pkg/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart
@@ -15,8 +15,8 @@
}
class C<T> implements B {
- void f(T /*@covariance=explicit, genericInterface*/ x) {}
- T /*@covariance=explicit, genericInterface*/ x;
+ void f(T /*@covariance=explicit*/ x) {}
+ T /*@covariance=explicit*/ x;
}
main() {}
diff --git a/pkg/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.strong.expect b/pkg/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.strong.expect
index a03ad85..863bd18 100644
--- a/pkg/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.strong.expect
@@ -16,10 +16,10 @@
method f(covariant core::Object x) → void {}
}
class C<T extends core::Object = dynamic> extends core::Object implements self::B {
- covariant generic-covariant-impl generic-covariant-interface field self::C::T x = null;
+ covariant generic-covariant-impl field self::C::T x = null;
synthetic constructor •() → void
: super core::Object::•()
;
- method f(covariant generic-covariant-impl generic-covariant-interface self::C::T x) → void {}
+ method f(covariant generic-covariant-impl self::C::T x) → void {}
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.strong.transformed.expect
index a03ad85..863bd18 100644
--- a/pkg/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks/generic_vs_explicit_covariance.dart.strong.transformed.expect
@@ -16,10 +16,10 @@
method f(covariant core::Object x) → void {}
}
class C<T extends core::Object = dynamic> extends core::Object implements self::B {
- covariant generic-covariant-impl generic-covariant-interface field self::C::T x = null;
+ covariant generic-covariant-impl field self::C::T x = null;
synthetic constructor •() → void
: super core::Object::•()
;
- method f(covariant generic-covariant-impl generic-covariant-interface self::C::T x) → void {}
+ method f(covariant generic-covariant-impl self::C::T x) → void {}
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart b/pkg/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart
index 111cb15..ce4aebd 100644
--- a/pkg/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart
@@ -10,7 +10,7 @@
}
abstract class I<T> {
- void f(T /*@covariance=genericInterface, genericImpl*/ x);
+ void f(T /*@covariance=genericImpl*/ x);
}
class C extends B implements I<num> {
diff --git a/pkg/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.strong.expect
index 730f655..feb0e21 100644
--- a/pkg/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.strong.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract method f(generic-covariant-impl generic-covariant-interface self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class C extends self::B implements self::I<core::num> {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.strong.transformed.expect
index 730f655..feb0e21 100644
--- a/pkg/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/abstract_override_becomes_forwarding_stub.dart.strong.transformed.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract method f(generic-covariant-impl generic-covariant-interface self::I::T x) → void;
+ abstract method f(generic-covariant-impl self::I::T x) → void;
}
class C extends self::B implements self::I<core::num> {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart b/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart
index a28b798..9cc0c47 100644
--- a/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart
@@ -8,36 +8,25 @@
typedef F<T>(T x);
class C<T> {
- void f(T /*@covariance=genericInterface, genericImpl*/ x) {}
- void g1(T /*@covariance=genericInterface, genericImpl*/ x) {
+ void f(T /*@covariance=genericImpl*/ x) {}
+ void g1(T /*@covariance=genericImpl*/ x) {
this.f(x);
}
- void g2(T /*@covariance=genericInterface, genericImpl*/ x) {
+ void g2(T /*@covariance=genericImpl*/ x) {
f(x);
}
- void g3(C<T> /*@covariance=genericInterface, genericImpl*/ c,
- T /*@covariance=genericInterface, genericImpl*/ x) {
+ void g3(C<T> /*@covariance=genericImpl*/ c, T /*@covariance=genericImpl*/ x) {
c.f(x);
}
F<T> g4() => this.f;
}
-class
-/*@forwardingStub=abstract void f(covariance=(genericImpl) int x)*/
-/*@forwardingStub=abstract void g1(covariance=(genericImpl) int x)*/
-/*@forwardingStub=abstract void g2(covariance=(genericImpl) int x)*/
-/*@forwardingStub=abstract void g3(covariance=(genericImpl) C<int> c, covariance=(genericImpl) int x)*/
+class D extends C<int> {}
- D extends C<int> {}
-
-class /*@forwardingStub=abstract void g1(covariance=(genericImpl) num x)*/
-/*@forwardingStub=abstract void g2(covariance=(genericImpl) num x)*/
-/*@forwardingStub=abstract void g3(covariance=(genericImpl) C<num> c, covariance=(genericImpl) num x)*/
-
- E extends C<num> {
+class E extends C<num> {
void f(covariant int /*@covariance=explicit*/ x) {}
}
diff --git a/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart.strong.expect
index 56e15b3..3ceb928 100644
--- a/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart.strong.expect
@@ -7,14 +7,14 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f(generic-covariant-impl generic-covariant-interface self::C::T x) → void {}
- method g1(generic-covariant-impl generic-covariant-interface self::C::T x) → void {
+ method f(generic-covariant-impl self::C::T x) → void {}
+ method g1(generic-covariant-impl self::C::T x) → void {
this.{self::C::f}(x);
}
- method g2(generic-covariant-impl generic-covariant-interface self::C::T x) → void {
+ method g2(generic-covariant-impl self::C::T x) → void {
this.{self::C::f}(x);
}
- method g3(generic-covariant-impl generic-covariant-interface self::C<self::C::T> c, generic-covariant-impl generic-covariant-interface self::C::T x) → void {
+ method g3(generic-covariant-impl self::C<self::C::T> c, generic-covariant-impl self::C::T x) → void {
c.{self::C::f}(x);
}
method g4() → (self::C::T) → dynamic
@@ -24,23 +24,16 @@
synthetic constructor •() → void
: super self::C::•()
;
- abstract forwarding-stub method f(generic-covariant-impl core::int x) → void;
- abstract forwarding-stub method g1(generic-covariant-impl core::int x) → void;
- abstract forwarding-stub method g2(generic-covariant-impl core::int x) → void;
- abstract forwarding-stub method g3(generic-covariant-impl self::C<core::int> c, generic-covariant-impl core::int x) → void;
}
class E extends self::C<core::num> {
synthetic constructor •() → void
: super self::C::•()
;
method f(covariant generic-covariant-impl core::int x) → void {}
- abstract forwarding-stub method g1(generic-covariant-impl core::num x) → void;
- abstract forwarding-stub method g2(generic-covariant-impl core::num x) → void;
- abstract forwarding-stub method g3(generic-covariant-impl self::C<core::num> c, generic-covariant-impl core::num x) → void;
}
static method test() → dynamic {
(core::Object) → dynamic x = (new self::D::•().{self::C::g4}() as{TypeError} (core::int) → dynamic) as (core::Object) → dynamic;
x.call("hi");
- new self::E::•().{self::E::g1}(1.5);
+ new self::E::•().{self::C::g1}(1.5);
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart.strong.transformed.expect
index 56e15b3..3ceb928 100644
--- a/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/call_through_this.dart.strong.transformed.expect
@@ -7,14 +7,14 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f(generic-covariant-impl generic-covariant-interface self::C::T x) → void {}
- method g1(generic-covariant-impl generic-covariant-interface self::C::T x) → void {
+ method f(generic-covariant-impl self::C::T x) → void {}
+ method g1(generic-covariant-impl self::C::T x) → void {
this.{self::C::f}(x);
}
- method g2(generic-covariant-impl generic-covariant-interface self::C::T x) → void {
+ method g2(generic-covariant-impl self::C::T x) → void {
this.{self::C::f}(x);
}
- method g3(generic-covariant-impl generic-covariant-interface self::C<self::C::T> c, generic-covariant-impl generic-covariant-interface self::C::T x) → void {
+ method g3(generic-covariant-impl self::C<self::C::T> c, generic-covariant-impl self::C::T x) → void {
c.{self::C::f}(x);
}
method g4() → (self::C::T) → dynamic
@@ -24,23 +24,16 @@
synthetic constructor •() → void
: super self::C::•()
;
- abstract forwarding-stub method f(generic-covariant-impl core::int x) → void;
- abstract forwarding-stub method g1(generic-covariant-impl core::int x) → void;
- abstract forwarding-stub method g2(generic-covariant-impl core::int x) → void;
- abstract forwarding-stub method g3(generic-covariant-impl self::C<core::int> c, generic-covariant-impl core::int x) → void;
}
class E extends self::C<core::num> {
synthetic constructor •() → void
: super self::C::•()
;
method f(covariant generic-covariant-impl core::int x) → void {}
- abstract forwarding-stub method g1(generic-covariant-impl core::num x) → void;
- abstract forwarding-stub method g2(generic-covariant-impl core::num x) → void;
- abstract forwarding-stub method g3(generic-covariant-impl self::C<core::num> c, generic-covariant-impl core::num x) → void;
}
static method test() → dynamic {
(core::Object) → dynamic x = (new self::D::•().{self::C::g4}() as{TypeError} (core::int) → dynamic) as (core::Object) → dynamic;
x.call("hi");
- new self::E::•().{self::E::g1}(1.5);
+ new self::E::•().{self::C::g1}(1.5);
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart b/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart
index 15854b3..c88d47ada 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart
@@ -8,8 +8,7 @@
typedef void F<T>(T x);
class B<T> {
- B<T> operator +(B<T> /*@covariance=genericInterface, genericImpl*/ other) =>
- null;
+ B<T> operator +(B<T> /*@covariance=genericImpl*/ other) => null;
}
class C<T> {
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.strong.expect
index 35cd46f..8e6a045 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.strong.expect
@@ -7,7 +7,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- operator +(generic-covariant-impl generic-covariant-interface self::B<self::B::T> other) → self::B<self::B::T>
+ operator +(generic-covariant-impl self::B<self::B::T> other) → self::B<self::B::T>
return null;
}
class C<T extends core::Object = dynamic> extends core::Object {
@@ -19,19 +19,19 @@
set x(self::B<(self::C::T) → void> value) → void {}
}
static method test(self::C<core::num> c) → void {
- let final self::C<core::num> #t1 = c in #t1.{self::C::x} = (#t1.{self::C::x} as{TypeError} self::B<(core::num) → void>).{self::B::+}(let final dynamic #t2 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart:21:49: Error: A value of type 'test::B<dart.core::num>' can't be assigned to a variable of type 'test::B<(dart.core::num) \u8594 void>'.
+ let final self::C<core::num> #t1 = c in #t1.{self::C::x} = (#t1.{self::C::x} as{TypeError} self::B<(core::num) → void>).{self::B::+}(let final dynamic #t2 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart:20:49: Error: A value of type 'test::B<dart.core::num>' can't be assigned to a variable of type 'test::B<(dart.core::num) \u8594 void>'.
Try changing the type of the left hand side, or casting the right hand side to 'test::B<(dart.core::num) \u8594 void>'.
c. /*@checkReturn=B<(num) -> void>*/ x += new B<num>();
^" in let final dynamic #t3 = new self::B::•<core::num>() in null);
- self::B<(core::num) → void> y = let final self::C<core::num> #t4 = c in #t4.{self::C::x} = (#t4.{self::C::x} as{TypeError} self::B<(core::num) → void>).{self::B::+}(let final dynamic #t5 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart:22:57: Error: A value of type 'test::B<dart.core::num>' can't be assigned to a variable of type 'test::B<(dart.core::num) \u8594 void>'.
+ self::B<(core::num) → void> y = let final self::C<core::num> #t4 = c in #t4.{self::C::x} = (#t4.{self::C::x} as{TypeError} self::B<(core::num) → void>).{self::B::+}(let final dynamic #t5 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart:21:57: Error: A value of type 'test::B<dart.core::num>' can't be assigned to a variable of type 'test::B<(dart.core::num) \u8594 void>'.
Try changing the type of the left hand side, or casting the right hand side to 'test::B<(dart.core::num) \u8594 void>'.
var y = c. /*@checkReturn=B<(num) -> void>*/ x += new B<num>();
^" in let final dynamic #t6 = new self::B::•<core::num>() in null);
- let final self::C<core::num> #t7 = c in (#t7.{self::C::x} as{TypeError} self::B<(core::num) → void>).{core::Object::==}(null) ?{self::B<core::Object>} #t7.{self::C::x} = let final dynamic #t8 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart:23:50: Error: A value of type 'test::B<dart.core::num>' can't be assigned to a variable of type 'test::B<(dart.core::num) \u8594 void>'.
+ let final self::C<core::num> #t7 = c in (#t7.{self::C::x} as{TypeError} self::B<(core::num) → void>).{core::Object::==}(null) ?{self::B<core::Object>} #t7.{self::C::x} = let final dynamic #t8 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart:22:50: Error: A value of type 'test::B<dart.core::num>' can't be assigned to a variable of type 'test::B<(dart.core::num) \u8594 void>'.
Try changing the type of the left hand side, or casting the right hand side to 'test::B<(dart.core::num) \u8594 void>'.
c. /*@checkReturn=B<(num) -> void>*/ x ??= new B<num>();
^" in let final dynamic #t9 = new self::B::•<core::num>() in null : null;
- self::B<core::Object> z = let final self::C<core::num> #t10 = c in let final dynamic #t11 = #t10.{self::C::x} as{TypeError} self::B<(core::num) → void> in #t11.{core::Object::==}(null) ?{self::B<core::Object>} #t10.{self::C::x} = let final dynamic #t12 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart:24:58: Error: A value of type 'test::B<dart.core::num>' can't be assigned to a variable of type 'test::B<(dart.core::num) \u8594 void>'.
+ self::B<core::Object> z = let final self::C<core::num> #t10 = c in let final dynamic #t11 = #t10.{self::C::x} as{TypeError} self::B<(core::num) → void> in #t11.{core::Object::==}(null) ?{self::B<core::Object>} #t10.{self::C::x} = let final dynamic #t12 = let dynamic _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart:23:58: Error: A value of type 'test::B<dart.core::num>' can't be assigned to a variable of type 'test::B<(dart.core::num) \u8594 void>'.
Try changing the type of the left hand side, or casting the right hand side to 'test::B<(dart.core::num) \u8594 void>'.
var z = c. /*@checkReturn=B<(num) -> void>*/ x ??= new B<num>();
^" in let final dynamic #t13 = new self::B::•<core::num>() in null : #t11;
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.strong.transformed.expect
index 5a9326d..3180850 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart.strong.transformed.expect
@@ -7,7 +7,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- operator +(generic-covariant-impl generic-covariant-interface self::B<self::B::T> other) → self::B<self::B::T>
+ operator +(generic-covariant-impl self::B<self::B::T> other) → self::B<self::B::T>
return null;
}
class C<T extends core::Object = dynamic> extends core::Object {
@@ -19,19 +19,19 @@
set x(self::B<(self::C::T) → void> value) → void {}
}
static method test(self::C<core::num> c) → void {
- let final self::C<core::num> #t1 = c in #t1.{self::C::x} = (#t1.{self::C::x} as{TypeError} self::B<(core::num) → void>).{self::B::+}(let final dynamic #t2 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart:21:49: Error: A value of type 'test::B<dart.core::num>' can't be assigned to a variable of type 'test::B<(dart.core::num) \u8594 void>'.
+ let final self::C<core::num> #t1 = c in #t1.{self::C::x} = (#t1.{self::C::x} as{TypeError} self::B<(core::num) → void>).{self::B::+}(let final dynamic #t2 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart:20:49: Error: A value of type 'test::B<dart.core::num>' can't be assigned to a variable of type 'test::B<(dart.core::num) \u8594 void>'.
Try changing the type of the left hand side, or casting the right hand side to 'test::B<(dart.core::num) \u8594 void>'.
c. /*@checkReturn=B<(num) -> void>*/ x += new B<num>();
^" in let final self::B<core::num> #t3 = new self::B::•<core::num>() in null);
- self::B<(core::num) → void> y = let final self::C<core::num> #t4 = c in #t4.{self::C::x} = (#t4.{self::C::x} as{TypeError} self::B<(core::num) → void>).{self::B::+}(let final dynamic #t5 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart:22:57: Error: A value of type 'test::B<dart.core::num>' can't be assigned to a variable of type 'test::B<(dart.core::num) \u8594 void>'.
+ self::B<(core::num) → void> y = let final self::C<core::num> #t4 = c in #t4.{self::C::x} = (#t4.{self::C::x} as{TypeError} self::B<(core::num) → void>).{self::B::+}(let final dynamic #t5 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart:21:57: Error: A value of type 'test::B<dart.core::num>' can't be assigned to a variable of type 'test::B<(dart.core::num) \u8594 void>'.
Try changing the type of the left hand side, or casting the right hand side to 'test::B<(dart.core::num) \u8594 void>'.
var y = c. /*@checkReturn=B<(num) -> void>*/ x += new B<num>();
^" in let final self::B<core::num> #t6 = new self::B::•<core::num>() in null);
- let final self::C<core::num> #t7 = c in (#t7.{self::C::x} as{TypeError} self::B<(core::num) → void>).{core::Object::==}(null) ?{self::B<core::Object>} #t7.{self::C::x} = let final dynamic #t8 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart:23:50: Error: A value of type 'test::B<dart.core::num>' can't be assigned to a variable of type 'test::B<(dart.core::num) \u8594 void>'.
+ let final self::C<core::num> #t7 = c in (#t7.{self::C::x} as{TypeError} self::B<(core::num) → void>).{core::Object::==}(null) ?{self::B<core::Object>} #t7.{self::C::x} = let final dynamic #t8 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart:22:50: Error: A value of type 'test::B<dart.core::num>' can't be assigned to a variable of type 'test::B<(dart.core::num) \u8594 void>'.
Try changing the type of the left hand side, or casting the right hand side to 'test::B<(dart.core::num) \u8594 void>'.
c. /*@checkReturn=B<(num) -> void>*/ x ??= new B<num>();
^" in let final self::B<core::num> #t9 = new self::B::•<core::num>() in null : null;
- self::B<core::Object> z = let final self::C<core::num> #t10 = c in let final self::B<(core::num) → void> #t11 = #t10.{self::C::x} as{TypeError} self::B<(core::num) → void> in #t11.{core::Object::==}(null) ?{self::B<core::Object>} #t10.{self::C::x} = let final dynamic #t12 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart:24:58: Error: A value of type 'test::B<dart.core::num>' can't be assigned to a variable of type 'test::B<(dart.core::num) \u8594 void>'.
+ self::B<core::Object> z = let final self::C<core::num> #t10 = c in let final self::B<(core::num) → void> #t11 = #t10.{self::C::x} as{TypeError} self::B<(core::num) → void> in #t11.{core::Object::==}(null) ?{self::B<core::Object>} #t10.{self::C::x} = let final dynamic #t12 = let<BottomType> _ = null in invalid-expression "pkg/front_end/testcases/runtime_checks_new/contravariant_getter_return_compound_assign.dart:23:58: Error: A value of type 'test::B<dart.core::num>' can't be assigned to a variable of type 'test::B<(dart.core::num) \u8594 void>'.
Try changing the type of the left hand side, or casting the right hand side to 'test::B<(dart.core::num) \u8594 void>'.
var z = c. /*@checkReturn=B<(num) -> void>*/ x ??= new B<num>();
^" in let final self::B<core::num> #t13 = new self::B::•<core::num>() in null : #t11;
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart
index ffa9c1d..47d0002 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart
@@ -8,8 +8,7 @@
typedef void F<T>(T x);
class B<T> {
- B<T> operator +(B<T> /*@covariance=genericInterface, genericImpl*/ other) =>
- null;
+ B<T> operator +(B<T> /*@covariance=genericImpl*/ other) => null;
}
class C<T> {
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.strong.expect
index b74c2ed..0789042 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.strong.expect
@@ -7,7 +7,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- operator +(generic-covariant-impl generic-covariant-interface self::B<self::B::T> other) → self::B<self::B::T>
+ operator +(generic-covariant-impl self::B<self::B::T> other) → self::B<self::B::T>
return null;
}
class C<T extends core::Object = dynamic> extends core::Object {
diff --git a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.strong.transformed.expect
index b74c2ed..0789042 100644
--- a/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/contravariant_index_assign.dart.strong.transformed.expect
@@ -7,7 +7,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- operator +(generic-covariant-impl generic-covariant-interface self::B<self::B::T> other) → self::B<self::B::T>
+ operator +(generic-covariant-impl self::B<self::B::T> other) → self::B<self::B::T>
return null;
}
class C<T extends core::Object = dynamic> extends core::Object {
diff --git a/pkg/front_end/testcases/runtime_checks_new/derived_class_typed.dart b/pkg/front_end/testcases/runtime_checks_new/derived_class_typed.dart
index cd69147..0c73221 100644
--- a/pkg/front_end/testcases/runtime_checks_new/derived_class_typed.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/derived_class_typed.dart
@@ -6,15 +6,12 @@
library test;
class B<T> {
- void f(T /*@covariance=genericInterface, genericImpl*/ x) {}
- void g({T /*@covariance=genericInterface, genericImpl*/ x}) {}
- void h< /*@covariance=genericInterface, genericImpl*/ U extends T>() {}
+ void f(T /*@covariance=genericImpl*/ x) {}
+ void g({T /*@covariance=genericImpl*/ x}) {}
+ void h< /*@covariance=genericImpl*/ U extends T>() {}
}
-class /*@forwardingStub=abstract void f(covariance=(genericImpl) int x)*/
-/*@forwardingStub=abstract void h<covariance=(genericImpl) U extends int>()*/
-/*@forwardingStub=abstract void g({covariance=(genericImpl) int x})*/
- C extends B<int> {}
+class C extends B<int> {}
void g1(B<num> b) {
b.f(1.5);
diff --git a/pkg/front_end/testcases/runtime_checks_new/derived_class_typed.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/derived_class_typed.dart.strong.expect
index 485a5a8..89abbed 100644
--- a/pkg/front_end/testcases/runtime_checks_new/derived_class_typed.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/derived_class_typed.dart.strong.expect
@@ -6,23 +6,20 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f(generic-covariant-impl generic-covariant-interface self::B::T x) → void {}
- method g({generic-covariant-impl generic-covariant-interface self::B::T x = null}) → void {}
- method h<generic-covariant-impl generic-covariant-interface U extends self::B::T = dynamic>() → void {}
+ method f(generic-covariant-impl self::B::T x) → void {}
+ method g({generic-covariant-impl self::B::T x = null}) → void {}
+ method h<generic-covariant-impl U extends self::B::T = dynamic>() → void {}
}
class C extends self::B<core::int> {
synthetic constructor •() → void
: super self::B::•()
;
- abstract forwarding-stub method f(generic-covariant-impl core::int x) → void;
- abstract forwarding-stub method h<generic-covariant-impl U extends core::int>() → void;
- abstract forwarding-stub method g({generic-covariant-impl core::int x}) → void;
}
static method g1(self::B<core::num> b) → void {
b.{self::B::f}(1.5);
}
static method g2(self::C c) → void {
- c.{self::C::f}(1);
+ c.{self::B::f}(1);
}
static method test() → void {
self::g1(new self::C::•());
diff --git a/pkg/front_end/testcases/runtime_checks_new/derived_class_typed.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks_new/derived_class_typed.dart.strong.transformed.expect
index 485a5a8..89abbed 100644
--- a/pkg/front_end/testcases/runtime_checks_new/derived_class_typed.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/derived_class_typed.dart.strong.transformed.expect
@@ -6,23 +6,20 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f(generic-covariant-impl generic-covariant-interface self::B::T x) → void {}
- method g({generic-covariant-impl generic-covariant-interface self::B::T x = null}) → void {}
- method h<generic-covariant-impl generic-covariant-interface U extends self::B::T = dynamic>() → void {}
+ method f(generic-covariant-impl self::B::T x) → void {}
+ method g({generic-covariant-impl self::B::T x = null}) → void {}
+ method h<generic-covariant-impl U extends self::B::T = dynamic>() → void {}
}
class C extends self::B<core::int> {
synthetic constructor •() → void
: super self::B::•()
;
- abstract forwarding-stub method f(generic-covariant-impl core::int x) → void;
- abstract forwarding-stub method h<generic-covariant-impl U extends core::int>() → void;
- abstract forwarding-stub method g({generic-covariant-impl core::int x}) → void;
}
static method g1(self::B<core::num> b) → void {
b.{self::B::f}(1.5);
}
static method g2(self::C c) → void {
- c.{self::C::f}(1);
+ c.{self::B::f}(1);
}
static method test() → void {
self::g1(new self::C::•());
diff --git a/pkg/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart b/pkg/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart
index a879fca..7b9e86e 100644
--- a/pkg/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart
@@ -6,10 +6,9 @@
library test;
class B<T> {
- T /*@covariance=genericInterface, genericImpl*/ x;
+ T /*@covariance=genericImpl*/ x;
}
-class /*@forwardingStub=abstract void set x(covariance=(genericImpl) num _)*/ C
- extends B<num> {}
+class C extends B<num> {}
void main() {}
diff --git a/pkg/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.strong.expect
index 0de2a48..d853752 100644
--- a/pkg/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.strong.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class B<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::B::T x = null;
+ generic-covariant-impl field self::B::T x = null;
synthetic constructor •() → void
: super core::Object::•()
;
@@ -12,6 +12,5 @@
synthetic constructor •() → void
: super self::B::•()
;
- abstract forwarding-stub set x(generic-covariant-impl core::num _) → void;
}
static method main() → void {}
diff --git a/pkg/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.strong.transformed.expect
index 0de2a48..d853752 100644
--- a/pkg/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/field_forwarding_stub_abstract_generic_covariant.dart.strong.transformed.expect
@@ -3,7 +3,7 @@
import "dart:core" as core;
class B<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::B::T x = null;
+ generic-covariant-impl field self::B::T x = null;
synthetic constructor •() → void
: super core::Object::•()
;
@@ -12,6 +12,5 @@
synthetic constructor •() → void
: super self::B::•()
;
- abstract forwarding-stub set x(generic-covariant-impl core::num _) → void;
}
static method main() → void {}
diff --git a/pkg/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart b/pkg/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart
index 0030a53..1df42eb 100644
--- a/pkg/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart
@@ -6,8 +6,8 @@
library test;
class B<T> {
- T /*@covariance=genericInterface, genericImpl*/ x;
- T /*@covariance=genericInterface, genericImpl*/ y;
+ T /*@covariance=genericImpl*/ x;
+ T /*@covariance=genericImpl*/ y;
}
// This class inherits genericImpl annotations from its superclass, but doesn't
@@ -22,9 +22,9 @@
// This class also has members marked genericInterface, since the inferred types
// of x and y *do* depend on the type parameter T.
abstract class D<T> implements B<T> {
- var /*@covariance=genericInterface, genericImpl*/ x;
+ var /*@covariance=genericImpl*/ x;
get y;
- set y(/*@covariance=genericInterface, genericImpl*/ value);
+ set y(/*@covariance=genericImpl*/ value);
}
main() {}
diff --git a/pkg/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.strong.expect
index 56bdaf5..143a69a 100644
--- a/pkg/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.strong.expect
@@ -3,8 +3,8 @@
import "dart:core" as core;
class B<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::B::T x = null;
- generic-covariant-impl generic-covariant-interface field self::B::T y = null;
+ generic-covariant-impl field self::B::T x = null;
+ generic-covariant-impl field self::B::T y = null;
synthetic constructor •() → void
: super core::Object::•()
;
@@ -18,11 +18,11 @@
abstract set y(generic-covariant-impl core::num value) → void;
}
abstract class D<T extends core::Object = dynamic> extends core::Object implements self::B<self::D::T> {
- generic-covariant-impl generic-covariant-interface field self::D::T x = null;
+ generic-covariant-impl field self::D::T x = null;
synthetic constructor •() → void
: super core::Object::•()
;
abstract get y() → self::D::T;
- abstract set y(generic-covariant-impl generic-covariant-interface self::D::T value) → void;
+ abstract set y(generic-covariant-impl self::D::T value) → void;
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.strong.transformed.expect
index 56bdaf5..143a69a 100644
--- a/pkg/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/generic_covariance_based_on_inference.dart.strong.transformed.expect
@@ -3,8 +3,8 @@
import "dart:core" as core;
class B<T extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::B::T x = null;
- generic-covariant-impl generic-covariant-interface field self::B::T y = null;
+ generic-covariant-impl field self::B::T x = null;
+ generic-covariant-impl field self::B::T y = null;
synthetic constructor •() → void
: super core::Object::•()
;
@@ -18,11 +18,11 @@
abstract set y(generic-covariant-impl core::num value) → void;
}
abstract class D<T extends core::Object = dynamic> extends core::Object implements self::B<self::D::T> {
- generic-covariant-impl generic-covariant-interface field self::D::T x = null;
+ generic-covariant-impl field self::D::T x = null;
synthetic constructor •() → void
: super core::Object::•()
;
abstract get y() → self::D::T;
- abstract set y(generic-covariant-impl generic-covariant-interface self::D::T value) → void;
+ abstract set y(generic-covariant-impl self::D::T value) → void;
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart b/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart
index 17749bb..f38c741 100644
--- a/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart
@@ -38,7 +38,7 @@
abstract class I<T> {
T get x;
- void set x(T /*@covariance=genericInterface, genericImpl*/ value);
+ void set x(T /*@covariance=genericImpl*/ value);
Object get y;
void set y(covariant Object /*@covariance=explicit*/ value);
}
diff --git a/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart.strong.expect
index 314d87d..2990e03 100644
--- a/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_field.dart.strong.expect
@@ -24,7 +24,7 @@
: super core::Object::•()
;
abstract get x() → self::I::T;
- abstract set x(generic-covariant-impl generic-covariant-interface self::I::T value) → void;
+ abstract set x(generic-covariant-impl self::I::T value) → void;
abstract get y() → core::Object;
abstract set y(covariant core::Object value) → void;
}
diff --git a/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart b/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart
index 68558fd..8eeb4d8 100644
--- a/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart
@@ -38,7 +38,7 @@
abstract class I<T> {
T get x;
- void set x(T /*@covariance=genericInterface, genericImpl*/ value);
+ void set x(T /*@covariance=genericImpl*/ value);
Object get y;
void set y(covariant Object /*@covariance=explicit*/ value);
}
diff --git a/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart.strong.expect
index 77c4077..811f68e 100644
--- a/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/mixin_forwarding_stub_setter.dart.strong.expect
@@ -24,7 +24,7 @@
: super core::Object::•()
;
abstract get x() → self::I::T;
- abstract set x(generic-covariant-impl generic-covariant-interface self::I::T value) → void;
+ abstract set x(generic-covariant-impl self::I::T value) → void;
abstract get y() → core::Object;
abstract set y(covariant core::Object value) → void;
}
diff --git a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_class.dart b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_class.dart
index f82088b..3382ef6 100644
--- a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_class.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_class.dart
@@ -16,7 +16,7 @@
}
class
-/*@forwardingStub=void f(covariance=(genericInterface, genericImpl) ((C::T) -> void) -> void x, covariance=() Object y)*/
+/*@forwardingStub=void f(covariance=(genericImpl) ((C::T) -> void) -> void x, covariance=() Object y)*/
C<T> extends B<F<T>> implements I<F<T>> {}
void main() {}
diff --git a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_class.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_class.dart.strong.expect
index 8e34bf3..0a9304b 100644
--- a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_class.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_class.dart.strong.expect
@@ -19,7 +19,7 @@
synthetic constructor •() → void
: super self::B::•()
;
- forwarding-stub method f(generic-covariant-impl generic-covariant-interface ((self::C::T) → void) → void x, core::Object y) → void
+ forwarding-stub method f(generic-covariant-impl ((self::C::T) → void) → void x, core::Object y) → void
return super.{self::B::f}(x, y);
}
static method main() → void {}
diff --git a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_class.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_class.dart.strong.transformed.expect
index 8e34bf3..0a9304b 100644
--- a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_class.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_class.dart.strong.transformed.expect
@@ -19,7 +19,7 @@
synthetic constructor •() → void
: super self::B::•()
;
- forwarding-stub method f(generic-covariant-impl generic-covariant-interface ((self::C::T) → void) → void x, core::Object y) → void
+ forwarding-stub method f(generic-covariant-impl ((self::C::T) → void) → void x, core::Object y) → void
return super.{self::B::f}(x, y);
}
static method main() → void {}
diff --git a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart
index 2d928fc..d275f46 100644
--- a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart
@@ -10,7 +10,7 @@
}
abstract class I<T> {
- void f(T /*@covariance=genericInterface, genericImpl*/ x, Object y);
+ void f(T /*@covariance=genericImpl*/ x, Object y);
}
class
diff --git a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.strong.expect
index c26770b..df8dc2f 100644
--- a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.strong.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract method f(generic-covariant-impl generic-covariant-interface self::I::T x, core::Object y) → void;
+ abstract method f(generic-covariant-impl self::I::T x, core::Object y) → void;
}
class C extends self::B implements self::I<core::int> {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.strong.transformed.expect b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.strong.transformed.expect
index c26770b..df8dc2f 100644
--- a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.strong.transformed.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_interface.dart.strong.transformed.expect
@@ -12,7 +12,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract method f(generic-covariant-impl generic-covariant-interface self::I::T x, core::Object y) → void;
+ abstract method f(generic-covariant-impl self::I::T x, core::Object y) → void;
}
class C extends self::B implements self::I<core::int> {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart
index c5e433b..f232d54 100644
--- a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart
@@ -6,7 +6,7 @@
library test;
class B<T> {
- void f(T /*@covariance=genericInterface, genericImpl*/ x, int y) {}
+ void f(T /*@covariance=genericImpl*/ x, int y) {}
}
abstract class I {
diff --git a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart.strong.expect
index 79fe012..f48cc4b 100644
--- a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantImpl_from_super.dart.strong.expect
@@ -6,7 +6,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- method f(generic-covariant-impl generic-covariant-interface self::B::T x, core::int y) → void {}
+ method f(generic-covariant-impl self::B::T x, core::int y) → void {}
}
abstract class I extends core::Object {
synthetic constructor •() → void
diff --git a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart
index 1f8c085..0394769 100644
--- a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart
+++ b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart
@@ -8,7 +8,7 @@
typedef void F<T>(T t);
abstract class A<T> {
- void f(T /*@covariance=genericInterface, genericImpl*/ x, int y);
+ void f(T /*@covariance=genericImpl*/ x, int y);
}
class B<T> implements A<F<T>> {
@@ -20,7 +20,7 @@
}
class
-/*@forwardingStub=abstract void f(covariance=(genericInterface, genericImpl) ((C::T) -> void) -> void x, covariance=() Object y)*/
+/*@forwardingStub=abstract void f(covariance=(genericImpl) ((C::T) -> void) -> void x, covariance=() Object y)*/
C<T> extends B<F<T>> implements I<F<T>> {}
void main() {}
diff --git a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart.strong.expect b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart.strong.expect
index ee0c689..27289d4 100644
--- a/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart.strong.expect
+++ b/pkg/front_end/testcases/runtime_checks_new/stub_from_interface_covariantInterface_from_class.dart.strong.expect
@@ -7,7 +7,7 @@
synthetic constructor •() → void
: super core::Object::•()
;
- abstract method f(generic-covariant-impl generic-covariant-interface self::A::T x, core::int y) → void;
+ abstract method f(generic-covariant-impl self::A::T x, core::int y) → void;
}
class B<T extends core::Object = dynamic> extends core::Object implements self::A<(self::B::T) → void> {
synthetic constructor •() → void
@@ -25,6 +25,6 @@
synthetic constructor •() → void
: super self::B::•()
;
- abstract forwarding-stub method f(generic-covariant-impl generic-covariant-interface ((self::C::T) → void) → void x, core::Object y) → void;
+ abstract forwarding-stub method f(generic-covariant-impl ((self::C::T) → void) → void x, core::Object y) → void;
}
static method main() → void {}
diff --git a/pkg/front_end/testcases/strong.status b/pkg/front_end/testcases/strong.status
index 6f767dc..3ee0f85 100644
--- a/pkg/front_end/testcases/strong.status
+++ b/pkg/front_end/testcases/strong.status
@@ -77,13 +77,7 @@
inference/constructors_infer_from_arguments_argument_not_assignable: TypeCheckError
inference/constructors_too_many_positional_arguments: Fail # Issue #30040
inference/do_not_infer_overridden_fields_that_explicitly_say_dynamic_infer: TypeCheckError
-inference/downwards_inference_annotations_for_loop_variable: Fail # Issue #28434
-inference/downwards_inference_annotations_locals: Fail # Issue #30031 and Issue #28434
-inference/downwards_inference_annotations_locals_referring_to_locals: Fail # Issue #28434
-inference/downwards_inference_annotations_parameter: Fail # Issue #28434
-inference/downwards_inference_annotations_parameter_local: Fail # Issue #28434
-inference/downwards_inference_annotations_type_variable: Fail # Issue #28434
-inference/downwards_inference_annotations_type_variable_local: Fail # Issue #28434
+inference/downwards_inference_annotations_type_variable: Fail # Issue 28981
inference/downwards_inference_on_function_of_t_using_the_t: Fail # Issue #29798
inference/downwards_inference_on_list_literals_infer_downwards: RuntimeError
inference/downwards_inference_yield_yield_star: TypeCheckError
diff --git a/pkg/kernel/binary.md b/pkg/kernel/binary.md
index 0af9f95..7bb45af 100644
--- a/pkg/kernel/binary.md
+++ b/pkg/kernel/binary.md
@@ -313,7 +313,7 @@
FileOffset fileOffset;
FileOffset fileEndOffset;
Byte flags (isFinal, isConst, isStatic, hasImplicitGetter, hasImplicitSetter,
- isCovariant, isGenericCovariantImpl, isGenericCovariantInterface);
+ isCovariant, isGenericCovariantImpl);
Name name;
List<Expression> annotations;
DartType type;
@@ -1095,7 +1095,7 @@
List<Expression> annotations;
Byte flags (isFinal, isConst, isFieldFormal, isCovariant,
- isInScope, isGenericCovariantImpl, isGenericCovariantInterface);
+ isInScope, isGenericCovariantImpl);
// For named parameters, this is the parameter name.
// For other variables, the name is cosmetic, may be empty,
// and is not necessarily unique.
@@ -1202,7 +1202,7 @@
type TypeParameter {
// Note: there is no tag on TypeParameter
- Byte flags (isGenericCovariantImpl, isGenericCovariantInterface);
+ Byte flags (isGenericCovariantImpl);
List<Expression> annotations;
StringReference name; // Cosmetic, may be empty, not unique.
DartType bound; // 'dynamic' if no explicit bound was given.
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index 2d27d28..a87b1b4 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -1072,7 +1072,6 @@
static const int FlagHasImplicitSetter = 1 << 4;
static const int FlagCovariant = 1 << 5;
static const int FlagGenericCovariantImpl = 1 << 6;
- static const int FlagGenericCovariantInterface = 1 << 7;
/// Whether the field is declared with the `covariant` keyword.
bool get isCovariant => flags & FlagCovariant != 0;
@@ -1108,14 +1107,6 @@
/// [DispatchCategory] for details.
bool get isGenericCovariantImpl => flags & FlagGenericCovariantImpl != 0;
- /// Indicates whether setter invocations using this interface target may need
- /// to perform a runtime type check to deal with generic covariance.
- ///
- /// When `true`, runtime checks may need to be performed; see
- /// [DispatchCategory] for details.
- bool get isGenericCovariantInterface =>
- flags & FlagGenericCovariantInterface != 0;
-
void set isCovariant(bool value) {
flags = value ? (flags | FlagCovariant) : (flags & ~FlagCovariant);
}
@@ -1150,12 +1141,6 @@
: (flags & ~FlagGenericCovariantImpl);
}
- void set isGenericCovariantInterface(bool value) {
- flags = value
- ? (flags | FlagGenericCovariantInterface)
- : (flags & ~FlagGenericCovariantInterface);
- }
-
/// True if the field is neither final nor const.
bool get isMutable => flags & (FlagFinal | FlagConst) == 0;
bool get isInstanceMember => !isStatic;
@@ -4381,7 +4366,6 @@
static const int FlagCovariant = 1 << 3;
static const int FlagInScope = 1 << 4; // Temporary flag used by verifier.
static const int FlagGenericCovariantImpl = 1 << 5;
- static const int FlagGenericCovariantInterface = 1 << 6;
bool get isFinal => flags & FlagFinal != 0;
bool get isConst => flags & FlagConst != 0;
@@ -4402,15 +4386,6 @@
/// [DispatchCategory] for details.
bool get isGenericCovariantImpl => flags & FlagGenericCovariantImpl != 0;
- /// If this [VariableDeclaration] is a parameter of a method, indicates
- /// whether invocations using the method as an interface target may need to
- /// perform a runtime type check to deal with generic covariance.
- ///
- /// When `true`, runtime checks may need to be performed; see
- /// [DispatchCategory] for details.
- bool get isGenericCovariantInterface =>
- flags & FlagGenericCovariantInterface != 0;
-
void set isFinal(bool value) {
flags = value ? (flags | FlagFinal) : (flags & ~FlagFinal);
}
@@ -4434,12 +4409,6 @@
: (flags & ~FlagGenericCovariantImpl);
}
- void set isGenericCovariantInterface(bool value) {
- flags = value
- ? (flags | FlagGenericCovariantInterface)
- : (flags & ~FlagGenericCovariantInterface);
- }
-
void addAnnotation(Expression annotation) {
if (annotations.isEmpty) {
annotations = <Expression>[];
@@ -4451,11 +4420,13 @@
accept1(StatementVisitor1 v, arg) => v.visitVariableDeclaration(this, arg);
visitChildren(Visitor v) {
+ visitList(annotations, v);
type?.accept(v);
initializer?.accept(v);
}
transformChildren(Transformer v) {
+ transformList(annotations, v, this);
type = v.visitDartType(type);
if (initializer != null) {
initializer = initializer.accept(v);
@@ -5034,7 +5005,6 @@
// Must match serialized bit positions.
static const int FlagGenericCovariantImpl = 1 << 0;
- static const int FlagGenericCovariantInterface = 1 << 1;
/// If this [TypeParameter] is a type parameter of a generic method, indicates
/// whether the method implementation needs to contain a runtime type check to
@@ -5044,27 +5014,12 @@
/// [DispatchCategory] for details.
bool get isGenericCovariantImpl => flags & FlagGenericCovariantImpl != 0;
- /// If this [TypeParameter] is a type parameter of a generic method, indicates
- /// whether invocations using the method as an interface target may need to
- /// perform a runtime type check to deal with generic covariance.
- ///
- /// When `true`, runtime checks may need to be performed; see
- /// [DispatchCategory] for details.
- bool get isGenericCovariantInterface =>
- flags & FlagGenericCovariantInterface != 0;
-
void set isGenericCovariantImpl(bool value) {
flags = value
? (flags | FlagGenericCovariantImpl)
: (flags & ~FlagGenericCovariantImpl);
}
- void set isGenericCovariantInterface(bool value) {
- flags = value
- ? (flags | FlagGenericCovariantInterface)
- : (flags & ~FlagGenericCovariantInterface);
- }
-
void addAnnotation(Expression annotation) {
if (annotations.isEmpty) {
annotations = <Expression>[];
diff --git a/pkg/kernel/lib/text/ast_to_text.dart b/pkg/kernel/lib/text/ast_to_text.dart
index 4ec4cbd..5584371 100644
--- a/pkg/kernel/lib/text/ast_to_text.dart
+++ b/pkg/kernel/lib/text/ast_to_text.dart
@@ -869,11 +869,17 @@
}
}
- void writeAnnotationList(List<Expression> nodes) {
+ void writeAnnotationList(List<Expression> nodes, {bool separateLines: true}) {
for (Expression node in nodes) {
- writeIndentation();
+ if (separateLines) {
+ writeIndentation();
+ }
writeAnnotation(node);
- endLine();
+ if (separateLines) {
+ endLine();
+ } else {
+ writeSpace();
+ }
}
}
@@ -885,8 +891,6 @@
writeModifier(node.isStatic, 'static');
writeModifier(node.isCovariant, 'covariant');
writeModifier(node.isGenericCovariantImpl, 'generic-covariant-impl');
- writeModifier(
- node.isGenericCovariantInterface, 'generic-covariant-interface');
writeModifier(node.isFinal, 'final');
writeModifier(node.isConst, 'const');
// Only show implicit getter/setter modifiers in cases where they are
@@ -1671,6 +1675,7 @@
}
visitFunctionDeclaration(FunctionDeclaration node) {
+ writeAnnotationList(node.variable.annotations);
writeIndentation();
writeWord('function');
if (node.function != null) {
@@ -1685,11 +1690,9 @@
{bool useVarKeyword: false}) {
if (showOffsets) writeWord("[${node.fileOffset}]");
if (showMetadata) writeMetadata(node);
- writeAnnotationList(node.annotations);
+ writeAnnotationList(node.annotations, separateLines: false);
writeModifier(node.isCovariant, 'covariant');
writeModifier(node.isGenericCovariantImpl, 'generic-covariant-impl');
- writeModifier(
- node.isGenericCovariantInterface, 'generic-covariant-interface');
writeModifier(node.isFinal, 'final');
writeModifier(node.isConst, 'const');
if (node.type != null) {
@@ -1834,9 +1837,7 @@
visitTypeParameter(TypeParameter node) {
writeModifier(node.isGenericCovariantImpl, 'generic-covariant-impl');
- writeModifier(
- node.isGenericCovariantInterface, 'generic-covariant-interface');
- writeAnnotationList(node.annotations);
+ writeAnnotationList(node.annotations, separateLines: false);
writeWord(getTypeParameterName(node));
writeSpaced('extends');
writeType(node.bound);
diff --git a/pkg/kernel/lib/transformations/mixin_full_resolution.dart b/pkg/kernel/lib/transformations/mixin_full_resolution.dart
index 24a5e33..27effdc 100644
--- a/pkg/kernel/lib/transformations/mixin_full_resolution.dart
+++ b/pkg/kernel/lib/transformations/mixin_full_resolution.dart
@@ -158,8 +158,6 @@
VariableDeclaration parameter =
setter.function.positionalParameters.first;
clone.isGenericCovariantImpl = parameter.isGenericCovariantImpl;
- clone.isGenericCovariantInterface =
- parameter.isGenericCovariantInterface;
}
nonSetters.remove(field.name);
class_.addMember(clone);
diff --git a/pkg/vm/lib/bytecode/gen_bytecode.dart b/pkg/vm/lib/bytecode/gen_bytecode.dart
index c51cf1f..988a721 100644
--- a/pkg/vm/lib/bytecode/gen_bytecode.dart
+++ b/pkg/vm/lib/bytecode/gen_bytecode.dart
@@ -789,6 +789,7 @@
@override
visitStaticSet(StaticSet node) {
node.value.accept(this);
+ _genDupTOS(node);
final target = node.target;
if (target is Field) {
// TODO(alexmarkov): assignable check
@@ -796,6 +797,7 @@
asm.emitStoreStaticTOS(cpIndex);
} else {
_genStaticCall(target, new ConstantArgDesc(1), 1);
+ asm.emitDrop1();
}
}
diff --git a/pkg/vm/lib/bytecode/local_vars.dart b/pkg/vm/lib/bytecode/local_vars.dart
index 578cbc6..93789ad 100644
--- a/pkg/vm/lib/bytecode/local_vars.dart
+++ b/pkg/vm/lib/bytecode/local_vars.dart
@@ -235,4 +235,10 @@
_allocateTemp(node);
super.visitSwitchStatement(node);
}
+
+ @override
+ visitStaticSet(StaticSet node) {
+ _allocateTemp(node);
+ super.visitStaticSet(node);
+ }
}
diff --git a/pkg/vm/lib/frontend_server.dart b/pkg/vm/lib/frontend_server.dart
index f94b215..d950c1e 100644
--- a/pkg/vm/lib/frontend_server.dart
+++ b/pkg/vm/lib/frontend_server.dart
@@ -63,6 +63,8 @@
' by gen_snapshot(which needs platform embedded) vs'
' Flutter engine(which does not)',
defaultsTo: true)
+ ..addOption('import-dill',
+ help: 'Import libraries from existing dill file', defaultsTo: null)
..addOption('output-dill',
help: 'Output path for the generated dill', defaultsTo: null)
..addOption('output-incremental-dill',
@@ -258,6 +260,13 @@
strongMode: options['strong'], syncAsync: options['sync-async']);
compilerOptions.target = getTarget(options['target'], targetFlags);
+ final String importDill = options['import-dill'];
+ if (importDill != null) {
+ compilerOptions.inputSummaries = <Uri>[
+ Uri.base.resolveUri(new Uri.file(importDill))
+ ];
+ }
+
Component component;
if (options['incremental']) {
_compilerOptions = compilerOptions;
@@ -284,10 +293,9 @@
transformer.transform(component);
}
- final IOSink sink = new File(_kernelBinaryFilename).openWrite();
- final BinaryPrinter printer = printerFactory.newBinaryPrinter(sink);
- printer.writeComponentFile(component);
- await sink.close();
+ await writeDillFile(component, _kernelBinaryFilename,
+ filterExternal: importDill != null);
+
_outputStream
.writeln('$boundaryKey $_kernelBinaryFilename ${errors.length}');
final String depfile = options['depfile'];
@@ -301,6 +309,18 @@
return errors.isEmpty;
}
+ writeDillFile(Component component, String filename,
+ {bool filterExternal: false}) async {
+ final IOSink sink = new File(filename).openWrite();
+ final BinaryPrinter printer = filterExternal
+ ? new LimitedBinaryPrinter(
+ sink, (lib) => !lib.isExternal, true /* excludeUriToSource */)
+ : printerFactory.newBinaryPrinter(sink);
+
+ printer.writeComponentFile(component);
+ await sink.close();
+ }
+
Future<Null> invalidateIfBootstrapping() async {
if (_kernelBinaryFilename != _kernelBinaryFilenameFull) return null;
// If the generator is initialized bootstrapping is not in effect anyway,
diff --git a/pkg/vm/testcases/bytecode/boostrapping.dart.expect b/pkg/vm/testcases/bytecode/boostrapping.dart.expect
index 8070f3e..264ed59 100644
--- a/pkg/vm/testcases/bytecode/boostrapping.dart.expect
+++ b/pkg/vm/testcases/bytecode/boostrapping.dart.expect
@@ -105,17 +105,19 @@
external static method _getDefault() → core::int;
[@vm.bytecode=
Bytecode {
- Entry 1
+ Entry 2
CheckStack
Allocate CP#0
- StoreLocal r0
- Push r0
+ StoreLocal r1
+ Push r1
PushConstant CP#2
IndirectStaticCall 1, CP#1
Drop1
Push FP[-5]
PushConstant CP#4
IndirectStaticCall 2, CP#3
+ StoreLocal r0
+ Push r0
StoreStaticTOS CP#5
Drop1
PushConstant CP#6
@@ -135,7 +137,7 @@
}
[@vm.bytecode=
Bytecode {
- Entry 1
+ Entry 2
CheckStack
PushConstant CP#0
PushStatic CP#0
@@ -145,8 +147,8 @@
IfNeStrictTOS
Jump L1
Allocate CP#5
- StoreLocal r0
- Push r0
+ StoreLocal r1
+ Push r1
PushConstant CP#7
IndirectStaticCall 1, CP#6
Drop1
@@ -154,6 +156,8 @@
IndirectStaticCall 0, CP#8
PushConstant CP#10
IndirectStaticCall 2, CP#2
+ StoreLocal r0
+ Push r0
StoreStaticTOS CP#0
Drop1
L1:
@@ -421,12 +425,16 @@
;
[@vm.bytecode=
Bytecode {
- Entry 0
+ Entry 2
CheckStack
Push FP[-5]
+ StoreLocal r0
+ Push r0
StoreStaticTOS CP#0
Drop1
PushConstant CP#1
+ StoreLocal r1
+ Push r1
StoreStaticTOS CP#2
Drop1
PushConstant CP#1
@@ -443,7 +451,7 @@
}
[@vm.bytecode=
Bytecode {
- Entry 1
+ Entry 2
CheckStack
PushConstant CP#0
PushStatic CP#0
@@ -470,6 +478,8 @@
PushConstant CP#5
PushStatic CP#5
InstanceCall1 1, CP#9
+ StoreLocal r1
+ Push r1
StoreStaticTOS CP#0
Drop1
L3:
@@ -582,9 +592,11 @@
return self::_print;
[@vm.bytecode=
Bytecode {
- Entry 0
+ Entry 1
CheckStack
Push FP[-5]
+ StoreLocal r0
+ Push r0
StoreStaticTOS CP#0
Drop1
PushConstant CP#1
@@ -599,15 +611,21 @@
}
[@vm.bytecode=
Bytecode {
- Entry 0
+ Entry 3
CheckStack
Push FP[-7]
+ StoreLocal r0
+ Push r0
StoreStaticTOS CP#0
Drop1
Push FP[-6]
+ StoreLocal r1
+ Push r1
StoreStaticTOS CP#1
Drop1
Push FP[-5]
+ StoreLocal r2
+ Push r2
StoreStaticTOS CP#2
Drop1
PushConstant CP#3
@@ -711,12 +729,15 @@
}
[@vm.bytecode=
Bytecode {
- Entry 0
+ Entry 1
CheckStack
PushConstant CP#0
+ StoreLocal r0
+ Push r0
PushConstant CP#2
IndirectStaticCall 1, CP#1
Drop1
+ Drop1
PushConstant CP#3
ReturnTOS
}
diff --git a/pkg/vm/testcases/bytecode/instance_creation.dart.expect b/pkg/vm/testcases/bytecode/instance_creation.dart.expect
index b91a903..ec7540c 100644
--- a/pkg/vm/testcases/bytecode/instance_creation.dart.expect
+++ b/pkg/vm/testcases/bytecode/instance_creation.dart.expect
@@ -3,8 +3,8 @@
import "dart:core" as core;
class Base<T1 extends core::Object = dynamic, T2 extends core::Object = dynamic> extends core::Object {
- generic-covariant-impl generic-covariant-interface field self::Base::T1 t1 = null;
- generic-covariant-impl generic-covariant-interface field self::Base::T2 t2 = null;
+ generic-covariant-impl field self::Base::T1 t1 = null;
+ generic-covariant-impl field self::Base::T2 t2 = null;
[@vm.bytecode=
Bytecode {
Entry 1
@@ -89,8 +89,6 @@
] constructor •(core::String s) → void
: super self::Base::•()
;
- abstract forwarding-stub set t1(generic-covariant-impl core::int _) → void;
- abstract forwarding-stub set t2(generic-covariant-impl core::String _) → void;
}
class B<T extends core::Object = dynamic> extends self::Base<core::List<self::B::T>, core::String> {
[@vm.bytecode=
@@ -141,7 +139,6 @@
: super self::Base::•() {
core::print("B: ${self::B::T}");
}
- abstract forwarding-stub set t2(generic-covariant-impl core::String _) → void;
}
class C extends core::Object {
[@vm.bytecode=
diff --git a/pkg/vm/testcases/bytecode/type_ops.dart.expect b/pkg/vm/testcases/bytecode/type_ops.dart.expect
index e6af3e1..f0549ca 100644
--- a/pkg/vm/testcases/bytecode/type_ops.dart.expect
+++ b/pkg/vm/testcases/bytecode/type_ops.dart.expect
@@ -66,7 +66,7 @@
;
}
class D<P extends core::Object = dynamic, Q extends core::Object = dynamic> extends self::C<core::int, self::D::Q, self::D::P> {
- generic-covariant-impl generic-covariant-interface field core::Map<self::D::P, self::D::Q> foo = null;
+ generic-covariant-impl field core::Map<self::D::P, self::D::Q> foo = null;
[@vm.bytecode=
Bytecode {
Entry 0
diff --git a/pkg/vm/testcases/transformations/type_flow/summary_collector/implicit_return_null.dart b/pkg/vm/testcases/transformations/type_flow/summary_collector/implicit_return_null.dart
index 16cfc50..11518c5 100644
--- a/pkg/vm/testcases/transformations/type_flow/summary_collector/implicit_return_null.dart
+++ b/pkg/vm/testcases/transformations/type_flow/summary_collector/implicit_return_null.dart
@@ -102,13 +102,15 @@
}
if3(bool c) {
- if (c) {} else {
+ if (c) {
+ } else {
throw 'Error!';
}
}
if4(bool c) {
- if (c) {} else {}
+ if (c) {
+ } else {}
}
void if5(bool c) {
diff --git a/pkg/vm/tool/test_bytecode b/pkg/vm/tool/test_bytecode
new file mode 100755
index 0000000..f1c4893
--- /dev/null
+++ b/pkg/vm/tool/test_bytecode
@@ -0,0 +1,66 @@
+#!/usr/bin/env bash
+# Copyright (c) 2018, 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.
+
+# Script for generating bytecode in a kernel file using Dart 2 pipeline and
+# interpreting the resulting bytecode.
+
+# Usage
+# pkg/vm/tool/test_bytecode ~/foo.dart
+
+set -e
+
+# Pick the architecture and mode to build and test.
+BUILD_FLAGS="-m debug -a x64"
+BUILD_SUBDIR="DebugX64"
+
+function follow_links() {
+ file="$1"
+ while [ -h "$file" ]; do
+ # On Mac OS, readlink -f doesn't work.
+ file="$(readlink "$file")"
+ done
+ echo "$file"
+}
+
+# Unlike $0, $BASH_SOURCE points to the absolute path of this file.
+PROG_NAME="$(follow_links "$BASH_SOURCE")"
+
+# Handle the case where dart-sdk/bin has been symlinked to.
+CUR_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
+
+SDK_DIR="$CUR_DIR/../../.."
+BUILD_DIR="$SDK_DIR/out/$BUILD_SUBDIR"
+
+# Verify that the VM supports the interpreter, if not, rebuild it.
+REBUILD=0
+if [ -f $BUILD_DIR/dart ]
+then
+ $BUILD_DIR/dart --trace-interpreter-after=-1 \
+ $SDK_DIR/runtime/tests/vm/dart/hello_world_test.dart > /dev/null 2>&1 \
+ || REBUILD=1
+else
+ REBUILD=1
+fi
+if [ $REBUILD -ne 0 ]
+then
+ echo "Rebuilding VM to support interpreter"
+ rm -rf $BUILD_DIR
+ $SDK_DIR/tools/gn.py $BUILD_FLAGS --gn-args=dart_use_interpreter=true
+ $SDK_DIR/tools/build.py $BUILD_FLAGS runtime
+fi
+
+# Generate dill file containing bytecode for input dart source.
+$CUR_DIR/gen_kernel --platform $BUILD_DIR/vm_platform_strong.dill \
+ --gen-bytecode $@ -o $BUILD_DIR/test_bytecode.dill
+
+# Required flags.
+DART_VM_FLAGS="--preview-dart-2 --optimization-counter-threshold=-1 $DART_VM_FLAGS"
+
+# Optional flags.
+# DART_VM_FLAGS="--force-log-flush --dump-kernel-bytecode --trace-interpreter-after=0 $DART_VM_FLAGS"
+
+# Execute dill file.
+exec $BUILD_DIR/dart $DART_VM_FLAGS $BUILD_DIR/test_bytecode.dill
+
diff --git a/runtime/BUILD.gn b/runtime/BUILD.gn
index f0e3eac..1a7fc12 100644
--- a/runtime/BUILD.gn
+++ b/runtime/BUILD.gn
@@ -143,6 +143,10 @@
]
}
+ if (dart_use_interpreter) {
+ defines += [ "DART_USE_INTERPRETER" ]
+ }
+
if (!is_win) {
cflags = [
"-Werror",
diff --git a/runtime/bin/gen_snapshot.cc b/runtime/bin/gen_snapshot.cc
index 4cf1c9d..6de85ad 100644
--- a/runtime/bin/gen_snapshot.cc
+++ b/runtime/bin/gen_snapshot.cc
@@ -156,7 +156,10 @@
#define BOOL_OPTIONS_LIST(V) \
V(dependencies_only, dependencies_only) \
V(print_dependencies, print_dependencies) \
- V(obfuscate, obfuscate)
+ V(obfuscate, obfuscate) \
+ V(verbose, verbose) \
+ V(version, version) \
+ V(help, help)
#define STRING_OPTION_DEFINITION(flag, variable) \
static const char* variable = NULL; \
@@ -187,6 +190,102 @@
return IsSnapshottingForPrecompilation() || (snapshot_kind == kCore);
}
+// clang-format off
+static void PrintUsage() {
+ Log::PrintErr(
+"Usage: gen_snapshot [<vm-flags>] [<options>] [<dart-script-file>] \n"
+" \n"
+"Common options: \n"
+"--package_root=<path> \n"
+" Where to find packages, that is, package:... imports. \n"
+"--packages=<packages_file> \n"
+" Where to find a package spec file \n"
+"--url_mapping=<mapping> \n"
+" Uses the URL mapping(s) specified on the command line to load the \n"
+" libraries. \n"
+"--dependencies=<output-file> \n"
+" Generates a Makefile with snapshot output files as targets and all \n"
+" transitive imports as sources. \n"
+"--print_dependencies \n"
+" Prints all transitive imports to stdout. \n"
+"--dependencies_only \n"
+" Don't create and output the snapshot. \n"
+"--help \n"
+" Display this message (add --verbose for information about all VM options).\n"
+"--version \n"
+" Print the VM version. \n"
+" \n"
+"To create a core snapshot: \n"
+"--snapshot_kind=core \n"
+"--vm_snapshot_data=<output-file> \n"
+"--isolate_snapshot_data=<output-file> \n"
+"[<dart-script-file>] \n"
+" \n"
+"Writes a snapshot of <dart-script-file> to the specified snapshot files. \n"
+"If no <dart-script-file> is passed, a generic snapshot of all the corelibs \n"
+"is created. \n"
+" \n"
+"To create a script snapshot with respect to a given core snapshot: \n"
+"--snapshot_kind=script \n"
+"--vm_snapshot_data=<input-file> \n"
+"--isolate_snapshot_data=<input-file> \n"
+"--script_snapshot=<output-file> \n"
+"<dart-script-file> \n"
+" \n"
+"Writes a snapshot of <dart-script-file> to the specified snapshot files. \n"
+"If no <dart-script-file> is passed, a generic snapshot of all the corelibs \n"
+"is created. \n"
+" \n"
+"To create an AOT application snapshot as blobs suitable for loading with \n"
+"mmap: \n"
+"--snapshot_kind=app-aot-blobs \n"
+"--vm_snapshot_data=<output-file> \n"
+"--vm_snapshot_instructions=<output-file> \n"
+"--isolate_snapshot_data=<output-file> \n"
+"--isolate_snapshot_instructions=<output-file> \n"
+"{--embedder_entry_points_manifest=<input-file>} \n"
+"[--obfuscate] \n"
+"[--save-obfuscation-map=<map-filename>] \n"
+" <dart-script-file> \n"
+" \n"
+"To create an AOT application snapshot as assembly suitable for compilation \n"
+"as a static or dynamic library: \n"
+"--snapshot_kind=app-aot-assembly \n"
+"--assembly=<output-file> \n"
+"{--embedder_entry_points_manifest=<input-file>} \n"
+"[--obfuscate] \n"
+"[--save-obfuscation-map=<map-filename>] \n"
+"<dart-script-file> \n"
+" \n"
+"AOT snapshots require entry points manifest files, which list the places \n"
+"in the Dart program the embedder calls from the C API (Dart_Invoke, etc). \n"
+"Not specifying these may cause the tree shaker to remove them from the \n"
+"program. The format of this manifest is as follows. Each line in the \n"
+"manifest is a comma separated list of three elements. The first entry is \n"
+"the library URI, the second entry is the class name and the final entry \n"
+"the function name. The file must be terminated with a newline character. \n"
+" \n"
+"Example: \n"
+" dart:something,SomeClass,doSomething \n"
+" \n"
+"AOT snapshots can be obfuscated: that is all identifiers will be renamed \n"
+"during compilation. This mode is enabled with --obfuscate flag. Mapping \n"
+"between original and obfuscated names can be serialized as a JSON array \n"
+"using --save-obfuscation-map=<filename> option. See dartbug.com/30524 \n"
+"for implementation details and limitations of the obfuscation pass. \n"
+" \n"
+"\n");
+ if (verbose) {
+ Log::PrintErr(
+"The following options are only used for VM development and may\n"
+"be changed in any future version:\n");
+ const char* print_flags = "--print_flags";
+ char* error = Dart_SetVMFlags(1, &print_flags);
+ ASSERT(error == NULL);
+ }
+}
+// clang-format on
+
// Parse out the command line arguments. Returns -1 if the arguments
// are incorrect, 0 otherwise.
static int ParseArguments(int argc,
@@ -218,6 +317,14 @@
*script_name = NULL;
}
+ if (help) {
+ PrintUsage();
+ Platform::Exit(0);
+ } else if (version) {
+ Log::PrintErr("Dart VM version: %s\n", Dart_VersionString());
+ Platform::Exit(0);
+ }
+
// Verify consistency of arguments.
if ((commandline_package_root != NULL) &&
(commandline_packages_file != NULL)) {
@@ -731,90 +838,6 @@
return lib;
}
-// clang-format off
-static void PrintUsage() {
- Log::PrintErr(
-"Usage: \n"
-" gen_snapshot [<vm-flags>] [<options>] [<dart-script-file>] \n"
-" \n"
-" Global options: \n"
-" --package_root=<path> Where to find packages, that is, \n"
-" package:... imports. \n"
-" \n"
-" --packages=<packages_file> Where to find a package spec file \n"
-" \n"
-" --url_mapping=<mapping> Uses the URL mapping(s) specified on \n"
-" the command line to load the \n"
-" libraries. \n"
-" --dependencies=<output-file> Generates a Makefile with snapshot output \n"
-" files as targets and all transitive imports\n"
-" as sources. \n"
-" --print_dependencies Prints all transitive imports to stdout. \n"
-" --dependencies_only Don't create and output the snapshot. \n"
-" \n"
-" To create a core snapshot: \n"
-" --snapshot_kind=core \n"
-" --vm_snapshot_data=<output-file> \n"
-" --isolate_snapshot_data=<output-file> \n"
-" [<dart-script-file>] \n"
-" \n"
-" Writes a snapshot of <dart-script-file> to the specified snapshot files. \n"
-" If no <dart-script-file> is passed, a generic snapshot of all the corelibs \n"
-" is created. \n"
-" \n"
-" To create a script snapshot with respect to a given core snapshot: \n"
-" --snapshot_kind=script \n"
-" --vm_snapshot_data=<input-file> \n"
-" --isolate_snapshot_data=<input-file> \n"
-" --script_snapshot=<output-file> \n"
-" <dart-script-file> \n"
-" \n"
-" Writes a snapshot of <dart-script-file> to the specified snapshot files. \n"
-" If no <dart-script-file> is passed, a generic snapshot of all the corelibs\n"
-" is created. \n"
-" \n"
-" To create an AOT application snapshot as blobs suitable for loading with \n"
-" mmap: \n"
-" --snapshot_kind=app-aot-blobs \n"
-" --vm_snapshot_data=<output-file> \n"
-" --vm_snapshot_instructions=<output-file> \n"
-" --isolate_snapshot_data=<output-file> \n"
-" --isolate_snapshot_instructions=<output-file> \n"
-" {--embedder_entry_points_manifest=<input-file>} \n"
-" [--obfuscate] \n"
-" [--save-obfuscation-map=<map-filename>] \n"
-" <dart-script-file> \n"
-" \n"
-" To create an AOT application snapshot as assembly suitable for compilation \n"
-" as a static or dynamic library: \n"
-" --snapshot_kind=app-aot-assembly \n"
-" --assembly=<output-file> \n"
-" {--embedder_entry_points_manifest=<input-file>} \n"
-" [--obfuscate] \n"
-" [--save-obfuscation-map=<map-filename>] \n"
-" <dart-script-file> \n"
-" \n"
-" AOT snapshots require entry points manifest files, which list the places \n"
-" in the Dart program the embedder calls from the C API (Dart_Invoke, etc). \n"
-" Not specifying these may cause the tree shaker to remove them from the \n"
-" program. The format of this manifest is as follows. Each line in the \n"
-" manifest is a comma separated list of three elements. The first entry is \n"
-" the library URI, the second entry is the class name and the final entry \n"
-" the function name. The file must be terminated with a newline character. \n"
-" \n"
-" Example: \n"
-" dart:something,SomeClass,doSomething \n"
-" \n"
-" AOT snapshots can be obfuscated: that is all identifiers will be renamed \n"
-" during compilation. This mode is enabled with --obfuscate flag. Mapping \n"
-" between original and obfuscated names can be serialized as a JSON array \n"
-" using --save-obfuscation-map=<filename> option. See dartbug.com/30524 \n"
-" for implementation details and limitations of the obfuscation pass. \n"
-" \n"
-"\n");
-}
-// clang-format on
-
static void LoadEntryPoint(size_t lib_index,
const Dart_QualifiedFunctionName* entry) {
if (strcmp(entry->library_uri, "::") == 0) {
diff --git a/runtime/lib/compact_hash.dart b/runtime/lib/compact_hash.dart
index 82bc532..fb3d938 100644
--- a/runtime/lib/compact_hash.dart
+++ b/runtime/lib/compact_hash.dart
@@ -460,12 +460,10 @@
static Set<R> _newEmpty<R>() => new _CompactLinkedHashSet<R>();
- Set<R> cast<R>() {
- Set<Object> self = this;
- return self is Set<R> ? self : Set.castFrom<E, R>(this, newSet: _newEmpty);
- }
+ Set<R> cast<R>() => Set.castFrom<E, R>(this, newSet: _newEmpty);
- Set<R> retype<R>() => Set.castFrom<E, R>(this, newSet: _newEmpty);
+ @Deprecated("Use cast instead.")
+ Set<R> retype<R>() => cast<R>();
int get length => _usedData - _deletedKeys;
@@ -623,12 +621,10 @@
static Set<R> _newEmpty<R>() => new _CompactLinkedIdentityHashSet<R>();
- Set<R> cast<R>() {
- Set<Object> self = this;
- return self is Set<R> ? self : Set.castFrom<E, R>(this, newSet: _newEmpty);
- }
+ Set<R> cast<R>() => Set.castFrom<E, R>(this, newSet: _newEmpty);
- Set<R> retype<R>() => Set.castFrom<E, R>(this, newSet: _newEmpty);
+ @Deprecated("Use cast instead.")
+ Set<R> retype<R>() => cast<R>();
}
class _CompactLinkedCustomHashSet<E> extends _CompactLinkedHashSet<E> {
@@ -646,12 +642,10 @@
_CompactLinkedCustomHashSet(this._equality, this._hasher, validKey)
: _validKey = (validKey != null) ? validKey : new _TypeTest<E>().test;
- Set<R> cast<R>() {
- Set<Object> self = this;
- return self is Set<R> ? self : Set.castFrom<E, R>(this);
- }
+ Set<R> cast<R>() => Set.castFrom<E, R>(this);
- Set<R> retype<R>() => Set.castFrom<E, R>(this);
+ @Deprecated("Use cast instead.")
+ Set<R> retype<R>() => cast<R>();
Set<E> toSet() =>
new _CompactLinkedCustomHashSet<E>(_equality, _hasher, _validKey)
diff --git a/runtime/lib/errors_patch.dart b/runtime/lib/errors_patch.dart
index 0eb39d1..73ea588 100644
--- a/runtime/lib/errors_patch.dart
+++ b/runtime/lib/errors_patch.dart
@@ -256,7 +256,8 @@
new Symbol(memberName),
invocation_type,
typeArguments != null
- ? _InvocationMirror._unpackTypeArguments(typeArguments)
+ // TODO(33073): Use actual count of type arguments in place of 0.
+ ? _InvocationMirror._unpackTypeArguments(typeArguments, 0)
: null,
argumentNames != null
? arguments.sublist(0, arguments.length - argumentNames.length)
diff --git a/runtime/lib/immutable_map.dart b/runtime/lib/immutable_map.dart
index 0417d71..2057a57 100644
--- a/runtime/lib/immutable_map.dart
+++ b/runtime/lib/immutable_map.dart
@@ -13,12 +13,10 @@
const _ImmutableMap._create(_ImmutableList keyValuePairs)
: _kvPairs = keyValuePairs;
- Map<K2, V2> cast<K2, V2>() {
- Map<Object, Object> self = this;
- return (self is Map<K2, V2>) ? self : this.retype<K2, V2>();
- }
+ Map<K2, V2> cast<K2, V2>() => Map.castFrom<K, V, K2, V2>(this);
- Map<K2, V2> retype<K2, V2>() => Map.castFrom<K, V, K2, V2>(this);
+ @Deprecated("Use cast instead.")
+ Map<K2, V2> retype<K2, V2>() => cast<K2, V2>();
V operator [](Object key) {
// To preserve the key-value order of the map literal, the keys are
diff --git a/runtime/lib/invocation_mirror_patch.dart b/runtime/lib/invocation_mirror_patch.dart
index 06ceeb4..46bc649 100644
--- a/runtime/lib/invocation_mirror_patch.dart
+++ b/runtime/lib/invocation_mirror_patch.dart
@@ -88,13 +88,13 @@
// A TypeArguments object does not have a corresponding Dart class and
// cannot be accessed as an array in Dart. Therefore, we need a native
// call to unpack the individual types into a list.
- _typeArguments = _unpackTypeArguments(_arguments[0]);
+ _typeArguments = _unpackTypeArguments(_arguments[0], typeArgsLen);
}
return _typeArguments;
}
// Unpack the given TypeArguments object into a new list of individual types.
- static List<Type> _unpackTypeArguments(typeArguments)
+ static List<Type> _unpackTypeArguments(typeArguments, int numTypeArguments)
native "InvocationMirror_unpackTypeArguments";
List get positionalArguments {
diff --git a/runtime/lib/mirrors.cc b/runtime/lib/mirrors.cc
index 362842d..3524eef 100644
--- a/runtime/lib/mirrors.cc
+++ b/runtime/lib/mirrors.cc
@@ -1217,49 +1217,6 @@
return param.bound();
}
-DEFINE_NATIVE_ENTRY(Mirrors_evalInLibraryWithPrivateKey, 2) {
- GET_NON_NULL_NATIVE_ARGUMENT(String, expression, arguments->NativeArgAt(0));
- GET_NATIVE_ARGUMENT(String, private_key, arguments->NativeArgAt(1));
-
- const GrowableObjectArray& libraries =
- GrowableObjectArray::Handle(isolate->object_store()->libraries());
- const int num_libraries = libraries.Length();
- Library& each_library = Library::Handle();
- Library& ctxt_library = Library::Handle();
- String& library_key = String::Handle();
-
- if (private_key.IsNull()) {
- ctxt_library = Library::CoreLibrary();
- } else {
- for (int i = 0; i < num_libraries; i++) {
- each_library ^= libraries.At(i);
- library_key = each_library.private_key();
- if (library_key.Equals(private_key)) {
- ctxt_library = each_library.raw();
- break;
- }
- }
- }
- ASSERT(!ctxt_library.IsNull());
- const Object& result = Object::Handle(ctxt_library.Evaluate(
- expression, Array::empty_array(), Array::empty_array()));
- if (result.IsError()) {
- Exceptions::PropagateError(Error::Cast(result));
- UNREACHABLE();
- }
-
- // Because we currently only use this native for building field extractors and
- // setters, assume the result is a closure and mark its function as invisible,
- // so it will not appear in stack traces. Whenever we support
- // ObjectMirror.evaluate this will need to be separated.
- ASSERT(result.IsClosure());
- const Function& func = Function::Handle(Closure::Cast(result).function());
- func.set_is_visible(false);
- func.set_is_debuggable(false);
-
- return result.raw();
-}
-
DEFINE_NATIVE_ENTRY(TypedefMirror_declaration, 1) {
GET_NON_NULL_NATIVE_ARGUMENT(Type, type, arguments->NativeArgAt(0));
ASSERT(type.IsFunctionType());
diff --git a/runtime/lib/mirrors_impl.dart b/runtime/lib/mirrors_impl.dart
index 4688f63..5c42dc4 100644
--- a/runtime/lib/mirrors_impl.dart
+++ b/runtime/lib/mirrors_impl.dart
@@ -67,150 +67,6 @@
bool _subtypeTest(Type a, Type b) native 'TypeMirror_subtypeTest';
-class _AccessorCacheAssociation<T extends Function> {
- String key;
- T value;
- bool usedSinceGrowth = true;
- _AccessorCacheAssociation(this.key, this.value);
-}
-
-/**
- * A map that will grow as associations are added but will prefer to evict
- * associations that have not been used since the last growth when needing to
- * grow again. Implemented as an open addressing hash table.
- */
-class _AccessorCache<T extends Function> {
- List<_AccessorCacheAssociation<T>> table;
- int shift;
- int mask;
- int capacity; // Max number of associations before we start evicting/growing.
- int size = 0; // Current number of associations.
-
- /**
- * Create a cache whose capacity is 75% of 2^shift.
- */
- _AccessorCache.withInitialShift(int shift) {
- // The scheme used here for handling collisions relies on there always
- // being at least one empty slot.
- if (shift < 1) {
- throw new _InternalMirrorError("_AccessorCache requires a shift >= 1");
- }
- initWithShift(shift);
- }
-
- void initWithShift(int shift) {
- this.shift = shift;
- this.mask = (1 << shift) - 1;
- this.capacity = (1 << shift) * 3 ~/ 4;
- this.table = new List<_AccessorCacheAssociation<T>>(1 << shift);
- assert(table.length > capacity);
- }
-
- int scanFor(String key) {
- var start = key.hashCode & mask;
- var index = start;
- do {
- var assoc = table[index];
- if (null == assoc || assoc.key == key) {
- return index;
- }
- index = (index + 1) & mask;
- } while (index != start);
- // Should never happen because we start evicting associations before the
- // table is full.
- throw new _InternalMirrorError("Internal error: _AccessorCache table full");
- }
-
- int scanForEmpty(String key) {
- var start = key.hashCode & mask;
- var index = start;
- do {
- if (null == table[index]) {
- return index;
- }
- index = (index + 1) & mask;
- } while (index != start);
- // Should never happen because we start evicting associations before the
- // table is full.
- throw new _InternalMirrorError("Internal error: _AccessorCache table full");
- }
-
- void fixCollisionsAfter(int start) {
- var assoc;
- var index = (start + 1) & mask;
- while (null != (assoc = table[index])) {
- var newIndex = scanFor(assoc.key);
- if (newIndex != index) {
- assert(table[newIndex] == null);
- table[newIndex] = assoc;
- table[index] = null;
- }
- index = (index + 1) & mask;
- }
- }
-
- void grow() {
- var oldTable = table;
-
- initWithShift(shift + 1);
-
- for (int oldIndex = 0; oldIndex < oldTable.length; oldIndex++) {
- var assoc = oldTable[oldIndex];
- if (assoc != null) {
- var newIndex = scanForEmpty(assoc.key);
- assoc.usedSinceGrowth = false;
- table[newIndex] = assoc;
- }
- }
- }
-
- void tryToShrinkOtherwiseGrow() {
- // Remove any associations not accessed since the last growth. If we are
- // unable to free any slots, grow.
- bool needToGrow = true;
- for (int i = 0; i < table.length; i++) {
- var assoc = table[i];
- if (null != assoc && (!assoc.usedSinceGrowth || null == assoc.value)) {
- table[i] = null;
- size--;
- fixCollisionsAfter(i);
- needToGrow = false;
- }
- }
- if (needToGrow) grow();
- }
-
- operator []=(String key, T value) {
- int index = scanFor(key);
- var assoc = table[index];
- if (null != assoc) {
- // Existing key, replace value.
- assert(assoc.key == key);
- assoc.value = value;
- assoc.usedSinceGrowth = true;
- } else {
- // New key.
- var newAssoc = new _AccessorCacheAssociation(key, value);
- if (size == capacity) {
- // No free slots.
- tryToShrinkOtherwiseGrow();
- index = scanFor(key);
- assert(table[index] == null);
- }
- table[index] = newAssoc;
- size++;
- }
- }
-
- T operator [](String key) {
- var index = scanFor(key);
- var assoc = table[index];
- if (null == assoc) return null;
- assoc.usedSinceGrowth = true;
- return assoc.value;
- }
-}
-
class _LocalMirrorSystem extends MirrorSystem {
final TypeMirror dynamicType = new _SpecialTypeMirror('dynamic');
final TypeMirror voidType = new _SpecialTypeMirror('void');
@@ -425,89 +281,15 @@
return identityHashCode(_reflectee) ^ 0x36363636;
}
- static var _getFieldClosures =
- new _AccessorCache<dynamic Function(dynamic)>.withInitialShift(4);
- static var _setFieldClosures =
- new _AccessorCache<dynamic Function(dynamic, dynamic)>.withInitialShift(
- 4);
-
- _createGetterClosure(unwrapped) {
- var atPosition = unwrapped.indexOf('@');
- if (atPosition == -1) {
- // Public symbol.
- return _eval('(x) => x.$unwrapped', null);
- } else {
- // Private symbol.
- var withoutKey = unwrapped.substring(0, atPosition);
- var privateKey = unwrapped.substring(atPosition);
- return _eval('(x) => x.$withoutKey', privateKey);
- }
- }
-
- _getFieldSlow(unwrapped) {
- // Slow path factored out to give the fast path a better chance at being
- // inlined.
- var result = reflect(_invokeGetter(_reflectee, unwrapped));
- // Wait until success to avoid creating closures for non-existent getters,
- // and defer the creation until the next getField invocation.
- // o.<operator> is not valid Dart and will cause a compilation error, so
- // don't attempt to generate such a closure.
- bool isOperator = _LocalMethodMirror._operators.contains(unwrapped);
- if (!isOperator) {
- _getFieldClosures[unwrapped] = (receiver) {
- var getterClosure = _createGetterClosure(unwrapped);
- _getFieldClosures[unwrapped] = getterClosure;
- return getterClosure(receiver);
- };
- }
- return result;
- }
-
InstanceMirror getField(Symbol memberName) {
- var unwrapped = _n(memberName);
- var f = _getFieldClosures[unwrapped];
- return (f == null) ? _getFieldSlow(unwrapped) : reflect(f(_reflectee));
- }
-
- _createSetterClosure(unwrapped) {
- var atPosition = unwrapped.indexOf('@');
- if (atPosition == -1) {
- // Public symbol.
- return _eval('(x, v) => x.$unwrapped = v', null);
- } else {
- // Private symbol.
- var withoutKey = unwrapped.substring(0, atPosition);
- var privateKey = unwrapped.substring(atPosition);
- return _eval('(x, v) => x.$withoutKey = v', privateKey);
- }
- }
-
- _setFieldSlow(unwrapped, arg) {
- // Slow path factored out to give the fast path a better chance at being
- // inlined.
- _invokeSetter(_reflectee, unwrapped, arg);
- var result = reflect(arg);
- // Wait until success to avoid creating closures for non-existent setters.
- // and defer the creation until the next setField invocation.
- _setFieldClosures[unwrapped] = (receiver, argument) {
- var setterClosure = _createSetterClosure(unwrapped);
- _setFieldClosures[unwrapped] = setterClosure;
- return setterClosure(receiver, argument);
- };
- return result;
+ return reflect(_invokeGetter(_reflectee, _n(memberName)));
}
InstanceMirror setField(Symbol memberName, arg) {
- var unwrapped = _n(memberName);
- var f = _setFieldClosures[unwrapped];
- return (f == null)
- ? _setFieldSlow(unwrapped, arg)
- : reflect(f(_reflectee, arg));
+ _invokeSetter(_reflectee, _n(memberName), arg);
+ return reflect(arg);
}
- static _eval(expression, privateKey)
- native "Mirrors_evalInLibraryWithPrivateKey";
-
// Override to include the receiver in the arguments.
InstanceMirror invoke(Symbol memberName, List positionalArguments,
[Map<Symbol, dynamic> namedArguments]) {
@@ -658,11 +440,15 @@
var _superinterfaces;
List<ClassMirror> get superinterfaces {
if (_superinterfaces == null) {
- _superinterfaces = isOriginalDeclaration
+ var interfaceTypes = isOriginalDeclaration
? _nativeInterfaces(_reflectedType)
: _nativeInterfacesInstantiated(_reflectedType);
- _superinterfaces = new UnmodifiableListView<ClassMirror>(
- _superinterfaces.map(reflectType));
+ var interfaceMirrors = new List<ClassMirror>();
+ for (var interfaceType in interfaceTypes) {
+ interfaceMirrors.add(reflectType(interfaceType));
+ }
+ _superinterfaces =
+ new UnmodifiableListView<ClassMirror>(interfaceMirrors);
}
return _superinterfaces;
}
@@ -1311,12 +1097,14 @@
_LocalLibraryDependencyMirror(
this.sourceLibrary,
this._targetMirrorOrPrefix,
- this.combinators,
+ List<dynamic> mutableCombinators,
prefixString,
this.isImport,
this.isDeferred,
List<dynamic> unwrappedMetadata)
: prefix = _s(prefixString),
+ combinators = new UnmodifiableListView<CombinatorMirror>(
+ mutableCombinators.cast<CombinatorMirror>()),
metadata = new UnmodifiableListView<InstanceMirror>(
unwrappedMetadata.map(reflect));
@@ -1354,7 +1142,8 @@
final bool isShow;
_LocalCombinatorMirror(identifierString, this.isShow)
- : this.identifiers = [_s(identifierString)];
+ : this.identifiers =
+ new UnmodifiableListView<Symbol>(<Symbol>[_s(identifierString)]);
bool get isHide => !isShow;
}
diff --git a/runtime/lib/object.cc b/runtime/lib/object.cc
index 9008f08..dd04cd4 100644
--- a/runtime/lib/object.cc
+++ b/runtime/lib/object.cc
@@ -468,16 +468,24 @@
zone, parent_type_arguments, smi_parent_len.Value(), smi_len.Value());
}
-DEFINE_NATIVE_ENTRY(InvocationMirror_unpackTypeArguments, 1) {
+DEFINE_NATIVE_ENTRY(InvocationMirror_unpackTypeArguments, 2) {
const TypeArguments& type_arguments =
TypeArguments::CheckedHandle(zone, arguments->NativeArgAt(0));
- const intptr_t len = type_arguments.Length();
+ const Smi& num_type_arguments =
+ Smi::CheckedHandle(zone, arguments->NativeArgAt(1));
+ bool all_dynamic = type_arguments.IsNull();
+ const intptr_t len =
+ all_dynamic ? num_type_arguments.Value() : type_arguments.Length();
const Array& type_list = Array::Handle(
zone, Array::New(len, Type::Handle(zone, Type::DartTypeType())));
AbstractType& type = AbstractType::Handle(zone);
for (intptr_t i = 0; i < len; i++) {
- type = type_arguments.TypeAt(i);
- type_list.SetAt(i, type);
+ if (all_dynamic) {
+ type_list.SetAt(i, Object::dynamic_type());
+ } else {
+ type = type_arguments.TypeAt(i);
+ type_list.SetAt(i, type);
+ }
}
type_list.MakeImmutable();
return type_list.raw();
diff --git a/runtime/lib/typed_data_patch.dart b/runtime/lib/typed_data_patch.dart
index 383bfcd..b868a2d 100644
--- a/runtime/lib/typed_data_patch.dart
+++ b/runtime/lib/typed_data_patch.dart
@@ -123,12 +123,10 @@
Iterable<int> followedBy(Iterable<int> other) =>
new FollowedByIterable<int>.firstEfficient(this, other);
- List<R> cast<R>() {
- List<Object> self = this;
- return self is List<R> ? self : List.castFrom<int, R>(this);
- }
+ List<R> cast<R>() => List.castFrom<int, R>(this);
- List<R> retype<R>() => List.castFrom<int, R>(this);
+ @Deprecated("Use cast instead.")
+ List<R> retype<R>() => cast<R>();
void set first(int value) {
if (this.length == 0) throw new RangeError.index(0, this);
@@ -486,12 +484,10 @@
Iterable<double> followedBy(Iterable<double> other) =>
new FollowedByIterable<double>.firstEfficient(this, other);
- List<R> cast<R>() {
- List<Object> self = this;
- return self is List<R> ? self : List.castFrom<double, R>(this);
- }
+ List<R> cast<R>() => List.castFrom<double, R>(this);
- List<R> retype<R>() => List.castFrom<double, R>(this);
+ @Deprecated("Use cast instead.")
+ List<R> retype<R>() => cast<R>();
void set first(double value) {
if (this.length == 0) throw new RangeError.index(0, this);
@@ -852,12 +848,10 @@
Iterable<Float32x4> followedBy(Iterable<Float32x4> other) =>
new FollowedByIterable<Float32x4>.firstEfficient(this, other);
- List<R> cast<R>() {
- List<Object> self = this;
- return self is List<R> ? self : List.castFrom<Float32x4, R>(this);
- }
+ List<R> cast<R>() => List.castFrom<Float32x4, R>(this);
- List<R> retype<R>() => List.castFrom<Float32x4, R>(this);
+ @Deprecated("Use cast instead.")
+ List<R> retype<R>() => cast<R>();
void set first(Float32x4 value) {
if (this.length == 0) throw new RangeError.index(0, this);
@@ -1222,12 +1216,10 @@
Iterable<Int32x4> followedBy(Iterable<Int32x4> other) =>
new FollowedByIterable<Int32x4>.firstEfficient(this, other);
- List<R> cast<R>() {
- List<Object> self = this;
- return self is List<R> ? self : List.castFrom<Int32x4, R>(this);
- }
+ List<R> cast<R>() => List.castFrom<Int32x4, R>(this);
- List<R> retype<R>() => List.castFrom<Int32x4, R>(this);
+ @Deprecated("Use cast instead.")
+ List<R> retype<R>() => cast<R>();
void set first(Int32x4 value) {
if (this.length == 0) throw new RangeError.index(0, this);
@@ -1591,12 +1583,10 @@
Iterable<Float64x2> followedBy(Iterable<Float64x2> other) =>
new FollowedByIterable<Float64x2>.firstEfficient(this, other);
- List<R> cast<R>() {
- List<Object> self = this;
- return self is List<R> ? self : List.castFrom<Float64x2, R>(this);
- }
+ List<R> cast<R>() => List.castFrom<Float64x2, R>(this);
- List<R> retype<R>() => List.castFrom<Float64x2, R>(this);
+ @Deprecated("Use cast instead.")
+ List<R> retype<R>() => cast<R>();
void set first(Float64x2 value) {
if (this.length == 0) throw new RangeError.index(0, this);
diff --git a/runtime/platform/globals.h b/runtime/platform/globals.h
index ef225bc..517d182 100644
--- a/runtime/platform/globals.h
+++ b/runtime/platform/globals.h
@@ -140,6 +140,11 @@
#error DART_PRECOMPILED_RUNTIME and DART_NOSNAPSHOT are mutually exclusive
#endif // defined(DART_PRECOMPILED_RUNTIME) && defined(DART_NOSNAPSHOT)
+#if defined(DART_PRECOMPILED_RUNTIME) || defined(DART_PRECOMPILER)
+// TODO(zra): Fix GN build file not to define DART_USE_INTERPRETER in this case.
+#undef DART_USE_INTERPRETER
+#endif // defined(DART_PRECOMPILED_RUNTIME) || defined(DART_PRECOMPILER)
+
#if defined(DART_PRECOMPILED_RUNTIME)
#define NOT_IN_PRECOMPILED(code)
#else
diff --git a/runtime/runtime_args.gni b/runtime/runtime_args.gni
index e88807e..f6586e2 100644
--- a/runtime/runtime_args.gni
+++ b/runtime/runtime_args.gni
@@ -77,4 +77,8 @@
} else {
dart_component_kind = "static_library"
}
+
+ # Whether the runtime should interpret called functions for which bytecode
+ # is provided by kernel, rather than compile them before execution.
+ dart_use_interpreter = false
}
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index 1c25d3c..6e45883 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -9,7 +9,6 @@
cc/Fail0: Fail # These tests are expected to crash on all platforms.
cc/Fail1: Fail # These tests are expected to crash on all platforms.
cc/Fail2: Fail # These tests are expected to crash on all platforms.
-cc/IsolateReload_ChangeInstanceFormat9: Fail, Crash # issue 32942
cc/IsolateReload_PendingConstructorCall_AbstractToConcrete: Fail, Crash # Issue 32981. Fails on non-Windows, crashes on Windows (because of test.py special handline)
cc/IsolateReload_PendingConstructorCall_ConcreteToAbstract: Fail, Crash # Issue 32981. Fails on non-Windows, crashes on Windows (because of test.py special handline)
cc/IsolateReload_PendingStaticCall_DefinedToNSM: Fail # Issue 32981
diff --git a/runtime/vm/bootstrap_natives.h b/runtime/vm/bootstrap_natives.h
index b292388..b4152ff 100644
--- a/runtime/vm/bootstrap_natives.h
+++ b/runtime/vm/bootstrap_natives.h
@@ -316,7 +316,7 @@
V(Internal_inquireIs64Bit, 0) \
V(Internal_extractTypeArguments, 2) \
V(Internal_prependTypeArguments, 4) \
- V(InvocationMirror_unpackTypeArguments, 1) \
+ V(InvocationMirror_unpackTypeArguments, 2) \
V(NoSuchMethodError_existingMethodSignature, 3) \
V(LinkedHashMap_getIndex, 1) \
V(LinkedHashMap_setIndex, 2) \
@@ -357,7 +357,6 @@
// List of bootstrap native entry points used in the dart:mirror library.
#define MIRRORS_BOOTSTRAP_NATIVE_LIST(V) \
- V(Mirrors_evalInLibraryWithPrivateKey, 2) \
V(Mirrors_makeLocalClassMirror, 1) \
V(Mirrors_makeLocalTypeMirror, 1) \
V(Mirrors_instantiateGenericType, 2) \
diff --git a/runtime/vm/compiler/assembler/disassembler_kbc.cc b/runtime/vm/compiler/assembler/disassembler_kbc.cc
new file mode 100644
index 0000000..0fefb14
--- /dev/null
+++ b/runtime/vm/compiler/assembler/disassembler_kbc.cc
@@ -0,0 +1,367 @@
+// Copyright (c) 2018, 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.
+
+#include "vm/globals.h"
+#if defined(DART_USE_INTERPRETER)
+
+#include "vm/compiler/assembler/disassembler_kbc.h"
+
+#include "platform/assert.h"
+#include "vm/constants_kbc.h"
+#include "vm/cpu.h"
+#include "vm/instructions.h"
+
+namespace dart {
+
+static const char* kOpcodeNames[] = {
+#define BYTECODE_NAME(name, encoding, op1, op2, op3) #name,
+ KERNEL_BYTECODES_LIST(BYTECODE_NAME)
+#undef BYTECODE_NAME
+};
+
+static const size_t kOpcodeCount =
+ sizeof(kOpcodeNames) / sizeof(kOpcodeNames[0]);
+
+typedef void (*BytecodeFormatter)(char* buffer,
+ intptr_t size,
+ uword pc,
+ uint32_t bc);
+typedef void (*Fmt)(char** buf, intptr_t* size, uword pc, int32_t value);
+
+template <typename ValueType>
+void FormatOperand(char** buf,
+ intptr_t* size,
+ const char* fmt,
+ ValueType value) {
+ intptr_t written = Utils::SNPrint(*buf, *size, fmt, value);
+ if (written < *size) {
+ *buf += written;
+ *size += written;
+ } else {
+ *size = -1;
+ }
+}
+
+static void Fmt___(char** buf, intptr_t* size, uword pc, int32_t value) {}
+
+static void Fmttgt(char** buf, intptr_t* size, uword pc, int32_t value) {
+ FormatOperand(buf, size, "-> %" Px, pc + (value << 2));
+}
+
+static void Fmtlit(char** buf, intptr_t* size, uword pc, int32_t value) {
+ FormatOperand(buf, size, "k%d", value);
+}
+
+static void Fmtreg(char** buf, intptr_t* size, uword pc, int32_t value) {
+ FormatOperand(buf, size, "r%d", value);
+}
+
+static void Fmtxeg(char** buf, intptr_t* size, uword pc, int32_t value) {
+ if (value < 0) {
+ FormatOperand(buf, size, "FP[%d]", value);
+ } else {
+ Fmtreg(buf, size, pc, value);
+ }
+}
+
+static void Fmtnum(char** buf, intptr_t* size, uword pc, int32_t value) {
+ FormatOperand(buf, size, "#%d", value);
+}
+
+static void Apply(char** buf,
+ intptr_t* size,
+ uword pc,
+ Fmt fmt,
+ int32_t value,
+ const char* suffix) {
+ if (*size <= 0) {
+ return;
+ }
+
+ fmt(buf, size, pc, value);
+ if (*size > 0) {
+ FormatOperand(buf, size, "%s", suffix);
+ }
+}
+
+static void Format0(char* buf,
+ intptr_t size,
+ uword pc,
+ uint32_t op,
+ Fmt op1,
+ Fmt op2,
+ Fmt op3) {}
+
+static void FormatT(char* buf,
+ intptr_t size,
+ uword pc,
+ uint32_t op,
+ Fmt op1,
+ Fmt op2,
+ Fmt op3) {
+ const int32_t x = static_cast<int32_t>(op) >> 8;
+ Apply(&buf, &size, pc, op1, x, "");
+}
+
+static void FormatA(char* buf,
+ intptr_t size,
+ uword pc,
+ uint32_t op,
+ Fmt op1,
+ Fmt op2,
+ Fmt op3) {
+ const int32_t a = (op & 0xFF00) >> 8;
+ Apply(&buf, &size, pc, op1, a, "");
+}
+
+static void FormatA_D(char* buf,
+ intptr_t size,
+ uword pc,
+ uint32_t op,
+ Fmt op1,
+ Fmt op2,
+ Fmt op3) {
+ const int32_t a = (op & 0xFF00) >> 8;
+ const int32_t bc = op >> 16;
+ Apply(&buf, &size, pc, op1, a, ", ");
+ Apply(&buf, &size, pc, op2, bc, "");
+}
+
+static void FormatA_X(char* buf,
+ intptr_t size,
+ uword pc,
+ uint32_t op,
+ Fmt op1,
+ Fmt op2,
+ Fmt op3) {
+ const int32_t a = (op & 0xFF00) >> 8;
+ const int32_t bc = static_cast<int32_t>(op) >> 16;
+ Apply(&buf, &size, pc, op1, a, ", ");
+ Apply(&buf, &size, pc, op2, bc, "");
+}
+
+static void FormatX(char* buf,
+ intptr_t size,
+ uword pc,
+ uint32_t op,
+ Fmt op1,
+ Fmt op2,
+ Fmt op3) {
+ const int32_t bc = static_cast<int32_t>(op) >> 16;
+ Apply(&buf, &size, pc, op1, bc, "");
+}
+
+static void FormatD(char* buf,
+ intptr_t size,
+ uword pc,
+ uint32_t op,
+ Fmt op1,
+ Fmt op2,
+ Fmt op3) {
+ const int32_t bc = op >> 16;
+ Apply(&buf, &size, pc, op1, bc, "");
+}
+
+static void FormatA_B_C(char* buf,
+ intptr_t size,
+ uword pc,
+ uint32_t op,
+ Fmt op1,
+ Fmt op2,
+ Fmt op3) {
+ const int32_t a = (op >> 8) & 0xFF;
+ const int32_t b = (op >> 16) & 0xFF;
+ const int32_t c = (op >> 24) & 0xFF;
+ Apply(&buf, &size, pc, op1, a, ", ");
+ Apply(&buf, &size, pc, op2, b, ", ");
+ Apply(&buf, &size, pc, op3, c, "");
+}
+
+static void FormatA_B_Y(char* buf,
+ intptr_t size,
+ uword pc,
+ uint32_t op,
+ Fmt op1,
+ Fmt op2,
+ Fmt op3) {
+ const int32_t a = (op >> 8) & 0xFF;
+ const int32_t b = (op >> 16) & 0xFF;
+ const int32_t y = static_cast<int8_t>((op >> 24) & 0xFF);
+ Apply(&buf, &size, pc, op1, a, ", ");
+ Apply(&buf, &size, pc, op2, b, ", ");
+ Apply(&buf, &size, pc, op3, y, "");
+}
+
+#define BYTECODE_FORMATTER(name, encoding, op1, op2, op3) \
+ static void Format##name(char* buf, intptr_t size, uword pc, uint32_t op) { \
+ Format##encoding(buf, size, pc, op, Fmt##op1, Fmt##op2, Fmt##op3); \
+ }
+KERNEL_BYTECODES_LIST(BYTECODE_FORMATTER)
+#undef BYTECODE_FORMATTER
+
+static const BytecodeFormatter kFormatters[] = {
+#define BYTECODE_FORMATTER(name, encoding, op1, op2, op3) &Format##name,
+ KERNEL_BYTECODES_LIST(BYTECODE_FORMATTER)
+#undef BYTECODE_FORMATTER
+};
+
+static bool HasLoadFromPool(KBCInstr instr) {
+ switch (KernelBytecode::DecodeOpcode(instr)) {
+ case KernelBytecode::kLoadConstant:
+ case KernelBytecode::kPushConstant:
+ case KernelBytecode::kStaticCall:
+ case KernelBytecode::kIndirectStaticCall:
+ case KernelBytecode::kInstanceCall1:
+ case KernelBytecode::kInstanceCall2:
+ case KernelBytecode::kInstanceCall1Opt:
+ case KernelBytecode::kInstanceCall2Opt:
+ case KernelBytecode::kStoreStaticTOS:
+ case KernelBytecode::kPushStatic:
+ case KernelBytecode::kAllocate:
+ case KernelBytecode::kInstantiateType:
+ case KernelBytecode::kInstantiateTypeArgumentsTOS:
+ case KernelBytecode::kAssertAssignable:
+ return true;
+ default:
+ return false;
+ }
+}
+
+static bool GetLoadedObjectAt(uword pc,
+ const ObjectPool& object_pool,
+ Object* obj) {
+ KBCInstr instr = KernelBytecode::At(pc);
+ if (HasLoadFromPool(instr)) {
+ uint16_t index = KernelBytecode::DecodeD(instr);
+ if (object_pool.TypeAt(index) == ObjectPool::kTaggedObject) {
+ *obj = object_pool.ObjectAt(index);
+ return true;
+ }
+ }
+ return false;
+}
+
+void KernelBytecodeDisassembler::DecodeInstruction(char* hex_buffer,
+ intptr_t hex_size,
+ char* human_buffer,
+ intptr_t human_size,
+ int* out_instr_size,
+ const Code& bytecode,
+ Object** object,
+ uword pc) {
+#if !defined(PRODUCT)
+ const uint32_t instr = *reinterpret_cast<uint32_t*>(pc);
+ const uint8_t opcode = instr & 0xFF;
+ ASSERT(opcode < kOpcodeCount);
+ size_t name_size =
+ Utils::SNPrint(human_buffer, human_size, "%-10s\t", kOpcodeNames[opcode]);
+
+ human_buffer += name_size;
+ human_size -= name_size;
+ kFormatters[opcode](human_buffer, human_size, pc, instr);
+
+ Utils::SNPrint(hex_buffer, hex_size, "%08x", instr);
+ if (out_instr_size) {
+ *out_instr_size = sizeof(uint32_t);
+ }
+
+ *object = NULL;
+ if (!bytecode.IsNull()) {
+ *object = &Object::Handle();
+ const ObjectPool& pool = ObjectPool::Handle(bytecode.object_pool());
+ if (!GetLoadedObjectAt(pc, pool, *object)) {
+ *object = NULL;
+ }
+ }
+#else
+ UNREACHABLE();
+#endif
+}
+
+void KernelBytecodeDisassembler::Disassemble(uword start,
+ uword end,
+ DisassemblyFormatter* formatter,
+ const Code& bytecode) {
+#if !defined(PRODUCT)
+ const Code::Comments& comments =
+ bytecode.IsNull() ? Code::Comments::New(0) : bytecode.comments();
+ ASSERT(formatter != NULL);
+ char hex_buffer[kHexadecimalBufferSize]; // Instruction in hexadecimal form.
+ char human_buffer[kUserReadableBufferSize]; // Human-readable instruction.
+ uword pc = start;
+ intptr_t comment_finger = 0;
+ GrowableArray<const Function*> inlined_functions;
+ GrowableArray<TokenPosition> token_positions;
+ while (pc < end) {
+ const intptr_t offset = pc - start;
+ const intptr_t old_comment_finger = comment_finger;
+ while (comment_finger < comments.Length() &&
+ comments.PCOffsetAt(comment_finger) <= offset) {
+ formatter->Print(
+ " ;; %s\n",
+ String::Handle(comments.CommentAt(comment_finger)).ToCString());
+ comment_finger++;
+ }
+ if (old_comment_finger != comment_finger) {
+ char str[4000];
+ BufferFormatter f(str, sizeof(str));
+ // Comment emitted, emit inlining information.
+ bytecode.GetInlinedFunctionsAtInstruction(offset, &inlined_functions,
+ &token_positions);
+ // Skip top scope function printing (last entry in 'inlined_functions').
+ bool first = true;
+ for (intptr_t i = 1; i < inlined_functions.length(); i++) {
+ const char* name = inlined_functions[i]->ToQualifiedCString();
+ if (first) {
+ f.Print(" ;; Inlined [%s", name);
+ first = false;
+ } else {
+ f.Print(" -> %s", name);
+ }
+ }
+ if (!first) {
+ f.Print("]\n");
+ formatter->Print(str);
+ }
+ }
+ int instruction_length;
+ Object* object;
+ DecodeInstruction(hex_buffer, sizeof(hex_buffer), human_buffer,
+ sizeof(human_buffer), &instruction_length, bytecode,
+ &object, pc);
+ formatter->ConsumeInstruction(bytecode, hex_buffer, sizeof(hex_buffer),
+ human_buffer, sizeof(human_buffer), object,
+ pc);
+ pc += instruction_length;
+ }
+#else
+ UNREACHABLE();
+#endif
+}
+
+void KernelBytecodeDisassembler::Disassemble(const Function& function) {
+#if !defined(PRODUCT)
+ ASSERT(function.HasBytecode());
+ const char* function_fullname = function.ToFullyQualifiedCString();
+ Zone* zone = Thread::Current()->zone();
+ const Code& bytecode = Code::Handle(zone, function.Bytecode());
+ THR_Print("Bytecode for function '%s' {\n", function_fullname);
+ const Instructions& instr = Instructions::Handle(bytecode.instructions());
+ uword start = instr.PayloadStart();
+ DisassembleToStdout stdout_formatter;
+ LogBlock lb;
+ Disassemble(start, start + instr.Size(), &stdout_formatter, bytecode);
+ THR_Print("}\n");
+
+ const ObjectPool& object_pool =
+ ObjectPool::Handle(zone, bytecode.GetObjectPool());
+ object_pool.DebugPrint();
+#else
+ UNREACHABLE();
+#endif
+}
+
+} // namespace dart
+
+#endif // defined(DART_USE_INTERPRETER)
diff --git a/runtime/vm/compiler/assembler/disassembler_kbc.h b/runtime/vm/compiler/assembler/disassembler_kbc.h
new file mode 100644
index 0000000..b3e2408
--- /dev/null
+++ b/runtime/vm/compiler/assembler/disassembler_kbc.h
@@ -0,0 +1,89 @@
+// Copyright (c) 2018, 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.
+
+#ifndef RUNTIME_VM_COMPILER_ASSEMBLER_DISASSEMBLER_KBC_H_
+#define RUNTIME_VM_COMPILER_ASSEMBLER_DISASSEMBLER_KBC_H_
+
+#include "vm/globals.h"
+#if defined(DART_USE_INTERPRETER)
+
+#include "vm/compiler/assembler/disassembler.h"
+
+namespace dart {
+
+// Disassemble instructions.
+class KernelBytecodeDisassembler : public AllStatic {
+ public:
+ // Disassemble instructions between start and end.
+ // (The assumption is that start is at a valid instruction).
+ // Return true if all instructions were successfully decoded, false otherwise.
+ static void Disassemble(uword start,
+ uword end,
+ DisassemblyFormatter* formatter,
+ const Code& bytecode);
+
+ static void Disassemble(uword start,
+ uword end,
+ DisassemblyFormatter* formatter) {
+ Disassemble(start, end, formatter, Code::Handle());
+ }
+
+ static void Disassemble(uword start, uword end, const Code& bytecode) {
+#if !defined(PRODUCT)
+ DisassembleToStdout stdout_formatter;
+ LogBlock lb;
+ Disassemble(start, end, &stdout_formatter, bytecode);
+#else
+ UNREACHABLE();
+#endif
+ }
+
+ static void Disassemble(uword start, uword end) {
+#if !defined(PRODUCT)
+ DisassembleToStdout stdout_formatter;
+ LogBlock lb;
+ Disassemble(start, end, &stdout_formatter);
+#else
+ UNREACHABLE();
+#endif
+ }
+
+ static void Disassemble(uword start,
+ uword end,
+ char* buffer,
+ uintptr_t buffer_size) {
+#if !defined(PRODUCT)
+ DisassembleToMemory memory_formatter(buffer, buffer_size);
+ LogBlock lb;
+ Disassemble(start, end, &memory_formatter);
+#else
+ UNREACHABLE();
+#endif
+ }
+
+ // Decodes one instruction.
+ // Writes a hexadecimal representation into the hex_buffer and a
+ // human-readable representation into the human_buffer.
+ // Writes the length of the decoded instruction in bytes in out_instr_len.
+ static void DecodeInstruction(char* hex_buffer,
+ intptr_t hex_size,
+ char* human_buffer,
+ intptr_t human_size,
+ int* out_instr_len,
+ const Code& bytecode,
+ Object** object,
+ uword pc);
+
+ static void Disassemble(const Function& function);
+
+ private:
+ static const int kHexadecimalBufferSize = 32;
+ static const int kUserReadableBufferSize = 256;
+};
+
+} // namespace dart
+
+#endif // defined(DART_USE_INTERPRETER)
+
+#endif // RUNTIME_VM_COMPILER_ASSEMBLER_DISASSEMBLER_KBC_H_
diff --git a/runtime/vm/compiler/backend/flow_graph.cc b/runtime/vm/compiler/backend/flow_graph.cc
index 499bfc7..5411f90 100644
--- a/runtime/vm/compiler/backend/flow_graph.cc
+++ b/runtime/vm/compiler/backend/flow_graph.cc
@@ -426,7 +426,7 @@
// may later add overriding methods.
return true;
}
- Definition* callee_receiver = call->ArgumentAt(0);
+ Definition* callee_receiver = call->Receiver()->definition();
ASSERT(callee_receiver != NULL);
if (function().IsDynamicFunction() && IsReceiver(callee_receiver)) {
const String& name =
diff --git a/runtime/vm/compiler/backend/il.cc b/runtime/vm/compiler/backend/il.cc
index c0d51f7..247a75b 100644
--- a/runtime/vm/compiler/backend/il.cc
+++ b/runtime/vm/compiler/backend/il.cc
@@ -3699,7 +3699,7 @@
}
Definition* InstanceCallInstr::Canonicalize(FlowGraph* flow_graph) {
- const intptr_t receiver_cid = PushArgumentAt(0)->value()->Type()->ToCid();
+ const intptr_t receiver_cid = Receiver()->Type()->ToCid();
// TODO(erikcorry): Even for cold call sites we could still try to look up
// methods when we know the receiver cid. We don't currently do this because
diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h
index 2fee1fc..a957568 100644
--- a/runtime/vm/compiler/backend/il.h
+++ b/runtime/vm/compiler/backend/il.h
@@ -3077,6 +3077,9 @@
}
intptr_t FirstArgIndex() const { return type_args_len_ > 0 ? 1 : 0; }
+ Value* Receiver() const {
+ return this->PushArgumentAt(FirstArgIndex())->value();
+ }
intptr_t ArgumentCountWithoutTypeArgs() const {
return arguments_->length() - FirstArgIndex();
}
@@ -3324,6 +3327,8 @@
}
intptr_t type_args_len() const { return instance_call()->type_args_len(); }
+ Value* Receiver() const { return instance_call()->Receiver(); }
+
bool HasOnlyDispatcherOrImplicitAccessorTargets() const;
const CallTargets& targets() const { return targets_; }
diff --git a/runtime/vm/compiler/backend/inliner.cc b/runtime/vm/compiler/backend/inliner.cc
index e137fad..9e2bd30 100644
--- a/runtime/vm/compiler/backend/inliner.cc
+++ b/runtime/vm/compiler/backend/inliner.cc
@@ -1388,16 +1388,17 @@
// Find the closure of the callee.
ASSERT(call->ArgumentCount() > 0);
Function& target = Function::ZoneHandle();
- AllocateObjectInstr* alloc =
- call->ArgumentAt(0)->OriginalDefinition()->AsAllocateObject();
- if ((alloc != NULL) && !alloc->closure_function().IsNull()) {
- target ^= alloc->closure_function().raw();
- ASSERT(alloc->cls().IsClosureClass());
- }
- ConstantInstr* constant =
- call->ArgumentAt(0)->OriginalDefinition()->AsConstant();
- if ((constant != NULL) && constant->value().IsClosure()) {
- target ^= Closure::Cast(constant->value()).function();
+ Definition* receiver =
+ call->Receiver()->definition()->OriginalDefinition();
+ if (AllocateObjectInstr* alloc = receiver->AsAllocateObject()) {
+ if (!alloc->closure_function().IsNull()) {
+ target ^= alloc->closure_function().raw();
+ ASSERT(alloc->cls().IsClosureClass());
+ }
+ } else if (ConstantInstr* constant = receiver->AsConstant()) {
+ if (constant->value().IsClosure()) {
+ target ^= Closure::Cast(constant->value()).function();
+ }
}
if (target.IsNull()) {
@@ -1712,7 +1713,7 @@
// Replace the receiver argument with a redefinition to prevent code from
// the inlined body from being hoisted above the inlined entry.
GrowableArray<Definition*> arguments(call_->ArgumentCount());
- Definition* receiver = call_->ArgumentAt(0);
+ Definition* receiver = call_->Receiver()->definition();
RedefinitionInstr* redefinition =
new (Z) RedefinitionInstr(new (Z) Value(receiver));
redefinition->set_ssa_temp_index(
@@ -1768,7 +1769,7 @@
BlockEntryInstr* current_block = entry;
Instruction* cursor = entry;
- Definition* receiver = call_->ArgumentAt(0);
+ Definition* receiver = call_->Receiver()->definition();
// There are at least two variants including non-inlined ones, so we have
// at least one branch on the class id.
LoadClassIdInstr* load_cid =
@@ -2930,13 +2931,14 @@
TargetEntryInstr* entry;
Definition* last;
if (FlowGraphInliner::TryInlineRecognizedMethod(
- flow_graph, receiver_cid, target, call, call->ArgumentAt(0),
- call->token_pos(), call->ic_data(), &entry, &last, policy)) {
+ flow_graph, receiver_cid, target, call,
+ call->Receiver()->definition(), call->token_pos(), call->ic_data(),
+ &entry, &last, policy)) {
// Insert receiver class check if needed.
if (MethodRecognizer::PolymorphicTarget(target) ||
flow_graph->InstanceCallNeedsClassCheck(call, target.kind())) {
Instruction* check = flow_graph->CreateCheckClass(
- call->ArgumentAt(0), *Cids::Create(Z, *call->ic_data(), 0),
+ call->Receiver()->definition(), *Cids::Create(Z, *call->ic_data(), 0),
call->deopt_id(), call->token_pos());
flow_graph->InsertBefore(call, check, call->env(), FlowGraph::kEffect);
}
@@ -2980,9 +2982,8 @@
Definition* receiver = NULL;
intptr_t receiver_cid = kIllegalCid;
if (!call->function().is_static()) {
- receiver = call->ArgumentAt(call->FirstArgIndex());
- receiver_cid =
- call->PushArgumentAt(call->FirstArgIndex())->value()->Type()->ToCid();
+ receiver = call->Receiver()->definition();
+ receiver_cid = call->Receiver()->Type()->ToCid();
}
if (FlowGraphInliner::TryInlineRecognizedMethod(
flow_graph, receiver_cid, call->function(), call, receiver,
diff --git a/runtime/vm/compiler/backend/type_propagator.cc b/runtime/vm/compiler/backend/type_propagator.cc
index 76cf248..6b9c5bb 100644
--- a/runtime/vm/compiler/backend/type_propagator.cc
+++ b/runtime/vm/compiler/backend/type_propagator.cc
@@ -298,19 +298,22 @@
void FlowGraphTypePropagator::VisitInstanceCall(InstanceCallInstr* instr) {
if (instr->has_unique_selector()) {
- SetCid(instr->ArgumentAt(0), instr->ic_data()->GetReceiverClassIdAt(0));
+ SetCid(instr->Receiver()->definition(),
+ instr->ic_data()->GetReceiverClassIdAt(0));
return;
}
- CheckNonNullSelector(instr, instr->ArgumentAt(0), instr->function_name());
+ CheckNonNullSelector(instr, instr->Receiver()->definition(),
+ instr->function_name());
}
void FlowGraphTypePropagator::VisitPolymorphicInstanceCall(
PolymorphicInstanceCallInstr* instr) {
if (instr->instance_call()->has_unique_selector()) {
- SetCid(instr->ArgumentAt(0), instr->targets().MonomorphicReceiverCid());
+ SetCid(instr->Receiver()->definition(),
+ instr->targets().MonomorphicReceiverCid());
return;
}
- CheckNonNullSelector(instr, instr->ArgumentAt(0),
+ CheckNonNullSelector(instr, instr->Receiver()->definition(),
instr->instance_call()->function_name());
}
diff --git a/runtime/vm/compiler/call_specializer.cc b/runtime/vm/compiler/call_specializer.cc
index adfdeb3..637823d 100644
--- a/runtime/vm/compiler/call_specializer.cc
+++ b/runtime/vm/compiler/call_specializer.cc
@@ -284,8 +284,7 @@
return;
}
- const intptr_t receiver_cid =
- call->PushArgumentAt(0)->value()->Type()->ToCid();
+ const intptr_t receiver_cid = call->Receiver()->Type()->ToCid();
if (receiver_cid == kDynamicCid) {
return; // No information about receiver was infered.
}
diff --git a/runtime/vm/compiler/compiler_sources.gni b/runtime/vm/compiler/compiler_sources.gni
index af0ec3f..376f43b 100644
--- a/runtime/vm/compiler/compiler_sources.gni
+++ b/runtime/vm/compiler/compiler_sources.gni
@@ -26,6 +26,8 @@
"assembler/disassembler_arm.cc",
"assembler/disassembler_arm64.cc",
"assembler/disassembler_dbc.cc",
+ "assembler/disassembler_kbc.cc",
+ "assembler/disassembler_kbc.h",
"assembler/disassembler_x86.cc",
"backend/block_scheduler.cc",
"backend/block_scheduler.h",
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
index 5d5b373..0e85f68 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
@@ -4,6 +4,7 @@
#include "vm/compiler/frontend/kernel_binary_flowgraph.h"
#include "vm/compiler/aot/precompiler.h"
+#include "vm/compiler/assembler/disassembler_kbc.h"
#include "vm/compiler/frontend/prologue_builder.h"
#include "vm/compiler/jit/compiler.h"
#include "vm/longjump.h"
@@ -14,6 +15,11 @@
#if !defined(DART_PRECOMPILED_RUNTIME)
namespace dart {
+
+#if defined(DART_USE_INTERPRETER)
+DEFINE_FLAG(bool, dump_kernel_bytecode, false, "Dump kernel bytecode");
+#endif // defined(DART_USE_INTERPRETER)
+
namespace kernel {
#define Z (zone_)
@@ -907,6 +913,262 @@
return InferredTypeMetadata(cid, nullable);
}
+#if defined(DART_USE_INTERPRETER)
+void BytecodeMetadataHelper::CopyBytecode(const Function& function) {
+ // TODO(regis): Avoid copying bytecode from mapped kernel binary.
+ const intptr_t node_offset = function.kernel_offset();
+ const intptr_t md_offset = GetNextMetadataPayloadOffset(node_offset);
+ if (md_offset < 0) {
+ return;
+ }
+
+ AlternativeReadingScope alt(&builder_->reader_, &H.metadata_payloads(),
+ md_offset - MetadataPayloadOffset);
+
+ // Read bytecode.
+ intptr_t bytecode_size = builder_->reader_.ReadUInt();
+ intptr_t bytecode_offset = builder_->reader_.offset();
+ uint8_t* bytecode_data = builder_->reader_.CopyDataIntoZone(
+ builder_->zone_, bytecode_offset, bytecode_size);
+
+ // This enum and the code below reading the constant pool from kernel must be
+ // kept in sync with pkg/vm/lib/bytecode/constant_pool.dart.
+ enum ConstantPoolTag {
+ kInvalid,
+ kNull,
+ kString,
+ kInt,
+ kDouble,
+ kBool,
+ kArgDesc,
+ kICData,
+ kStaticICData,
+ kField,
+ kFieldOffset,
+ kClass,
+ kTypeArgumentsFieldOffset,
+ kTearOff,
+ kType,
+ kTypeArguments,
+ kList,
+ kInstance,
+ kSymbol,
+ kTypeArgumentsForInstanceAllocation,
+ };
+
+ // Read object pool.
+ builder_->reader_.set_offset(bytecode_offset + bytecode_size);
+ intptr_t obj_count = builder_->reader_.ReadListLength();
+ const ObjectPool& obj_pool =
+ ObjectPool::Handle(builder_->zone_, ObjectPool::New(obj_count));
+ Object& obj = Object::Handle(builder_->zone_);
+ Object& elem = Object::Handle(builder_->zone_);
+ Array& array = Array::Handle(builder_->zone_);
+ Field& field = Field::Handle(builder_->zone_);
+ String& name = String::Handle(builder_->zone_);
+ for (intptr_t i = 0; i < obj_count; ++i) {
+ const intptr_t tag = builder_->ReadTag();
+ switch (tag) {
+ case ConstantPoolTag::kInvalid:
+ UNREACHABLE();
+ case ConstantPoolTag::kNull:
+ obj = Object::null();
+ break;
+ case ConstantPoolTag::kString:
+ obj = H.DartString(builder_->ReadStringReference()).raw();
+ ASSERT(obj.IsString());
+ obj = H.Canonicalize(String::Cast(obj));
+ break;
+ case ConstantPoolTag::kInt: {
+ uint32_t low_bits = builder_->ReadUInt32();
+ int64_t value = builder_->ReadUInt32();
+ value = (value << 32) | low_bits;
+ obj = Integer::New(value);
+ } break;
+ case ConstantPoolTag::kDouble: {
+ uint32_t low_bits = builder_->ReadUInt32();
+ uint64_t bits = builder_->ReadUInt32();
+ bits = (bits << 32) | low_bits;
+ double value = bit_cast<double, uint64_t>(bits);
+ obj = Double::New(value);
+ } break;
+ case ConstantPoolTag::kBool:
+ if (builder_->ReadUInt() == 1) {
+ obj = Bool::True().raw();
+ } else {
+ obj = Bool::False().raw();
+ }
+ break;
+ case ConstantPoolTag::kArgDesc: {
+ intptr_t num_arguments = builder_->ReadUInt();
+ intptr_t num_type_args = builder_->ReadUInt();
+ intptr_t num_arg_names = builder_->ReadListLength();
+ if (num_arg_names == 0) {
+ obj = ArgumentsDescriptor::New(num_type_args, num_arguments);
+ } else {
+ array = Array::New(num_arg_names);
+ for (intptr_t j = 0; j < num_arg_names; j++) {
+ array.SetAt(j, H.DartSymbolPlain(builder_->ReadStringReference()));
+ }
+ obj = ArgumentsDescriptor::New(num_type_args, num_arguments, array);
+ }
+ } break;
+ case ConstantPoolTag::kICData: {
+ NameIndex target = builder_->ReadCanonicalNameReference();
+ name = H.DartProcedureName(target).raw();
+ intptr_t arg_desc_index = builder_->ReadUInt();
+ ASSERT(arg_desc_index < i);
+ array ^= obj_pool.ObjectAt(arg_desc_index);
+ // TODO(regis): Should num_args_tested be explicitly provided?
+ obj = ICData::New(function, name,
+ array, // Arguments descriptor.
+ Thread::kNoDeoptId, 1 /* num_args_tested */,
+ ICData::RebindRule::kInstance);
+#if defined(TAG_IC_DATA)
+ ICData::Cast(obj).set_tag(Instruction::kInstanceCall);
+#endif
+ } break;
+ case ConstantPoolTag::kStaticICData: {
+ NameIndex target = builder_->ReadCanonicalNameReference();
+ if (H.IsConstructor(target)) {
+ name = H.DartConstructorName(target).raw();
+ elem = H.LookupConstructorByKernelConstructor(target);
+ } else {
+ name = H.DartProcedureName(target).raw();
+ elem = H.LookupStaticMethodByKernelProcedure(target);
+ }
+ ASSERT(elem.IsFunction());
+ intptr_t arg_desc_index = builder_->ReadUInt();
+ ASSERT(arg_desc_index < i);
+ array ^= obj_pool.ObjectAt(arg_desc_index);
+ obj = ICData::New(function, name,
+ array, // Arguments descriptor.
+ Thread::kNoDeoptId, 0 /* num_args_tested */,
+ ICData::RebindRule::kStatic);
+ ICData::Cast(obj).AddTarget(Function::Cast(elem));
+#if defined(TAG_IC_DATA)
+ ICData::Cast(obj).set_tag(Instruction::kStaticCall);
+#endif
+ } break;
+ case ConstantPoolTag::kField:
+ obj =
+ H.LookupFieldByKernelField(builder_->ReadCanonicalNameReference());
+ ASSERT(obj.IsField());
+ break;
+ case ConstantPoolTag::kFieldOffset:
+ obj =
+ H.LookupFieldByKernelField(builder_->ReadCanonicalNameReference());
+ ASSERT(obj.IsField());
+ obj = Smi::New(Field::Cast(obj).Offset() / kWordSize);
+ break;
+ case ConstantPoolTag::kClass:
+ obj =
+ H.LookupClassByKernelClass(builder_->ReadCanonicalNameReference());
+ ASSERT(obj.IsClass());
+ break;
+ case ConstantPoolTag::kTypeArgumentsFieldOffset:
+ obj =
+ H.LookupClassByKernelClass(builder_->ReadCanonicalNameReference());
+ ASSERT(obj.IsClass());
+ obj = Smi::New(Class::Cast(obj).type_arguments_field_offset() /
+ kWordSize);
+ break;
+ case ConstantPoolTag::kTearOff:
+ obj = H.LookupStaticMethodByKernelProcedure(
+ builder_->ReadCanonicalNameReference());
+ ASSERT(obj.IsFunction());
+ obj = Function::Cast(obj).ImplicitClosureFunction();
+ ASSERT(obj.IsFunction());
+ obj = Function::Cast(obj).ImplicitStaticClosure();
+ ASSERT(obj.IsInstance());
+ obj = H.Canonicalize(Instance::Cast(obj));
+ break;
+ case ConstantPoolTag::kType:
+ UNIMPLEMENTED(); // Encoding is under discussion with CFE team.
+ obj = builder_->type_translator_.BuildType().raw();
+ ASSERT(obj.IsAbstractType());
+ break;
+ case ConstantPoolTag::kTypeArguments:
+ UNIMPLEMENTED(); // Encoding is under discussion with CFE team.
+ obj = builder_->type_translator_
+ .BuildTypeArguments(builder_->ReadListLength())
+ .raw();
+ ASSERT(obj.IsNull() || obj.IsTypeArguments());
+ break;
+ case ConstantPoolTag::kList: {
+ obj = builder_->type_translator_.BuildType().raw();
+ ASSERT(obj.IsAbstractType());
+ const intptr_t length = builder_->ReadListLength();
+ array = Array::New(length, AbstractType::Cast(obj));
+ for (intptr_t j = 0; j < length; j++) {
+ intptr_t elem_index = builder_->ReadUInt();
+ ASSERT(elem_index < i);
+ elem = obj_pool.ObjectAt(elem_index);
+ array.SetAt(j, elem);
+ }
+ obj = H.Canonicalize(Array::Cast(obj));
+ ASSERT(!obj.IsNull());
+ } break;
+ case ConstantPoolTag::kInstance: {
+ obj =
+ H.LookupClassByKernelClass(builder_->ReadCanonicalNameReference());
+ ASSERT(obj.IsClass());
+ obj = Instance::New(Class::Cast(obj), Heap::kOld);
+ intptr_t elem_index = builder_->ReadUInt();
+ ASSERT(elem_index < i);
+ elem = obj_pool.ObjectAt(elem_index);
+ if (!elem.IsNull()) {
+ ASSERT(elem.IsTypeArguments());
+ Instance::Cast(obj).SetTypeArguments(TypeArguments::Cast(elem));
+ }
+ intptr_t num_fields = builder_->ReadUInt();
+ for (intptr_t j = 0; j < num_fields; j++) {
+ NameIndex field_name = builder_->ReadCanonicalNameReference();
+ ASSERT(H.IsField(field_name));
+ field = H.LookupFieldByKernelField(field_name);
+ intptr_t elem_index = builder_->ReadUInt();
+ ASSERT(elem_index < i);
+ elem = obj_pool.ObjectAt(elem_index);
+ Instance::Cast(obj).SetField(field, elem);
+ }
+ obj = H.Canonicalize(Instance::Cast(obj));
+ } break;
+ case ConstantPoolTag::kSymbol:
+ obj = H.DartSymbolPlain(builder_->ReadStringReference()).raw();
+ ASSERT(String::Cast(obj).IsSymbol());
+ break;
+ case kTypeArgumentsForInstanceAllocation: {
+ obj =
+ H.LookupClassByKernelClass(builder_->ReadCanonicalNameReference());
+ ASSERT(obj.IsClass());
+ intptr_t elem_index = builder_->ReadUInt();
+ ASSERT(elem_index < i);
+ elem = obj_pool.ObjectAt(elem_index);
+ ASSERT(elem.IsNull() || elem.IsTypeArguments());
+ elem = Type::New(Class::Cast(obj), TypeArguments::Cast(elem),
+ TokenPosition::kNoSource);
+ elem = ClassFinalizer::FinalizeType(Class::Cast(obj), Type::Cast(elem));
+ obj = Type::Cast(elem).arguments();
+ } break;
+ default:
+ UNREACHABLE();
+ }
+ obj_pool.SetTypeAt(i, ObjectPool::kTaggedObject);
+ obj_pool.SetObjectAt(i, obj);
+ }
+
+ const Code& bytecode = Code::Handle(
+ builder_->zone_,
+ Code::FinalizeBytecode(reinterpret_cast<void*>(bytecode_data),
+ bytecode_size, obj_pool));
+ function.AttachBytecode(bytecode);
+
+ if (FLAG_dump_kernel_bytecode) {
+ KernelBytecodeDisassembler::Disassemble(function);
+ }
+}
+#endif // defined(DART_USE_INTERPRETER)
+
StreamingScopeBuilder::StreamingScopeBuilder(ParsedFunction* parsed_function)
: result_(NULL),
parsed_function_(parsed_function),
@@ -5788,6 +6050,17 @@
SetOffset(kernel_offset);
+#if defined(DART_USE_INTERPRETER)
+ // TODO(regis): Clean up this logic of when to compile.
+ // If the bytecode was previously loaded, we really want to compile.
+ if (!function.HasBytecode()) {
+ bytecode_metadata_helper_.CopyBytecode(function);
+ if (function.HasBytecode()) {
+ return NULL;
+ }
+ }
+#endif
+
// We need to read out the NSM-forwarder bit before we can build scopes.
switch (function.kind()) {
case RawFunction::kImplicitClosureFunction:
@@ -10684,6 +10957,9 @@
procedure_attributes_metadata_helper_.SetMetadataMappings(
offset + kUInt32Size, mappings_num);
}
+ } else if (H.StringEquals(tag, BytecodeMetadataHelper::tag())) {
+ bytecode_metadata_helper_.SetMetadataMappings(offset + kUInt32Size,
+ mappings_num);
}
}
}
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
index 87ef12b..77d8ce6 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
@@ -92,7 +92,6 @@
enum Flag {
kIsGenericCovariantImpl = 1 << 0,
- kIsGenericCovariantInterface = 1 << 1
};
explicit TypeParameterHelper(KernelReaderHelper* helper) {
@@ -150,7 +149,6 @@
kConst = 1 << 1,
kCovariant = 1 << 3,
kIsGenericCovariantImpl = 1 << 5,
- kIsGenericCovariantInterface = 1 << 6
};
explicit VariableDeclarationHelper(KernelReaderHelper* helper)
@@ -169,9 +167,6 @@
bool IsFinal() { return (flags_ & kFinal) != 0; }
bool IsCovariant() { return (flags_ & kCovariant) != 0; }
- bool IsGenericCovariantInterface() {
- return (flags_ & kIsGenericCovariantInterface) != 0;
- }
bool IsGenericCovariantImpl() {
return (flags_ & kIsGenericCovariantImpl) != 0;
}
@@ -215,7 +210,6 @@
kStatic = 1 << 2,
kIsCovariant = 1 << 5,
kIsGenericCovariantImpl = 1 << 6,
- kIsGenericCovariantInterface = 1 << 7
};
explicit FieldHelper(KernelReaderHelper* helper)
@@ -242,9 +236,6 @@
bool IsGenericCovariantImpl() {
return (flags_ & kIsGenericCovariantImpl) != 0;
}
- bool IsGenericCovariantInterface() {
- return (flags_ & kIsGenericCovariantInterface) != 0;
- }
bool FieldHasFunctionLiteralInitializer(TokenPosition* start,
TokenPosition* end) {
@@ -673,6 +664,19 @@
ProcedureAttributesMetadata* metadata);
};
+// Helper class which provides access to bytecode metadata.
+class BytecodeMetadataHelper : public MetadataHelper {
+ public:
+ static const char* tag() { return "vm.bytecode"; }
+
+ explicit BytecodeMetadataHelper(StreamingFlowGraphBuilder* builder)
+ : MetadataHelper(builder) {}
+
+#if defined(DART_USE_INTERPRETER)
+ void CopyBytecode(const Function& function);
+#endif
+};
+
class StreamingDartTypeTranslator {
public:
StreamingDartTypeTranslator(StreamingFlowGraphBuilder* builder,
@@ -1188,6 +1192,7 @@
direct_call_metadata_helper_(this),
inferred_type_metadata_helper_(this),
procedure_attributes_metadata_helper_(this),
+ bytecode_metadata_helper_(this),
metadata_scanned_(false) {}
StreamingFlowGraphBuilder(TranslationHelper* translation_helper,
@@ -1210,6 +1215,7 @@
direct_call_metadata_helper_(this),
inferred_type_metadata_helper_(this),
procedure_attributes_metadata_helper_(this),
+ bytecode_metadata_helper_(this),
metadata_scanned_(false) {}
StreamingFlowGraphBuilder(TranslationHelper* translation_helper,
@@ -1232,6 +1238,7 @@
direct_call_metadata_helper_(this),
inferred_type_metadata_helper_(this),
procedure_attributes_metadata_helper_(this),
+ bytecode_metadata_helper_(this),
metadata_scanned_(false) {}
virtual ~StreamingFlowGraphBuilder() {}
@@ -1561,6 +1568,7 @@
DirectCallMetadataHelper direct_call_metadata_helper_;
InferredTypeMetadataHelper inferred_type_metadata_helper_;
ProcedureAttributesMetadataHelper procedure_attributes_metadata_helper_;
+ BytecodeMetadataHelper bytecode_metadata_helper_;
bool metadata_scanned_;
friend class ClassHelper;
@@ -1568,6 +1576,7 @@
friend class ConstructorHelper;
friend class DirectCallMetadataHelper;
friend class ProcedureAttributesMetadataHelper;
+ friend class BytecodeMetadataHelper;
friend class FieldHelper;
friend class FunctionNodeHelper;
friend class InferredTypeMetadataHelper;
diff --git a/runtime/vm/compiler/jit/compiler.cc b/runtime/vm/compiler/jit/compiler.cc
index 81113f6..18225e6 100644
--- a/runtime/vm/compiler/jit/compiler.cc
+++ b/runtime/vm/compiler/jit/compiler.cc
@@ -161,7 +161,11 @@
/* not building var desc */ NULL,
/* not inlining */ NULL, optimized, osr_id);
FlowGraph* graph = builder.BuildGraph();
+#if defined(DART_USE_INTERPRETER)
+ ASSERT((graph != NULL) || parsed_function->function().HasBytecode());
+#else
ASSERT(graph != NULL);
+#endif
return graph;
}
FlowGraphBuilder builder(*parsed_function, ic_data_array,
@@ -255,6 +259,14 @@
}
Exceptions::PropagateError(Error::Cast(result));
}
+#if defined(DART_USE_INTERPRETER)
+ // TODO(regis): Revisit.
+ if (!function.HasCode() && function.HasBytecode()) {
+ // Function was not actually compiled, but its bytecode was loaded.
+ // Verify that InterpretCall stub code was installed.
+ ASSERT(function.CurrentCode() == StubCode::InterpretCall_entry()->code());
+ }
+#endif
}
bool Compiler::CanOptimizeFunction(Thread* thread, const Function& function) {
@@ -816,6 +828,13 @@
zone, parsed_function(), *ic_data_array, osr_id(), optimized());
}
+#if defined(DART_USE_INTERPRETER)
+ // TODO(regis): Revisit.
+ if (flow_graph == NULL && function.HasBytecode()) {
+ return Code::null();
+ }
+#endif
+
const bool print_flow_graph =
(FLAG_print_flow_graph ||
(optimized() && FLAG_print_flow_graph_optimized)) &&
@@ -997,6 +1016,14 @@
}
const Code& result = Code::Handle(helper.Compile(pipeline));
+
+#if defined(DART_USE_INTERPRETER)
+ // TODO(regis): Revisit.
+ if (result.IsNull() && function.HasBytecode()) {
+ return Object::null();
+ }
+#endif
+
if (!result.IsNull()) {
if (!optimized) {
function.SetWasCompiled(true);
diff --git a/runtime/vm/constants_dbc.h b/runtime/vm/constants_dbc.h
index b30f42c..2c94483 100644
--- a/runtime/vm/constants_dbc.h
+++ b/runtime/vm/constants_dbc.h
@@ -953,7 +953,7 @@
const char* names[] = {
#define NAME(name, encoding, op1, op2, op3) #name,
BYTECODES_LIST(NAME)
-#undef DECLARE_BYTECODE
+#undef NAME
};
return names[DecodeOpcode(instr)];
}
diff --git a/runtime/vm/constants_kbc.h b/runtime/vm/constants_kbc.h
new file mode 100644
index 0000000..52ceebf
--- /dev/null
+++ b/runtime/vm/constants_kbc.h
@@ -0,0 +1,1090 @@
+// Copyright (c) 2018, 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.
+
+#ifndef RUNTIME_VM_CONSTANTS_KBC_H_
+#define RUNTIME_VM_CONSTANTS_KBC_H_
+
+#include "platform/assert.h"
+#include "platform/globals.h"
+#include "platform/utils.h"
+
+namespace dart {
+
+// clang-format off
+// List of KernelBytecode instructions.
+//
+// INTERPRETER STATE
+//
+// current frame info (see stack_frame_kbc.h for layout)
+// v-----^-----v
+// ~----+----~ ~----+-------+-------+-~ ~-+-------+-------+-~
+// ~ | ~ ~ | FP[0] | FP[1] | ~ ~ | SP[-1]| SP[0] |
+// ~----+----~ ~----+-------+-------+-~ ~-+-------+-------+-~
+// ^ ^
+// FP SP
+//
+//
+// The state of execution is captured in few interpreter registers:
+//
+// FP - base of the current frame
+// SP - top of the stack (TOS) for the current frame
+// PP - object pool for the currently execution function
+//
+// Frame info stored below FP additionally contains pointers to the currently
+// executing function and code (see stack_frame_dbc.h for more information).
+//
+// In the unoptimized code most of bytecodes take operands implicitly from
+// stack and store results again on the stack. Constant operands are usually
+// taken from the object pool by index.
+//
+// ENCODING
+//
+// Each instruction is a 32-bit integer with opcode stored in the least
+// significant byte. The following operand encodings are used:
+//
+// 0........8.......16.......24.......32
+// +--------+--------+--------+--------+
+// | opcode |~~~~~~~~~~~~~~~~~~~~~~~~~~| 0: no operands
+// +--------+--------+--------+--------+
+//
+// +--------+--------+--------+--------+
+// | opcode | A |~~~~~~~~~~~~~~~~~| A: single unsigned 8-bit operand
+// +--------+--------+--------+--------+
+//
+// +--------+--------+--------+--------+
+// | opcode | A | D | A_D: unsigned 8-bit operand and
+// +--------+--------+--------+--------+ unsigned 16-bit operand
+//
+// +--------+--------+--------+--------+
+// | opcode | A | X | A_X: unsigned 8-bit operand and
+// +--------+--------+--------+--------+ signed 16-bit operand
+//
+// +--------+--------+--------+--------+
+// | opcode |~~~~~~~~| D | D: unsigned 16-bit operand
+// +--------+--------+--------+--------+
+//
+// +--------+--------+--------+--------+
+// | opcode |~~~~~~~~| X | X: signed 16-bit operand
+// +--------+--------+--------+--------+
+//
+// +--------+--------+--------+--------+
+// | opcode | A | B | C | A_B_C: 3 unsigned 8-bit operands
+// +--------+--------+--------+--------+
+//
+// +--------+--------+--------+--------+
+// | opcode | A | B | Y | A_B_Y: 2 unsigned 8-bit operands
+// +--------+--------+--------+--------+ 1 signed 8-bit operand
+//
+// +--------+--------+--------+--------+
+// | opcode | T | T: signed 24-bit operand
+// +--------+--------+--------+--------+
+//
+//
+// INSTRUCTIONS
+//
+// - Trap
+//
+// Unreachable instruction.
+//
+// - Nop D
+//
+// This instruction does nothing. It may refer to an object in the constant
+// pool that may be decoded by other instructions.
+//
+// - Compile
+//
+// Compile current function and start executing newly produced code
+// (used to implement LazyCompileStub);
+//
+// - Intrinsic id
+//
+// Execute intrinsic with the given id. If intrinsic returns true then
+// return from the current function to the caller passing value produced
+// by the intrinsic as a result;
+//
+// - Drop1; DropR n; Drop n
+//
+// Drop 1 or n values from the stack, if instruction is DropR push the first
+// dropped value to the stack;
+//
+// - Jump target
+//
+// Jump to the given target. Target is specified as offset from the PC of the
+// jump instruction.
+//
+// - Return R; ReturnTOS
+//
+// Return to the caller using either a value from the given register or a
+// value from the top-of-stack as a result.
+//
+// Note: return instruction knows how many arguments to remove from the
+// stack because it can look at the call instruction at caller's PC and
+// take argument count from it.
+//
+// - Move rA, rX
+//
+// FP[rA] <- FP[rX]
+// Note: rX is signed so it can be used to address parameters which are
+// at negative indices with respect to FP.
+//
+// - Swap rA, rX
+//
+// FP[rA], FP[rX] <- FP[rX], FP[rA]
+// Note: rX is signed so it can be used to address parameters which are
+// at negative indices with respect to FP.
+//
+// - Push rX
+//
+// Push FP[rX] to the stack.
+//
+// - LoadConstant rA, D; PushConstant D
+//
+// Load value at index D from constant pool into FP[rA] or push it onto the
+// stack.
+//
+// - StoreLocal rX; PopLocal rX
+//
+// Store top of the stack into FP[rX] and pop it if needed.
+//
+// - StaticCall ArgC, D
+//
+// Invoke function in SP[0] with arguments SP[-(1+ArgC)], ..., SP[-1] and
+// argument descriptor PP[D], which indicates whether the first argument
+// is a type argument vector.
+//
+// - IndirectStaticCall ArgC, D
+//
+// Invoke the function given by the ICData in SP[0] with arguments
+// SP[-(1+ArgC)], ..., SP[-1] and argument descriptor PP[D], which
+// indicates whether the first argument is a type argument vector.
+//
+// - InstanceCall<N> ArgC, D; InstanceCall<N>Opt ArgC, D
+//
+// Lookup and invoke method with N checked arguments using ICData in PP[D]
+// with arguments SP[-(1+ArgC)], ..., SP[-1].
+// The ICData indicates whether the first argument is a type argument vector.
+//
+// - NativeCall ArgA, ArgB, ArgC
+//
+// Invoke native function at pool[ArgB] with argc_tag at pool[ArgC] using
+// wrapper at pool[ArgA].
+//
+// - PushPolymorphicInstanceCall ArgC, D
+//
+// Skips 2*D + 1 instructions and pushes a function object onto the stack
+// if one can be found as follows. Otherwise skips only 2*D instructions.
+// The function is looked up in the IC data encoded in the following 2*D
+// Nop instructions. The Nop instructions should be arranged in pairs with
+// the first being the cid, and the second being the function to push if
+// the cid matches the cid in the pair.
+//
+// - PushPolymorphicInstanceCallByRange ArgC, D
+//
+// Skips 3*D + 1 instructions and pushes a function object onto the stack
+// if one can be found as follows. Otherwise skips only 3*D instructions.
+// The function is looked up in the IC data encoded in the following 3*D
+// Nop instructions. The Nop instructions should be arranged in triples with
+// the first being the start cid, the second being the number of cids, and
+// the third being the function to push if the cid is in the range given
+// by the first two Nop instructions.
+//
+// - OneByteStringFromCharCode rA, rX
+//
+// Load the one-character symbol with the char code given by the Smi
+// in FP[rX] into FP[rA].
+//
+// - StringToCharCode rA, rX
+//
+// Load and smi-encode the single char code of the string in FP[rX] into
+// FP[rA]. If the string's length is not 1, load smi -1 instead.
+//
+// - AddTOS; SubTOS; MulTOS; BitOrTOS; BitAndTOS; EqualTOS; LessThanTOS;
+// GreaterThanTOS;
+//
+// Smi fast-path for a corresponding method. Checks if SP[0] and SP[-1] are
+// both smis and result of SP[0] <op> SP[-1] is a smi - if this is true
+// then pops operands and pushes result on the stack and skips the next
+// instruction (which implements a slow path fallback).
+//
+// - Add, Sub, Mul, Div, Mod, Shl, Shr rA, rB, rC
+//
+// Arithmetic operations on Smis. FP[rA] <- FP[rB] op FP[rC].
+// If these instructions can trigger a deoptimization, the following
+// instruction should be Deopt. If no deoptimization should be triggered,
+// the immediately following instruction is skipped. These instructions
+// expect their operands to be Smis, but don't check that they are.
+//
+// - Smi<op>TOS
+//
+// Performs SP[0] <op> SP[-1], pops operands and pushes result on the stack.
+// Assumes SP[0] and SP[-1] are both smis and the result is a Smi.
+//
+// - ShlImm rA, rB, rC
+//
+// FP[rA] <- FP[rB] << rC. Shifts the Smi in FP[rB] left by rC. rC is
+// assumed to be a legal positive number by which left-shifting is possible.
+//
+// - Min, Max rA, rB, rC
+//
+// FP[rA] <- {min, max}(FP[rB], FP[rC]). Assumes that FP[rB], and FP[rC] are
+// Smis.
+//
+// - Neg rA , rD
+//
+// FP[rA] <- -FP[rD]. Assumes FP[rD] is a Smi. If there is no overflow the
+// immediately following instruction is skipped.
+//
+// - DMin, DMax, DAdd, DSub, DMul, DDiv, DPow, DMod rA, rB, rC
+//
+// Arithmetic operations on unboxed doubles. FP[rA] <- FP[rB] op FP[rC].
+//
+// - DNeg, DCos, DSin, DSqrt rA, rD
+//
+// FP[rA] <- op(FP[rD]). Assumes FP[rD] is an unboxed double.
+//
+// - DTruncate, DFloor, DCeil rA, rD
+//
+// Applies trunc(), floor(), or ceil() to the unboxed double in FP[rD], and
+// stores the result in FP[rA].
+//
+// - DoubleToFloat, FloatToDouble rA, rD
+//
+// Convert the unboxed float or double in FP[rD] as indicated, and store the
+// result in FP[rA].
+//
+// - DoubleIsNaN rA, rD
+//
+// If the unboxed double in FP[rD] is a NaN, then writes Bool::True().raw()
+// into FP[rA], and Bool::False().raw() otherwise.
+//
+// - DoubleIsInfinite rA, rD
+//
+// If the unboxed double in FP[rD] is + or - infinity, then
+// writes Bool::True().raw() into FP[rA], and Bool::False().raw() otherwise.
+//
+// - BitOr, BitAnd, BitXor rA, rB, rC
+//
+// FP[rA] <- FP[rB] op FP[rC]. These instructions expect their operands to be
+// Smis, but don't check that they are.
+//
+// - BitNot rA, rD
+//
+// FP[rA] <- ~FP[rD]. As above, assumes FP[rD] is a Smi.
+//
+// - WriteIntoDouble rA, rD
+//
+// Box the double in FP[rD] using the box in FP[rA].
+//
+// - UnboxDouble rA, rD
+//
+// Unbox the double in FP[rD] into FP[rA]. Assumes FP[rD] is a double.
+//
+// - CheckedUnboxDouble rA, rD
+//
+// Unboxes FP[rD] into FP[rA] and skips the following instruction unless
+// FP[rD] is not a double or a Smi. When FP[rD] is a Smi, converts it to a
+// double.
+//
+// - UnboxInt32 rA, rB, C
+//
+// Unboxes the integer in FP[rB] into FP[rA]. If C == 1, the value may be
+// truncated. If FP[rA] is successfully unboxed the following instruction is
+// skipped.
+//
+// - BoxInt32 rA, rD
+//
+// Boxes the unboxed signed 32-bit integer in FP[rD] into FP[rA].
+//
+// - BoxUint32 rA, rD
+//
+// Boxes the unboxed unsigned 32-bit integer in FP[rD] into FP[rA].
+//
+// - SmiToDouble rA, rD
+//
+// Convert the Smi in FP[rD] to an unboxed double in FP[rA].
+//
+// - DoubleToSmi rA, rD
+//
+// If the unboxed double in FP[rD] can be converted to a Smi in FP[rA], then
+// this instruction does so, and skips the following instruction. Otherwise,
+// the following instruction is not skipped.
+//
+// - StoreStaticTOS D
+//
+// Stores TOS into the static field PP[D].
+//
+// - PushStatic
+//
+// Pushes value of the static field PP[D] on to the stack.
+//
+// - InitStaticTOS
+//
+// Takes static field from TOS and ensures that it is initialized.
+//
+// - If<Cond>(Num)TOS
+// If<Cond>(Num) rA, rD
+//
+// Cond is either NeStrict or EqStrict
+//
+// Skips the next instruction unless the given condition holds. 'Num'
+// variants perform number check while non-Num variants just compare
+// RawObject pointers.
+//
+// Used to implement conditional jump:
+//
+// IfNeStrictTOS
+// Jump T ;; jump if not equal
+//
+// - If<Cond>Null rA
+//
+// Cond is Eq or Ne. Skips the next instruction unless the given condition
+// holds.
+//
+// - If<Cond> rA, rD
+//
+// Cond is Le, Lt, Ge, Gt, unsigned variants ULe, ULt, UGe, UGt, and
+// unboxed double variants DEq, DNe, DLe, DLt, DGe, DGt.
+// Skips the next instruction unless FP[rA] <Cond> FP[rD]. Assumes that
+// FP[rA] and FP[rD] are Smis or unboxed doubles as indicated by <Cond>.
+//
+// - IfSmi<Cond>TOS
+//
+// Cond is Lt, Le, Ge, Gt.
+// Skips the next instruction unless SP[-1] <Cond> SP[-0].
+// It is expected both SP[-1] and SP[-0] are Smis.
+//
+// - CreateArrayTOS
+//
+// Allocate array of length SP[0] with type arguments SP[-1].
+//
+// - CreateArrayOpt rA, rB, rC
+//
+// Try to allocate a new array where FP[rB] is the length, and FP[rC] is the
+// type. If allocation is successful, the result is stored in FP[rA], and
+// the next four instructions, which should be the
+// (Push type; Push length; AllocateTOS; PopLocal) slow path are skipped.
+//
+// - Allocate D
+//
+// Allocate object of class PP[D] with no type arguments.
+//
+// - AllocateOpt rA, D
+//
+// Try allocating an object with tags in PP[D] with no type arguments.
+// If allocation is successful, the result is stored in FP[rA], and
+// the next two instructions, which should be the (Allocate class; PopLocal)
+// slow path are skipped
+//
+// - AllocateT
+//
+// Allocate object of class SP[0] with type arguments SP[-1].
+//
+// - AllocateTOpt rA, D
+//
+// Similar to AllocateOpt with the difference that the offset of the
+// type arguments in the resulting object is taken from the D field of the
+// following Nop instruction, and on success 4 instructions are skipped and
+// the object at the top of the stack is popped.
+//
+// - StoreIndexedTOS
+//
+// Store SP[0] into array SP[-2] at index SP[-1]. No typechecking is done.
+// SP[-2] is assumed to be a RawArray, SP[-1] to be a smi.
+//
+// - StoreIndexed rA, rB, rC
+//
+// Store FP[rC] into array FP[rA] at index FP[rB]. No typechecking is done.
+// FP[rA] is assumed to be a RawArray, FP[rB] to be a smi.
+//
+// - StoreIndexed{N}{Type} rA, rB, rC
+//
+// Where Type is Float32, Float64, Uint8, or OneByteString
+// Where N is '', '4', or '8'. N may only be '4' for Float32 and '8' for
+// Float64.
+//
+// Store the unboxed double or tagged Smi in FP[rC] into the typed data array
+// at FP[rA] at index FP[rB]. If N is not '', the index is assumed to be
+// already scaled by N.
+//
+// - StoreIndexedExternalUint8 rA, rB, rC
+//
+// Similar to StoreIndexedUint8 but FP[rA] is an external typed data aray.
+//
+// - NoSuchMethod
+//
+// Performs noSuchmethod handling code.
+//
+// - TailCall
+//
+// Unwinds the current frame, populates the arguments descriptor register
+// with SP[-1] and tail calls the code in SP[-0].
+//
+// - TailCallOpt rA, rD
+//
+// Unwinds the current frame, populates the arguments descriptor register
+// with rA and tail calls the code in rD.
+//
+// - LoadArgDescriptor
+//
+// Load the caller-provoided argument descriptor and pushes it onto the
+// stack.
+//
+// - LoadArgDescriptorOpt rA
+//
+// Load the caller-provoided argument descriptor into [rA].
+//
+// - LoadFpRelativeSlot rD
+//
+// Loads from FP using the negative index of SP[-0]+rD.
+// It is assumed that SP[-0] is a Smi.
+//
+// - LoadFpRelativeSlotOpt rA, rB, rY
+//
+// Loads from FP using the negative index of FP[rB]+rY and stores the result
+// into rA.
+// It is assumed that rY is a Smi.
+//
+// - StoreFpRelativeSlot rD
+//
+// Stores SP[-0] by indexing into FP using the negative index of SP[-1]+rD.
+// It is assumed that SP[-1] is a Smi.
+//
+// - StoreFpRelativeSlotOpt rA, rB, rY
+//
+// Stores rA by indexing into FP using the the negative index of FP[rB]+rY.
+// It is assumed that rY is a Smi.
+//
+// - LoadIndexedTOS
+//
+// Loads from array SP[-1] at index SP[-0].
+// It is assumed that SP[-0] is a Smi.
+//
+// - LoadIndexed rA, rB, rC
+//
+// Loads from array FP[rB] at index FP[rC] into FP[rA]. No typechecking is
+// done. FP[rB] is assumed to be a RawArray, and to contain a Smi at FP[rC].
+//
+// - LoadIndexed{N}{Type} rA, rB, rC
+//
+// Where Type is Float32, Float64, OneByteString, TwoByteString, Uint8,
+// Int8, and N is '', '4', or '8'. N may only be '4' for Float32, and may
+// only be '8' for Float64.
+//
+// Loads from typed data array FP[rB] at index FP[rC] into an unboxed double,
+// or tagged Smi in FP[rA] as indicated by the type in the name. If N is not
+// '', the index is assumed to be already scaled by N.
+//
+// - LoadIndexedExternal{Int8, Uint8} rA, rB, rC
+//
+// Loads from the external typed data array FP[rB] at index FP[rC] into
+// FP[rA]. No typechecking is done.
+//
+// - StoreField rA, B, rC
+//
+// Store value FP[rC] into object FP[rA] at offset (in words) B.
+//
+// - StoreFieldExt rA, rD
+//
+// Store value FP[rD] into object FP[rA] at offset (in words)
+// stored in the following Nop instruction. Used to access fields with
+// large offsets.
+//
+// - StoreFieldTOS D
+//
+// Store value SP[0] into object SP[-1] at offset (in words) PP[D].
+//
+// - LoadField rA, rB, C
+//
+// Load value at offset (in words) C from object FP[rB] into FP[rA].
+//
+// - LoadFieldExt rA, rD
+//
+// Load value from object FP[rD] at offset (in words) stored in the
+// following Nop instruction into FP[rA]. Used to access fields with
+// large offsets.
+//
+// - LoadUntagged rA, rB, C
+//
+// Like LoadField, but assumes that FP[rB] is untagged.
+//
+// - LoadFieldTOS D
+//
+// Push value at offset (in words) PP[D] from object SP[0].
+//
+// - BooleanNegateTOS
+//
+// SP[0] = !SP[0]
+//
+// - BooleanNegate rA, rD
+//
+// FP[rA] = !FP[rD]
+//
+// - Throw A
+//
+// Throw (Rethrow if A != 0) exception. Exception object and stack object
+// are taken from TOS.
+//
+// - Entry rD
+//
+// Function prologue for the function
+// rD - number of local slots to reserve;
+//
+// - EntryOptional A, B, C
+//
+// Function prologue for the function with optional or named arguments:
+// A - expected number of positional arguments;
+// B - number of optional arguments;
+// C - number of named arguments;
+//
+// Only one of B and C can be not 0.
+//
+// If B is not 0 then EntryOptional bytecode is followed by B LoadConstant
+// bytecodes specifying default values for optional arguments.
+//
+// If C is not 0 then EntryOptional is followed by 2 * B LoadConstant
+// bytecodes.
+// Bytecode at 2 * i specifies name of the i-th named argument and at
+// 2 * i + 1 default value. rA part of the LoadConstant bytecode specifies
+// the location of the parameter on the stack. Here named arguments are
+// sorted alphabetically to enable linear matching similar to how function
+// prologues are implemented on other architectures.
+//
+// Note: Unlike Entry bytecode EntryOptional does not setup the frame for
+// local variables this is done by a separate bytecode Frame.
+//
+// - EntryOptimized rD
+//
+// Function prologue for optimized functions.
+// rD - number of local slots to reserve for registers;
+//
+// Note: reserved slots are not initialized because optimized code
+// has stack maps attached to call sites.
+//
+// - HotCheck A, D
+//
+// Increment current function's usage counter by A and check if it
+// exceeds D. If it does trigger (re)optimization of the current
+// function.
+//
+// - Frame D
+//
+// Reserve and initialize with null space for D local variables.
+//
+// - SetFrame A
+//
+// Reinitialize SP assuming that current frame has size A.
+// Used to drop temporaries from the stack in the exception handler.
+//
+// - AllocateContext D
+//
+// Allocate Context object assuming for D context variables.
+//
+// - AllocateUninitializedContext rA, D
+//
+// Allocates an uninitialized context for D variables, and places the result
+// in FP[rA]. On success, skips the next 2 instructions, which should be the
+// slow path (AllocateContext D; PopLocal rA).
+//
+// - CloneContext
+//
+// Clone context stored in TOS.
+//
+// - MoveSpecial rA, D
+//
+// Copy special values from inside interpreter to FP[rA]. Currently only
+// used to pass exception object (D = 0) and stack trace object (D = 1) to
+// catch handler.
+//
+// - InstantiateType D
+//
+// Instantiate type PP[D] with instantiator type arguments SP[-1] and
+// function type arguments SP[0].
+//
+// - InstantiateTypeArgumentsTOS D
+//
+// Instantiate type arguments PP[D] with instantiator type arguments SP[-1]
+// and function type arguments SP[0].
+//
+// - InstanceOf
+//
+// Test if instance SP[-4] with instantiator type arguments SP[-3] and
+// function type arguments SP[-2] is a subtype of type SP[-1] using
+// SubtypeTestCache SP[0], with result placed at top of stack.
+//
+// - AssertAssignable A, D
+//
+// Assert that instance SP[-4] is assignable to variable named SP[0] of
+// type SP[-1] with instantiator type arguments SP[-3] and function type
+// 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.
+// Assumes that the stack is arranged the same as for AssertAssignable.
+//
+// - AssertBoolean A
+//
+// Assert that TOS is a boolean (A = 1) or that TOS is not null (A = 0).
+//
+// - TestSmi rA, rD
+//
+// If FP[rA] & FP[rD] != 0, then skip the next instruction. FP[rA] and FP[rD]
+// must be Smis.
+//
+// - TestCids rA, D
+//
+// The next D instructions must be Nops whose D field encodes a class id. If
+// the class id of FP[rA] matches, jump to PC + N + 1 if the matching Nop's
+// A != 0 or PC + N + 2 if the matching Nop's A = 0. If no match is found,
+// jump to PC + N.
+//
+// - CheckSmi rA
+//
+// If FP[rA] is a Smi, then skip the next instruction.
+//
+// - CheckEitherNonSmi rA, rD
+//
+// If either FP[rA] or FP[rD] is not a Smi, then skip the next instruction.
+//
+// - CheckClassId rA, D
+//
+// If the class id in FP[rA] matches the class id D, then skip the
+// following instruction.
+//
+// - CheckClassIdRange rA, D
+//
+// Next instruction is a Nop with S, the size of the class-id range.
+// If the class id in FP[rA] is between the D D + S, then skip the
+// following instruction.
+//
+// - CheckBitTest rA, D
+//
+// Skips the next 3 instructions if the object at FP[rA] is a valid class for
+// a dense switch with low cid encoded in the following Nop instruction, and
+// the cid mask encoded in the Nop instruction after that, or if D == 1 and
+// FP[rA] is a Smi. Skips 2 instructions otherwise.
+//
+// - CheckCids rA, rB, rC
+//
+// Skips rC + 1 instructions if the object at FP[rA] is a Smi and
+// rB == 1, or if FP[rA]'s cid is found in the array of cids encoded by the
+// following rC Nop instructions. Otherwise skips only rC instructions.
+//
+// - CheckCidsByRange rA, rB, rC
+//
+// Skips rC + 1 instructions if the object at FP[rA] is a Smi and rB ==
+// 1, or if FP[rA]'s cid is found in the array of cid ranges encoded by the
+// following rC Nop instructions. The cid ranges from a inclusive to b
+// exclusive are coded in pairs of (a, b - a). Otherwise skips only 2
+// instructions.
+//
+// - CheckStack
+//
+// Compare SP against isolate stack limit and call StackOverflow handler if
+// necessary.
+//
+// - CheckStackAlwaysExit
+//
+// Unconditionally call StackOverflow handler.
+//
+// - CheckFunctionTypeArgs A, D
+//
+// Check for a passed-in type argument vector of length A and
+// store it at FP[D].
+//
+// - DebugStep, DebugBreak A
+//
+// Debugger support. DebugBreak is bytecode that can be patched into the
+// instruction stream to trigger in place breakpoint.
+//
+// When patching instance or static call with DebugBreak we set A to
+// match patched call's argument count so that Return instructions continue
+// to work.
+//
+// TODO(vegorov) the way we replace calls with DebugBreak does not work
+// with our smi fast paths because DebugBreak is simply skipped.
+//
+// - LoadClassIdTOS, LoadClassId rA, D
+//
+// LoadClassIdTOS loads the class id from the object at SP[0] and stores it
+// to SP[0]. LoadClassId loads the class id from FP[rA] and stores it to
+// FP[D].
+//
+// - Deopt ArgC, D
+//
+// If D != 0 then trigger eager deoptimization with deopt id (D - 1).
+// If D == 0 then trigger lazy deoptimization.
+//
+// The meaning of operand ArgC (encoded as A operand) matches that of an
+// ArgC operand in call instructions. This is needed because we could
+// potentially patch calls instructions with a lazy deopt and we need to
+// ensure that any Return/ReturnTOS instructions
+// returning from the patched calls will continue to function,
+// e.g. in bytecode sequences like
+//
+// InstanceCall ... <- lazy deopt inside first call
+// InstanceCall ... <- patches second call with Deopt
+//
+// BYTECODE LIST FORMAT
+//
+// KernelBytecode list below is specified using the following format:
+//
+// V(BytecodeName, OperandForm, Op1, Op2, Op3)
+//
+// - OperandForm specifies operand encoding and should be one of 0, A, T, A_D,
+// A_X, X, D (see ENCODING section above).
+//
+// - Op1, Op2, Op2 specify operand meaning. Possible values:
+//
+// ___ ignored / non-existent operand
+// num immediate operand
+// lit constant literal from object pool
+// reg register (unsigned FP relative local)
+// xeg x-register (signed FP relative local)
+// tgt jump target relative to the PC of the current instruction
+//
+// TODO(vegorov) jump targets should be encoded relative to PC of the next
+// instruction because PC is incremented immediately after fetch
+// and before decoding.
+//
+#define KERNEL_BYTECODES_LIST(V) \
+ V(Trap, 0, ___, ___, ___) \
+ V(Nop, A_D, num, lit, ___) \
+ V(Compile, 0, ___, ___, ___) \
+ V(HotCheck, A_D, num, num, ___) \
+ V(Intrinsic, A, num, ___, ___) \
+ V(Drop1, 0, ___, ___, ___) \
+ V(DropR, A, num, ___, ___) \
+ V(Drop, A, num, ___, ___) \
+ V(Jump, T, tgt, ___, ___) \
+ V(Return, A, reg, ___, ___) \
+ V(ReturnTOS, 0, ___, ___, ___) \
+ V(Move, A_X, reg, xeg, ___) \
+ V(Swap, A_X, reg, xeg, ___) \
+ V(Push, X, xeg, ___, ___) \
+ V(LoadConstant, A_D, reg, lit, ___) \
+ V(LoadClassId, A_D, reg, reg, ___) \
+ V(LoadClassIdTOS, 0, ___, ___, ___) \
+ V(PushConstant, D, lit, ___, ___) \
+ V(StoreLocal, X, xeg, ___, ___) \
+ V(PopLocal, X, xeg, ___, ___) \
+ V(IndirectStaticCall, A_D, num, num, ___) \
+ V(StaticCall, A_D, num, num, ___) \
+ V(InstanceCall1, A_D, num, num, ___) \
+ V(InstanceCall2, A_D, num, num, ___) \
+ V(InstanceCall1Opt, A_D, num, num, ___) \
+ V(InstanceCall2Opt, A_D, num, num, ___) \
+ V(PushPolymorphicInstanceCall, A_D, num, num, ___) \
+ V(PushPolymorphicInstanceCallByRange, A_D, num, num, ___) \
+ V(NativeCall, A_B_C, num, num, num) \
+ V(OneByteStringFromCharCode, A_X, reg, xeg, ___) \
+ V(StringToCharCode, A_X, reg, xeg, ___) \
+ V(AddTOS, 0, ___, ___, ___) \
+ V(SubTOS, 0, ___, ___, ___) \
+ V(MulTOS, 0, ___, ___, ___) \
+ V(BitOrTOS, 0, ___, ___, ___) \
+ V(BitAndTOS, 0, ___, ___, ___) \
+ V(EqualTOS, 0, ___, ___, ___) \
+ V(LessThanTOS, 0, ___, ___, ___) \
+ V(GreaterThanTOS, 0, ___, ___, ___) \
+ 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) \
+ V(Div, A_B_C, reg, reg, reg) \
+ V(Mod, A_B_C, reg, reg, reg) \
+ V(Shl, A_B_C, reg, reg, reg) \
+ V(Shr, A_B_C, reg, reg, reg) \
+ V(ShlImm, A_B_C, reg, reg, num) \
+ V(Neg, A_D, reg, reg, ___) \
+ V(BitOr, A_B_C, reg, reg, reg) \
+ V(BitAnd, A_B_C, reg, reg, reg) \
+ V(BitXor, A_B_C, reg, reg, reg) \
+ V(BitNot, A_D, reg, reg, ___) \
+ V(Min, A_B_C, reg, reg, reg) \
+ V(Max, A_B_C, reg, reg, reg) \
+ V(WriteIntoDouble, A_D, reg, reg, ___) \
+ V(UnboxDouble, A_D, reg, reg, ___) \
+ V(CheckedUnboxDouble, A_D, reg, reg, ___) \
+ V(UnboxInt32, A_B_C, reg, reg, num) \
+ V(BoxInt32, A_D, reg, reg, ___) \
+ V(BoxUint32, A_D, reg, reg, ___) \
+ V(SmiToDouble, A_D, reg, reg, ___) \
+ V(DoubleToSmi, A_D, reg, reg, ___) \
+ V(DAdd, A_B_C, reg, reg, reg) \
+ V(DSub, A_B_C, reg, reg, reg) \
+ V(DMul, A_B_C, reg, reg, reg) \
+ V(DDiv, A_B_C, reg, reg, reg) \
+ V(DNeg, A_D, reg, reg, ___) \
+ V(DSqrt, A_D, reg, reg, ___) \
+ V(DMin, A_B_C, reg, reg, reg) \
+ V(DMax, A_B_C, reg, reg, reg) \
+ V(DCos, A_D, reg, reg, ___) \
+ V(DSin, A_D, reg, reg, ___) \
+ V(DPow, A_B_C, reg, reg, reg) \
+ V(DMod, A_B_C, reg, reg, reg) \
+ V(DTruncate, A_D, reg, reg, ___) \
+ V(DFloor, A_D, reg, reg, ___) \
+ V(DCeil, A_D, reg, reg, ___) \
+ V(DoubleToFloat, A_D, reg, reg, ___) \
+ V(FloatToDouble, A_D, reg, reg, ___) \
+ V(DoubleIsNaN, A, reg, ___, ___) \
+ V(DoubleIsInfinite, A, reg, ___, ___) \
+ V(StoreStaticTOS, D, lit, ___, ___) \
+ V(PushStatic, D, lit, ___, ___) \
+ V(InitStaticTOS, 0, ___, ___, ___) \
+ V(IfNeStrictTOS, 0, ___, ___, ___) \
+ V(IfEqStrictTOS, 0, ___, ___, ___) \
+ V(IfNeStrictNumTOS, 0, ___, ___, ___) \
+ V(IfEqStrictNumTOS, 0, ___, ___, ___) \
+ V(IfSmiLtTOS, 0, ___, ___, ___) \
+ V(IfSmiLeTOS, 0, ___, ___, ___) \
+ V(IfSmiGeTOS, 0, ___, ___, ___) \
+ V(IfSmiGtTOS, 0, ___, ___, ___) \
+ V(IfNeStrict, A_D, reg, reg, ___) \
+ V(IfEqStrict, A_D, reg, reg, ___) \
+ V(IfLe, A_D, reg, reg, ___) \
+ V(IfLt, A_D, reg, reg, ___) \
+ V(IfGe, A_D, reg, reg, ___) \
+ V(IfGt, A_D, reg, reg, ___) \
+ V(IfULe, A_D, reg, reg, ___) \
+ V(IfULt, A_D, reg, reg, ___) \
+ V(IfUGe, A_D, reg, reg, ___) \
+ V(IfUGt, A_D, reg, reg, ___) \
+ V(IfDNe, A_D, reg, reg, ___) \
+ V(IfDEq, A_D, reg, reg, ___) \
+ V(IfDLe, A_D, reg, reg, ___) \
+ V(IfDLt, A_D, reg, reg, ___) \
+ V(IfDGe, A_D, reg, reg, ___) \
+ V(IfDGt, A_D, reg, reg, ___) \
+ V(IfNeStrictNum, A_D, reg, reg, ___) \
+ V(IfEqStrictNum, A_D, reg, reg, ___) \
+ V(IfEqNull, A, reg, ___, ___) \
+ V(IfNeNull, A, reg, ___, ___) \
+ V(CreateArrayTOS, 0, ___, ___, ___) \
+ V(CreateArrayOpt, A_B_C, reg, reg, reg) \
+ V(Allocate, D, lit, ___, ___) \
+ V(AllocateT, 0, ___, ___, ___) \
+ V(AllocateOpt, A_D, reg, lit, ___) \
+ V(AllocateTOpt, A_D, reg, lit, ___) \
+ V(StoreIndexedTOS, 0, ___, ___, ___) \
+ V(StoreIndexed, A_B_C, reg, reg, reg) \
+ V(StoreIndexedUint8, A_B_C, reg, reg, reg) \
+ V(StoreIndexedExternalUint8, A_B_C, reg, reg, reg) \
+ V(StoreIndexedOneByteString, A_B_C, reg, reg, reg) \
+ V(StoreIndexedUint32, A_B_C, reg, reg, reg) \
+ V(StoreIndexedFloat32, A_B_C, reg, reg, reg) \
+ V(StoreIndexed4Float32, A_B_C, reg, reg, reg) \
+ V(StoreIndexedFloat64, A_B_C, reg, reg, reg) \
+ V(StoreIndexed8Float64, A_B_C, reg, reg, reg) \
+ V(NoSuchMethod, 0, ___, ___, ___) \
+ V(TailCall, 0, ___, ___, ___) \
+ V(TailCallOpt, A_D, reg, reg, ___) \
+ V(LoadArgDescriptor, 0, ___, ___, ___) \
+ V(LoadArgDescriptorOpt, A, reg, ___, ___) \
+ V(LoadFpRelativeSlot, X, reg, ___, ___) \
+ V(LoadFpRelativeSlotOpt, A_B_Y, reg, reg, reg) \
+ V(StoreFpRelativeSlot, X, reg, ___, ___) \
+ V(StoreFpRelativeSlotOpt, A_B_Y, reg, reg, reg) \
+ V(LoadIndexedTOS, 0, ___, ___, ___) \
+ V(LoadIndexed, A_B_C, reg, reg, reg) \
+ V(LoadIndexedUint8, A_B_C, reg, reg, reg) \
+ V(LoadIndexedInt8, A_B_C, reg, reg, reg) \
+ V(LoadIndexedInt32, A_B_C, reg, reg, reg) \
+ V(LoadIndexedUint32, A_B_C, reg, reg, reg) \
+ V(LoadIndexedExternalUint8, A_B_C, reg, reg, reg) \
+ V(LoadIndexedExternalInt8, A_B_C, reg, reg, reg) \
+ V(LoadIndexedFloat32, A_B_C, reg, reg, reg) \
+ V(LoadIndexed4Float32, A_B_C, reg, reg, reg) \
+ V(LoadIndexedFloat64, A_B_C, reg, reg, reg) \
+ V(LoadIndexed8Float64, A_B_C, reg, reg, reg) \
+ V(LoadIndexedOneByteString, A_B_C, reg, reg, reg) \
+ V(LoadIndexedTwoByteString, A_B_C, reg, reg, reg) \
+ V(StoreField, A_B_C, reg, num, reg) \
+ V(StoreFieldExt, A_D, reg, reg, ___) \
+ V(StoreFieldTOS, D, lit, ___, ___) \
+ V(LoadField, A_B_C, reg, reg, num) \
+ V(LoadFieldExt, A_D, reg, reg, ___) \
+ V(LoadUntagged, A_B_C, reg, reg, num) \
+ V(LoadFieldTOS, D, lit, ___, ___) \
+ V(BooleanNegateTOS, 0, ___, ___, ___) \
+ V(BooleanNegate, A_D, reg, reg, ___) \
+ V(Throw, A, num, ___, ___) \
+ V(Entry, D, num, ___, ___) \
+ V(EntryOptional, A_B_C, num, num, num) \
+ V(EntryOptimized, A_D, num, num, ___) \
+ V(Frame, D, num, ___, ___) \
+ V(SetFrame, A, num, ___, num) \
+ V(AllocateContext, D, num, ___, ___) \
+ V(AllocateUninitializedContext, A_D, reg, num, ___) \
+ V(CloneContext, 0, ___, ___, ___) \
+ V(MoveSpecial, A_D, reg, num, ___) \
+ V(InstantiateType, D, lit, ___, ___) \
+ V(InstantiateTypeArgumentsTOS, A_D, num, lit, ___) \
+ 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, ___) \
+ V(CheckSmi, A, reg, ___, ___) \
+ V(CheckEitherNonSmi, A_D, reg, reg, ___) \
+ V(CheckClassId, A_D, reg, num, ___) \
+ V(CheckClassIdRange, A_D, reg, num, ___) \
+ V(CheckBitTest, A_D, reg, num, ___) \
+ V(CheckCids, A_B_C, reg, num, num) \
+ V(CheckCidsByRange, A_B_C, reg, num, num) \
+ V(CheckStack, 0, ___, ___, ___) \
+ V(CheckStackAlwaysExit, 0, ___, ___, ___) \
+ V(CheckFunctionTypeArgs, A_D, num, num, ___) \
+ V(DebugStep, 0, ___, ___, ___) \
+ V(DebugBreak, A, num, ___, ___) \
+ V(Deopt, A_D, num, num, ___) \
+ V(DeoptRewind, 0, ___, ___, ___)
+
+// clang-format on
+
+typedef uint32_t KBCInstr;
+
+class KernelBytecode {
+ public:
+ enum Opcode {
+#define DECLARE_BYTECODE(name, encoding, op1, op2, op3) k##name,
+ KERNEL_BYTECODES_LIST(DECLARE_BYTECODE)
+#undef DECLARE_BYTECODE
+ };
+
+ static const char* NameOf(KBCInstr instr) {
+ const char* names[] = {
+#define NAME(name, encoding, op1, op2, op3) #name,
+ KERNEL_BYTECODES_LIST(NAME)
+#undef NAME
+ };
+ return names[DecodeOpcode(instr)];
+ }
+
+ static const intptr_t kOpShift = 0;
+ static const intptr_t kAShift = 8;
+ static const intptr_t kAMask = 0xFF;
+ static const intptr_t kBShift = 16;
+ static const intptr_t kBMask = 0xFF;
+ static const intptr_t kCShift = 24;
+ static const intptr_t kCMask = 0xFF;
+ static const intptr_t kDShift = 16;
+ static const intptr_t kDMask = 0xFFFF;
+ static const intptr_t kYShift = 24;
+ static const intptr_t kYMask = 0xFF;
+
+ static KBCInstr Encode(Opcode op, uintptr_t a, uintptr_t b, uintptr_t c) {
+ ASSERT((a & kAMask) == a);
+ ASSERT((b & kBMask) == b);
+ ASSERT((c & kCMask) == c);
+ return op | (a << kAShift) | (b << kBShift) | (c << kCShift);
+ }
+
+ static KBCInstr Encode(Opcode op, uintptr_t a, uintptr_t d) {
+ ASSERT((a & kAMask) == a);
+ ASSERT((d & kDMask) == d);
+ return op | (a << kAShift) | (d << kDShift);
+ }
+
+ static KBCInstr EncodeSigned(Opcode op, uintptr_t a, intptr_t x) {
+ ASSERT((a & kAMask) == a);
+ ASSERT((x << kDShift) >> kDShift == x);
+ return op | (a << kAShift) | (x << kDShift);
+ }
+
+ static KBCInstr EncodeSigned(Opcode op, intptr_t x) {
+ ASSERT((x << kAShift) >> kAShift == x);
+ return op | (x << kAShift);
+ }
+
+ static KBCInstr Encode(Opcode op) { return op; }
+
+ DART_FORCE_INLINE static uint8_t DecodeA(KBCInstr bc) {
+ return (bc >> kAShift) & kAMask;
+ }
+
+ DART_FORCE_INLINE static uint8_t DecodeB(KBCInstr bc) {
+ return (bc >> kBShift) & kBMask;
+ }
+
+ DART_FORCE_INLINE static uint16_t DecodeD(KBCInstr bc) {
+ return (bc >> kDShift) & kDMask;
+ }
+
+ DART_FORCE_INLINE static Opcode DecodeOpcode(KBCInstr bc) {
+ return static_cast<Opcode>(bc & 0xFF);
+ }
+
+ DART_FORCE_INLINE static bool IsTrap(KBCInstr instr) {
+ return DecodeOpcode(instr) == KernelBytecode::kTrap;
+ }
+
+ DART_FORCE_INLINE static bool IsCallOpcode(KBCInstr instr) {
+ switch (DecodeOpcode(instr)) {
+ case KernelBytecode::kStaticCall:
+ case KernelBytecode::kIndirectStaticCall:
+ case KernelBytecode::kInstanceCall1:
+ case KernelBytecode::kInstanceCall2:
+ case KernelBytecode::kInstanceCall1Opt:
+ case KernelBytecode::kInstanceCall2Opt:
+ case KernelBytecode::kDebugBreak:
+ return true;
+
+ default:
+ return false;
+ }
+ }
+
+ DART_FORCE_INLINE static bool IsFastSmiOpcode(KBCInstr instr) {
+ switch (DecodeOpcode(instr)) {
+ case KernelBytecode::kAddTOS:
+ case KernelBytecode::kSubTOS:
+ case KernelBytecode::kMulTOS:
+ case KernelBytecode::kBitOrTOS:
+ case KernelBytecode::kBitAndTOS:
+ case KernelBytecode::kEqualTOS:
+ case KernelBytecode::kLessThanTOS:
+ case KernelBytecode::kGreaterThanTOS:
+ return true;
+
+ default:
+ return false;
+ }
+ }
+
+ DART_FORCE_INLINE static uint8_t DecodeArgc(KBCInstr call) {
+ ASSERT(IsCallOpcode(call));
+ return (call >> 8) & 0xFF;
+ }
+
+ static KBCInstr At(uword pc) { return *reinterpret_cast<KBCInstr*>(pc); }
+
+ private:
+ DISALLOW_ALLOCATION();
+ DISALLOW_IMPLICIT_CONSTRUCTORS(KernelBytecode);
+};
+
+} // namespace dart
+
+#endif // RUNTIME_VM_CONSTANTS_KBC_H_
diff --git a/runtime/vm/dart_entry.cc b/runtime/vm/dart_entry.cc
index 860f672..15ab7b8 100644
--- a/runtime/vm/dart_entry.cc
+++ b/runtime/vm/dart_entry.cc
@@ -8,6 +8,7 @@
#include "vm/class_finalizer.h"
#include "vm/compiler/jit/compiler.h"
#include "vm/debugger.h"
+#include "vm/interpreter.h"
#include "vm/object_store.h"
#include "vm/resolver.h"
#include "vm/runtime_entry.h"
@@ -113,11 +114,32 @@
ASSERT(thread->IsMutatorThread());
ScopedIsolateStackLimits stack_limit(thread, current_sp);
if (!function.HasCode()) {
+#if defined(DART_USE_INTERPRETER)
+ // The function is not compiled yet. Interpret it if it has bytecode.
+ // The bytecode is loaded as part as an aborted compilation step.
+ if (!function.HasBytecode()) {
+ const Object& result =
+ Object::Handle(zone, Compiler::CompileFunction(thread, function));
+ if (result.IsError()) {
+ return Error::Cast(result).raw();
+ }
+ }
+ if (!function.HasCode() && function.HasBytecode()) {
+ const Code& bytecode = Code::Handle(zone, function.Bytecode());
+ ASSERT(!bytecode.IsNull());
+ ASSERT(thread->no_callback_scope_depth() == 0);
+ SuspendLongJumpScope suspend_long_jump_scope(thread);
+ TransitionToGenerated transition(thread);
+ return Interpreter::Current()->Call(bytecode, arguments_descriptor,
+ arguments, thread);
+ }
+#else
const Object& result =
Object::Handle(zone, Compiler::CompileFunction(thread, function));
if (result.IsError()) {
return Error::Cast(result).raw();
}
+#endif
}
// Now Call the invoke stub which will invoke the dart function.
#if !defined(TARGET_ARCH_DBC)
diff --git a/runtime/vm/dart_entry.h b/runtime/vm/dart_entry.h
index b518523..0898a93 100644
--- a/runtime/vm/dart_entry.h
+++ b/runtime/vm/dart_entry.h
@@ -125,6 +125,8 @@
friend class SnapshotWriter;
friend class Serializer;
friend class Deserializer;
+ friend class Interpreter;
+ friend class InterpreterHelpers;
friend class Simulator;
friend class SimulatorHelpers;
DISALLOW_COPY_AND_ASSIGN(ArgumentsDescriptor);
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
index 3f577f6..b4bcec3 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -729,25 +729,19 @@
pieces.Add(dst_name);
pieces.Add(Symbols::SingleQuote());
}
- // Print URIs of src and dst types.
- // Do not print "where" when no URIs get printed.
- bool printed_where = false;
+ // Print ambiguous URIs of src and dst types.
+ URIs uris(zone, 12);
if (!src_type.IsNull()) {
- const String& uris = String::Handle(zone, src_type.EnumerateURIs());
- if (uris.Length() > Symbols::SpaceIsFromSpace().Length()) {
- printed_where = true;
- pieces.Add(Symbols::SpaceWhereNewLine());
- pieces.Add(uris);
- }
+ src_type.EnumerateURIs(&uris);
}
if (!dst_type.IsDynamicType() && !dst_type.IsVoidType()) {
- const String& uris = String::Handle(zone, dst_type.EnumerateURIs());
- if (uris.Length() > Symbols::SpaceIsFromSpace().Length()) {
- if (!printed_where) {
- pieces.Add(Symbols::SpaceWhereNewLine());
- }
- pieces.Add(uris);
- }
+ dst_type.EnumerateURIs(&uris);
+ }
+ const String& formatted_uris =
+ String::Handle(zone, AbstractType::PrintURIs(&uris));
+ if (formatted_uris.Length() > 0) {
+ pieces.Add(Symbols::SpaceWhereNewLine());
+ pieces.Add(formatted_uris);
}
}
}
diff --git a/runtime/vm/interpreter.cc b/runtime/vm/interpreter.cc
new file mode 100644
index 0000000..725c385
--- /dev/null
+++ b/runtime/vm/interpreter.cc
@@ -0,0 +1,4118 @@
+// Copyright (c) 2018, 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.
+
+#include <setjmp.h> // NOLINT
+#include <stdlib.h>
+
+#include "vm/globals.h"
+#if defined(DART_USE_INTERPRETER)
+
+#include "vm/interpreter.h"
+
+#include "vm/compiler/assembler/assembler.h"
+#include "vm/compiler/assembler/disassembler_kbc.h"
+#include "vm/compiler/jit/compiler.h"
+#include "vm/constants_kbc.h"
+#include "vm/cpu.h"
+#include "vm/dart_entry.h"
+#include "vm/debugger.h"
+#include "vm/lockers.h"
+#include "vm/native_arguments.h"
+#include "vm/native_entry.h"
+#include "vm/object.h"
+#include "vm/object_store.h"
+#include "vm/os_thread.h"
+#include "vm/stack_frame_kbc.h"
+#include "vm/symbols.h"
+
+namespace dart {
+
+DEFINE_FLAG(uint64_t,
+ trace_interpreter_after,
+ ULLONG_MAX,
+ "Trace interpreter execution after instruction count reached.");
+
+#define LIKELY(cond) __builtin_expect((cond), 1)
+#define UNLIKELY(cond) __builtin_expect((cond), 0)
+
+// InterpreterSetjmpBuffer are linked together, and the last created one
+// is referenced by the Interpreter. When an exception is thrown, the exception
+// runtime looks at where to jump and finds the corresponding
+// InterpreterSetjmpBuffer based on the stack pointer of the exception handler.
+// The runtime then does a Longjmp on that buffer to return to the interpreter.
+class InterpreterSetjmpBuffer {
+ public:
+ void Longjmp() {
+ // "This" is now the last setjmp buffer.
+ interpreter_->set_last_setjmp_buffer(this);
+ longjmp(buffer_, 1);
+ }
+
+ explicit InterpreterSetjmpBuffer(Interpreter* interpreter) {
+ interpreter_ = interpreter;
+ link_ = interpreter->last_setjmp_buffer();
+ interpreter->set_last_setjmp_buffer(this);
+ fp_ = interpreter->fp_;
+ }
+
+ ~InterpreterSetjmpBuffer() {
+ ASSERT(interpreter_->last_setjmp_buffer() == this);
+ interpreter_->set_last_setjmp_buffer(link_);
+ }
+
+ InterpreterSetjmpBuffer* link() const { return link_; }
+
+ uword fp() const { return reinterpret_cast<uword>(fp_); }
+
+ jmp_buf buffer_;
+
+ private:
+ RawObject** fp_;
+ Interpreter* interpreter_;
+ InterpreterSetjmpBuffer* link_;
+
+ friend class Interpreter;
+
+ DISALLOW_ALLOCATION();
+ DISALLOW_COPY_AND_ASSIGN(InterpreterSetjmpBuffer);
+};
+
+DART_FORCE_INLINE static RawObject** SavedCallerFP(RawObject** FP) {
+ return reinterpret_cast<RawObject**>(FP[kKBCSavedCallerFpSlotFromFp]);
+}
+
+DART_FORCE_INLINE static RawObject** FrameArguments(RawObject** FP,
+ intptr_t argc) {
+ return FP - (kKBCDartFrameFixedSize + argc);
+}
+
+#define RAW_CAST(Type, val) (InterpreterHelpers::CastTo##Type(val))
+
+class InterpreterHelpers {
+ public:
+#define DEFINE_CASTS(Type) \
+ DART_FORCE_INLINE static Raw##Type* CastTo##Type(RawObject* obj) { \
+ ASSERT((k##Type##Cid == kSmiCid) ? !obj->IsHeapObject() \
+ : obj->Is##Type()); \
+ return reinterpret_cast<Raw##Type*>(obj); \
+ }
+ CLASS_LIST(DEFINE_CASTS)
+#undef DEFINE_CASTS
+
+ DART_FORCE_INLINE static RawSmi* GetClassIdAsSmi(RawObject* obj) {
+ return Smi::New(obj->IsHeapObject() ? obj->GetClassId()
+ : static_cast<intptr_t>(kSmiCid));
+ }
+
+ DART_FORCE_INLINE static intptr_t GetClassId(RawObject* obj) {
+ return obj->IsHeapObject() ? obj->GetClassId()
+ : static_cast<intptr_t>(kSmiCid);
+ }
+
+ DART_FORCE_INLINE static void IncrementUsageCounter(RawFunction* f) {
+ f->ptr()->usage_counter_++;
+ }
+
+ DART_FORCE_INLINE static void IncrementICUsageCount(RawObject** entries,
+ intptr_t offset,
+ intptr_t args_tested) {
+ const intptr_t count_offset = ICData::CountIndexFor(args_tested);
+ const intptr_t raw_smi_old =
+ reinterpret_cast<intptr_t>(entries[offset + count_offset]);
+ const intptr_t raw_smi_new = raw_smi_old + Smi::RawValue(1);
+ *reinterpret_cast<intptr_t*>(&entries[offset + count_offset]) = raw_smi_new;
+ }
+
+ DART_FORCE_INLINE static bool IsStrictEqualWithNumberCheck(RawObject* lhs,
+ RawObject* rhs) {
+ if (lhs == rhs) {
+ return true;
+ }
+
+ if (lhs->IsHeapObject() && rhs->IsHeapObject()) {
+ const intptr_t lhs_cid = lhs->GetClassId();
+ const intptr_t rhs_cid = rhs->GetClassId();
+ if (lhs_cid == rhs_cid) {
+ switch (lhs_cid) {
+ case kDoubleCid:
+ return (bit_cast<uint64_t, double>(
+ static_cast<RawDouble*>(lhs)->ptr()->value_) ==
+ bit_cast<uint64_t, double>(
+ static_cast<RawDouble*>(rhs)->ptr()->value_));
+
+ case kMintCid:
+ return (static_cast<RawMint*>(lhs)->ptr()->value_ ==
+ static_cast<RawMint*>(rhs)->ptr()->value_);
+
+ case kBigintCid:
+ return (DLRT_BigintCompare(static_cast<RawBigint*>(lhs),
+ static_cast<RawBigint*>(rhs)) == 0);
+ }
+ }
+ }
+
+ return false;
+ }
+
+ template <typename T>
+ DART_FORCE_INLINE static T* Untag(T* tagged) {
+ return tagged->ptr();
+ }
+
+ DART_FORCE_INLINE static bool CheckIndex(RawSmi* index, RawSmi* length) {
+ return !index->IsHeapObject() && (reinterpret_cast<intptr_t>(index) >= 0) &&
+ (reinterpret_cast<intptr_t>(index) <
+ reinterpret_cast<intptr_t>(length));
+ }
+
+ DART_FORCE_INLINE static intptr_t ArgDescTypeArgsLen(RawArray* argdesc) {
+ return Smi::Value(*reinterpret_cast<RawSmi**>(
+ reinterpret_cast<uword>(argdesc->ptr()) +
+ Array::element_offset(ArgumentsDescriptor::kTypeArgsLenIndex)));
+ }
+
+ DART_FORCE_INLINE static intptr_t ArgDescArgCount(RawArray* argdesc) {
+ return Smi::Value(*reinterpret_cast<RawSmi**>(
+ reinterpret_cast<uword>(argdesc->ptr()) +
+ Array::element_offset(ArgumentsDescriptor::kCountIndex)));
+ }
+
+ DART_FORCE_INLINE static intptr_t ArgDescPosCount(RawArray* argdesc) {
+ return Smi::Value(*reinterpret_cast<RawSmi**>(
+ reinterpret_cast<uword>(argdesc->ptr()) +
+ Array::element_offset(ArgumentsDescriptor::kPositionalCountIndex)));
+ }
+
+ static bool ObjectArraySetIndexed(Thread* thread,
+ RawObject** FP,
+ RawObject** result) {
+ return !thread->isolate()->type_checks() &&
+ ObjectArraySetIndexedUnchecked(thread, FP, result);
+ }
+
+ static bool ObjectArraySetIndexedUnchecked(Thread* thread,
+ RawObject** FP,
+ RawObject** result) {
+ RawObject** args = FrameArguments(FP, 3);
+ RawSmi* index = static_cast<RawSmi*>(args[1]);
+ RawArray* array = static_cast<RawArray*>(args[0]);
+ if (CheckIndex(index, array->ptr()->length_)) {
+ array->StorePointer(array->ptr()->data() + Smi::Value(index), args[2]);
+ return true;
+ }
+ return false;
+ }
+
+ static bool ObjectArrayGetIndexed(Thread* thread,
+ RawObject** FP,
+ RawObject** result) {
+ RawObject** args = FrameArguments(FP, 2);
+ RawSmi* index = static_cast<RawSmi*>(args[1]);
+ RawArray* array = static_cast<RawArray*>(args[0]);
+ if (CheckIndex(index, array->ptr()->length_)) {
+ *result = array->ptr()->data()[Smi::Value(index)];
+ return true;
+ }
+ return false;
+ }
+
+ static bool GrowableArraySetIndexed(Thread* thread,
+ RawObject** FP,
+ RawObject** result) {
+ return !thread->isolate()->type_checks() &&
+ GrowableArraySetIndexedUnchecked(thread, FP, result);
+ }
+
+ static bool GrowableArraySetIndexedUnchecked(Thread* thread,
+ RawObject** FP,
+ RawObject** result) {
+ RawObject** args = FrameArguments(FP, 3);
+ RawSmi* index = static_cast<RawSmi*>(args[1]);
+ RawGrowableObjectArray* array =
+ static_cast<RawGrowableObjectArray*>(args[0]);
+ if (CheckIndex(index, array->ptr()->length_)) {
+ RawArray* data = array->ptr()->data_;
+ data->StorePointer(data->ptr()->data() + Smi::Value(index), args[2]);
+ return true;
+ }
+ return false;
+ }
+
+ static bool GrowableArrayGetIndexed(Thread* thread,
+ RawObject** FP,
+ RawObject** result) {
+ RawObject** args = FrameArguments(FP, 2);
+ RawSmi* index = static_cast<RawSmi*>(args[1]);
+ RawGrowableObjectArray* array =
+ static_cast<RawGrowableObjectArray*>(args[0]);
+ if (CheckIndex(index, array->ptr()->length_)) {
+ *result = array->ptr()->data_->ptr()->data()[Smi::Value(index)];
+ return true;
+ }
+ return false;
+ }
+
+ static bool Double_getIsNan(Thread* thread,
+ RawObject** FP,
+ RawObject** result) {
+ RawObject** args = FrameArguments(FP, 1);
+ RawDouble* d = static_cast<RawDouble*>(args[0]);
+ *result =
+ isnan(d->ptr()->value_) ? Bool::True().raw() : Bool::False().raw();
+ return true;
+ }
+
+ static bool Double_getIsInfinite(Thread* thread,
+ RawObject** FP,
+ RawObject** result) {
+ RawObject** args = FrameArguments(FP, 1);
+ RawDouble* d = static_cast<RawDouble*>(args[0]);
+ *result =
+ isinf(d->ptr()->value_) ? Bool::True().raw() : Bool::False().raw();
+ return true;
+ }
+
+ static bool ObjectEquals(Thread* thread, RawObject** FP, RawObject** result) {
+ RawObject** args = FrameArguments(FP, 2);
+ *result = args[0] == args[1] ? Bool::True().raw() : Bool::False().raw();
+ return true;
+ }
+
+ static bool ObjectRuntimeType(Thread* thread,
+ RawObject** FP,
+ RawObject** result) {
+ RawObject** args = FrameArguments(FP, 1);
+ const intptr_t cid = GetClassId(args[0]);
+ if (cid == kClosureCid) {
+ return false;
+ }
+ if (cid < kNumPredefinedCids) {
+ if (cid == kDoubleCid) {
+ *result = thread->isolate()->object_store()->double_type();
+ return true;
+ } else if (RawObject::IsStringClassId(cid)) {
+ *result = thread->isolate()->object_store()->string_type();
+ return true;
+ } else if (RawObject::IsIntegerClassId(cid)) {
+ *result = thread->isolate()->object_store()->int_type();
+ return true;
+ }
+ }
+ RawClass* cls = thread->isolate()->class_table()->At(cid);
+ if (cls->ptr()->num_type_arguments_ != 0) {
+ return false;
+ }
+ RawType* typ = cls->ptr()->canonical_type_;
+ if (typ == Object::null()) {
+ return false;
+ }
+ *result = static_cast<RawObject*>(typ);
+ return true;
+ }
+
+ static bool GetDoubleOperands(RawObject** args, double* d1, double* d2) {
+ RawObject* obj2 = args[1];
+ if (!obj2->IsHeapObject()) {
+ *d2 =
+ static_cast<double>(reinterpret_cast<intptr_t>(obj2) >> kSmiTagSize);
+ } else if (obj2->GetClassId() == kDoubleCid) {
+ RawDouble* obj2d = static_cast<RawDouble*>(obj2);
+ *d2 = obj2d->ptr()->value_;
+ } else {
+ return false;
+ }
+ RawDouble* obj1 = static_cast<RawDouble*>(args[0]);
+ *d1 = obj1->ptr()->value_;
+ return true;
+ }
+
+ static RawObject* AllocateDouble(Thread* thread, double value) {
+ const intptr_t instance_size = Double::InstanceSize();
+ const uword start =
+ thread->heap()->new_space()->TryAllocateInTLAB(thread, instance_size);
+ if (LIKELY(start != 0)) {
+ uword tags = 0;
+ tags = RawObject::ClassIdTag::update(kDoubleCid, tags);
+ tags = RawObject::SizeTag::update(instance_size, tags);
+ // Also writes zero in the hash_ field.
+ *reinterpret_cast<uword*>(start + Double::tags_offset()) = tags;
+ *reinterpret_cast<double*>(start + Double::value_offset()) = value;
+ return reinterpret_cast<RawObject*>(start + kHeapObjectTag);
+ }
+ return NULL;
+ }
+
+ static bool Double_add(Thread* thread, RawObject** FP, RawObject** result) {
+ double d1, d2;
+ if (!GetDoubleOperands(FrameArguments(FP, 2), &d1, &d2)) {
+ return false;
+ }
+ RawObject* new_double = AllocateDouble(thread, d1 + d2);
+ if (new_double != NULL) {
+ *result = new_double;
+ return true;
+ }
+ return false;
+ }
+
+ static bool Double_mul(Thread* thread, RawObject** FP, RawObject** result) {
+ double d1, d2;
+ if (!GetDoubleOperands(FrameArguments(FP, 2), &d1, &d2)) {
+ return false;
+ }
+ RawObject* new_double = AllocateDouble(thread, d1 * d2);
+ if (new_double != NULL) {
+ *result = new_double;
+ return true;
+ }
+ return false;
+ }
+
+ static bool Double_sub(Thread* thread, RawObject** FP, RawObject** result) {
+ double d1, d2;
+ if (!GetDoubleOperands(FrameArguments(FP, 2), &d1, &d2)) {
+ return false;
+ }
+ RawObject* new_double = AllocateDouble(thread, d1 - d2);
+ if (new_double != NULL) {
+ *result = new_double;
+ return true;
+ }
+ return false;
+ }
+
+ static bool Double_div(Thread* thread, RawObject** FP, RawObject** result) {
+ double d1, d2;
+ if (!GetDoubleOperands(FrameArguments(FP, 2), &d1, &d2)) {
+ return false;
+ }
+ RawObject* new_double = AllocateDouble(thread, d1 / d2);
+ if (new_double != NULL) {
+ *result = new_double;
+ return true;
+ }
+ return false;
+ }
+
+ static bool Double_greaterThan(Thread* thread,
+ RawObject** FP,
+ RawObject** result) {
+ double d1, d2;
+ if (!GetDoubleOperands(FrameArguments(FP, 2), &d1, &d2)) {
+ return false;
+ }
+ *result = d1 > d2 ? Bool::True().raw() : Bool::False().raw();
+ return true;
+ }
+
+ static bool Double_greaterEqualThan(Thread* thread,
+ RawObject** FP,
+ RawObject** result) {
+ double d1, d2;
+ if (!GetDoubleOperands(FrameArguments(FP, 2), &d1, &d2)) {
+ return false;
+ }
+ *result = d1 >= d2 ? Bool::True().raw() : Bool::False().raw();
+ return true;
+ }
+
+ static bool Double_lessThan(Thread* thread,
+ RawObject** FP,
+ RawObject** result) {
+ double d1, d2;
+ if (!GetDoubleOperands(FrameArguments(FP, 2), &d1, &d2)) {
+ return false;
+ }
+ *result = d1 < d2 ? Bool::True().raw() : Bool::False().raw();
+ return true;
+ }
+
+ static bool Double_equal(Thread* thread, RawObject** FP, RawObject** result) {
+ double d1, d2;
+ if (!GetDoubleOperands(FrameArguments(FP, 2), &d1, &d2)) {
+ return false;
+ }
+ *result = d1 == d2 ? Bool::True().raw() : Bool::False().raw();
+ return true;
+ }
+
+ static bool Double_lessEqualThan(Thread* thread,
+ RawObject** FP,
+ RawObject** result) {
+ double d1, d2;
+ if (!GetDoubleOperands(FrameArguments(FP, 2), &d1, &d2)) {
+ return false;
+ }
+ *result = d1 <= d2 ? Bool::True().raw() : Bool::False().raw();
+ return true;
+ }
+
+ static bool ClearAsyncThreadStack(Thread* thread,
+ RawObject** FP,
+ RawObject** result) {
+ thread->clear_async_stack_trace();
+ *result = Object::null();
+ return true;
+ }
+
+ static bool SetAsyncThreadStackTrace(Thread* thread,
+ RawObject** FP,
+ RawObject** result) {
+ RawObject** args = FrameArguments(FP, 1);
+ thread->set_raw_async_stack_trace(
+ reinterpret_cast<RawStackTrace*>(args[0]));
+ *result = Object::null();
+ return true;
+ }
+
+ DART_FORCE_INLINE static RawCode* FrameCode(RawObject** FP) {
+ ASSERT(GetClassId(FP[kKBCPcMarkerSlotFromFp]) == kCodeCid);
+ return static_cast<RawCode*>(FP[kKBCPcMarkerSlotFromFp]);
+ }
+
+ DART_FORCE_INLINE static void SetFrameCode(RawObject** FP, RawCode* code) {
+ ASSERT(GetClassId(code) == kCodeCid);
+ FP[kKBCPcMarkerSlotFromFp] = code;
+ }
+
+ DART_FORCE_INLINE static uint8_t* GetTypedData(RawObject* obj,
+ RawObject* index) {
+ ASSERT(RawObject::IsTypedDataClassId(obj->GetClassId()));
+ RawTypedData* array = reinterpret_cast<RawTypedData*>(obj);
+ const intptr_t byte_offset = Smi::Value(RAW_CAST(Smi, index));
+ ASSERT(byte_offset >= 0);
+ return array->ptr()->data() + byte_offset;
+ }
+};
+
+DART_FORCE_INLINE static uint32_t* SavedCallerPC(RawObject** FP) {
+ return reinterpret_cast<uint32_t*>(FP[kKBCSavedCallerPcSlotFromFp]);
+}
+
+DART_FORCE_INLINE static RawFunction* FrameFunction(RawObject** FP) {
+ RawFunction* function = static_cast<RawFunction*>(FP[kKBCFunctionSlotFromFp]);
+ ASSERT(InterpreterHelpers::GetClassId(function) == kFunctionCid ||
+ InterpreterHelpers::GetClassId(function) == kNullCid);
+ return function;
+}
+
+IntrinsicHandler Interpreter::intrinsics_[Interpreter::kIntrinsicCount];
+
+// Synchronization primitives support.
+void Interpreter::InitOnce() {
+ for (intptr_t i = 0; i < kIntrinsicCount; i++) {
+ intrinsics_[i] = 0;
+ }
+
+ intrinsics_[kObjectArraySetIndexedIntrinsic] =
+ InterpreterHelpers::ObjectArraySetIndexed;
+ intrinsics_[kObjectArraySetIndexedUncheckedIntrinsic] =
+ InterpreterHelpers::ObjectArraySetIndexedUnchecked;
+ intrinsics_[kObjectArrayGetIndexedIntrinsic] =
+ InterpreterHelpers::ObjectArrayGetIndexed;
+ intrinsics_[kGrowableArraySetIndexedIntrinsic] =
+ InterpreterHelpers::GrowableArraySetIndexed;
+ intrinsics_[kGrowableArraySetIndexedUncheckedIntrinsic] =
+ InterpreterHelpers::GrowableArraySetIndexedUnchecked;
+ intrinsics_[kGrowableArrayGetIndexedIntrinsic] =
+ InterpreterHelpers::GrowableArrayGetIndexed;
+ intrinsics_[kObjectEqualsIntrinsic] = InterpreterHelpers::ObjectEquals;
+ intrinsics_[kObjectRuntimeTypeIntrinsic] =
+ InterpreterHelpers::ObjectRuntimeType;
+
+ intrinsics_[kDouble_getIsNaNIntrinsic] = InterpreterHelpers::Double_getIsNan;
+ intrinsics_[kDouble_getIsInfiniteIntrinsic] =
+ InterpreterHelpers::Double_getIsInfinite;
+ intrinsics_[kDouble_addIntrinsic] = InterpreterHelpers::Double_add;
+ intrinsics_[kDouble_mulIntrinsic] = InterpreterHelpers::Double_mul;
+ intrinsics_[kDouble_subIntrinsic] = InterpreterHelpers::Double_sub;
+ intrinsics_[kDouble_divIntrinsic] = InterpreterHelpers::Double_div;
+ intrinsics_[kDouble_greaterThanIntrinsic] =
+ InterpreterHelpers::Double_greaterThan;
+ intrinsics_[kDouble_greaterEqualThanIntrinsic] =
+ InterpreterHelpers::Double_greaterEqualThan;
+ intrinsics_[kDouble_lessThanIntrinsic] = InterpreterHelpers::Double_lessThan;
+ intrinsics_[kDouble_equalIntrinsic] = InterpreterHelpers::Double_equal;
+ intrinsics_[kDouble_lessEqualThanIntrinsic] =
+ InterpreterHelpers::Double_lessEqualThan;
+ intrinsics_[kClearAsyncThreadStackTraceIntrinsic] =
+ InterpreterHelpers::ClearAsyncThreadStack;
+ intrinsics_[kSetAsyncThreadStackTraceIntrinsic] =
+ InterpreterHelpers::SetAsyncThreadStackTrace;
+}
+
+Interpreter::Interpreter()
+ : stack_(NULL), fp_(NULL), pp_(NULL), argdesc_(NULL) {
+ // Setup interpreter support first. Some of this information is needed to
+ // setup the architecture state.
+ // We allocate the stack here, the size is computed as the sum of
+ // the size specified by the user and the buffer space needed for
+ // handling stack overflow exceptions. To be safe in potential
+ // stack underflows we also add some underflow buffer space.
+ stack_ = new uintptr_t[(OSThread::GetSpecifiedStackSize() +
+ OSThread::kStackSizeBuffer +
+ kInterpreterStackUnderflowSize) /
+ sizeof(uintptr_t)];
+ // Low address.
+ stack_base_ =
+ reinterpret_cast<uword>(stack_) + kInterpreterStackUnderflowSize;
+ // High address.
+ stack_limit_ = stack_base_ + OSThread::GetSpecifiedStackSize();
+
+ last_setjmp_buffer_ = NULL;
+ top_exit_frame_info_ = 0;
+
+ DEBUG_ONLY(icount_ = 0);
+}
+
+Interpreter::~Interpreter() {
+ delete[] stack_;
+ Isolate* isolate = Isolate::Current();
+ if (isolate != NULL) {
+ isolate->set_interpreter(NULL);
+ }
+}
+
+// Get the active Interpreter for the current isolate.
+Interpreter* Interpreter::Current() {
+ Interpreter* interpreter = Isolate::Current()->interpreter();
+ if (interpreter == NULL) {
+ interpreter = new Interpreter();
+ Isolate::Current()->set_interpreter(interpreter);
+ }
+ return interpreter;
+}
+
+#if defined(DEBUG)
+// Returns true if tracing of executed instructions is enabled.
+DART_FORCE_INLINE bool Interpreter::IsTracingExecution() const {
+ return icount_ > FLAG_trace_interpreter_after;
+}
+
+// Prints bytecode instruction at given pc for instruction tracing.
+DART_NOINLINE void Interpreter::TraceInstruction(uint32_t* pc) const {
+ THR_Print("%" Pu64 " ", icount_);
+ if (FLAG_support_disassembler) {
+ KernelBytecodeDisassembler::Disassemble(reinterpret_cast<uword>(pc),
+ reinterpret_cast<uword>(pc + 1));
+ } else {
+ THR_Print("Disassembler not supported in this mode.\n");
+ }
+}
+#endif // defined(DEBUG)
+
+// Calls into the Dart runtime are based on this interface.
+typedef void (*InterpreterRuntimeCall)(NativeArguments arguments);
+
+// Calls to leaf Dart runtime functions are based on this interface.
+typedef intptr_t (*InterpreterLeafRuntimeCall)(intptr_t r0,
+ intptr_t r1,
+ intptr_t r2,
+ intptr_t r3);
+
+// Calls to leaf float Dart runtime functions are based on this interface.
+typedef double (*InterpreterLeafFloatRuntimeCall)(double d0, double d1);
+
+void Interpreter::Exit(Thread* thread,
+ RawObject** base,
+ RawObject** frame,
+ uint32_t* pc) {
+ frame[0] = Function::null();
+ frame[1] = Code::null();
+ frame[2] = reinterpret_cast<RawObject*>(pc);
+ frame[3] = reinterpret_cast<RawObject*>(base);
+ fp_ = frame + kKBCDartFrameFixedSize;
+ thread->set_top_exit_frame_info(reinterpret_cast<uword>(fp_));
+}
+
+// TODO(vegorov): Investigate advantages of using
+// __builtin_s{add,sub,mul}_overflow() intrinsics here and below.
+// Note that they may clobber the output location even when there is overflow:
+// https://gcc.gnu.org/onlinedocs/gcc/Integer-Overflow-Builtins.html
+DART_FORCE_INLINE static bool SignedAddWithOverflow(int32_t lhs,
+ int32_t rhs,
+ intptr_t* out) {
+ intptr_t res = 1;
+#if defined(HOST_ARCH_IA32)
+ asm volatile(
+ "add %2, %1\n"
+ "jo 1f;\n"
+ "xor %0, %0\n"
+ "mov %1, 0(%3)\n"
+ "1: "
+ : "+r"(res), "+r"(lhs)
+ : "r"(rhs), "r"(out)
+ : "cc");
+#elif defined(HOST_ARCH_X64)
+ int64_t tmp;
+ asm volatile(
+ "addl %[rhs], %[lhs]\n"
+ "jo 1f;\n"
+ "xor %[res], %[res]\n"
+ "movslq %[lhs], %[tmp]\n"
+ "mov %[tmp], 0(%[out])\n"
+ "1: "
+ : [res] "+r"(res), [lhs] "+r"(lhs), [tmp] "=&r"(tmp)
+ : [rhs] "r"(rhs), [out] "r"(out)
+ : "cc");
+#elif defined(HOST_ARCH_ARM)
+ asm volatile(
+ "adds %1, %1, %2;\n"
+ "bvs 1f;\n"
+ "mov %0, #0;\n"
+ "str %1, [%3, #0]\n"
+ "1:"
+ : "+r"(res), "+r"(lhs)
+ : "r"(rhs), "r"(out)
+ : "cc");
+#elif defined(HOST_ARCH_ARM64)
+ asm volatile(
+ "adds %w1, %w1, %w2;\n"
+ "bvs 1f;\n"
+ "sxtw %x1, %w1;\n"
+ "mov %0, #0;\n"
+ "str %x1, [%3, #0]\n"
+ "1:"
+ : "+r"(res), "+r"(lhs)
+ : "r"(rhs), "r"(out)
+ : "cc");
+#else
+#error "Unsupported platform"
+#endif
+ return (res != 0);
+}
+
+DART_FORCE_INLINE static bool SignedSubWithOverflow(int32_t lhs,
+ int32_t rhs,
+ intptr_t* out) {
+ intptr_t res = 1;
+#if defined(HOST_ARCH_IA32)
+ asm volatile(
+ "sub %2, %1\n"
+ "jo 1f;\n"
+ "xor %0, %0\n"
+ "mov %1, 0(%3)\n"
+ "1: "
+ : "+r"(res), "+r"(lhs)
+ : "r"(rhs), "r"(out)
+ : "cc");
+#elif defined(HOST_ARCH_X64)
+ int64_t tmp;
+ asm volatile(
+ "subl %[rhs], %[lhs]\n"
+ "jo 1f;\n"
+ "xor %[res], %[res]\n"
+ "movslq %[lhs], %[tmp]\n"
+ "mov %[tmp], 0(%[out])\n"
+ "1: "
+ : [res] "+r"(res), [lhs] "+r"(lhs), [tmp] "=&r"(tmp)
+ : [rhs] "r"(rhs), [out] "r"(out)
+ : "cc");
+#elif defined(HOST_ARCH_ARM)
+ asm volatile(
+ "subs %1, %1, %2;\n"
+ "bvs 1f;\n"
+ "mov %0, #0;\n"
+ "str %1, [%3, #0]\n"
+ "1:"
+ : "+r"(res), "+r"(lhs)
+ : "r"(rhs), "r"(out)
+ : "cc");
+#elif defined(HOST_ARCH_ARM64)
+ asm volatile(
+ "subs %w1, %w1, %w2;\n"
+ "bvs 1f;\n"
+ "sxtw %x1, %w1;\n"
+ "mov %0, #0;\n"
+ "str %x1, [%3, #0]\n"
+ "1:"
+ : "+r"(res), "+r"(lhs)
+ : "r"(rhs), "r"(out)
+ : "cc");
+#else
+#error "Unsupported platform"
+#endif
+ return (res != 0);
+}
+
+DART_FORCE_INLINE static bool SignedMulWithOverflow(int32_t lhs,
+ int32_t rhs,
+ intptr_t* out) {
+ intptr_t res = 1;
+#if defined(HOST_ARCH_IA32)
+ asm volatile(
+ "imul %2, %1\n"
+ "jo 1f;\n"
+ "xor %0, %0\n"
+ "mov %1, 0(%3)\n"
+ "1: "
+ : "+r"(res), "+r"(lhs)
+ : "r"(rhs), "r"(out)
+ : "cc");
+#elif defined(HOST_ARCH_X64)
+ int64_t tmp;
+ asm volatile(
+ "imull %[rhs], %[lhs]\n"
+ "jo 1f;\n"
+ "xor %[res], %[res]\n"
+ "movslq %[lhs], %[tmp]\n"
+ "mov %[tmp], 0(%[out])\n"
+ "1: "
+ : [res] "+r"(res), [lhs] "+r"(lhs), [tmp] "=&r"(tmp)
+ : [rhs] "r"(rhs), [out] "r"(out)
+ : "cc");
+#elif defined(HOST_ARCH_ARM)
+ asm volatile(
+ "smull %1, ip, %1, %2;\n"
+ "cmp ip, %1, ASR #31;\n"
+ "bne 1f;\n"
+ "mov %0, $0;\n"
+ "str %1, [%3, #0]\n"
+ "1:"
+ : "+r"(res), "+r"(lhs)
+ : "r"(rhs), "r"(out)
+ : "cc", "r12");
+#elif defined(HOST_ARCH_ARM64)
+ int64_t prod_lo = 0;
+ asm volatile(
+ "smull %x1, %w2, %w3\n"
+ "asr %x2, %x1, #63\n"
+ "cmp %x2, %x1, ASR #31;\n"
+ "bne 1f;\n"
+ "mov %0, #0;\n"
+ "str %x1, [%4, #0]\n"
+ "1:"
+ : "=r"(res), "+r"(prod_lo), "+r"(lhs)
+ : "r"(rhs), "r"(out)
+ : "cc");
+#else
+#error "Unsupported platform"
+#endif
+ return (res != 0);
+}
+
+DART_FORCE_INLINE static bool AreBothSmis(intptr_t a, intptr_t b) {
+ return ((a | b) & kHeapObjectTag) == 0;
+}
+
+#define SMI_MUL(lhs, rhs, pres) SignedMulWithOverflow((lhs), (rhs) >> 1, pres)
+#define SMI_COND(cond, lhs, rhs, pres) \
+ ((*(pres) = ((lhs cond rhs) ? true_value : false_value)), false)
+#define SMI_EQ(lhs, rhs, pres) SMI_COND(==, lhs, rhs, pres)
+#define SMI_LT(lhs, rhs, pres) SMI_COND(<, lhs, rhs, pres)
+#define SMI_GT(lhs, rhs, pres) SMI_COND(>, lhs, rhs, pres)
+#define SMI_BITOR(lhs, rhs, pres) ((*(pres) = (lhs | rhs)), false)
+#define SMI_BITAND(lhs, rhs, pres) ((*(pres) = ((lhs) & (rhs))), false)
+#define SMI_BITXOR(lhs, rhs, pres) ((*(pres) = ((lhs) ^ (rhs))), false)
+
+void Interpreter::CallRuntime(Thread* thread,
+ RawObject** base,
+ RawObject** exit_frame,
+ uint32_t* pc,
+ intptr_t argc_tag,
+ RawObject** args,
+ RawObject** result,
+ uword target) {
+ Exit(thread, base, exit_frame, pc);
+ NativeArguments native_args(thread, argc_tag, args, result);
+ reinterpret_cast<RuntimeFunction>(target)(native_args);
+}
+
+DART_FORCE_INLINE static void EnterSyntheticFrame(RawObject*** FP,
+ RawObject*** SP,
+ uint32_t* pc) {
+ RawObject** fp = *SP + kKBCDartFrameFixedSize;
+ fp[kKBCPcMarkerSlotFromFp] = 0;
+ fp[kKBCSavedCallerPcSlotFromFp] = reinterpret_cast<RawObject*>(pc);
+ fp[kKBCSavedCallerFpSlotFromFp] = reinterpret_cast<RawObject*>(*FP);
+ *FP = fp;
+ *SP = fp - 1;
+}
+
+DART_FORCE_INLINE static void LeaveSyntheticFrame(RawObject*** FP,
+ RawObject*** SP) {
+ RawObject** fp = *FP;
+ *FP = reinterpret_cast<RawObject**>(fp[kKBCSavedCallerFpSlotFromFp]);
+ *SP = fp - kKBCDartFrameFixedSize;
+}
+
+DART_NOINLINE bool Interpreter::InvokeCompiled(Thread* thread,
+ RawFunction* function,
+ RawArray* argdesc,
+ RawObject** call_base,
+ RawObject** call_top,
+ uint32_t** pc,
+ RawObject*** FP,
+ RawObject*** SP) {
+ InterpreterSetjmpBuffer buffer(this);
+ if (!setjmp(buffer.buffer_)) {
+#if defined(USING_SIMULATOR) || defined(TARGET_ARCH_DBC)
+ // TODO(regis): Revisit.
+ UNIMPLEMENTED();
+#endif
+ ASSERT(thread->vm_tag() == VMTag::kDartTagId);
+ ASSERT(thread->execution_state() == Thread::kThreadInGenerated);
+ if (!Function::HasCode(function)) {
+ ASSERT(!Function::HasBytecode(function));
+ call_top[1] = 0; // Code result.
+ call_top[2] = function;
+ CallRuntime(thread, *FP, call_top + 3, *pc, 1, call_top + 2, call_top + 1,
+ reinterpret_cast<uword>(DRT_CompileFunction));
+ }
+ if (Function::HasCode(function)) {
+ RawCode* code = function->ptr()->code_;
+ ASSERT(code != StubCode::LazyCompile_entry()->code());
+ // TODO(regis): Do we really need a stub? Try to invoke directly.
+
+ // On success, returns a RawInstance. On failure, a RawError.
+ typedef RawObject* (*invokestub)(RawCode * code, RawArray * argdesc,
+ RawObject * *arg0, Thread * thread);
+ invokestub entrypoint = reinterpret_cast<invokestub>(
+ StubCode::InvokeDartCodeFromBytecode_entry()->EntryPoint());
+ *call_base = entrypoint(code, argdesc, call_base, thread);
+ // Result is at call_base;
+ *SP = call_base;
+ } else {
+ ASSERT(Function::HasBytecode(function));
+ // Bytecode was loaded in the above compilation step.
+ // Stay in interpreter.
+ RawCode* bytecode = function->ptr()->bytecode_;
+ RawObject** callee_fp = call_top + kKBCDartFrameFixedSize;
+ callee_fp[kKBCPcMarkerSlotFromFp] = bytecode;
+ callee_fp[kKBCSavedCallerPcSlotFromFp] =
+ reinterpret_cast<RawObject*>(*pc);
+ callee_fp[kKBCSavedCallerFpSlotFromFp] =
+ reinterpret_cast<RawObject*>(*FP);
+ pp_ = bytecode->ptr()->object_pool_;
+ *pc = reinterpret_cast<uint32_t*>(bytecode->ptr()->entry_point_);
+ pc_ = reinterpret_cast<uword>(*pc); // For the profiler.
+ *FP = callee_fp;
+ *SP = *FP - 1;
+ // Dispatch will interpret function.
+ }
+ ASSERT(thread->vm_tag() == VMTag::kDartTagId);
+ ASSERT(thread->execution_state() == Thread::kThreadInGenerated);
+ thread->set_top_exit_frame_info(0);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+DART_FORCE_INLINE void Interpreter::Invoke(Thread* thread,
+ RawObject** call_base,
+ RawObject** call_top,
+ uint32_t** pc,
+ RawObject*** FP,
+ RawObject*** SP) {
+ RawObject** callee_fp = call_top + kKBCDartFrameFixedSize;
+
+ RawFunction* function = FrameFunction(callee_fp);
+ if (Function::HasCode(function) || !Function::HasBytecode(function)) {
+ // TODO(regis): If the function is a dispatcher, execute the dispatch here.
+ if (!InvokeCompiled(thread, function, argdesc_, call_base, call_top, pc, FP,
+ SP)) {
+ // Handle exception
+ *FP = reinterpret_cast<RawObject**>(fp_);
+ *pc = reinterpret_cast<uint32_t*>(pc_);
+ pp_ = InterpreterHelpers::FrameCode(*FP)->ptr()->object_pool_;
+ *SP = *FP - 1;
+ }
+ } else {
+ RawCode* bytecode = function->ptr()->bytecode_;
+ callee_fp[kKBCPcMarkerSlotFromFp] = bytecode;
+ callee_fp[kKBCSavedCallerPcSlotFromFp] = reinterpret_cast<RawObject*>(*pc);
+ callee_fp[kKBCSavedCallerFpSlotFromFp] = reinterpret_cast<RawObject*>(*FP);
+ pp_ = bytecode->ptr()->object_pool_;
+ *pc = reinterpret_cast<uint32_t*>(bytecode->ptr()->entry_point_);
+ pc_ = reinterpret_cast<uword>(*pc); // For the profiler.
+ *FP = callee_fp;
+ *SP = *FP - 1;
+ }
+}
+
+void Interpreter::InlineCacheMiss(int checked_args,
+ Thread* thread,
+ RawICData* icdata,
+ RawObject** args,
+ RawObject** top,
+ uint32_t* pc,
+ RawObject** FP,
+ RawObject** SP) {
+ RawObject** result = top;
+ RawObject** miss_handler_args = top + 1;
+ for (intptr_t i = 0; i < checked_args; i++) {
+ miss_handler_args[i] = args[i];
+ }
+ miss_handler_args[checked_args] = icdata;
+ RuntimeFunction handler = NULL;
+ switch (checked_args) {
+ case 1:
+ handler = DRT_InlineCacheMissHandlerOneArg;
+ break;
+ case 2:
+ handler = DRT_InlineCacheMissHandlerTwoArgs;
+ break;
+ default:
+ UNREACHABLE();
+ break;
+ }
+
+ // Handler arguments: arguments to check and an ICData object.
+ const intptr_t miss_handler_argc = checked_args + 1;
+ RawObject** exit_frame = miss_handler_args + miss_handler_argc;
+ CallRuntime(thread, FP, exit_frame, pc, miss_handler_argc, miss_handler_args,
+ result, reinterpret_cast<uword>(handler));
+}
+
+DART_FORCE_INLINE void Interpreter::InstanceCall1(Thread* thread,
+ RawICData* icdata,
+ RawObject** call_base,
+ RawObject** top,
+ uint32_t** pc,
+ RawObject*** FP,
+ RawObject*** SP,
+ bool optimized) {
+ ASSERT(icdata->GetClassId() == kICDataCid);
+
+ const intptr_t kCheckedArgs = 1;
+ RawObject** args = call_base;
+ RawArray* cache = icdata->ptr()->ic_data_->ptr();
+
+ const intptr_t type_args_len =
+ InterpreterHelpers::ArgDescTypeArgsLen(icdata->ptr()->args_descriptor_);
+ const intptr_t receiver_idx = type_args_len > 0 ? 1 : 0;
+ RawSmi* receiver_cid =
+ InterpreterHelpers::GetClassIdAsSmi(args[receiver_idx]);
+
+ bool found = false;
+ const intptr_t length = Smi::Value(cache->length_);
+ intptr_t i;
+ for (i = 0; i < (length - (kCheckedArgs + 2)); i += (kCheckedArgs + 2)) {
+ if (cache->data()[i + 0] == receiver_cid) {
+ top[0] = cache->data()[i + kCheckedArgs];
+ found = true;
+ break;
+ }
+ }
+
+ argdesc_ = icdata->ptr()->args_descriptor_;
+
+ if (found) {
+ if (!optimized) {
+ InterpreterHelpers::IncrementICUsageCount(cache->data(), i, kCheckedArgs);
+ }
+ } else {
+ InlineCacheMiss(kCheckedArgs, thread, icdata, call_base + receiver_idx, top,
+ *pc, *FP, *SP);
+ }
+
+ Invoke(thread, call_base, top, pc, FP, SP);
+}
+
+DART_FORCE_INLINE void Interpreter::InstanceCall2(Thread* thread,
+ RawICData* icdata,
+ RawObject** call_base,
+ RawObject** top,
+ uint32_t** pc,
+ RawObject*** FP,
+ RawObject*** SP,
+ bool optimized) {
+ ASSERT(icdata->GetClassId() == kICDataCid);
+
+ const intptr_t kCheckedArgs = 2;
+ RawObject** args = call_base;
+ RawArray* cache = icdata->ptr()->ic_data_->ptr();
+
+ const intptr_t type_args_len =
+ InterpreterHelpers::ArgDescTypeArgsLen(icdata->ptr()->args_descriptor_);
+ const intptr_t receiver_idx = type_args_len > 0 ? 1 : 0;
+ RawSmi* receiver_cid =
+ InterpreterHelpers::GetClassIdAsSmi(args[receiver_idx]);
+ RawSmi* arg0_cid =
+ InterpreterHelpers::GetClassIdAsSmi(args[receiver_idx + 1]);
+
+ bool found = false;
+ const intptr_t length = Smi::Value(cache->length_);
+ intptr_t i;
+ for (i = 0; i < (length - (kCheckedArgs + 2)); i += (kCheckedArgs + 2)) {
+ if ((cache->data()[i + 0] == receiver_cid) &&
+ (cache->data()[i + 1] == arg0_cid)) {
+ top[0] = cache->data()[i + kCheckedArgs];
+ found = true;
+ break;
+ }
+ }
+
+ argdesc_ = icdata->ptr()->args_descriptor_;
+
+ if (found) {
+ if (!optimized) {
+ InterpreterHelpers::IncrementICUsageCount(cache->data(), i, kCheckedArgs);
+ }
+ } else {
+ InlineCacheMiss(kCheckedArgs, thread, icdata, call_base + receiver_idx, top,
+ *pc, *FP, *SP);
+ }
+
+ Invoke(thread, call_base, top, pc, FP, SP);
+}
+
+DART_FORCE_INLINE void Interpreter::PrepareForTailCall(
+ RawCode* code,
+ RawImmutableArray* args_desc,
+ RawObject** FP,
+ RawObject*** SP,
+ uint32_t** pc) {
+ // Drop all stack locals.
+ *SP = FP - 1;
+
+ // Replace the callee with the new [code].
+ FP[kKBCFunctionSlotFromFp] = Object::null();
+ FP[kKBCPcMarkerSlotFromFp] = code;
+ *pc = reinterpret_cast<uint32_t*>(code->ptr()->entry_point_);
+ pc_ = reinterpret_cast<uword>(pc); // For the profiler.
+ pp_ = code->ptr()->object_pool_;
+ argdesc_ = args_desc;
+}
+
+// Note: functions below are marked DART_NOINLINE to recover performance on
+// ARM where inlining these functions into the interpreter loop seemed to cause
+// some code quality issues.
+static DART_NOINLINE bool InvokeRuntime(Thread* thread,
+ Interpreter* interpreter,
+ RuntimeFunction drt,
+ const NativeArguments& args) {
+ InterpreterSetjmpBuffer buffer(interpreter);
+ if (!setjmp(buffer.buffer_)) {
+ thread->set_vm_tag(reinterpret_cast<uword>(drt));
+ drt(args);
+ thread->set_vm_tag(VMTag::kDartTagId);
+ thread->set_top_exit_frame_info(0);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+static DART_NOINLINE bool InvokeNative(Thread* thread,
+ Interpreter* interpreter,
+ NativeFunctionWrapper wrapper,
+ Dart_NativeFunction function,
+ Dart_NativeArguments args) {
+ InterpreterSetjmpBuffer buffer(interpreter);
+ if (!setjmp(buffer.buffer_)) {
+ thread->set_vm_tag(reinterpret_cast<uword>(function));
+ wrapper(args, function);
+ thread->set_vm_tag(VMTag::kDartTagId);
+ thread->set_top_exit_frame_info(0);
+ return true;
+ } else {
+ return false;
+ }
+}
+
+// Note:
+// All macro helpers are intended to be used only inside Interpreter::Call.
+
+// Counts and prints executed bytecode instructions (in DEBUG mode).
+#if defined(DEBUG)
+#define TRACE_INSTRUCTION \
+ icount_++; \
+ if (IsTracingExecution()) { \
+ TraceInstruction(pc - 1); \
+ }
+#else
+#define TRACE_INSTRUCTION
+#endif // defined(DEBUG)
+
+// Decode opcode and A part of the given value and dispatch to the
+// corresponding bytecode handler.
+#define DISPATCH_OP(val) \
+ do { \
+ op = (val); \
+ rA = ((op >> 8) & 0xFF); \
+ TRACE_INSTRUCTION \
+ goto* dispatch[op & 0xFF]; \
+ } while (0)
+
+// Fetch next operation from PC, increment program counter and dispatch.
+#define DISPATCH() DISPATCH_OP(*pc++)
+
+// Define entry point that handles bytecode Name with the given operand format.
+#define BYTECODE(Name, Operands) \
+ BYTECODE_HEADER(Name, DECLARE_##Operands, DECODE_##Operands)
+
+#define BYTECODE_HEADER(Name, Declare, Decode) \
+ Declare; \
+ bc##Name : Decode
+
+// Helpers to decode common instruction formats. Used in conjunction with
+// BYTECODE() macro.
+#define DECLARE_A_B_C \
+ uint16_t rB, rC; \
+ USE(rB); \
+ USE(rC)
+#define DECODE_A_B_C \
+ rB = ((op >> KernelBytecode::kBShift) & KernelBytecode::kBMask); \
+ rC = ((op >> KernelBytecode::kCShift) & KernelBytecode::kCMask);
+
+#define DECLARE_A_B_Y \
+ uint16_t rB; \
+ int8_t rY; \
+ USE(rB); \
+ USE(rY)
+#define DECODE_A_B_Y \
+ rB = ((op >> KernelBytecode::kBShift) & KernelBytecode::kBMask); \
+ rY = ((op >> KernelBytecode::kYShift) & KernelBytecode::kYMask);
+
+#define DECLARE_0
+#define DECODE_0
+
+#define DECLARE_A
+#define DECODE_A
+
+#define DECLARE___D \
+ uint32_t rD; \
+ USE(rD)
+#define DECODE___D rD = (op >> KernelBytecode::kDShift);
+
+#define DECLARE_A_D DECLARE___D
+#define DECODE_A_D DECODE___D
+
+#define DECLARE_A_X \
+ int32_t rD; \
+ USE(rD)
+#define DECODE_A_X rD = (static_cast<int32_t>(op) >> KernelBytecode::kDShift);
+
+#define SMI_FASTPATH_ICDATA_INC \
+ do { \
+ ASSERT(KernelBytecode::IsCallOpcode(*pc)); \
+ const uint16_t kidx = KernelBytecode::DecodeD(*pc); \
+ const RawICData* icdata = RAW_CAST(ICData, LOAD_CONSTANT(kidx)); \
+ RawObject** entries = icdata->ptr()->ic_data_->ptr()->data(); \
+ InterpreterHelpers::IncrementICUsageCount(entries, 0, 2); \
+ } while (0);
+
+// Declare bytecode handler for a smi operation (e.g. AddTOS) with the
+// given result type and the given behavior specified as a function
+// that takes left and right operands and result slot and returns
+// true if fast-path succeeds.
+#define SMI_FASTPATH_TOS(ResultT, Func) \
+ { \
+ const intptr_t lhs = reinterpret_cast<intptr_t>(SP[-1]); \
+ const intptr_t rhs = reinterpret_cast<intptr_t>(SP[-0]); \
+ ResultT* slot = reinterpret_cast<ResultT*>(SP - 1); \
+ if (LIKELY(!thread->isolate()->single_step()) && \
+ LIKELY(AreBothSmis(lhs, rhs) && !Func(lhs, rhs, slot))) { \
+ SMI_FASTPATH_ICDATA_INC; \
+ /* Fast path succeeded. Skip the generic call that follows. */ \
+ pc++; \
+ /* We dropped 2 arguments and push result */ \
+ SP--; \
+ } \
+ }
+
+// Skip the next instruction if there is no overflow.
+#define SMI_OP_CHECK(ResultT, Func) \
+ { \
+ const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rB]); \
+ const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rC]); \
+ ResultT* slot = reinterpret_cast<ResultT*>(&FP[rA]); \
+ if (LIKELY(!Func(lhs, rhs, slot))) { \
+ /* Success. Skip the instruction that follows. */ \
+ pc++; \
+ } \
+ }
+
+// Do not check for overflow.
+#define SMI_OP_NOCHECK(ResultT, Func) \
+ { \
+ const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rB]); \
+ const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rC]); \
+ ResultT* slot = reinterpret_cast<ResultT*>(&FP[rA]); \
+ Func(lhs, rhs, slot); \
+ }
+
+// Exception handling helper. Gets handler FP and PC from the Interpreter where
+// they were stored by Interpreter::Longjmp and proceeds to execute the handler.
+// Corner case: handler PC can be a fake marker that marks entry frame, which
+// means exception was not handled in the Dart code. In this case we return
+// caught exception from Interpreter::Call.
+#define HANDLE_EXCEPTION \
+ do { \
+ FP = reinterpret_cast<RawObject**>(fp_); \
+ pc = reinterpret_cast<uint32_t*>(pc_); \
+ if ((reinterpret_cast<uword>(pc) & 2) != 0) { /* Entry frame? */ \
+ fp_ = reinterpret_cast<RawObject**>(fp_[0]); \
+ thread->set_top_exit_frame_info(reinterpret_cast<uword>(fp_)); \
+ thread->set_top_resource(top_resource); \
+ thread->set_vm_tag(vm_tag); \
+ return special_[kExceptionSpecialIndex]; \
+ } \
+ pp_ = InterpreterHelpers::FrameCode(FP)->ptr()->object_pool_; \
+ goto DispatchAfterException; \
+ } while (0)
+
+#define HANDLE_RETURN \
+ do { \
+ pp_ = InterpreterHelpers::FrameCode(FP)->ptr()->object_pool_; \
+ } while (0)
+
+// Runtime call helpers: handle invocation and potential exception after return.
+#define INVOKE_RUNTIME(Func, Args) \
+ if (!InvokeRuntime(thread, this, Func, Args)) { \
+ HANDLE_EXCEPTION; \
+ } else { \
+ HANDLE_RETURN; \
+ }
+
+#define INVOKE_NATIVE(Wrapper, Func, Args) \
+ if (!InvokeNative(thread, this, Wrapper, Func, Args)) { \
+ HANDLE_EXCEPTION; \
+ } else { \
+ HANDLE_RETURN; \
+ }
+
+#define LOAD_CONSTANT(index) (pp_->ptr()->data()[(index)].raw_obj_)
+
+// Returns true if deoptimization succeeds.
+DART_FORCE_INLINE bool Interpreter::Deoptimize(Thread* thread,
+ uint32_t** pc,
+ RawObject*** FP,
+ RawObject*** SP,
+ bool is_lazy) {
+ // Note: frame translation will take care of preserving result at the
+ // top of the stack. See CompilerDeoptInfo::CreateDeoptInfo.
+
+ // Make sure we preserve SP[0] when entering synthetic frame below.
+ (*SP)++;
+
+ // Leaf runtime function DeoptimizeCopyFrame expects a Dart frame.
+ // The code in this frame may not cause GC.
+ // DeoptimizeCopyFrame and DeoptimizeFillFrame are leaf runtime calls.
+ EnterSyntheticFrame(FP, SP, *pc - (is_lazy ? 1 : 0));
+ const intptr_t frame_size_in_bytes =
+ DLRT_DeoptimizeCopyFrame(reinterpret_cast<uword>(*FP), is_lazy ? 1 : 0);
+ LeaveSyntheticFrame(FP, SP);
+
+ *SP = *FP + (frame_size_in_bytes / kWordSize);
+ EnterSyntheticFrame(FP, SP, *pc - (is_lazy ? 1 : 0));
+ DLRT_DeoptimizeFillFrame(reinterpret_cast<uword>(*FP));
+
+ // We are now inside a valid frame.
+ {
+ *++(*SP) = 0; // Space for the result: number of materialization args.
+ Exit(thread, *FP, *SP + 1, /*pc=*/0);
+ NativeArguments native_args(thread, 0, *SP, *SP);
+ if (!InvokeRuntime(thread, this, DRT_DeoptimizeMaterialize, native_args)) {
+ return false;
+ }
+ }
+ const intptr_t materialization_arg_count =
+ Smi::Value(RAW_CAST(Smi, *(*SP)--)) / kWordSize;
+
+ // Restore caller PC.
+ *pc = SavedCallerPC(*FP);
+ pc_ = reinterpret_cast<uword>(*pc); // For the profiler.
+
+ // Check if it is a fake PC marking the entry frame.
+ ASSERT((reinterpret_cast<uword>(*pc) & 2) == 0);
+
+ // Restore SP, FP and PP.
+ // Unoptimized frame SP is one below FrameArguments(...) because
+ // FrameArguments(...) returns a pointer to the first argument.
+ *SP = FrameArguments(*FP, materialization_arg_count) - 1;
+ *FP = SavedCallerFP(*FP);
+
+ // Restore pp.
+ pp_ = InterpreterHelpers::FrameCode(*FP)->ptr()->object_pool_;
+
+ return true;
+}
+
+RawObject* Interpreter::Call(const Code& code,
+ const Array& arguments_descriptor,
+ const Array& arguments,
+ Thread* thread) {
+ // Dispatch used to interpret bytecode. Contains addresses of
+ // labels of bytecode handlers. Handlers themselves are defined below.
+ static const void* dispatch[] = {
+#define TARGET(name, fmt, fmta, fmtb, fmtc) &&bc##name,
+ KERNEL_BYTECODES_LIST(TARGET)
+#undef TARGET
+ };
+
+ // Interpreter state (see constants_kbc.h for high-level overview).
+ uint32_t* pc; // Program Counter: points to the next op to execute.
+ RawObject** FP; // Frame Pointer.
+ RawObject** SP; // Stack Pointer.
+
+ uint32_t op; // Currently executing op.
+ uint16_t rA; // A component of the currently executing op.
+
+ if (fp_ == NULL) {
+ fp_ = reinterpret_cast<RawObject**>(stack_);
+ }
+
+ // Save current VM tag and mark thread as executing Dart code.
+ const uword vm_tag = thread->vm_tag();
+ thread->set_vm_tag(VMTag::kDartTagId); // TODO(regis): kDartBytecodeTagId?
+
+ // Save current top stack resource and reset the list.
+ StackResource* top_resource = thread->top_resource();
+ thread->set_top_resource(NULL);
+
+ // Setup entry frame:
+ //
+ // ^
+ // | previous Dart frames
+ // ~~~~~~~~~~~~~~~ |
+ // | ........... | -+
+ // fp_ > | | saved top_exit_frame_info
+ // | arg 0 | -+
+ // ~~~~~~~~~~~~~~~ |
+ // > incoming arguments
+ // ~~~~~~~~~~~~~~~ |
+ // | arg 1 | -+
+ // | function | -+
+ // | code | |
+ // | callee PC | ---> special fake PC marking an entry frame
+ // SP > | fp_ | |
+ // FP > | ........... | > normal Dart frame (see stack_frame_kbc.h)
+ // |
+ // v
+ //
+ FP = fp_ + 1 + arguments.Length() + kKBCDartFrameFixedSize;
+ SP = FP - 1;
+
+ // Save outer top_exit_frame_info.
+ fp_[0] = reinterpret_cast<RawObject*>(thread->top_exit_frame_info());
+ thread->set_top_exit_frame_info(0);
+
+ // Copy arguments and setup the Dart frame.
+ const intptr_t argc = arguments.Length();
+ for (intptr_t i = 0; i < argc; i++) {
+ fp_[1 + i] = arguments.At(i);
+ }
+
+ FP[kKBCFunctionSlotFromFp] = code.function();
+ FP[kKBCPcMarkerSlotFromFp] = code.raw();
+ FP[kKBCSavedCallerPcSlotFromFp] =
+ reinterpret_cast<RawObject*>((argc << 2) | 2);
+ FP[kKBCSavedCallerFpSlotFromFp] = reinterpret_cast<RawObject*>(fp_);
+
+ // Load argument descriptor.
+ argdesc_ = arguments_descriptor.raw();
+
+ // Ready to start executing bytecode. Load entry point and corresponding
+ // object pool.
+ pc = reinterpret_cast<uint32_t*>(code.raw()->ptr()->entry_point_);
+ pc_ = reinterpret_cast<uword>(pc); // For the profiler.
+ pp_ = code.object_pool();
+
+ // Cache some frequently used values in the frame.
+ RawBool* true_value = Bool::True().raw();
+ RawBool* false_value = Bool::False().raw();
+ RawObject* null_value = Object::null();
+
+#if defined(DEBUG)
+ Function& function_h = Function::Handle();
+#endif
+
+ // Enter the dispatch loop.
+ DISPATCH();
+
+ // KernelBytecode handlers (see constants_kbc.h for bytecode descriptions).
+ {
+ BYTECODE(Entry, A_D);
+ const uint16_t num_locals = rD;
+
+ // Initialize locals with null & set SP.
+ for (intptr_t i = 0; i < num_locals; i++) {
+ FP[i] = null_value;
+ }
+ SP = FP + num_locals - 1;
+
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(EntryOptional, A_B_C);
+ // TODO(regis): Recover deleted code.
+ // See https://dart-review.googlesource.com/c/sdk/+/25320
+ UNIMPLEMENTED();
+
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(EntryOptimized, A_D);
+ const uint16_t num_registers = rD;
+
+ // Reserve space for registers used by the optimized code.
+ SP = FP + num_registers - 1;
+
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Frame, A_D);
+ // Initialize locals with null and increment SP.
+ const uint16_t num_locals = rD;
+ for (intptr_t i = 1; i <= num_locals; i++) {
+ SP[i] = null_value;
+ }
+ SP += num_locals;
+
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(SetFrame, A);
+ SP = FP + rA - 1;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Compile, 0);
+ FP[0] = argdesc_;
+ FP[1] = FrameFunction(FP);
+ FP[2] = 0;
+
+ UNIMPLEMENTED(); // TODO(regis): Revisit.
+
+ Exit(thread, FP, FP + 3, pc);
+ NativeArguments args(thread, 1, FP + 1, FP + 2);
+ INVOKE_RUNTIME(DRT_CompileFunction, args);
+ {
+ // Function should be compiled now, dispatch to its entry point.
+ RawCode* code = FrameFunction(FP)->ptr()->code_;
+ InterpreterHelpers::SetFrameCode(FP, code);
+ pp_ = code->ptr()->object_pool_;
+ pc = reinterpret_cast<uint32_t*>(code->ptr()->entry_point_);
+ pc_ = reinterpret_cast<uword>(pc); // For the profiler.
+ argdesc_ = static_cast<RawArray*>(FP[0]);
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(HotCheck, A_D);
+ const uint8_t increment = rA;
+ const uint16_t threshold = rD;
+ RawFunction* f = FrameFunction(FP);
+ int32_t counter = f->ptr()->usage_counter_;
+ // Note: we don't increment usage counter in the prologue of optimized
+ // functions.
+ if (increment) {
+ counter += increment;
+ f->ptr()->usage_counter_ = counter;
+ }
+ if (UNLIKELY(counter >= threshold)) {
+ FP[0] = f;
+ FP[1] = 0;
+
+ // Save the args desriptor which came in.
+ FP[2] = argdesc_;
+
+ UNIMPLEMENTED(); // TODO(regis): Revisit.
+
+ // 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.
+ const StubEntry* stub = StubCode::OptimizeFunction_entry();
+ FP[kKBCPcMarkerSlotFromFp] = stub->code();
+ pc = reinterpret_cast<uint32_t*>(stub->EntryPoint());
+
+ 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.
+ ASSERT(FP[1]->GetClassId() == kFunctionCid);
+ RawFunction* function = static_cast<RawFunction*>(FP[1]);
+ RawCode* code = function->ptr()->code_;
+ InterpreterHelpers::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.
+ }
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(CheckStack, A);
+ {
+ // TODO(regis): Support a second stack limit or can we share the DBC one?
+#if 0
+ if (reinterpret_cast<uword>(SP) >= thread->stack_limit()) {
+ Exit(thread, FP, SP + 1, pc);
+ NativeArguments args(thread, 0, NULL, NULL);
+ INVOKE_RUNTIME(DRT_StackOverflow, args);
+ }
+#endif
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(CheckStackAlwaysExit, A);
+ {
+ Exit(thread, FP, SP + 1, pc);
+ NativeArguments args(thread, 0, NULL, NULL);
+ INVOKE_RUNTIME(DRT_StackOverflow, args);
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(CheckFunctionTypeArgs, A_D);
+ const uint16_t declared_type_args_len = rA;
+ const uint16_t first_stack_local_index = rD;
+
+ // Decode arguments descriptor's type args len.
+ const intptr_t type_args_len =
+ InterpreterHelpers::ArgDescTypeArgsLen(argdesc_);
+ if ((type_args_len != declared_type_args_len) && (type_args_len != 0)) {
+ goto ClosureNoSuchMethod;
+ }
+ if (type_args_len > 0) {
+ // Decode arguments descriptor's argument count (excluding type args).
+ const intptr_t arg_count = InterpreterHelpers::ArgDescArgCount(argdesc_);
+ // Copy passed-in type args to first local slot.
+ FP[first_stack_local_index] = *FrameArguments(FP, arg_count + 1);
+ } else if (declared_type_args_len > 0) {
+ FP[first_stack_local_index] = Object::null();
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DebugStep, A);
+ if (thread->isolate()->single_step()) {
+ Exit(thread, FP, SP + 1, pc);
+ NativeArguments args(thread, 0, NULL, NULL);
+ INVOKE_RUNTIME(DRT_SingleStepHandler, args);
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DebugBreak, A);
+#if !defined(PRODUCT)
+ {
+ const uint32_t original_bc =
+ static_cast<uint32_t>(reinterpret_cast<uintptr_t>(
+ thread->isolate()->debugger()->GetPatchedStubAddress(
+ reinterpret_cast<uword>(pc))));
+
+ SP[1] = null_value;
+ Exit(thread, FP, SP + 2, pc);
+ NativeArguments args(thread, 0, NULL, SP + 1);
+ INVOKE_RUNTIME(DRT_BreakpointRuntimeHandler, args)
+ DISPATCH_OP(original_bc);
+ }
+#else
+ // There should be no debug breaks in product mode.
+ UNREACHABLE();
+#endif
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(InstantiateType, A_D);
+ // Stack: instantiator type args, function type args
+ RawObject* type = LOAD_CONSTANT(rD);
+ SP[1] = type;
+ SP[2] = SP[-1];
+ SP[3] = SP[0];
+ Exit(thread, FP, SP + 4, pc);
+ {
+ NativeArguments args(thread, 3, SP + 1, SP - 1);
+ INVOKE_RUNTIME(DRT_InstantiateType, args);
+ }
+ SP -= 1;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(InstantiateTypeArgumentsTOS, A_D);
+ // Stack: instantiator type args, function type args
+ RawTypeArguments* type_arguments =
+ static_cast<RawTypeArguments*>(LOAD_CONSTANT(rD));
+
+ RawObject* instantiator_type_args = SP[-1];
+ RawObject* function_type_args = SP[0];
+ // If both instantiators are null and if the type argument vector
+ // instantiated from null becomes a vector of dynamic, then use null as
+ // the type arguments.
+ if ((rA == 0) || (null_value != instantiator_type_args) ||
+ (null_value != function_type_args)) {
+ // First lookup in the cache.
+ RawArray* instantiations = type_arguments->ptr()->instantiations_;
+ for (intptr_t i = 0;
+ instantiations->ptr()->data()[i] != NULL; // kNoInstantiator
+ i += 3) { // kInstantiationSizeInWords
+ if ((instantiations->ptr()->data()[i] == instantiator_type_args) &&
+ (instantiations->ptr()->data()[i + 1] == function_type_args)) {
+ // Found in the cache.
+ SP[-1] = instantiations->ptr()->data()[i + 2];
+ goto InstantiateTypeArgumentsTOSDone;
+ }
+ }
+
+ // Cache lookup failed, call runtime.
+ SP[1] = type_arguments;
+ SP[2] = instantiator_type_args;
+ SP[3] = function_type_args;
+
+ Exit(thread, FP, SP + 4, pc);
+ NativeArguments args(thread, 3, SP + 1, SP - 1);
+ INVOKE_RUNTIME(DRT_InstantiateTypeArguments, args);
+ }
+
+ InstantiateTypeArgumentsTOSDone:
+ SP -= 1;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Throw, A);
+ {
+ SP[1] = 0; // Space for result.
+ Exit(thread, FP, SP + 2, pc);
+ if (rA == 0) { // Throw
+ NativeArguments args(thread, 1, SP, SP + 1);
+ INVOKE_RUNTIME(DRT_Throw, args);
+ } else { // ReThrow
+ NativeArguments args(thread, 2, SP - 1, SP + 1);
+ INVOKE_RUNTIME(DRT_ReThrow, args);
+ }
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Drop1, 0);
+ SP--;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Drop, 0);
+ SP -= rA;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DropR, 0);
+ RawObject* result = SP[0];
+ SP -= rA;
+ SP[0] = result;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadConstant, A_D);
+ FP[rA] = LOAD_CONSTANT(rD);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(PushConstant, __D);
+ *++SP = LOAD_CONSTANT(rD);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Push, A_X);
+ *++SP = FP[rD];
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Move, A_X);
+ FP[rA] = FP[rD];
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Swap, A_X);
+ RawObject* tmp = FP[rD];
+ FP[rD] = FP[rA];
+ FP[rA] = tmp;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreLocal, A_X);
+ FP[rD] = *SP;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(PopLocal, A_X);
+ FP[rD] = *SP--;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(MoveSpecial, A_D);
+ FP[rA] = special_[rD];
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(BooleanNegateTOS, 0);
+ SP[0] = (SP[0] == true_value) ? false_value : true_value;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(BooleanNegate, A_D);
+ FP[rA] = (FP[rD] == true_value) ? false_value : true_value;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IndirectStaticCall, A_D);
+
+ // Check if single stepping.
+ if (thread->isolate()->single_step()) {
+ Exit(thread, FP, SP + 1, pc);
+ NativeArguments args(thread, 0, NULL, NULL);
+ INVOKE_RUNTIME(DRT_SingleStepHandler, args);
+ }
+
+ // Invoke target function.
+ {
+ const uint16_t argc = rA;
+ // Look up the function in the ICData.
+ RawObject* ic_data_obj = SP[0];
+ RawICData* ic_data = RAW_CAST(ICData, ic_data_obj);
+ RawObject** data = ic_data->ptr()->ic_data_->ptr()->data();
+ InterpreterHelpers::IncrementICUsageCount(data, 0, 0);
+ SP[0] = data[ICData::TargetIndexFor(ic_data->ptr()->state_bits_ & 0x3)];
+ RawObject** call_base = SP - argc;
+ RawObject** call_top = SP; // *SP contains function
+ argdesc_ = static_cast<RawArray*>(LOAD_CONSTANT(rD));
+ Invoke(thread, call_base, call_top, &pc, &FP, &SP);
+ }
+
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StaticCall, A_D);
+ const uint16_t argc = rA;
+ RawObject** call_base = SP - argc;
+ RawObject** call_top = SP; // *SP contains function
+ argdesc_ = static_cast<RawArray*>(LOAD_CONSTANT(rD));
+ Invoke(thread, call_base, call_top, &pc, &FP, &SP);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(InstanceCall1, A_D);
+
+ // Check if single stepping.
+ if (thread->isolate()->single_step()) {
+ Exit(thread, FP, SP + 1, pc);
+ NativeArguments args(thread, 0, NULL, NULL);
+ INVOKE_RUNTIME(DRT_SingleStepHandler, args);
+ }
+
+ {
+ const uint16_t argc = rA;
+ const uint16_t kidx = rD;
+
+ RawObject** call_base = SP - argc + 1;
+ RawObject** call_top = SP + 1;
+
+ RawICData* icdata = RAW_CAST(ICData, LOAD_CONSTANT(kidx));
+ InterpreterHelpers::IncrementUsageCounter(
+ RAW_CAST(Function, icdata->ptr()->owner_));
+ InstanceCall1(thread, icdata, call_base, call_top, &pc, &FP, &SP,
+ false /* optimized */);
+ }
+
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(InstanceCall2, A_D);
+ if (thread->isolate()->single_step()) {
+ Exit(thread, FP, SP + 1, pc);
+ NativeArguments args(thread, 0, NULL, NULL);
+ INVOKE_RUNTIME(DRT_SingleStepHandler, args);
+ }
+
+ {
+ const uint16_t argc = rA;
+ const uint16_t kidx = rD;
+
+ RawObject** call_base = SP - argc + 1;
+ RawObject** call_top = SP + 1;
+
+ RawICData* icdata = RAW_CAST(ICData, LOAD_CONSTANT(kidx));
+ InterpreterHelpers::IncrementUsageCounter(
+ RAW_CAST(Function, icdata->ptr()->owner_));
+ InstanceCall2(thread, icdata, call_base, call_top, &pc, &FP, &SP,
+ false /* optimized */);
+ }
+
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(InstanceCall1Opt, A_D);
+
+ {
+ const uint16_t argc = rA;
+ const uint16_t kidx = rD;
+
+ RawObject** call_base = SP - argc + 1;
+ RawObject** call_top = SP + 1;
+
+ RawICData* icdata = RAW_CAST(ICData, LOAD_CONSTANT(kidx));
+ InterpreterHelpers::IncrementUsageCounter(FrameFunction(FP));
+ InstanceCall1(thread, icdata, call_base, call_top, &pc, &FP, &SP,
+ true /* optimized */);
+ }
+
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(InstanceCall2Opt, A_D);
+
+ {
+ const uint16_t argc = rA;
+ const uint16_t kidx = rD;
+
+ RawObject** call_base = SP - argc + 1;
+ RawObject** call_top = SP + 1;
+
+ RawICData* icdata = RAW_CAST(ICData, LOAD_CONSTANT(kidx));
+ InterpreterHelpers::IncrementUsageCounter(FrameFunction(FP));
+ InstanceCall2(thread, icdata, call_base, call_top, &pc, &FP, &SP,
+ true /* optimized */);
+ }
+
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(PushPolymorphicInstanceCall, A_D);
+ const uint8_t argc = rA;
+ const intptr_t cids_length = rD;
+ RawObject** args = SP - argc + 1;
+ const intptr_t receiver_cid = InterpreterHelpers::GetClassId(args[0]);
+ for (intptr_t i = 0; i < 2 * cids_length; i += 2) {
+ const intptr_t icdata_cid = KernelBytecode::DecodeD(*(pc + i));
+ if (receiver_cid == icdata_cid) {
+ RawFunction* target = RAW_CAST(
+ Function, LOAD_CONSTANT(KernelBytecode::DecodeD(*(pc + i + 1))));
+ *++SP = target;
+ pc++;
+ break;
+ }
+ }
+ pc += 2 * cids_length;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(PushPolymorphicInstanceCallByRange, A_D);
+ const uint8_t argc = rA;
+ const intptr_t cids_length = rD;
+ RawObject** args = SP - argc + 1;
+ const intptr_t receiver_cid = InterpreterHelpers::GetClassId(args[0]);
+ for (intptr_t i = 0; i < 3 * cids_length; i += 3) {
+ // Note unsigned types to get an unsigned range compare.
+ const uintptr_t cid_start = KernelBytecode::DecodeD(*(pc + i));
+ const uintptr_t cids = KernelBytecode::DecodeD(*(pc + i + 1));
+ if (receiver_cid - cid_start < cids) {
+ RawFunction* target = RAW_CAST(
+ Function, LOAD_CONSTANT(KernelBytecode::DecodeD(*(pc + i + 2))));
+ *++SP = target;
+ pc++;
+ break;
+ }
+ }
+ pc += 3 * cids_length;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(NativeCall, A_B_C);
+ NativeFunctionWrapper trampoline =
+ reinterpret_cast<NativeFunctionWrapper>(LOAD_CONSTANT(rA));
+ Dart_NativeFunction function =
+ reinterpret_cast<Dart_NativeFunction>(LOAD_CONSTANT(rB));
+ intptr_t argc_tag = reinterpret_cast<intptr_t>(LOAD_CONSTANT(rC));
+ const intptr_t num_arguments = NativeArguments::ArgcBits::decode(argc_tag);
+
+ *++SP = null_value; // Result slot.
+
+ RawObject** incoming_args = SP - num_arguments;
+ RawObject** return_slot = SP;
+ Exit(thread, FP, SP, pc);
+ NativeArguments args(thread, argc_tag, incoming_args, return_slot);
+ INVOKE_NATIVE(trampoline, function,
+ reinterpret_cast<Dart_NativeArguments>(&args));
+
+ *(SP - num_arguments) = *return_slot;
+ SP -= num_arguments;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(OneByteStringFromCharCode, A_X);
+ const intptr_t char_code = Smi::Value(RAW_CAST(Smi, FP[rD]));
+ ASSERT(char_code >= 0);
+ ASSERT(char_code <= 255);
+ RawString** strings = Symbols::PredefinedAddress();
+ const intptr_t index = char_code + Symbols::kNullCharCodeSymbolOffset;
+ FP[rA] = strings[index];
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StringToCharCode, A_X);
+ RawOneByteString* str = RAW_CAST(OneByteString, FP[rD]);
+ if (str->ptr()->length_ == Smi::New(1)) {
+ FP[rA] = Smi::New(str->ptr()->data()[0]);
+ } else {
+ FP[rA] = Smi::New(-1);
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(AddTOS, A_B_C);
+ SMI_FASTPATH_TOS(intptr_t, SignedAddWithOverflow);
+ DISPATCH();
+ }
+ {
+ BYTECODE(SubTOS, A_B_C);
+ SMI_FASTPATH_TOS(intptr_t, SignedSubWithOverflow);
+ DISPATCH();
+ }
+ {
+ BYTECODE(MulTOS, A_B_C);
+ SMI_FASTPATH_TOS(intptr_t, SMI_MUL);
+ DISPATCH();
+ }
+ {
+ BYTECODE(BitOrTOS, A_B_C);
+ SMI_FASTPATH_TOS(intptr_t, SMI_BITOR);
+ DISPATCH();
+ }
+ {
+ BYTECODE(BitAndTOS, A_B_C);
+ SMI_FASTPATH_TOS(intptr_t, SMI_BITAND);
+ DISPATCH();
+ }
+ {
+ BYTECODE(EqualTOS, A_B_C);
+ SMI_FASTPATH_TOS(RawObject*, SMI_EQ);
+ DISPATCH();
+ }
+ {
+ BYTECODE(LessThanTOS, A_B_C);
+ SMI_FASTPATH_TOS(RawObject*, SMI_LT);
+ DISPATCH();
+ }
+ {
+ BYTECODE(GreaterThanTOS, A_B_C);
+ SMI_FASTPATH_TOS(RawObject*, SMI_GT);
+ DISPATCH();
+ }
+ {
+ BYTECODE(SmiAddTOS, 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(SmiSubTOS, 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(SmiMulTOS, 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(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();
+ }
+ {
+ BYTECODE(Sub, A_B_C);
+ SMI_OP_CHECK(intptr_t, SignedSubWithOverflow);
+ DISPATCH();
+ }
+ {
+ BYTECODE(Mul, A_B_C);
+ SMI_OP_CHECK(intptr_t, SMI_MUL);
+ DISPATCH();
+ }
+ {
+ BYTECODE(Neg, A_D);
+ const intptr_t value = reinterpret_cast<intptr_t>(FP[rD]);
+ intptr_t* out = reinterpret_cast<intptr_t*>(&FP[rA]);
+ if (LIKELY(!SignedSubWithOverflow(0, value, out))) {
+ pc++;
+ }
+ DISPATCH();
+ }
+ {
+ BYTECODE(BitOr, A_B_C);
+ SMI_OP_NOCHECK(intptr_t, SMI_BITOR);
+ DISPATCH();
+ }
+ {
+ BYTECODE(BitAnd, A_B_C);
+ SMI_OP_NOCHECK(intptr_t, SMI_BITAND);
+ DISPATCH();
+ }
+ {
+ BYTECODE(BitXor, A_B_C);
+ SMI_OP_NOCHECK(intptr_t, SMI_BITXOR);
+ DISPATCH();
+ }
+ {
+ BYTECODE(BitNot, A_D);
+ const intptr_t value = reinterpret_cast<intptr_t>(FP[rD]);
+ *reinterpret_cast<intptr_t*>(&FP[rA]) = ~value & (~kSmiTagMask);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Div, A_B_C);
+ const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rC]);
+ if (rhs != 0) {
+ const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rB]);
+ const intptr_t res = (lhs >> kSmiTagSize) / (rhs >> kSmiTagSize);
+ const intptr_t untaggable = 0x40000000L;
+ if (res != untaggable) {
+ *reinterpret_cast<intptr_t*>(&FP[rA]) = res << kSmiTagSize;
+ pc++;
+ }
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Mod, A_B_C);
+ const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rC]);
+ if (rhs != 0) {
+ const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rB]);
+ const intptr_t res = ((lhs >> kSmiTagSize) % (rhs >> kSmiTagSize))
+ << kSmiTagSize;
+ *reinterpret_cast<intptr_t*>(&FP[rA]) =
+ (res < 0) ? ((rhs < 0) ? (res - rhs) : (res + rhs)) : res;
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Shl, A_B_C);
+ const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rC]) >> kSmiTagSize;
+ const int kBitsPerInt32 = 32;
+ if (static_cast<uintptr_t>(rhs) < kBitsPerInt32) {
+ const int32_t lhs = reinterpret_cast<intptr_t>(FP[rB]);
+ const int32_t res = lhs << rhs;
+ if (lhs == (res >> rhs)) {
+ *reinterpret_cast<intptr_t*>(&FP[rA]) = static_cast<intptr_t>(res);
+ pc++;
+ }
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Shr, A_B_C);
+ const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rC]) >> kSmiTagSize;
+ if (rhs >= 0) {
+ const intptr_t shift_amount = (rhs >= 32) ? (32 - 1) : rhs;
+ const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rB]) >> kSmiTagSize;
+ *reinterpret_cast<intptr_t*>(&FP[rA]) = (lhs >> shift_amount)
+ << kSmiTagSize;
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(ShlImm, A_B_C);
+ const uint8_t shift = rC;
+ const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rB]);
+ FP[rA] = reinterpret_cast<RawObject*>(lhs << shift);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Min, A_B_C);
+ const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rB]);
+ const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rC]);
+ FP[rA] = reinterpret_cast<RawObject*>((lhs < rhs) ? lhs : rhs);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Max, A_B_C);
+ const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rB]);
+ const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rC]);
+ FP[rA] = reinterpret_cast<RawObject*>((lhs > rhs) ? lhs : rhs);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(UnboxInt32, A_B_C);
+ const intptr_t box_cid = InterpreterHelpers::GetClassId(FP[rB]);
+ const bool may_truncate = rC == 1;
+ if (box_cid == kSmiCid) {
+ const intptr_t value = reinterpret_cast<intptr_t>(FP[rB]) >> kSmiTagSize;
+ const int32_t value32 = static_cast<int32_t>(value);
+ if (may_truncate || (value == static_cast<intptr_t>(value32))) {
+ FP[rA] = reinterpret_cast<RawObject*>(value);
+ pc++;
+ }
+ } else if (box_cid == kMintCid) {
+ RawMint* mint = RAW_CAST(Mint, FP[rB]);
+ const int64_t value = mint->ptr()->value_;
+ const int32_t value32 = static_cast<int32_t>(value);
+ if (may_truncate || (value == static_cast<int64_t>(value32))) {
+ FP[rA] = reinterpret_cast<RawObject*>(value);
+ pc++;
+ }
+ }
+ DISPATCH();
+ }
+
+#if defined(ARCH_IS_64_BIT)
+ {
+ BYTECODE(WriteIntoDouble, A_D);
+ const double value = bit_cast<double, RawObject*>(FP[rD]);
+ RawDouble* box = RAW_CAST(Double, FP[rA]);
+ box->ptr()->value_ = value;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(UnboxDouble, A_D);
+ const RawDouble* box = RAW_CAST(Double, FP[rD]);
+ FP[rA] = bit_cast<RawObject*, double>(box->ptr()->value_);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(CheckedUnboxDouble, A_D);
+ const intptr_t box_cid = InterpreterHelpers::GetClassId(FP[rD]);
+ if (box_cid == kSmiCid) {
+ const intptr_t value = reinterpret_cast<intptr_t>(FP[rD]) >> kSmiTagSize;
+ const double result = static_cast<double>(value);
+ FP[rA] = bit_cast<RawObject*, double>(result);
+ pc++;
+ } else if (box_cid == kDoubleCid) {
+ const RawDouble* box = RAW_CAST(Double, FP[rD]);
+ FP[rA] = bit_cast<RawObject*, double>(box->ptr()->value_);
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DoubleToSmi, A_D);
+ const double value = bit_cast<double, RawObject*>(FP[rD]);
+ if (!isnan(value)) {
+ const intptr_t result = static_cast<intptr_t>(value);
+ if ((result <= Smi::kMaxValue) && (result >= Smi::kMinValue)) {
+ FP[rA] = reinterpret_cast<RawObject*>(result << kSmiTagSize);
+ pc++;
+ }
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(SmiToDouble, A_D);
+ const intptr_t value = reinterpret_cast<intptr_t>(FP[rD]) >> kSmiTagSize;
+ const double result = static_cast<double>(value);
+ FP[rA] = bit_cast<RawObject*, double>(result);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DAdd, A_B_C);
+ const double lhs = bit_cast<double, RawObject*>(FP[rB]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rC]);
+ FP[rA] = bit_cast<RawObject*, double>(lhs + rhs);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DSub, A_B_C);
+ const double lhs = bit_cast<double, RawObject*>(FP[rB]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rC]);
+ FP[rA] = bit_cast<RawObject*, double>(lhs - rhs);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DMul, A_B_C);
+ const double lhs = bit_cast<double, RawObject*>(FP[rB]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rC]);
+ FP[rA] = bit_cast<RawObject*, double>(lhs * rhs);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DDiv, A_B_C);
+ const double lhs = bit_cast<double, RawObject*>(FP[rB]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rC]);
+ const double result = lhs / rhs;
+ FP[rA] = bit_cast<RawObject*, double>(result);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DNeg, A_D);
+ const double value = bit_cast<double, RawObject*>(FP[rD]);
+ FP[rA] = bit_cast<RawObject*, double>(-value);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DSqrt, A_D);
+ const double value = bit_cast<double, RawObject*>(FP[rD]);
+ FP[rA] = bit_cast<RawObject*, double>(sqrt(value));
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DSin, A_D);
+ const double value = bit_cast<double, RawObject*>(FP[rD]);
+ FP[rA] = bit_cast<RawObject*, double>(sin(value));
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DCos, A_D);
+ const double value = bit_cast<double, RawObject*>(FP[rD]);
+ FP[rA] = bit_cast<RawObject*, double>(cos(value));
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DPow, A_B_C);
+ const double lhs = bit_cast<double, RawObject*>(FP[rB]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rC]);
+ const double result = pow(lhs, rhs);
+ FP[rA] = bit_cast<RawObject*, double>(result);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DMod, A_B_C);
+ const double lhs = bit_cast<double, RawObject*>(FP[rB]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rC]);
+ const double result = DartModulo(lhs, rhs);
+ FP[rA] = bit_cast<RawObject*, double>(result);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DMin, A_B_C);
+ const double lhs = bit_cast<double, RawObject*>(FP[rB]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rC]);
+ FP[rA] = bit_cast<RawObject*, double>(fmin(lhs, rhs));
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DMax, A_B_C);
+ const double lhs = bit_cast<double, RawObject*>(FP[rB]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rC]);
+ FP[rA] = bit_cast<RawObject*, double>(fmax(lhs, rhs));
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DTruncate, A_D);
+ const double value = bit_cast<double, RawObject*>(FP[rD]);
+ FP[rA] = bit_cast<RawObject*, double>(trunc(value));
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DFloor, A_D);
+ const double value = bit_cast<double, RawObject*>(FP[rD]);
+ FP[rA] = bit_cast<RawObject*, double>(floor(value));
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DCeil, A_D);
+ const double value = bit_cast<double, RawObject*>(FP[rD]);
+ FP[rA] = bit_cast<RawObject*, double>(ceil(value));
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DoubleToFloat, A_D);
+ const double value = bit_cast<double, RawObject*>(FP[rD]);
+ const float valuef = static_cast<float>(value);
+ *reinterpret_cast<float*>(&FP[rA]) = valuef;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(FloatToDouble, A_D);
+ const float valuef = *reinterpret_cast<float*>(&FP[rD]);
+ const double value = static_cast<double>(valuef);
+ FP[rA] = bit_cast<RawObject*, double>(value);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DoubleIsNaN, A);
+ const double v = bit_cast<double, RawObject*>(FP[rA]);
+ if (!isnan(v)) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DoubleIsInfinite, A);
+ const double v = bit_cast<double, RawObject*>(FP[rA]);
+ if (!isinf(v)) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexedFloat32, A_B_C);
+ uint8_t* data = InterpreterHelpers::GetTypedData(FP[rB], FP[rC]);
+ const uint32_t value = *reinterpret_cast<uint32_t*>(data);
+ const uint64_t value64 = value;
+ FP[rA] = reinterpret_cast<RawObject*>(value64);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexed4Float32, A_B_C);
+ ASSERT(RawObject::IsTypedDataClassId(FP[rB]->GetClassId()));
+ RawTypedData* array = reinterpret_cast<RawTypedData*>(FP[rB]);
+ RawSmi* index = RAW_CAST(Smi, FP[rC]);
+ ASSERT(InterpreterHelpers::CheckIndex(index, array->ptr()->length_));
+ const uint32_t value =
+ reinterpret_cast<uint32_t*>(array->ptr()->data())[Smi::Value(index)];
+ const uint64_t value64 = value; // sign extend to clear high bits.
+ FP[rA] = reinterpret_cast<RawObject*>(value64);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexedFloat64, A_B_C);
+ uint8_t* data = InterpreterHelpers::GetTypedData(FP[rB], FP[rC]);
+ *reinterpret_cast<uint64_t*>(&FP[rA]) = *reinterpret_cast<uint64_t*>(data);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexed8Float64, A_B_C);
+ ASSERT(RawObject::IsTypedDataClassId(FP[rB]->GetClassId()));
+ RawTypedData* array = reinterpret_cast<RawTypedData*>(FP[rB]);
+ RawSmi* index = RAW_CAST(Smi, FP[rC]);
+ ASSERT(InterpreterHelpers::CheckIndex(index, array->ptr()->length_));
+ const int64_t value =
+ reinterpret_cast<int64_t*>(array->ptr()->data())[Smi::Value(index)];
+ FP[rA] = reinterpret_cast<RawObject*>(value);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreIndexedFloat32, A_B_C);
+ uint8_t* data = InterpreterHelpers::GetTypedData(FP[rA], FP[rB]);
+ const uint64_t value = reinterpret_cast<uint64_t>(FP[rC]);
+ const uint32_t value32 = value;
+ *reinterpret_cast<uint32_t*>(data) = value32;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreIndexed4Float32, A_B_C);
+ ASSERT(RawObject::IsTypedDataClassId(FP[rA]->GetClassId()));
+ RawTypedData* array = reinterpret_cast<RawTypedData*>(FP[rA]);
+ RawSmi* index = RAW_CAST(Smi, FP[rB]);
+ ASSERT(InterpreterHelpers::CheckIndex(index, array->ptr()->length_));
+ const uint64_t value = reinterpret_cast<uint64_t>(FP[rC]);
+ const uint32_t value32 = value;
+ reinterpret_cast<uint32_t*>(array->ptr()->data())[Smi::Value(index)] =
+ value32;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreIndexedFloat64, A_B_C);
+ uint8_t* data = InterpreterHelpers::GetTypedData(FP[rA], FP[rB]);
+ *reinterpret_cast<uint64_t*>(data) = reinterpret_cast<uint64_t>(FP[rC]);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreIndexed8Float64, A_B_C);
+ ASSERT(RawObject::IsTypedDataClassId(FP[rA]->GetClassId()));
+ RawTypedData* array = reinterpret_cast<RawTypedData*>(FP[rA]);
+ RawSmi* index = RAW_CAST(Smi, FP[rB]);
+ ASSERT(InterpreterHelpers::CheckIndex(index, array->ptr()->length_));
+ const int64_t value = reinterpret_cast<int64_t>(FP[rC]);
+ reinterpret_cast<int64_t*>(array->ptr()->data())[Smi::Value(index)] = value;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(BoxInt32, A_D);
+ // Casts sign-extend high 32 bits from low 32 bits.
+ const intptr_t value = reinterpret_cast<intptr_t>(FP[rD]);
+ const int32_t value32 = static_cast<int32_t>(value);
+ FP[rA] = Smi::New(static_cast<intptr_t>(value32));
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(BoxUint32, A_D);
+ // Casts to zero out high 32 bits.
+ const uintptr_t value = reinterpret_cast<uintptr_t>(FP[rD]);
+ const uint32_t value32 = static_cast<uint32_t>(value);
+ FP[rA] = Smi::New(static_cast<intptr_t>(value32));
+ DISPATCH();
+ }
+#else // defined(ARCH_IS_64_BIT)
+ {
+ BYTECODE(WriteIntoDouble, A_D);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(UnboxDouble, A_D);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(CheckedUnboxDouble, A_D);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DoubleToSmi, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(SmiToDouble, A_D);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DAdd, A_B_C);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DSub, A_B_C);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DMul, A_B_C);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DDiv, A_B_C);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DNeg, A_D);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DSqrt, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DSin, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DCos, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DPow, A_B_C);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DMod, A_B_C);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DMin, A_B_C);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DMax, A_B_C);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DTruncate, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DFloor, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DCeil, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DoubleToFloat, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(FloatToDouble, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DoubleIsNaN, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DoubleIsInfinite, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexedFloat32, A_B_C);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexed4Float32, A_B_C);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexedFloat64, A_B_C);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexed8Float64, A_B_C);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreIndexedFloat32, A_B_C);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreIndexed4Float32, A_B_C);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreIndexedFloat64, A_B_C);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreIndexed8Float64, A_B_C);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(BoxInt32, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(BoxUint32, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+#endif // defined(ARCH_IS_64_BIT)
+
+ // Return and return like instructions (Intrinsic).
+ {
+ RawObject* result; // result to return to the caller.
+
+ BYTECODE(Intrinsic, A);
+ // Try invoking intrinsic handler. If it succeeds (returns true)
+ // then just return the value it returned to the caller.
+ result = null_value;
+ if (!intrinsics_[rA](thread, FP, &result)) {
+ DISPATCH();
+ }
+ goto ReturnImpl;
+
+ BYTECODE(Return, A);
+ result = FP[rA];
+ goto ReturnImpl;
+
+ BYTECODE(ReturnTOS, 0);
+ result = *SP;
+ // Fall through to the ReturnImpl.
+
+ ReturnImpl:
+ // Restore caller PC.
+ pc = SavedCallerPC(FP);
+ pc_ = reinterpret_cast<uword>(pc); // For the profiler.
+
+ // Check if it is a fake PC marking the entry frame.
+ if ((reinterpret_cast<uword>(pc) & 2) != 0) {
+ const intptr_t argc = reinterpret_cast<uword>(pc) >> 2;
+ fp_ = reinterpret_cast<RawObject**>(FrameArguments(FP, argc + 1)[0]);
+ thread->set_top_exit_frame_info(reinterpret_cast<uword>(fp_));
+ thread->set_top_resource(top_resource);
+ thread->set_vm_tag(vm_tag);
+ return result;
+ }
+
+ // Look at the caller to determine how many arguments to pop.
+ const uint8_t argc = KernelBytecode::DecodeArgc(pc[-1]);
+
+ // Restore SP, FP and PP. Push result and dispatch.
+ SP = FrameArguments(FP, argc);
+ FP = SavedCallerFP(FP);
+ pp_ = InterpreterHelpers::FrameCode(FP)->ptr()->object_pool_;
+ *SP = result;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreStaticTOS, A_D);
+ RawField* field = reinterpret_cast<RawField*>(LOAD_CONSTANT(rD));
+ RawInstance* value = static_cast<RawInstance*>(*SP--);
+ field->StorePointer(&field->ptr()->value_.static_value_, value);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(PushStatic, A_D);
+ RawField* field = reinterpret_cast<RawField*>(LOAD_CONSTANT(rD));
+ // Note: field is also on the stack, hence no increment.
+ *SP = field->ptr()->value_.static_value_;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreField, A_B_C);
+ const uint16_t offset_in_words = rB;
+ const uint16_t value_reg = rC;
+
+ RawInstance* instance = reinterpret_cast<RawInstance*>(FP[rA]);
+ RawObject* value = FP[value_reg];
+
+ instance->StorePointer(
+ reinterpret_cast<RawObject**>(instance->ptr()) + offset_in_words,
+ value);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreFieldExt, A_D);
+ // The offset is stored in the following nop-instruction which is skipped.
+ const uint16_t offset_in_words = KernelBytecode::DecodeD(*pc++);
+ RawInstance* instance = reinterpret_cast<RawInstance*>(FP[rA]);
+ RawObject* value = FP[rD];
+
+ instance->StorePointer(
+ reinterpret_cast<RawObject**>(instance->ptr()) + offset_in_words,
+ value);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreFieldTOS, A_D);
+ const uword offset_in_words =
+ static_cast<uword>(Smi::Value(RAW_CAST(Smi, LOAD_CONSTANT(rD))));
+ RawInstance* instance = reinterpret_cast<RawInstance*>(SP[-1]);
+ RawObject* value = reinterpret_cast<RawObject*>(SP[0]);
+ SP -= 2; // Drop instance and value.
+ instance->StorePointer(
+ reinterpret_cast<RawObject**>(instance->ptr()) + offset_in_words,
+ value);
+
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadField, A_B_C);
+ const uint16_t instance_reg = rB;
+ const uint16_t offset_in_words = rC;
+ RawInstance* instance = reinterpret_cast<RawInstance*>(FP[instance_reg]);
+ FP[rA] = reinterpret_cast<RawObject**>(instance->ptr())[offset_in_words];
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadFieldExt, A_D);
+ // The offset is stored in the following nop-instruction which is skipped.
+ const uint16_t offset_in_words = KernelBytecode::DecodeD(*pc++);
+ const uint16_t instance_reg = rD;
+ RawInstance* instance = reinterpret_cast<RawInstance*>(FP[instance_reg]);
+ FP[rA] = reinterpret_cast<RawObject**>(instance->ptr())[offset_in_words];
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadUntagged, A_B_C);
+ const uint16_t instance_reg = rB;
+ const uint16_t offset_in_words = rC;
+ RawInstance* instance = reinterpret_cast<RawInstance*>(FP[instance_reg]);
+ FP[rA] = reinterpret_cast<RawObject**>(instance)[offset_in_words];
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadFieldTOS, __D);
+ const uword offset_in_words =
+ static_cast<uword>(Smi::Value(RAW_CAST(Smi, LOAD_CONSTANT(rD))));
+ RawInstance* instance = static_cast<RawInstance*>(SP[0]);
+ SP[0] = reinterpret_cast<RawObject**>(instance->ptr())[offset_in_words];
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(InitStaticTOS, 0);
+ RawField* field = static_cast<RawField*>(*SP--);
+ RawObject* value = field->ptr()->value_.static_value_;
+ if ((value == Object::sentinel().raw()) ||
+ (value == Object::transition_sentinel().raw())) {
+ // Note: SP[1] already contains the field object.
+ SP[2] = 0;
+ Exit(thread, FP, SP + 3, pc);
+ NativeArguments args(thread, 1, SP + 1, SP + 2);
+ INVOKE_RUNTIME(DRT_InitStaticField, args);
+ }
+ DISPATCH();
+ }
+
+ // TODO(vegorov) allocation bytecodes can benefit from the new-space
+ // allocation fast-path that does not transition into the runtime system.
+ {
+ BYTECODE(AllocateUninitializedContext, A_D);
+ const uint16_t num_context_variables = rD;
+ const intptr_t instance_size = Context::InstanceSize(num_context_variables);
+ const uword start =
+ thread->heap()->new_space()->TryAllocateInTLAB(thread, instance_size);
+ if (LIKELY(start != 0)) {
+ uint32_t tags = 0;
+ tags = RawObject::ClassIdTag::update(kContextCid, tags);
+ tags = RawObject::SizeTag::update(instance_size, tags);
+ // Also writes 0 in the hash_ field of the header.
+ *reinterpret_cast<uword*>(start + Array::tags_offset()) = tags;
+ *reinterpret_cast<uword*>(start + Context::num_variables_offset()) =
+ num_context_variables;
+ FP[rA] = reinterpret_cast<RawObject*>(start + kHeapObjectTag);
+ pc += 2;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(AllocateContext, A_D);
+ const uint16_t num_context_variables = rD;
+ {
+ *++SP = 0;
+ SP[1] = Smi::New(num_context_variables);
+ Exit(thread, FP, SP + 2, pc);
+ NativeArguments args(thread, 1, SP + 1, SP);
+ INVOKE_RUNTIME(DRT_AllocateContext, args);
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(CloneContext, A);
+ {
+ SP[1] = SP[0]; // Context to clone.
+ Exit(thread, FP, SP + 2, pc);
+ NativeArguments args(thread, 1, SP + 1, SP);
+ INVOKE_RUNTIME(DRT_CloneContext, args);
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(AllocateOpt, A_D);
+ const uword tags =
+ static_cast<uword>(Smi::Value(RAW_CAST(Smi, LOAD_CONSTANT(rD))));
+ const intptr_t instance_size = RawObject::SizeTag::decode(tags);
+ const uword start =
+ thread->heap()->new_space()->TryAllocateInTLAB(thread, instance_size);
+ if (LIKELY(start != 0)) {
+ // Writes both the tags and the initial identity hash on 64 bit platforms.
+ *reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags;
+ for (intptr_t current_offset = sizeof(RawInstance);
+ current_offset < instance_size; current_offset += kWordSize) {
+ *reinterpret_cast<RawObject**>(start + current_offset) = null_value;
+ }
+ FP[rA] = reinterpret_cast<RawObject*>(start + kHeapObjectTag);
+ pc += 2;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Allocate, A_D);
+ SP[1] = 0; // Space for the result.
+ SP[2] = LOAD_CONSTANT(rD); // Class object.
+ SP[3] = null_value; // Type arguments.
+ Exit(thread, FP, SP + 4, pc);
+ NativeArguments args(thread, 2, SP + 2, SP + 1);
+ INVOKE_RUNTIME(DRT_AllocateObject, args);
+ SP++; // Result is in SP[1].
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(AllocateTOpt, A_D);
+ const uword tags = Smi::Value(RAW_CAST(Smi, LOAD_CONSTANT(rD)));
+ const intptr_t instance_size = RawObject::SizeTag::decode(tags);
+ const uword start =
+ thread->heap()->new_space()->TryAllocateInTLAB(thread, instance_size);
+ if (LIKELY(start != 0)) {
+ RawObject* type_args = SP[0];
+ const intptr_t type_args_offset = KernelBytecode::DecodeD(*pc);
+ // Writes both the tags and the initial identity hash on 64 bit platforms.
+ *reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags;
+ for (intptr_t current_offset = sizeof(RawInstance);
+ current_offset < instance_size; current_offset += kWordSize) {
+ *reinterpret_cast<RawObject**>(start + current_offset) = null_value;
+ }
+ *reinterpret_cast<RawObject**>(start + type_args_offset) = type_args;
+ FP[rA] = reinterpret_cast<RawObject*>(start + kHeapObjectTag);
+ SP -= 1; // Consume the type arguments on the stack.
+ pc += 4;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(AllocateT, 0);
+ SP[1] = SP[-0]; // Class object.
+ SP[2] = SP[-1]; // Type arguments
+ Exit(thread, FP, SP + 3, pc);
+ NativeArguments args(thread, 2, SP + 1, SP - 1);
+ INVOKE_RUNTIME(DRT_AllocateObject, args);
+ SP -= 1; // Result is in SP - 1.
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(CreateArrayOpt, A_B_C);
+ if (LIKELY(!FP[rB]->IsHeapObject())) {
+ const intptr_t length = Smi::Value(RAW_CAST(Smi, FP[rB]));
+ if (LIKELY(static_cast<uintptr_t>(length) <= Array::kMaxElements)) {
+ const intptr_t fixed_size_plus_alignment_padding =
+ sizeof(RawArray) + kObjectAlignment - 1;
+ const intptr_t instance_size =
+ (fixed_size_plus_alignment_padding + length * kWordSize) &
+ ~(kObjectAlignment - 1);
+ const uword start = thread->heap()->new_space()->TryAllocateInTLAB(
+ thread, instance_size);
+ if (LIKELY(start != 0)) {
+ const intptr_t cid = kArrayCid;
+ uword tags = 0;
+ if (LIKELY(instance_size <= RawObject::SizeTag::kMaxSizeTag)) {
+ tags = RawObject::SizeTag::update(instance_size, tags);
+ }
+ tags = RawObject::ClassIdTag::update(cid, tags);
+ // Writes both the tags and the initial identity hash on 64 bit
+ // platforms.
+ *reinterpret_cast<uword*>(start + Instance::tags_offset()) = tags;
+ *reinterpret_cast<RawObject**>(start + Array::length_offset()) =
+ FP[rB];
+ *reinterpret_cast<RawObject**>(
+ start + Array::type_arguments_offset()) = FP[rC];
+ RawObject** data =
+ reinterpret_cast<RawObject**>(start + Array::data_offset());
+ for (intptr_t i = 0; i < length; i++) {
+ data[i] = null_value;
+ }
+ FP[rA] = reinterpret_cast<RawObject*>(start + kHeapObjectTag);
+ pc += 4;
+ }
+ }
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(CreateArrayTOS, 0);
+ SP[1] = SP[-0]; // Length.
+ SP[2] = SP[-1]; // Type.
+ Exit(thread, FP, SP + 3, pc);
+ NativeArguments args(thread, 2, SP + 1, SP - 1);
+ INVOKE_RUNTIME(DRT_AllocateArray, args);
+ SP -= 1;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(InstanceOf, 0);
+ // Stack: instance, instantiator type args, function type args, type, cache
+ RawInstance* instance = static_cast<RawInstance*>(SP[-4]);
+ RawTypeArguments* instantiator_type_arguments =
+ static_cast<RawTypeArguments*>(SP[-3]);
+ RawTypeArguments* function_type_arguments =
+ static_cast<RawTypeArguments*>(SP[-2]);
+ RawAbstractType* type = static_cast<RawAbstractType*>(SP[-1]);
+ RawSubtypeTestCache* cache = static_cast<RawSubtypeTestCache*>(SP[0]);
+
+ if (cache != null_value) {
+ const intptr_t cid = InterpreterHelpers::GetClassId(instance);
+
+ RawTypeArguments* instance_type_arguments =
+ static_cast<RawTypeArguments*>(null_value);
+ RawObject* instance_cid_or_function;
+ if (cid == kClosureCid) {
+ RawClosure* closure = static_cast<RawClosure*>(instance);
+ if (closure->ptr()->function_type_arguments_ != TypeArguments::null()) {
+ // Cache cannot be used for generic closures.
+ goto InstanceOfCallRuntime;
+ }
+ instance_type_arguments = closure->ptr()->instantiator_type_arguments_;
+ instance_cid_or_function = closure->ptr()->function_;
+ } else {
+ instance_cid_or_function = Smi::New(cid);
+
+ RawClass* instance_class = thread->isolate()->class_table()->At(cid);
+ if (instance_class->ptr()->num_type_arguments_ < 0) {
+ goto InstanceOfCallRuntime;
+ } else if (instance_class->ptr()->num_type_arguments_ > 0) {
+ instance_type_arguments = reinterpret_cast<RawTypeArguments**>(
+ instance->ptr())[instance_class->ptr()
+ ->type_arguments_field_offset_in_words_];
+ }
+ }
+
+ for (RawObject** entries = cache->ptr()->cache_->ptr()->data();
+ entries[0] != null_value;
+ entries += SubtypeTestCache::kTestEntryLength) {
+ if ((entries[SubtypeTestCache::kInstanceClassIdOrFunction] ==
+ instance_cid_or_function) &&
+ (entries[SubtypeTestCache::kInstanceTypeArguments] ==
+ instance_type_arguments) &&
+ (entries[SubtypeTestCache::kInstantiatorTypeArguments] ==
+ instantiator_type_arguments) &&
+ (entries[SubtypeTestCache::kFunctionTypeArguments] ==
+ function_type_arguments)) {
+ SP[-4] = entries[SubtypeTestCache::kTestResult];
+ goto InstanceOfOk;
+ }
+ }
+ }
+
+ // clang-format off
+ InstanceOfCallRuntime:
+ {
+ SP[1] = instance;
+ SP[2] = type;
+ SP[3] = instantiator_type_arguments;
+ SP[4] = function_type_arguments;
+ SP[5] = cache;
+ Exit(thread, FP, SP + 6, pc);
+ NativeArguments native_args(thread, 5, SP + 1, SP - 4);
+ INVOKE_RUNTIME(DRT_Instanceof, native_args);
+ }
+ // clang-format on
+
+ InstanceOfOk:
+ SP -= 4;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(BadTypeError, 0);
+ // Stack: instance, instantiator type args, function type args, type, name
+ RawObject** args = SP - 4;
+ if (args[0] != null_value) {
+ SP[1] = args[0]; // instance.
+ SP[2] = args[4]; // name.
+ SP[3] = args[3]; // type.
+ Exit(thread, FP, SP + 4, pc);
+ NativeArguments native_args(thread, 3, SP + 1, SP - 4);
+ INVOKE_RUNTIME(DRT_BadTypeError, native_args);
+ UNREACHABLE();
+ }
+ SP -= 4;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(AssertAssignable, A_D);
+ // Stack: instance, instantiator type args, function type args, type, name
+ RawObject** args = SP - 4;
+ const bool may_be_smi = (rA == 1);
+ const bool is_smi =
+ ((reinterpret_cast<intptr_t>(args[0]) & kSmiTagMask) == kSmiTag);
+ const bool smi_ok = is_smi && may_be_smi;
+ if (!smi_ok && (args[0] != null_value)) {
+ RawSubtypeTestCache* cache =
+ static_cast<RawSubtypeTestCache*>(LOAD_CONSTANT(rD));
+ if (cache != null_value) {
+ RawInstance* instance = static_cast<RawInstance*>(args[0]);
+ RawTypeArguments* instantiator_type_arguments =
+ static_cast<RawTypeArguments*>(args[1]);
+ RawTypeArguments* function_type_arguments =
+ static_cast<RawTypeArguments*>(args[2]);
+
+ const intptr_t cid = InterpreterHelpers::GetClassId(instance);
+
+ RawTypeArguments* instance_type_arguments =
+ static_cast<RawTypeArguments*>(null_value);
+ RawObject* instance_cid_or_function;
+ if (cid == kClosureCid) {
+ RawClosure* closure = static_cast<RawClosure*>(instance);
+ if (closure->ptr()->function_type_arguments_ !=
+ TypeArguments::null()) {
+ // Cache cannot be used for generic closures.
+ goto AssertAssignableCallRuntime;
+ }
+ instance_type_arguments =
+ closure->ptr()->instantiator_type_arguments_;
+ instance_cid_or_function = closure->ptr()->function_;
+ } else {
+ instance_cid_or_function = Smi::New(cid);
+
+ RawClass* instance_class = thread->isolate()->class_table()->At(cid);
+ if (instance_class->ptr()->num_type_arguments_ < 0) {
+ goto AssertAssignableCallRuntime;
+ } else if (instance_class->ptr()->num_type_arguments_ > 0) {
+ instance_type_arguments = reinterpret_cast<RawTypeArguments**>(
+ instance->ptr())[instance_class->ptr()
+ ->type_arguments_field_offset_in_words_];
+ }
+ }
+
+ for (RawObject** entries = cache->ptr()->cache_->ptr()->data();
+ entries[0] != null_value;
+ entries += SubtypeTestCache::kTestEntryLength) {
+ if ((entries[SubtypeTestCache::kInstanceClassIdOrFunction] ==
+ instance_cid_or_function) &&
+ (entries[SubtypeTestCache::kInstanceTypeArguments] ==
+ instance_type_arguments) &&
+ (entries[SubtypeTestCache::kInstantiatorTypeArguments] ==
+ instantiator_type_arguments) &&
+ (entries[SubtypeTestCache::kFunctionTypeArguments] ==
+ function_type_arguments)) {
+ if (true_value == entries[SubtypeTestCache::kTestResult]) {
+ goto AssertAssignableOk;
+ } else {
+ break;
+ }
+ }
+ }
+ }
+
+ AssertAssignableCallRuntime:
+ SP[1] = args[0]; // instance
+ SP[2] = args[3]; // type
+ SP[3] = args[1]; // instantiator type args
+ SP[4] = args[2]; // function type args
+ SP[5] = args[4]; // name
+ SP[6] = cache;
+ Exit(thread, FP, SP + 7, pc);
+ NativeArguments native_args(thread, 6, SP + 1, SP - 4);
+ INVOKE_RUNTIME(DRT_TypeCheck, native_args);
+ }
+
+ AssertAssignableOk:
+ SP -= 4;
+ DISPATCH();
+ }
+
+ {
+ 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?
+ if ((value == true_value) || (value == false_value)) {
+ goto AssertBooleanOk;
+ }
+ } else if (value != null_value) {
+ goto AssertBooleanOk;
+ }
+
+ // Assertion failed.
+ {
+ SP[1] = SP[0]; // instance
+ Exit(thread, FP, SP + 2, pc);
+ NativeArguments args(thread, 1, SP + 1, SP);
+ INVOKE_RUNTIME(DRT_NonBoolTypeError, args);
+ }
+
+ AssertBooleanOk:
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(TestSmi, A_D);
+ intptr_t left = reinterpret_cast<intptr_t>(RAW_CAST(Smi, FP[rA]));
+ intptr_t right = reinterpret_cast<intptr_t>(RAW_CAST(Smi, FP[rD]));
+ if ((left & right) != 0) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(TestCids, A_D);
+ const intptr_t cid = InterpreterHelpers::GetClassId(FP[rA]);
+ const intptr_t num_cases = rD;
+ for (intptr_t i = 0; i < num_cases; i++) {
+ ASSERT(KernelBytecode::DecodeOpcode(pc[i]) == KernelBytecode::kNop);
+ intptr_t test_target = KernelBytecode::DecodeA(pc[i]);
+ intptr_t test_cid = KernelBytecode::DecodeD(pc[i]);
+ if (cid == test_cid) {
+ if (test_target != 0) {
+ pc += 1; // Match true.
+ } else {
+ pc += 2; // Match false.
+ }
+ break;
+ }
+ }
+ pc += num_cases;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(CheckSmi, 0);
+ intptr_t obj = reinterpret_cast<intptr_t>(FP[rA]);
+ if ((obj & kSmiTagMask) == kSmiTag) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(CheckEitherNonSmi, A_D);
+ const intptr_t obj1 = reinterpret_cast<intptr_t>(FP[rA]);
+ const intptr_t obj2 = reinterpret_cast<intptr_t>(FP[rD]);
+ const intptr_t tag = (obj1 | obj2) & kSmiTagMask;
+ if (tag != kSmiTag) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(CheckClassId, A_D);
+ const intptr_t actual_cid =
+ reinterpret_cast<intptr_t>(FP[rA]) >> kSmiTagSize;
+ const intptr_t desired_cid = rD;
+ pc += (actual_cid == desired_cid) ? 1 : 0;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(CheckClassIdRange, A_D);
+ const intptr_t actual_cid =
+ reinterpret_cast<intptr_t>(FP[rA]) >> kSmiTagSize;
+ const uintptr_t cid_start = rD;
+ const uintptr_t cid_range = KernelBytecode::DecodeD(*pc);
+ // Unsigned comparison. Skip either just the nop or both the nop and the
+ // following instruction.
+ pc += (actual_cid - cid_start <= cid_range) ? 2 : 1;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(CheckBitTest, A_D);
+ const intptr_t raw_value = reinterpret_cast<intptr_t>(FP[rA]);
+ const bool is_smi = ((raw_value & kSmiTagMask) == kSmiTag);
+ const intptr_t cid_min = KernelBytecode::DecodeD(*pc);
+ const intptr_t cid_mask = Smi::Value(
+ RAW_CAST(Smi, LOAD_CONSTANT(KernelBytecode::DecodeD(*(pc + 1)))));
+ if (LIKELY(!is_smi)) {
+ const intptr_t cid_max = Utils::HighestBit(cid_mask) + cid_min;
+ const intptr_t cid = InterpreterHelpers::GetClassId(FP[rA]);
+ // The cid is in-bounds, and the bit is set in the mask.
+ if ((cid >= cid_min) && (cid <= cid_max) &&
+ ((cid_mask & (1 << (cid - cid_min))) != 0)) {
+ pc += 3;
+ } else {
+ pc += 2;
+ }
+ } else {
+ const bool may_be_smi = (rD == 1);
+ pc += (may_be_smi ? 3 : 2);
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(CheckCids, A_B_C);
+ const intptr_t raw_value = reinterpret_cast<intptr_t>(FP[rA]);
+ const bool is_smi = ((raw_value & kSmiTagMask) == kSmiTag);
+ const bool may_be_smi = (rB == 1);
+ const intptr_t cids_length = rC;
+ if (LIKELY(!is_smi)) {
+ const intptr_t cid = InterpreterHelpers::GetClassId(FP[rA]);
+ for (intptr_t i = 0; i < cids_length; i++) {
+ const intptr_t desired_cid = KernelBytecode::DecodeD(*(pc + i));
+ if (cid == desired_cid) {
+ pc++;
+ break;
+ }
+ }
+ pc += cids_length;
+ } else {
+ pc += cids_length;
+ pc += (may_be_smi ? 1 : 0);
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(CheckCidsByRange, A_B_C);
+ const intptr_t raw_value = reinterpret_cast<intptr_t>(FP[rA]);
+ const bool is_smi = ((raw_value & kSmiTagMask) == kSmiTag);
+ const bool may_be_smi = (rB == 1);
+ const intptr_t cids_length = rC;
+ if (LIKELY(!is_smi)) {
+ const intptr_t cid = InterpreterHelpers::GetClassId(FP[rA]);
+ for (intptr_t i = 0; i < cids_length; i += 2) {
+ // Note unsigned type to get unsigned range check below.
+ const uintptr_t cid_start = KernelBytecode::DecodeD(*(pc + i));
+ const uintptr_t cids = KernelBytecode::DecodeD(*(pc + i + 1));
+ if (cid - cid_start < cids) {
+ pc++;
+ break;
+ }
+ }
+ pc += cids_length;
+ } else {
+ pc += cids_length;
+ pc += (may_be_smi ? 1 : 0);
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfEqStrictTOS, 0);
+ SP -= 2;
+ if (SP[1] != SP[2]) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfNeStrictTOS, 0);
+ SP -= 2;
+ if (SP[1] == SP[2]) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfEqStrictNumTOS, 0);
+ if (thread->isolate()->single_step()) {
+ Exit(thread, FP, SP + 1, pc);
+ NativeArguments args(thread, 0, NULL, NULL);
+ INVOKE_RUNTIME(DRT_SingleStepHandler, args);
+ }
+
+ SP -= 2;
+ if (!InterpreterHelpers::IsStrictEqualWithNumberCheck(SP[1], SP[2])) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfNeStrictNumTOS, 0);
+ if (thread->isolate()->single_step()) {
+ Exit(thread, FP, SP + 1, pc);
+ NativeArguments args(thread, 0, NULL, NULL);
+ INVOKE_RUNTIME(DRT_SingleStepHandler, args);
+ }
+
+ SP -= 2;
+ if (InterpreterHelpers::IsStrictEqualWithNumberCheck(SP[1], SP[2])) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfSmiLtTOS, 0);
+ RawSmi* left = Smi::RawCast(SP[-1]);
+ RawSmi* right = Smi::RawCast(SP[-0]);
+ if (!(Smi::Value(left) < Smi::Value(right))) {
+ pc++;
+ }
+ SP -= 2;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfSmiLeTOS, 0);
+ RawSmi* left = Smi::RawCast(SP[-1]);
+ RawSmi* right = Smi::RawCast(SP[-0]);
+ if (!(Smi::Value(left) <= Smi::Value(right))) {
+ pc++;
+ }
+ SP -= 2;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfSmiGeTOS, 0);
+ RawSmi* left = Smi::RawCast(SP[-1]);
+ RawSmi* right = Smi::RawCast(SP[-0]);
+ if (!(Smi::Value(left) >= Smi::Value(right))) {
+ pc++;
+ }
+ SP -= 2;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfSmiGtTOS, 0);
+ RawSmi* left = Smi::RawCast(SP[-1]);
+ RawSmi* right = Smi::RawCast(SP[-0]);
+ if (!(Smi::Value(left) > Smi::Value(right))) {
+ pc++;
+ }
+ SP -= 2;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfEqStrict, A_D);
+ RawObject* lhs = FP[rA];
+ RawObject* rhs = FP[rD];
+ if (lhs != rhs) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfNeStrict, A_D);
+ RawObject* lhs = FP[rA];
+ RawObject* rhs = FP[rD];
+ if (lhs == rhs) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfLe, A_D);
+ const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rA]);
+ const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rD]);
+ if (lhs > rhs) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfLt, A_D);
+ const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rA]);
+ const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rD]);
+ if (lhs >= rhs) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfGe, A_D);
+ const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rA]);
+ const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rD]);
+ if (lhs < rhs) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfGt, A_D);
+ const intptr_t lhs = reinterpret_cast<intptr_t>(FP[rA]);
+ const intptr_t rhs = reinterpret_cast<intptr_t>(FP[rD]);
+ if (lhs <= rhs) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfULe, A_D);
+ const uintptr_t lhs = reinterpret_cast<uintptr_t>(FP[rA]);
+ const uintptr_t rhs = reinterpret_cast<uintptr_t>(FP[rD]);
+ if (lhs > rhs) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfULt, A_D);
+ const uintptr_t lhs = reinterpret_cast<uintptr_t>(FP[rA]);
+ const uintptr_t rhs = reinterpret_cast<uintptr_t>(FP[rD]);
+ if (lhs >= rhs) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfUGe, A_D);
+ const uintptr_t lhs = reinterpret_cast<uintptr_t>(FP[rA]);
+ const uintptr_t rhs = reinterpret_cast<uintptr_t>(FP[rD]);
+ if (lhs < rhs) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfUGt, A_D);
+ const uintptr_t lhs = reinterpret_cast<uintptr_t>(FP[rA]);
+ const uintptr_t rhs = reinterpret_cast<uintptr_t>(FP[rD]);
+ if (lhs <= rhs) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+#if defined(ARCH_IS_64_BIT)
+ {
+ BYTECODE(IfDEq, A_D);
+ const double lhs = bit_cast<double, RawObject*>(FP[rA]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rD]);
+ pc += (lhs == rhs) ? 0 : 1;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDNe, A_D);
+ const double lhs = bit_cast<double, RawObject*>(FP[rA]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rD]);
+ pc += (lhs != rhs) ? 0 : 1;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDLe, A_D);
+ const double lhs = bit_cast<double, RawObject*>(FP[rA]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rD]);
+ pc += (lhs <= rhs) ? 0 : 1;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDLt, A_D);
+ const double lhs = bit_cast<double, RawObject*>(FP[rA]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rD]);
+ pc += (lhs < rhs) ? 0 : 1;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDGe, A_D);
+ const double lhs = bit_cast<double, RawObject*>(FP[rA]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rD]);
+ pc += (lhs >= rhs) ? 0 : 1;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDGt, A_D);
+ const double lhs = bit_cast<double, RawObject*>(FP[rA]);
+ const double rhs = bit_cast<double, RawObject*>(FP[rD]);
+ pc += (lhs > rhs) ? 0 : 1;
+ DISPATCH();
+ }
+#else // defined(ARCH_IS_64_BIT)
+ {
+ BYTECODE(IfDEq, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDNe, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDLe, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDLt, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDGe, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfDGt, A_D);
+ UNREACHABLE();
+ DISPATCH();
+ }
+#endif // defined(ARCH_IS_64_BIT)
+
+ {
+ BYTECODE(IfEqStrictNum, A_D);
+ RawObject* lhs = FP[rA];
+ RawObject* rhs = FP[rD];
+ if (!InterpreterHelpers::IsStrictEqualWithNumberCheck(lhs, rhs)) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfNeStrictNum, A_D);
+ RawObject* lhs = FP[rA];
+ RawObject* rhs = FP[rD];
+ if (InterpreterHelpers::IsStrictEqualWithNumberCheck(lhs, rhs)) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfEqNull, A);
+ if (FP[rA] != null_value) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(IfNeNull, A_D);
+ if (FP[rA] == null_value) {
+ pc++;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Jump, 0);
+ const int32_t target = static_cast<int32_t>(op) >> 8;
+ pc += (target - 1);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadClassId, A_D);
+ const uint16_t object_reg = rD;
+ RawObject* obj = static_cast<RawObject*>(FP[object_reg]);
+ FP[rA] = InterpreterHelpers::GetClassIdAsSmi(obj);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadClassIdTOS, 0);
+ RawObject* obj = static_cast<RawObject*>(SP[0]);
+ SP[0] = InterpreterHelpers::GetClassIdAsSmi(obj);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreIndexedTOS, 0);
+ SP -= 3;
+ RawArray* array = RAW_CAST(Array, SP[1]);
+ RawSmi* index = RAW_CAST(Smi, SP[2]);
+ RawObject* value = SP[3];
+ ASSERT(InterpreterHelpers::CheckIndex(index, array->ptr()->length_));
+ array->StorePointer(array->ptr()->data() + Smi::Value(index), value);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreIndexed, A_B_C);
+ RawArray* array = RAW_CAST(Array, FP[rA]);
+ RawSmi* index = RAW_CAST(Smi, FP[rB]);
+ RawObject* value = FP[rC];
+ ASSERT(InterpreterHelpers::CheckIndex(index, array->ptr()->length_));
+ array->StorePointer(array->ptr()->data() + Smi::Value(index), value);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreIndexedUint8, A_B_C);
+ uint8_t* data = InterpreterHelpers::GetTypedData(FP[rA], FP[rB]);
+ *data = Smi::Value(RAW_CAST(Smi, FP[rC]));
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreIndexedExternalUint8, A_B_C);
+ uint8_t* array = reinterpret_cast<uint8_t*>(FP[rA]);
+ RawSmi* index = RAW_CAST(Smi, FP[rB]);
+ RawSmi* value = RAW_CAST(Smi, FP[rC]);
+ array[Smi::Value(index)] = Smi::Value(value);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreIndexedOneByteString, A_B_C);
+ RawOneByteString* array = RAW_CAST(OneByteString, FP[rA]);
+ RawSmi* index = RAW_CAST(Smi, FP[rB]);
+ RawSmi* value = RAW_CAST(Smi, FP[rC]);
+ ASSERT(InterpreterHelpers::CheckIndex(index, array->ptr()->length_));
+ array->ptr()->data()[Smi::Value(index)] = Smi::Value(value);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreIndexedUint32, A_B_C);
+ uint8_t* data = InterpreterHelpers::GetTypedData(FP[rA], FP[rB]);
+ const uintptr_t value = reinterpret_cast<uintptr_t>(FP[rC]);
+ *reinterpret_cast<uint32_t*>(data) = static_cast<uint32_t>(value);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(TailCall, 0);
+ RawCode* code = RAW_CAST(Code, SP[-0]);
+ RawImmutableArray* args_desc = RAW_CAST(ImmutableArray, SP[-1]);
+ PrepareForTailCall(code, args_desc, FP, &SP, &pc);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(TailCallOpt, A_D);
+ RawImmutableArray* args_desc = RAW_CAST(ImmutableArray, FP[rA]);
+ RawCode* code = RAW_CAST(Code, FP[rD]);
+ PrepareForTailCall(code, args_desc, FP, &SP, &pc);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadArgDescriptor, 0);
+ SP++;
+ SP[0] = argdesc_;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadArgDescriptorOpt, A);
+ FP[rA] = argdesc_;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(NoSuchMethod, 0);
+ goto ClosureNoSuchMethod;
+ }
+
+ {
+ BYTECODE(LoadFpRelativeSlot, A_X);
+ RawSmi* index = RAW_CAST(Smi, SP[-0]);
+ const int16_t offset = rD;
+ SP[-0] = FP[-(Smi::Value(index) + offset)];
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadFpRelativeSlotOpt, A_B_Y);
+ RawSmi* index = RAW_CAST(Smi, FP[rB]);
+ const int8_t offset = rY;
+ FP[rA] = FP[-(Smi::Value(index) + offset)];
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreFpRelativeSlot, A_X);
+ RawSmi* index = RAW_CAST(Smi, SP[-1]);
+ const int16_t offset = rD;
+ FP[-(Smi::Value(index) + offset) - 0] = SP[-0];
+ SP--;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(StoreFpRelativeSlotOpt, A_B_Y);
+ RawSmi* index = RAW_CAST(Smi, FP[rB]);
+ const int8_t offset = rY;
+ FP[-(Smi::Value(index) + offset) - 0] = FP[rA];
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexedTOS, 0);
+ // Currently this instruction is only emitted if it's safe to do.
+ ASSERT(!SP[0]->IsHeapObject());
+ ASSERT(SP[-1]->IsArray() || SP[-1]->IsImmutableArray());
+
+ const intptr_t index_scale = rA;
+ RawSmi* index = RAW_CAST(Smi, SP[-0]);
+ RawArray* array = Array::RawCast(SP[-1]);
+
+ ASSERT(InterpreterHelpers::CheckIndex(index, array->ptr()->length_));
+ SP[-1] = array->ptr()->data()[Smi::Value(index) << index_scale];
+ SP--;
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexed, A_B_C);
+ RawObject* obj = FP[rB];
+ ASSERT(obj->IsArray() || obj->IsImmutableArray());
+ RawArray* array = reinterpret_cast<RawArray*>(obj);
+ RawSmi* index = RAW_CAST(Smi, FP[rC]);
+ ASSERT(InterpreterHelpers::CheckIndex(index, array->ptr()->length_));
+ FP[rA] = array->ptr()->data()[Smi::Value(index)];
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexedUint8, A_B_C);
+ uint8_t* data = InterpreterHelpers::GetTypedData(FP[rB], FP[rC]);
+ FP[rA] = Smi::New(*data);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexedInt8, A_B_C);
+ uint8_t* data = InterpreterHelpers::GetTypedData(FP[rB], FP[rC]);
+ FP[rA] = Smi::New(*reinterpret_cast<int8_t*>(data));
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexedUint32, A_B_C);
+ const uint8_t* data = InterpreterHelpers::GetTypedData(FP[rB], FP[rC]);
+ const uint32_t value = *reinterpret_cast<const uint32_t*>(data);
+ FP[rA] = reinterpret_cast<RawObject*>(value);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexedInt32, A_B_C);
+ const uint8_t* data = InterpreterHelpers::GetTypedData(FP[rB], FP[rC]);
+ const int32_t value = *reinterpret_cast<const int32_t*>(data);
+ FP[rA] = reinterpret_cast<RawObject*>(value);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexedExternalUint8, A_B_C);
+ uint8_t* data = reinterpret_cast<uint8_t*>(FP[rB]);
+ RawSmi* index = RAW_CAST(Smi, FP[rC]);
+ FP[rA] = Smi::New(data[Smi::Value(index)]);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexedExternalInt8, A_B_C);
+ int8_t* data = reinterpret_cast<int8_t*>(FP[rB]);
+ RawSmi* index = RAW_CAST(Smi, FP[rC]);
+ FP[rA] = Smi::New(data[Smi::Value(index)]);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexedOneByteString, A_B_C);
+ RawOneByteString* array = RAW_CAST(OneByteString, FP[rB]);
+ RawSmi* index = RAW_CAST(Smi, FP[rC]);
+ ASSERT(InterpreterHelpers::CheckIndex(index, array->ptr()->length_));
+ FP[rA] = Smi::New(array->ptr()->data()[Smi::Value(index)]);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(LoadIndexedTwoByteString, A_B_C);
+ RawTwoByteString* array = RAW_CAST(TwoByteString, FP[rB]);
+ RawSmi* index = RAW_CAST(Smi, FP[rC]);
+ ASSERT(InterpreterHelpers::CheckIndex(index, array->ptr()->length_));
+ FP[rA] = Smi::New(array->ptr()->data()[Smi::Value(index)]);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Deopt, A_D);
+ const bool is_lazy = rD == 0;
+ if (!Deoptimize(thread, &pc, &FP, &SP, is_lazy)) {
+ HANDLE_EXCEPTION;
+ }
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(DeoptRewind, 0);
+ pc = reinterpret_cast<uint32_t*>(thread->resume_pc());
+ if (!Deoptimize(thread, &pc, &FP, &SP, false /* eager */)) {
+ HANDLE_EXCEPTION;
+ }
+ {
+ Exit(thread, FP, SP + 1, pc);
+ NativeArguments args(thread, 0, NULL, NULL);
+ INVOKE_RUNTIME(DRT_RewindPostDeopt, args);
+ }
+ UNREACHABLE(); // DRT_RewindPostDeopt does not exit normally.
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Nop, 0);
+ DISPATCH();
+ }
+
+ {
+ BYTECODE(Trap, 0);
+ UNIMPLEMENTED();
+ DISPATCH();
+ }
+
+ // Helper used to handle noSuchMethod on closures.
+ {
+ ClosureNoSuchMethod:
+#if defined(DEBUG)
+ function_h ^= FrameFunction(FP);
+ ASSERT(function_h.IsNull() || function_h.IsClosureFunction());
+#endif
+
+ // Restore caller context as we are going to throw NoSuchMethod.
+ pc = SavedCallerPC(FP);
+
+ const bool has_dart_caller = (reinterpret_cast<uword>(pc) & 2) == 0;
+ const intptr_t argc = has_dart_caller ? KernelBytecode::DecodeArgc(pc[-1])
+ : (reinterpret_cast<uword>(pc) >> 2);
+ const bool has_function_type_args =
+ has_dart_caller && InterpreterHelpers::ArgDescTypeArgsLen(argdesc_) > 0;
+
+ SP = FrameArguments(FP, 0);
+ RawObject** args = SP - argc;
+ FP = SavedCallerFP(FP);
+ if (has_dart_caller) {
+ pp_ = InterpreterHelpers::FrameCode(FP)->ptr()->object_pool_;
+ }
+
+ *++SP = null_value;
+ *++SP = args[has_function_type_args ? 1 : 0]; // Closure object.
+ *++SP = argdesc_;
+ *++SP = null_value; // Array of arguments (will be filled).
+
+ // Allocate array of arguments.
+ {
+ SP[1] = Smi::New(argc); // length
+ SP[2] = null_value; // type
+ Exit(thread, FP, SP + 3, pc);
+ NativeArguments native_args(thread, 2, SP + 1, SP);
+ if (!InvokeRuntime(thread, this, DRT_AllocateArray, native_args)) {
+ HANDLE_EXCEPTION;
+ } else if (has_dart_caller) {
+ HANDLE_RETURN;
+ }
+
+ // Copy arguments into the newly allocated array.
+ RawArray* array = static_cast<RawArray*>(SP[0]);
+ ASSERT(array->GetClassId() == kArrayCid);
+ for (intptr_t i = 0; i < argc; i++) {
+ array->ptr()->data()[i] = args[i];
+ }
+ }
+
+ // Invoke noSuchMethod passing down closure, argument descriptor and
+ // array of arguments.
+ {
+ Exit(thread, FP, SP + 1, pc);
+ NativeArguments native_args(thread, 3, SP - 2, SP - 3);
+ INVOKE_RUNTIME(DRT_InvokeClosureNoSuchMethod, native_args);
+ UNREACHABLE();
+ }
+
+ DISPATCH();
+ }
+
+ // Single dispatch point used by exception handling macros.
+ {
+ DispatchAfterException:
+ DISPATCH();
+ }
+
+ UNREACHABLE();
+ return 0;
+}
+
+void Interpreter::JumpToFrame(uword pc, uword sp, uword fp, Thread* thread) {
+ // Walk over all setjmp buffers (simulated --> C++ transitions)
+ // and try to find the setjmp associated with the simulated frame pointer.
+ InterpreterSetjmpBuffer* buf = last_setjmp_buffer();
+ while ((buf->link() != NULL) && (buf->link()->fp() > fp)) {
+ buf = buf->link();
+ }
+ ASSERT(buf != NULL);
+ ASSERT(last_setjmp_buffer() == buf);
+
+ // The C++ caller has not cleaned up the stack memory of C++ frames.
+ // Prepare for unwinding frames by destroying all the stack resources
+ // in the previous C++ frames.
+ StackResource::Unwind(thread);
+
+ // Set the tag.
+ thread->set_vm_tag(VMTag::kDartTagId);
+ // Clear top exit frame.
+ thread->set_top_exit_frame_info(0);
+
+ fp_ = reinterpret_cast<RawObject**>(fp);
+
+ if (pc == StubCode::RunExceptionHandler_entry()->EntryPoint()) {
+ // The RunExceptionHandler stub is a placeholder. We implement
+ // its behavior here.
+ RawObject* raw_exception = thread->active_exception();
+ RawObject* raw_stacktrace = thread->active_stacktrace();
+ ASSERT(raw_exception != Object::null());
+ special_[kExceptionSpecialIndex] = raw_exception;
+ special_[kStackTraceSpecialIndex] = raw_stacktrace;
+ pc_ = thread->resume_pc();
+ } else {
+ pc_ = pc;
+ }
+
+ buf->Longjmp();
+ UNREACHABLE();
+}
+
+void Interpreter::VisitObjectPointers(ObjectPointerVisitor* visitor) {
+ visitor->VisitPointer(reinterpret_cast<RawObject**>(&pp_));
+ visitor->VisitPointer(reinterpret_cast<RawObject**>(&argdesc_));
+}
+
+} // namespace dart
+
+#endif // defined(DART_USE_INTERPRETER)
diff --git a/runtime/vm/interpreter.h b/runtime/vm/interpreter.h
new file mode 100644
index 0000000..def46e6
--- /dev/null
+++ b/runtime/vm/interpreter.h
@@ -0,0 +1,199 @@
+// Copyright (c) 2018, 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.
+
+#ifndef RUNTIME_VM_INTERPRETER_H_
+#define RUNTIME_VM_INTERPRETER_H_
+
+#include "vm/compiler/method_recognizer.h"
+#include "vm/constants_kbc.h"
+
+namespace dart {
+
+class Isolate;
+class RawObject;
+class InterpreterSetjmpBuffer;
+class Thread;
+class Code;
+class Array;
+class RawICData;
+class RawImmutableArray;
+class RawArray;
+class RawObjectPool;
+class RawFunction;
+class ObjectPointerVisitor;
+
+// Interpreter intrinsic handler. It is invoked on entry to the intrinsified
+// function via Intrinsic bytecode before the frame is setup.
+// If the handler returns true then Intrinsic bytecode works as a return
+// instruction returning the value in result. Otherwise interpreter proceeds to
+// execute the body of the function.
+typedef bool (*IntrinsicHandler)(Thread* thread,
+ RawObject** FP,
+ RawObject** result);
+
+class Interpreter {
+ public:
+ static const uword kInterpreterStackUnderflowSize = 0x80;
+
+ Interpreter();
+ ~Interpreter();
+
+ // The currently executing Interpreter instance, which is associated to the
+ // current isolate
+ static Interpreter* Current();
+
+ // Low address (KBC stack grows up).
+ uword stack_base() const { return stack_base_; }
+ // High address (KBC stack grows up).
+ uword stack_limit() const { return stack_limit_; }
+
+ // The thread's top_exit_frame_info refers to a Dart frame in the interpreter
+ // stack. The interpreter's top_exit_frame_info refers to a C++ frame in the
+ // native stack.
+ uword top_exit_frame_info() const { return top_exit_frame_info_; }
+ void set_top_exit_frame_info(uword value) { top_exit_frame_info_ = value; }
+
+ // Call on program start.
+ static void InitOnce();
+
+ RawObject* Call(const Code& code,
+ const Array& arguments_descriptor,
+ const Array& arguments,
+ Thread* thread);
+
+ void JumpToFrame(uword pc, uword sp, uword fp, Thread* thread);
+
+ uword get_sp() const { return reinterpret_cast<uword>(fp_); } // Yes, fp_.
+ uword get_fp() const { return reinterpret_cast<uword>(fp_); }
+ uword get_pc() const { return pc_; }
+
+ enum IntrinsicId {
+#define V(test_class_name, test_function_name, enum_name, type, fp) \
+ k##enum_name##Intrinsic,
+ ALL_INTRINSICS_LIST(V) GRAPH_INTRINSICS_LIST(V)
+#undef V
+ kIntrinsicCount,
+ };
+
+ static bool IsSupportedIntrinsic(IntrinsicId id) {
+ return intrinsics_[id] != NULL;
+ }
+
+ enum SpecialIndex {
+ kExceptionSpecialIndex,
+ kStackTraceSpecialIndex,
+ kSpecialIndexCount
+ };
+
+ void VisitObjectPointers(ObjectPointerVisitor* visitor);
+
+ private:
+ uintptr_t* stack_;
+ uword stack_base_;
+ uword stack_limit_;
+
+ RawObject** fp_;
+ uword pc_;
+ DEBUG_ONLY(uint64_t icount_;)
+
+ InterpreterSetjmpBuffer* last_setjmp_buffer_;
+ uword top_exit_frame_info_;
+
+ RawObjectPool* pp_; // Pool Pointer.
+ RawArray* argdesc_; // Arguments Descriptor: used to pass information between
+ // call instruction and the function entry.
+ RawObject* special_[kSpecialIndexCount];
+
+ static IntrinsicHandler intrinsics_[kIntrinsicCount];
+
+ void Exit(Thread* thread,
+ RawObject** base,
+ RawObject** exit_frame,
+ uint32_t* pc);
+
+ void CallRuntime(Thread* thread,
+ RawObject** base,
+ RawObject** exit_frame,
+ uint32_t* pc,
+ intptr_t argc_tag,
+ RawObject** args,
+ RawObject** result,
+ uword target);
+
+ void Invoke(Thread* thread,
+ RawObject** call_base,
+ RawObject** call_top,
+ uint32_t** pc,
+ RawObject*** FP,
+ RawObject*** SP);
+
+ bool InvokeCompiled(Thread* thread,
+ RawFunction* function,
+ RawArray* argdesc,
+ RawObject** call_base,
+ RawObject** call_top,
+ uint32_t** pc,
+ RawObject*** FP,
+ RawObject*** SP);
+
+ bool Deoptimize(Thread* thread,
+ uint32_t** pc,
+ RawObject*** FP,
+ RawObject*** SP,
+ bool is_lazy);
+
+ void InlineCacheMiss(int checked_args,
+ Thread* thread,
+ RawICData* icdata,
+ RawObject** call_base,
+ RawObject** top,
+ uint32_t* pc,
+ RawObject** FP,
+ RawObject** SP);
+
+ void InstanceCall1(Thread* thread,
+ RawICData* icdata,
+ RawObject** call_base,
+ RawObject** call_top,
+ uint32_t** pc,
+ RawObject*** FP,
+ RawObject*** SP,
+ bool optimized);
+
+ void InstanceCall2(Thread* thread,
+ RawICData* icdata,
+ RawObject** call_base,
+ RawObject** call_top,
+ uint32_t** pc,
+ RawObject*** FP,
+ RawObject*** SP,
+ bool optimized);
+
+ void PrepareForTailCall(RawCode* code,
+ RawImmutableArray* args_desc,
+ RawObject** FP,
+ RawObject*** SP,
+ uint32_t** pc);
+
+#if !defined(PRODUCT)
+ // Returns true if tracing of executed instructions is enabled.
+ bool IsTracingExecution() const;
+
+ // Prints bytecode instruction at given pc for instruction tracing.
+ void TraceInstruction(uint32_t* pc) const;
+#endif // !defined(PRODUCT)
+
+ // Longjmp support for exceptions.
+ InterpreterSetjmpBuffer* last_setjmp_buffer() { return last_setjmp_buffer_; }
+ void set_last_setjmp_buffer(InterpreterSetjmpBuffer* buffer) {
+ last_setjmp_buffer_ = buffer;
+ }
+
+ friend class InterpreterSetjmpBuffer;
+ DISALLOW_COPY_AND_ASSIGN(Interpreter);
+};
+
+} // namespace dart
+
+#endif // RUNTIME_VM_INTERPRETER_H_
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index c3dcbe0..10ec3e4 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -21,6 +21,7 @@
#include "vm/flags.h"
#include "vm/heap.h"
#include "vm/image_snapshot.h"
+#include "vm/interpreter.h"
#include "vm/isolate_reload.h"
#include "vm/kernel_isolate.h"
#include "vm/lockers.h"
@@ -905,6 +906,7 @@
library_tag_handler_(NULL),
api_state_(NULL),
random_(),
+ interpreter_(NULL),
simulator_(NULL),
mutex_(new Mutex(NOT_IN_PRODUCT("Isolate::mutex_"))),
symbols_mutex_(new Mutex(NOT_IN_PRODUCT("Isolate::symbols_mutex_"))),
@@ -980,6 +982,9 @@
delete heap_;
delete object_store_;
delete api_state_;
+#if defined(DART_USE_INTERPRETER)
+ delete interpreter_;
+#endif
#if defined(USING_SIMULATOR)
delete simulator_;
#endif
@@ -1938,6 +1943,12 @@
}
#endif // !defined(DART_PRECOMPILED_RUNTIME)
+#if defined(DART_USE_INTERPRETER)
+ if (interpreter() != NULL) {
+ interpreter()->VisitObjectPointers(visitor);
+ }
+#endif // defined(DART_USE_INTERPRETER)
+
#if defined(TARGET_ARCH_DBC)
if (simulator() != NULL) {
simulator()->VisitObjectPointers(visitor);
diff --git a/runtime/vm/isolate.h b/runtime/vm/isolate.h
index 66f75f9..bf2f38c 100644
--- a/runtime/vm/isolate.h
+++ b/runtime/vm/isolate.h
@@ -38,6 +38,7 @@
class HandleVisitor;
class Heap;
class ICData;
+class Interpreter;
class IsolateProfilerData;
class IsolateReloadContext;
class IsolateSpawnState;
@@ -403,6 +404,9 @@
Random* random() { return &random_; }
+ Interpreter* interpreter() const { return interpreter_; }
+ void set_interpreter(Interpreter* value) { interpreter_ = value; }
+
Simulator* simulator() const { return simulator_; }
void set_simulator(Simulator* value) { simulator_ = value; }
@@ -936,6 +940,7 @@
Dart_LibraryTagHandler library_tag_handler_;
ApiState* api_state_;
Random random_;
+ Interpreter* interpreter_;
Simulator* simulator_;
Mutex* mutex_; // Protects compiler stats.
Mutex* symbols_mutex_; // Protects concurrent access to the symbol table.
diff --git a/runtime/vm/native_arguments.h b/runtime/vm/native_arguments.h
index f7151e3..910e2d6 100644
--- a/runtime/vm/native_arguments.h
+++ b/runtime/vm/native_arguments.h
@@ -96,13 +96,8 @@
RawObject* ArgAt(int index) const {
ASSERT((index >= 0) && (index < ArgCount()));
-#if defined(TARGET_ARCH_DBC)
- // On DBC stack is growing upwards, in reverse direction from all other
- // architectures.
- RawObject** arg_ptr = &(argv_[index]);
-#else
- RawObject** arg_ptr = &(argv_[-index]);
-#endif
+ RawObject** arg_ptr =
+ &(argv_[ReverseArgOrderBit::decode(argc_tag_) ? index : -index]);
// Tell MemorySanitizer the RawObject* was initialized (by generated code).
MSAN_UNPOISON(arg_ptr, kWordSize);
return *arg_ptr;
@@ -205,23 +200,32 @@
enum ArgcTagBits {
kArgcBit = 0,
kArgcSize = 24,
- kFunctionBit = 24,
+ kFunctionBit = kArgcBit + kArgcSize,
kFunctionSize = 3,
+ kReverseArgOrderBit = kFunctionBit + kFunctionSize,
+ kReverseArgOrderSize = 1,
};
class ArgcBits : public BitField<intptr_t, int32_t, kArgcBit, kArgcSize> {};
class FunctionBits
: public BitField<intptr_t, int, kFunctionBit, kFunctionSize> {};
+ class ReverseArgOrderBit
+ : public BitField<intptr_t, bool, kReverseArgOrderBit, 1> {};
friend class Api;
friend class BootstrapNatives;
+ friend class Interpreter;
friend class Simulator;
-#if defined(TARGET_ARCH_DBC)
- // Allow simulator to create NativeArguments on the stack.
+#if defined(TARGET_ARCH_DBC) || defined(DART_USE_INTERPRETER)
+ // Allow simulator and interpreter to create NativeArguments in reverse order
+ // on the stack.
NativeArguments(Thread* thread,
int argc_tag,
RawObject** argv,
RawObject** retval)
- : thread_(thread), argc_tag_(argc_tag), argv_(argv), retval_(retval) {}
+ : thread_(thread),
+ argc_tag_(ReverseArgOrderBit::update(kReverseArgOrderBit, argc_tag)),
+ argv_(argv),
+ retval_(retval) {}
#endif
// Since this function is passed a RawObject directly, we need to be
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 1e84c31..caa190c 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -5468,20 +5468,18 @@
return result.raw();
}
-RawString* TypeArguments::EnumerateURIs() const {
+void TypeArguments::EnumerateURIs(URIs* uris) const {
if (IsNull()) {
- return Symbols::Empty().raw();
+ return;
}
Thread* thread = Thread::Current();
Zone* zone = thread->zone();
AbstractType& type = AbstractType::Handle(zone);
const intptr_t num_types = Length();
- const Array& pieces = Array::Handle(zone, Array::New(num_types));
for (intptr_t i = 0; i < num_types; i++) {
type = TypeAt(i);
- pieces.SetAt(i, String::Handle(zone, type.EnumerateURIs()));
+ type.EnumerateURIs(uris);
}
- return String::ConcatAll(pieces);
}
const char* TypeArguments::ToCString() const {
@@ -5592,10 +5590,46 @@
}
bool Function::HasCode() const {
+ NoSafepointScope no_safepoint;
ASSERT(raw_ptr()->code_ != Code::null());
+#if defined(DART_USE_INTERPRETER)
+ return raw_ptr()->code_ != StubCode::LazyCompile_entry()->code() &&
+ raw_ptr()->code_ != StubCode::InterpretCall_entry()->code();
+#else
return raw_ptr()->code_ != StubCode::LazyCompile_entry()->code();
+#endif
}
+#if defined(DART_USE_INTERPRETER)
+void Function::AttachBytecode(const Code& value) const {
+ DEBUG_ASSERT(IsMutatorOrAtSafepoint());
+ // Finish setting up code before activating it.
+ value.set_owner(*this);
+ StorePointer(&raw_ptr()->bytecode_, value.raw());
+
+ // We should not have loaded the bytecode if the function had code.
+ ASSERT(!HasCode());
+
+ // Set the code entry_point to to InterpretCall stub.
+ SetInstructions(Code::Handle(StubCode::InterpretCall_entry()->code()));
+}
+
+bool Function::HasBytecode() const {
+ return raw_ptr()->bytecode_ != Code::null();
+}
+
+bool Function::HasCode(RawFunction* function) {
+ NoSafepointScope no_safepoint;
+ ASSERT(function->ptr()->code_ != Code::null());
+ return function->ptr()->code_ != StubCode::LazyCompile_entry()->code() &&
+ function->ptr()->code_ != StubCode::InterpretCall_entry()->code();
+}
+
+bool Function::HasBytecode(RawFunction* function) {
+ return function->ptr()->bytecode_ != Code::null();
+}
+#endif
+
void Function::ClearCode() const {
#if defined(DART_PRECOMPILED_RUNTIME)
UNREACHABLE();
@@ -14565,6 +14599,64 @@
}
#endif // !defined(DART_PRECOMPILED_RUNTIME)
+#if defined(DART_USE_INTERPRETER)
+RawCode* Code::FinalizeBytecode(void* bytecode_data,
+ intptr_t bytecode_size,
+ const ObjectPool& object_pool,
+ CodeStatistics* stats /* = nullptr */) {
+ // Allocate the Code and Instructions objects. Code is allocated first
+ // because a GC during allocation of the code will leave the instruction
+ // pages read-only.
+ const intptr_t pointer_offset_count = 0; // No fixups in bytecode.
+ Code& code = Code::ZoneHandle(Code::New(pointer_offset_count));
+ Instructions& instrs = Instructions::ZoneHandle(
+ Instructions::New(bytecode_size, true /* has_single_entry_point */));
+ INC_STAT(Thread::Current(), total_instr_size, bytecode_size);
+ INC_STAT(Thread::Current(), total_code_size, bytecode_size);
+
+ // Copy the bytecode data into the instruction area. No fixups to apply.
+ MemoryRegion instrs_region(reinterpret_cast<void*>(instrs.PayloadStart()),
+ instrs.Size());
+ MemoryRegion bytecode_region(bytecode_data, bytecode_size);
+ // TODO(regis): Avoid copying bytecode.
+ instrs_region.CopyFrom(0, bytecode_region);
+
+ // TODO(regis): Keep following lines or not?
+ code.set_compile_timestamp(OS::GetCurrentMonotonicMicros());
+ // TODO(regis): Do we need to notify CodeObservers for bytecode too?
+ // If so, provide a better name using ToLibNamePrefixedQualifiedCString().
+ CodeObservers::NotifyAll("bytecode", instrs.PayloadStart(),
+ 0 /* prologue_offset */, instrs.Size(),
+ false /* optimized */);
+ {
+ NoSafepointScope no_safepoint;
+
+ // Hook up Code and Instructions objects.
+ code.SetActiveInstructions(instrs);
+ code.set_instructions(instrs);
+ code.set_is_alive(true);
+
+ // Set object pool in Instructions object.
+ INC_STAT(Thread::Current(), total_code_size,
+ object_pool.Length() * sizeof(uintptr_t));
+ code.set_object_pool(object_pool.raw());
+
+ if (FLAG_write_protect_code) {
+ uword address = RawObject::ToAddr(instrs.raw());
+ VirtualMemory::Protect(reinterpret_cast<void*>(address),
+ instrs.raw()->Size(), VirtualMemory::kReadExecute);
+ }
+ }
+ // No Code::Comments to set. Default is 0 length Comments.
+ // No prologue was ever entered, optimistically assume nothing was ever
+ // pushed onto the stack.
+ code.SetPrologueOffset(bytecode_size); // TODO(regis): Correct?
+ INC_STAT(Thread::Current(), total_code_size,
+ code.comments().comments_.Length());
+ return code.raw();
+}
+#endif // defined(DART_USE_INTERPRETER)
+
bool Code::SlowFindRawCodeVisitor::FindObject(RawObject* raw_obj) const {
return RawCode::ContainsPC(raw_obj, pc_);
}
@@ -16252,10 +16344,9 @@
return NULL;
}
-RawString* AbstractType::EnumerateURIs() const {
+void AbstractType::EnumerateURIs(URIs* uris) const {
// AbstractType is an abstract class.
UNREACHABLE();
- return NULL;
}
RawAbstractType* AbstractType::OnlyBuddyInTrail(TrailPtr trail) const {
@@ -16327,6 +16418,52 @@
return false;
}
+void AbstractType::AddURI(URIs* uris, const String& name, const String& uri) {
+ ASSERT(uris != NULL);
+ const intptr_t len = uris->length();
+ ASSERT((len % 3) == 0);
+ bool print_uri = false;
+ for (intptr_t i = 0; i < len; i += 3) {
+ if (uris->At(i).Equals(name)) {
+ if (uris->At(i + 1).Equals(uri)) {
+ // Same name and same URI: no need to add this already listed URI.
+ return; // No state change is possible.
+ } else {
+ // Same name and different URI: the name is ambiguous, print both URIs.
+ print_uri = true;
+ uris->SetAt(i + 2, Symbols::print());
+ }
+ }
+ }
+ uris->Add(name);
+ uris->Add(uri);
+ if (print_uri) {
+ uris->Add(Symbols::print());
+ } else {
+ uris->Add(Symbols::Empty());
+ }
+}
+
+RawString* AbstractType::PrintURIs(URIs* uris) {
+ ASSERT(uris != NULL);
+ Thread* thread = Thread::Current();
+ Zone* zone = thread->zone();
+ const intptr_t len = uris->length();
+ ASSERT((len % 3) == 0);
+ GrowableHandlePtrArray<const String> pieces(zone, 5 * (len / 3));
+ for (intptr_t i = 0; i < len; i += 3) {
+ // Only print URIs that have been marked.
+ if (uris->At(i + 2).raw() == Symbols::print().raw()) {
+ pieces.Add(Symbols::TwoSpaces());
+ pieces.Add(uris->At(i));
+ pieces.Add(Symbols::SpaceIsFromSpace());
+ pieces.Add(uris->At(i + 1));
+ pieces.Add(Symbols::NewLine());
+ }
+ }
+ return Symbols::FromConcatAll(thread, pieces);
+}
+
RawString* AbstractType::BuildName(NameVisibility name_visibility) const {
ASSERT(name_visibility != kScrubbedName);
Thread* thread = Thread::Current();
@@ -17629,13 +17766,12 @@
}
#endif // DEBUG
-RawString* Type::EnumerateURIs() const {
+void Type::EnumerateURIs(URIs* uris) const {
if (IsDynamicType() || IsVoidType()) {
- return Symbols::Empty().raw();
+ return;
}
Thread* thread = Thread::Current();
Zone* zone = thread->zone();
- GrowableHandlePtrArray<const String> pieces(zone, 6);
if (IsFunctionType()) {
// The scope class and type arguments do not appear explicitly in the user
// visible name. The type arguments were used to instantiate the function
@@ -17643,26 +17779,22 @@
const Function& sig_fun = Function::Handle(zone, signature());
AbstractType& type = AbstractType::Handle(zone);
const intptr_t num_params = sig_fun.NumParameters();
- GrowableHandlePtrArray<const String> pieces(zone, num_params + 1);
for (intptr_t i = 0; i < num_params; i++) {
type = sig_fun.ParameterTypeAt(i);
- pieces.Add(String::Handle(zone, type.EnumerateURIs()));
+ type.EnumerateURIs(uris);
}
// Handle result type last, since it appears last in the user visible name.
type = sig_fun.result_type();
- pieces.Add(String::Handle(zone, type.EnumerateURIs()));
+ type.EnumerateURIs(uris);
} else {
const Class& cls = Class::Handle(zone, type_class());
- pieces.Add(Symbols::TwoSpaces());
- pieces.Add(String::Handle(zone, cls.UserVisibleName()));
- pieces.Add(Symbols::SpaceIsFromSpace());
+ const String& name = String::Handle(zone, cls.UserVisibleName());
const Library& library = Library::Handle(zone, cls.library());
- pieces.Add(String::Handle(zone, library.url()));
- pieces.Add(Symbols::NewLine());
+ const String& uri = String::Handle(zone, library.url());
+ AddURI(uris, name, uri);
const TypeArguments& type_args = TypeArguments::Handle(zone, arguments());
- pieces.Add(String::Handle(zone, type_args.EnumerateURIs()));
+ type_args.EnumerateURIs(uris);
}
- return Symbols::FromConcatAll(thread, pieces);
}
intptr_t Type::ComputeHash() const {
@@ -17899,22 +18031,17 @@
}
#endif // DEBUG
-RawString* TypeRef::EnumerateURIs() const {
+void TypeRef::EnumerateURIs(URIs* uris) const {
Thread* thread = Thread::Current();
Zone* zone = thread->zone();
const AbstractType& ref_type = AbstractType::Handle(zone, type());
ASSERT(!ref_type.IsDynamicType() && !ref_type.IsVoidType());
- GrowableHandlePtrArray<const String> pieces(zone, 6);
const Class& cls = Class::Handle(zone, ref_type.type_class());
- pieces.Add(Symbols::TwoSpaces());
- pieces.Add(String::Handle(zone, cls.UserVisibleName()));
- // Break cycle by not printing type arguments, but '<optimized out>' instead.
- pieces.Add(Symbols::OptimizedOut());
- pieces.Add(Symbols::SpaceIsFromSpace());
+ const String& name = String::Handle(zone, cls.UserVisibleName());
const Library& library = Library::Handle(zone, cls.library());
- pieces.Add(String::Handle(zone, library.url()));
- pieces.Add(Symbols::NewLine());
- return Symbols::FromConcatAll(thread, pieces);
+ const String& uri = String::Handle(zone, library.url());
+ AddURI(uris, name, uri);
+ // Break cycle by not printing type arguments.
}
intptr_t TypeRef::Hash() const {
@@ -18131,12 +18258,10 @@
*bound_error, script, token_pos(), Report::AtLocation,
Report::kMalboundedType, Heap::kNew,
"type parameter '%s' of class '%s' must extend bound '%s', "
- "but type argument '%s' is not a subtype of '%s' where\n%s%s",
+ "but type argument '%s' is not a subtype of '%s'",
type_param_name.ToCString(), class_name.ToCString(),
declared_bound_name.ToCString(), bounded_type_name.ToCString(),
- upper_bound_name.ToCString(),
- String::Handle(bounded_type.EnumerateURIs()).ToCString(),
- String::Handle(upper_bound.EnumerateURIs()).ToCString());
+ upper_bound_name.ToCString());
}
}
return false;
@@ -18185,11 +18310,10 @@
return clone.raw();
}
-RawString* TypeParameter::EnumerateURIs() const {
+void TypeParameter::EnumerateURIs(URIs* uris) const {
Thread* thread = Thread::Current();
Zone* zone = thread->zone();
GrowableHandlePtrArray<const String> pieces(zone, 4);
- pieces.Add(Symbols::TwoSpaces());
pieces.Add(String::Handle(zone, name()));
Class& cls = Class::Handle(zone, parameterized_class());
if (cls.IsNull()) {
@@ -18202,12 +18326,12 @@
if (!cls.IsNull()) {
pieces.Add(Symbols::SpaceOfSpace());
pieces.Add(String::Handle(zone, cls.UserVisibleName()));
- pieces.Add(Symbols::SpaceIsFromSpace());
+ const String& name =
+ String::Handle(zone, Symbols::FromConcatAll(thread, pieces));
const Library& library = Library::Handle(zone, cls.library());
- pieces.Add(String::Handle(zone, library.url()));
+ const String& uri = String::Handle(zone, library.url());
+ AddURI(uris, name, uri);
}
- pieces.Add(Symbols::NewLine());
- return Symbols::FromConcatAll(thread, pieces);
}
intptr_t TypeParameter::ComputeHash() const {
@@ -18485,9 +18609,9 @@
return BoundedType::New(bounded_type, upper_bound, type_param);
}
-RawString* BoundedType::EnumerateURIs() const {
+void BoundedType::EnumerateURIs(URIs* uris) const {
// The bound does not appear in the user visible name.
- return AbstractType::Handle(type()).EnumerateURIs();
+ AbstractType::Handle(type()).EnumerateURIs(uris);
}
intptr_t BoundedType::ComputeHash() const {
diff --git a/runtime/vm/object.h b/runtime/vm/object.h
index 6a99622..a422fe0 100644
--- a/runtime/vm/object.h
+++ b/runtime/vm/object.h
@@ -903,6 +903,12 @@
typedef ZoneGrowableHandlePtrArray<const AbstractType> Trail;
typedef ZoneGrowableHandlePtrArray<const AbstractType>* TrailPtr;
+// A URIs array contains triplets of strings.
+// The first string in the triplet is a type name (usually a class).
+// The second string in the triplet is the URI of the type.
+// The third string in the triplet is "print" if the triplet should be printed.
+typedef ZoneGrowableHandlePtrArray<const String> URIs;
+
class Class : public Object {
public:
intptr_t instance_size() const {
@@ -2229,6 +2235,10 @@
}
void set_unoptimized_code(const Code& value) const;
bool HasCode() const;
+#if defined(DART_USE_INTERPRETER)
+ static bool HasCode(RawFunction* function);
+ static bool HasBytecode(RawFunction* function);
+#endif
static intptr_t code_offset() { return OFFSET_OF(RawFunction, code_); }
@@ -2236,6 +2246,12 @@
return OFFSET_OF(RawFunction, entry_point_);
}
+#if defined(DART_USE_INTERPRETER)
+ void AttachBytecode(const Code& bytecode) const;
+ RawCode* Bytecode() const { return raw_ptr()->bytecode_; }
+ bool HasBytecode() const;
+#endif
+
virtual intptr_t Hash() const;
// Returns true if there is at least one debugger breakpoint
@@ -4915,6 +4931,12 @@
Assembler* assembler,
bool optimized,
CodeStatistics* stats = nullptr);
+#if defined(DART_USE_INTERPRETER)
+ static RawCode* FinalizeBytecode(void* bytecode_data,
+ intptr_t bytecode_size,
+ const ObjectPool& object_pool,
+ CodeStatistics* stats = nullptr);
+#endif
#endif
static RawCode* LookupCode(uword pc);
static RawCode* LookupCodeInVmIsolate(uword pc);
@@ -5801,8 +5823,9 @@
// Canonicalize only if instantiated, otherwise returns 'this'.
RawTypeArguments* Canonicalize(TrailPtr trail = NULL) const;
- // Returns a formatted list of occurring type arguments with their URI.
- RawString* EnumerateURIs() const;
+ // Add the class name and URI of each type argument of this vector to the uris
+ // list and mark ambiguous triplets to be printed.
+ void EnumerateURIs(URIs* uris) const;
// Return 'this' if this type argument vector is instantiated, i.e. if it does
// not refer to type parameters. Otherwise, return a new type argument vector
@@ -6015,6 +6038,12 @@
// The receiver may be added several times, each time with a different buddy.
bool TestAndAddBuddyToTrail(TrailPtr* trail, const AbstractType& buddy) const;
+ // Add the pair <name, uri> to the list, if not already present.
+ static void AddURI(URIs* uris, const String& name, const String& uri);
+
+ // Return a formatted string of the uris.
+ static RawString* PrintURIs(URIs* uris);
+
// The name of this type, including the names of its type arguments, if any.
virtual RawString* Name() const { return BuildName(kInternalName); }
@@ -6024,8 +6053,9 @@
return BuildName(kUserVisibleName);
}
- // Returns a formatted list of occurring types with their URI.
- virtual RawString* EnumerateURIs() const;
+ // Add the class name and URI of each occuring type to the uris
+ // list and mark ambiguous triplets to be printed.
+ virtual void EnumerateURIs(URIs* uris) const;
virtual intptr_t Hash() const;
@@ -6231,7 +6261,7 @@
// Check if type is canonical.
virtual bool CheckIsCanonical(Thread* thread) const;
#endif // DEBUG
- virtual RawString* EnumerateURIs() const;
+ virtual void EnumerateURIs(URIs* uris) const;
virtual intptr_t Hash() const;
@@ -6384,7 +6414,7 @@
// Check if typeref is canonical.
virtual bool CheckIsCanonical(Thread* thread) const;
#endif // DEBUG
- virtual RawString* EnumerateURIs() const;
+ virtual void EnumerateURIs(URIs* uris) const;
virtual intptr_t Hash() const;
@@ -6474,7 +6504,7 @@
// Check if type parameter is canonical.
virtual bool CheckIsCanonical(Thread* thread) const { return true; }
#endif // DEBUG
- virtual RawString* EnumerateURIs() const;
+ virtual void EnumerateURIs(URIs* uris) const;
virtual intptr_t Hash() const;
@@ -6580,7 +6610,7 @@
// Check if bounded type is canonical.
virtual bool CheckIsCanonical(Thread* thread) const { return true; }
#endif // DEBUG
- virtual RawString* EnumerateURIs() const;
+ virtual void EnumerateURIs(URIs* uris) const;
virtual intptr_t Hash() const;
@@ -8414,10 +8444,10 @@
#define TYPED_GETTER_SETTER(name, type) \
type Get##name(intptr_t byte_offset) const { \
- return *reinterpret_cast<type*>(DataAddr(byte_offset)); \
+ return ReadUnaligned(reinterpret_cast<type*>(DataAddr(byte_offset))); \
} \
void Set##name(intptr_t byte_offset, type value) const { \
- *reinterpret_cast<type*>(DataAddr(byte_offset)) = value; \
+ StoreUnaligned(reinterpret_cast<type*>(DataAddr(byte_offset)), value); \
}
TYPED_GETTER_SETTER(Int8, int8_t)
TYPED_GETTER_SETTER(Uint8, uint8_t)
diff --git a/runtime/vm/object_reload.cc b/runtime/vm/object_reload.cc
index 8ce4190..aecf5ef 100644
--- a/runtime/vm/object_reload.cc
+++ b/runtime/vm/object_reload.cc
@@ -634,13 +634,9 @@
bool Class::CanReloadFinalized(const Class& replacement,
IsolateReloadContext* context) const {
- // Make sure the declaration types matches for the two classes.
+ // Make sure the declaration types argument count matches for the two classes.
// ex. class A<int,B> {} cannot be replace with class A<B> {}.
-
- const AbstractType& dt = AbstractType::Handle(DeclarationType());
- const AbstractType& replacement_dt =
- AbstractType::Handle(replacement.DeclarationType());
- if (!dt.Equals(replacement_dt)) {
+ if (NumTypeArguments() != replacement.NumTypeArguments()) {
context->AddReasonForCancelling(new (context->zone()) TypeParametersChanged(
context->zone(), *this, replacement));
return false;
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index e0128b1..2e3e2f1 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -260,6 +260,8 @@
friend class object; \
friend class RawObject; \
friend class Heap; \
+ friend class Interpreter; \
+ friend class InterpreterHelpers; \
friend class Simulator; \
friend class SimulatorHelpers; \
DISALLOW_ALLOCATION(); \
@@ -725,6 +727,8 @@
friend class CodeLookupTableBuilder; // profiler
friend class NativeEntry; // GetClassId
friend class WritePointerVisitor; // GetClassId
+ friend class Interpreter;
+ friend class InterpreterHelpers;
friend class Simulator;
friend class SimulatorHelpers;
friend class ObjectLocator;
@@ -926,6 +930,9 @@
RawObject** to_no_code() {
return reinterpret_cast<RawObject**>(&ptr()->ic_data_array_);
}
+#if defined(DART_USE_INTERPRETER)
+ RawCode* bytecode_;
+#endif
RawCode* code_; // Currently active code. Accessed from generated code.
NOT_IN_PRECOMPILED(RawCode* unoptimized_code_); // Unoptimized code, keep it
// after optimization.
diff --git a/runtime/vm/runtime_entry.cc b/runtime/vm/runtime_entry.cc
index fca1d73..aadb840 100644
--- a/runtime/vm/runtime_entry.cc
+++ b/runtime/vm/runtime_entry.cc
@@ -15,6 +15,7 @@
#include "vm/exceptions.h"
#include "vm/flags.h"
#include "vm/instructions.h"
+#include "vm/interpreter.h"
#include "vm/kernel_isolate.h"
#include "vm/message.h"
#include "vm/message_handler.h"
@@ -1716,6 +1717,42 @@
arguments.SetReturn(result);
}
+// Interpret a function call. Should be called only for uncompiled functions.
+// Arg0: function object
+// Arg1: ICData or MegamorphicCache
+// Arg2: arguments descriptor array
+// Arg3: arguments array
+DEFINE_RUNTIME_ENTRY(InterpretCall, 4) {
+#if defined(DART_USE_INTERPRETER)
+ const Function& function = Function::CheckedHandle(zone, arguments.ArgAt(0));
+ // TODO(regis): Use icdata.
+ // const Object& ic_data_or_cache = Object::Handle(zone, arguments.ArgAt(1));
+ const Array& orig_arguments_desc =
+ Array::CheckedHandle(zone, arguments.ArgAt(2));
+ const Array& orig_arguments = Array::CheckedHandle(zone, arguments.ArgAt(3));
+ ASSERT(!function.HasCode());
+ ASSERT(function.HasBytecode());
+ const Code& bytecode = Code::Handle(zone, function.Bytecode());
+ Object& result = Object::Handle(zone);
+ Interpreter* interpreter = Interpreter::Current();
+ ASSERT(interpreter != NULL);
+ {
+ TransitionToGenerated transition(thread);
+ result = interpreter->Call(bytecode, orig_arguments_desc, orig_arguments,
+ thread);
+ }
+ if (result.IsError()) {
+ if (result.IsLanguageError()) {
+ Exceptions::ThrowCompileTimeError(LanguageError::Cast(result));
+ UNREACHABLE();
+ }
+ Exceptions::PropagateError(Error::Cast(result));
+ }
+#else
+ UNREACHABLE();
+#endif
+}
+
#if !defined(PRODUCT) && !defined(DART_PRECOMPILED_RUNTIME)
// The following code is used to stress test
// - deoptimization
diff --git a/runtime/vm/runtime_entry_list.h b/runtime/vm/runtime_entry_list.h
index b8ed437..d9c7367 100644
--- a/runtime/vm/runtime_entry_list.h
+++ b/runtime/vm/runtime_entry_list.h
@@ -45,6 +45,7 @@
V(UpdateFieldCid) \
V(InitStaticField) \
V(CompileFunction) \
+ V(InterpretCall) \
V(MonomorphicMiss) \
V(SingleTargetMiss) \
V(UnlinkedCall)
diff --git a/runtime/vm/stack_frame_kbc.h b/runtime/vm/stack_frame_kbc.h
new file mode 100644
index 0000000..c4e81b5
--- /dev/null
+++ b/runtime/vm/stack_frame_kbc.h
@@ -0,0 +1,68 @@
+// Copyright (c) 2018, 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.
+
+#ifndef RUNTIME_VM_STACK_FRAME_KBC_H_
+#define RUNTIME_VM_STACK_FRAME_KBC_H_
+
+namespace dart {
+
+/* Kernel Bytecode Frame Layout
+
+IMPORTANT: KBC stack is growing upwards which is different from all other
+architectures. This enables efficient addressing for locals via unsigned index.
+
+ | | <- TOS
+Callee frame | ... |
+ | saved FP | (FP of current frame)
+ | saved PC | (PC of current frame)
+ | code object |
+ | function object |
+ +--------------------+
+Current frame | ... T| <- SP of current frame
+ | ... T|
+ | first local T| <- FP of current frame
+ | caller's FP *|
+ | caller's PC *|
+ | code object T| (current frame's code object)
+ | function object T| (current frame's function object)
+ +--------------------+
+Caller frame | last parameter | <- SP of caller frame
+ | ... |
+
+ T against a slot indicates it needs to be traversed during GC.
+ * against a slot indicates that it can be traversed during GC
+ because it will look like a smi to the visitor.
+*/
+
+static const int kKBCDartFrameFixedSize = 4; // Function, Code, PC, FP
+static const int kKBCSavedPcSlotFromSp = 3;
+
+static const int kKBCFirstObjectSlotFromFp = -4; // Used by GC.
+static const int kKBCLastFixedObjectSlotFromFp = -3;
+
+static const int kKBCSavedCallerFpSlotFromFp = -1;
+static const int kKBCSavedCallerPpSlotFromFp = kKBCSavedCallerFpSlotFromFp;
+static const int kKBCSavedCallerPcSlotFromFp = -2;
+static const int kKBCCallerSpSlotFromFp = -kKBCDartFrameFixedSize - 1;
+static const int kKBCPcMarkerSlotFromFp = -3;
+static const int kKBCFunctionSlotFromFp = -4;
+
+// Note: These constants don't match actual KBC behavior. This is done because
+// setting kKBCFirstLocalSlotFromFp to 0 breaks assumptions spread across the
+// code.
+// Instead for the purposes of local variable allocation we pretend that KBC
+// behaves as other architectures (stack growing downwards) and later fix
+// these indices during code generation in the backend.
+static const int kKBCParamEndSlotFromFp = 4; // One slot past last parameter.
+static const int kKBCFirstLocalSlotFromFp = -1;
+static const int kKBCExitLinkSlotFromEntryFp = 0;
+
+// Value for stack limit that is used to cause an interrupt.
+// Note that on KBC stack is growing upwards so interrupt limit is 0 unlike
+// on all other architectures.
+static const uword kKBCInterruptStackLimit = 0;
+
+} // namespace dart
+
+#endif // RUNTIME_VM_STACK_FRAME_KBC_H_
diff --git a/runtime/vm/stub_code.h b/runtime/vm/stub_code.h
index 4fd3d6a..01ffc6f 100644
--- a/runtime/vm/stub_code.h
+++ b/runtime/vm/stub_code.h
@@ -28,8 +28,11 @@
V(DeoptForRewind) \
V(UpdateStoreBuffer) \
V(PrintStopMessage) \
+ V(AllocateArray) \
+ V(AllocateContext) \
V(CallToRuntime) \
V(LazyCompile) \
+ V(InterpretCall) \
V(CallBootstrapNative) \
V(CallNoScopeNative) \
V(CallAutoScopeNative) \
@@ -37,6 +40,7 @@
V(CallStaticFunction) \
V(OptimizeFunction) \
V(InvokeDartCode) \
+ V(InvokeDartCodeFromBytecode) \
V(DebugStepCheck) \
V(UnlinkedCall) \
V(MonomorphicMiss) \
@@ -52,8 +56,6 @@
V(OptimizedIdenticalWithNumberCheck) \
V(ICCallBreakpoint) \
V(RuntimeCallBreakpoint) \
- V(AllocateArray) \
- V(AllocateContext) \
V(OneArgCheckInlineCache) \
V(TwoArgsCheckInlineCache) \
V(SmiAddInlineCache) \
diff --git a/runtime/vm/stub_code_arm.cc b/runtime/vm/stub_code_arm.cc
index 8f51b9f..a97ccc5 100644
--- a/runtime/vm/stub_code_arm.cc
+++ b/runtime/vm/stub_code_arm.cc
@@ -886,6 +886,10 @@
__ Ret();
}
+void StubCode::GenerateInvokeDartCodeFromBytecodeStub(Assembler* assembler) {
+ __ Unimplemented("Interpreter not yet supported");
+}
+
// Called for inline allocation of contexts.
// Input:
// R1: number of context variables.
@@ -1678,6 +1682,10 @@
__ bx(R2);
}
+void StubCode::GenerateInterpretCallStub(Assembler* assembler) {
+ __ Unimplemented("Interpreter not yet supported");
+}
+
// R9: Contains an ICData.
void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) {
__ EnterStubFrame();
diff --git a/runtime/vm/stub_code_arm64.cc b/runtime/vm/stub_code_arm64.cc
index f0354a8..df85dd5 100644
--- a/runtime/vm/stub_code_arm64.cc
+++ b/runtime/vm/stub_code_arm64.cc
@@ -943,6 +943,10 @@
__ ret();
}
+void StubCode::GenerateInvokeDartCodeFromBytecodeStub(Assembler* assembler) {
+ __ Unimplemented("Interpreter not yet supported");
+}
+
// Called for inline allocation of contexts.
// Input:
// R1: number of context variables.
@@ -1725,6 +1729,10 @@
__ br(R2);
}
+void StubCode::GenerateInterpretCallStub(Assembler* assembler) {
+ __ Unimplemented("Interpreter not yet supported");
+}
+
// R5: Contains an ICData.
void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) {
__ EnterStubFrame();
diff --git a/runtime/vm/stub_code_ia32.cc b/runtime/vm/stub_code_ia32.cc
index a632adf..feb5068 100644
--- a/runtime/vm/stub_code_ia32.cc
+++ b/runtime/vm/stub_code_ia32.cc
@@ -800,6 +800,10 @@
__ ret();
}
+void StubCode::GenerateInvokeDartCodeFromBytecodeStub(Assembler* assembler) {
+ __ Unimplemented("Interpreter not yet supported");
+}
+
// Called for inline allocation of contexts.
// Input:
// EDX: number of context variables.
@@ -1606,6 +1610,10 @@
__ jmp(EAX);
}
+void StubCode::GenerateInterpretCallStub(Assembler* assembler) {
+ __ Unimplemented("Interpreter not yet supported");
+}
+
// ECX: Contains an ICData.
void StubCode::GenerateICCallBreakpointStub(Assembler* assembler) {
__ EnterStubFrame();
diff --git a/runtime/vm/stub_code_x64.cc b/runtime/vm/stub_code_x64.cc
index fc8e781..d87f045 100644
--- a/runtime/vm/stub_code_x64.cc
+++ b/runtime/vm/stub_code_x64.cc
@@ -789,9 +789,10 @@
__ pushq(RAX);
__ movq(Address(THR, Thread::top_resource_offset()), Immediate(0));
__ movq(RAX, Address(THR, Thread::top_exit_frame_info_offset()));
+ __ pushq(RAX);
+
// The constant kExitLinkSlotFromEntryFp must be kept in sync with the
// code below.
- __ pushq(RAX);
#if defined(DEBUG)
{
Label ok;
@@ -871,6 +872,146 @@
__ ret();
}
+// Called when invoking compiled Dart code from interpreted Dart code.
+// Input parameters:
+// RSP : points to return address.
+// RDI : target raw code
+// RSI : arguments raw descriptor array.
+// RDX : address of first argument.
+// RCX : current thread.
+void StubCode::GenerateInvokeDartCodeFromBytecodeStub(Assembler* assembler) {
+#if defined(DART_USE_INTERPRETER)
+ // Save frame pointer coming in.
+ __ EnterFrame(0);
+
+ const Register kTargetCodeReg = CallingConventions::kArg1Reg;
+ const Register kArgDescReg = CallingConventions::kArg2Reg;
+ const Register kArg0Reg = CallingConventions::kArg3Reg;
+ const Register kThreadReg = CallingConventions::kArg4Reg;
+
+ // Push code object to PC marker slot.
+ __ pushq(Address(kThreadReg,
+ Thread::invoke_dart_code_from_bytecode_stub_offset()));
+
+ // At this point, the stack looks like:
+ // | stub code object
+ // | saved RBP | <-- RBP
+ // | saved PC (return to interpreter's InvokeCompiled) |
+
+ const intptr_t kInitialOffset = 2;
+ // Save arguments descriptor array, later replaced by Smi argument count.
+ const intptr_t kArgumentsDescOffset = -(kInitialOffset)*kWordSize;
+ __ pushq(kArgDescReg);
+
+ // Save C++ ABI callee-saved registers.
+ __ PushRegisters(CallingConventions::kCalleeSaveCpuRegisters,
+ CallingConventions::kCalleeSaveXmmRegisters);
+
+ // If any additional (or fewer) values are pushed, the offsets in
+ // kExitLinkSlotFromEntryFp will need to be changed.
+
+ // Set up THR, which caches the current thread in Dart code.
+ if (THR != kThreadReg) {
+ __ movq(THR, kThreadReg);
+ }
+
+ // Save the current VMTag on the stack.
+ __ movq(RAX, Assembler::VMTagAddress());
+ __ pushq(RAX);
+
+ // Mark that the thread is executing Dart code.
+ __ movq(Assembler::VMTagAddress(), Immediate(VMTag::kDartTagId));
+
+ // Save top resource and top exit frame info. Use RAX as a temporary register.
+ // StackFrameIterator reads the top exit frame info saved in this frame.
+ __ movq(RAX, Address(THR, Thread::top_resource_offset()));
+ __ pushq(RAX);
+ __ movq(Address(THR, Thread::top_resource_offset()), Immediate(0));
+ __ movq(RAX, Address(THR, Thread::top_exit_frame_info_offset()));
+ __ pushq(RAX);
+
+ // The constant kExitLinkSlotFromEntryFp must be kept in sync with the
+ // code below.
+#if defined(DEBUG)
+ {
+ Label ok;
+ __ leaq(RAX, Address(RBP, kExitLinkSlotFromEntryFp * kWordSize));
+ __ cmpq(RAX, RSP);
+ __ j(EQUAL, &ok);
+ __ Stop("kExitLinkSlotFromEntryFp mismatch");
+ __ Bind(&ok);
+ }
+#endif
+
+ __ movq(Address(THR, Thread::top_exit_frame_info_offset()), Immediate(0));
+
+ // Load arguments descriptor array into R10, which is passed to Dart code.
+ __ movq(R10, kArgDescReg);
+
+ // Push arguments. At this point we only need to preserve kTargetCodeReg.
+ ASSERT(kTargetCodeReg != RDX);
+
+ // Load number of arguments into RBX and adjust count for type arguments.
+ __ movq(RBX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
+ __ cmpq(FieldAddress(R10, ArgumentsDescriptor::type_args_len_offset()),
+ Immediate(0));
+ Label args_count_ok;
+ __ j(EQUAL, &args_count_ok, Assembler::kNearJump);
+ __ addq(RBX, Immediate(Smi::RawValue(1))); // Include the type arguments.
+ __ Bind(&args_count_ok);
+ // Save number of arguments as Smi on stack, replacing saved ArgumentsDesc.
+ __ movq(Address(RBP, kArgumentsDescOffset), RBX);
+ __ SmiUntag(RBX);
+
+ // Compute address of first argument into RDX.
+ ASSERT(kArg0Reg == RDX);
+
+ // Set up arguments for the Dart call.
+ Label push_arguments;
+ Label done_push_arguments;
+ __ j(ZERO, &done_push_arguments, Assembler::kNearJump);
+ __ LoadImmediate(RAX, Immediate(0));
+ __ Bind(&push_arguments);
+ __ pushq(Address(RDX, RAX, TIMES_8, 0));
+ __ incq(RAX);
+ __ cmpq(RAX, RBX);
+ __ j(LESS, &push_arguments, Assembler::kNearJump);
+ __ Bind(&done_push_arguments);
+
+ // Call the Dart code entrypoint.
+ __ xorq(PP, PP); // GC-safe value into PP.
+ __ movq(CODE_REG, kTargetCodeReg);
+ __ movq(kTargetCodeReg, FieldAddress(CODE_REG, Code::entry_point_offset()));
+ __ call(kTargetCodeReg); // R10 is the arguments descriptor array.
+
+ // Read the saved number of passed arguments as Smi.
+ __ movq(RDX, Address(RBP, kArgumentsDescOffset));
+
+ // Get rid of arguments pushed on the stack.
+ __ leaq(RSP, Address(RSP, RDX, TIMES_4, 0)); // RDX is a Smi.
+
+ // Restore the saved top exit frame info and top resource back into the
+ // Isolate structure.
+ __ popq(Address(THR, Thread::top_exit_frame_info_offset()));
+ __ popq(Address(THR, Thread::top_resource_offset()));
+
+ // Restore the current VMTag from the stack.
+ __ popq(Assembler::VMTagAddress());
+
+ // Restore C++ ABI callee-saved registers.
+ __ PopRegisters(CallingConventions::kCalleeSaveCpuRegisters,
+ CallingConventions::kCalleeSaveXmmRegisters);
+ __ set_constant_pool_allowed(false);
+
+ // Restore the frame pointer.
+ __ LeaveFrame();
+
+ __ ret();
+#else
+ __ Stop("Not using interpreter");
+#endif
+}
+
// Called for inline allocation of contexts.
// Input:
// R10: number of context variables.
@@ -1647,7 +1788,7 @@
}
// Stub for compiling a function and jumping to the compiled code.
-// RCX: IC-Data (for methods).
+// RBX: IC-Data (for methods).
// R10: Arguments descriptor.
// RAX: Function.
void StubCode::GenerateLazyCompileStub(Assembler* assembler) {
@@ -1661,9 +1802,46 @@
__ popq(R10); // Restore arguments descriptor array.
__ LeaveStubFrame();
+ // When using the interpreter, the function's code may now point to the
+ // InterpretCall stub. Make sure RAX, R10, and RBX are preserved.
__ movq(CODE_REG, FieldAddress(RAX, Function::code_offset()));
- __ movq(RAX, FieldAddress(RAX, Function::entry_point_offset()));
- __ jmp(RAX);
+ __ movq(RCX, FieldAddress(RAX, Function::entry_point_offset()));
+ __ jmp(RCX);
+}
+
+// Stub for interpreting a function call.
+// RBX: IC-Data (for methods).
+// R10: Arguments descriptor.
+// RAX: Function.
+void StubCode::GenerateInterpretCallStub(Assembler* assembler) {
+#if defined(DART_USE_INTERPRETER)
+ __ EnterStubFrame();
+ __ movq(RDI, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
+ __ pushq(Immediate(0)); // Setup space on stack for result.
+ __ pushq(RAX); // Function.
+ __ pushq(RBX); // ICData/MegamorphicCache.
+ __ pushq(R10); // Arguments descriptor array.
+
+ // Adjust arguments count.
+ __ cmpq(FieldAddress(R10, ArgumentsDescriptor::type_args_len_offset()),
+ Immediate(0));
+ __ movq(R10, RDI);
+ Label args_count_ok;
+ __ j(EQUAL, &args_count_ok, Assembler::kNearJump);
+ __ addq(R10, Immediate(Smi::RawValue(1))); // Include the type arguments.
+ __ Bind(&args_count_ok);
+
+ // R10: Smi-tagged arguments array length.
+ PushArrayOfArguments(assembler);
+ const intptr_t kNumArgs = 4;
+ __ CallRuntime(kInterpretCallRuntimeEntry, kNumArgs);
+ __ Drop(kNumArgs);
+ __ popq(RAX); // Return value.
+ __ LeaveStubFrame();
+ __ ret();
+#else
+ __ Stop("Not using interpreter");
+#endif
}
// RBX: Contains an ICData.
diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h
index 06655b0..802233a 100644
--- a/runtime/vm/thread.h
+++ b/runtime/vm/thread.h
@@ -89,6 +89,8 @@
StubCode::FixAllocationStubTarget_entry()->code(), NULL) \
V(RawCode*, invoke_dart_code_stub_, \
StubCode::InvokeDartCode_entry()->code(), NULL) \
+ V(RawCode*, invoke_dart_code_from_bytecode_stub_, \
+ StubCode::InvokeDartCodeFromBytecode_entry()->code(), NULL) \
V(RawCode*, call_to_runtime_stub_, StubCode::CallToRuntime_entry()->code(), \
NULL) \
V(RawCode*, monomorphic_miss_stub_, \
@@ -871,6 +873,7 @@
#undef REUSABLE_FRIEND_DECLARATION
friend class ApiZone;
+ friend class Interpreter;
friend class InterruptChecker;
friend class Isolate;
friend class IsolateTestHelper;
diff --git a/runtime/vm/vm_sources.gni b/runtime/vm/vm_sources.gni
index 65be0c4..f15b129 100644
--- a/runtime/vm/vm_sources.gni
+++ b/runtime/vm/vm_sources.gni
@@ -48,7 +48,9 @@
"compiler_stats.h",
"constants_arm.h",
"constants_arm64.h",
+ "constants_dbc.h",
"constants_ia32.h",
+ "constants_kbc.h",
"constants_x64.h",
"cpu.h",
"cpu_arm.cc",
@@ -129,6 +131,8 @@
"instructions_ia32.h",
"instructions_x64.cc",
"instructions_x64.h",
+ "interpreter.cc",
+ "interpreter.h",
"isolate.cc",
"isolate.h",
"isolate_reload.cc",
@@ -296,7 +300,9 @@
"stack_frame.h",
"stack_frame_arm.h",
"stack_frame_arm64.h",
+ "stack_frame_dbc",
"stack_frame_ia32.h",
+ "stack_frame_kbc",
"stack_frame_x64.h",
"stack_trace.cc",
"stack_trace.h",
diff --git a/samples-dev/swarm/swarm_ui_lib/observable/observable.dart b/samples-dev/swarm/swarm_ui_lib/observable/observable.dart
index e9d32f8..4ae4097 100644
--- a/samples-dev/swarm/swarm_ui_lib/observable/observable.dart
+++ b/samples-dev/swarm/swarm_ui_lib/observable/observable.dart
@@ -148,7 +148,8 @@
List<R> cast<R>() => _internal.cast<R>();
- List<R> retype<R>() => _internal.retype<R>();
+ @Deprecated("Use cast instead.")
+ List<R> retype<R>() => cast<R>();
Iterable<R> whereType<R>() => _internal.whereType<R>();
diff --git a/sdk/lib/_http/http_impl.dart b/sdk/lib/_http/http_impl.dart
index f2a025e..8061440 100644
--- a/sdk/lib/_http/http_impl.dart
+++ b/sdk/lib/_http/http_impl.dart
@@ -1766,8 +1766,7 @@
void close() {
closed = true;
_httpClient._connectionClosed(this);
- _streamFuture
- // TODO(ajohnsen): Add timeout.
+ _streamFuture.timeout(_httpClient.idleTimeout)
.then((_) => _socket.destroy());
}
@@ -1885,13 +1884,17 @@
}
void close(bool force) {
- for (var c in _idle.toList()) {
- c.close();
- }
if (force) {
+ for (var c in _idle.toList()) {
+ c.destroy();
+ }
for (var c in _active.toList()) {
c.destroy();
}
+ } else {
+ for (var c in _idle.toList()) {
+ c.close();
+ }
}
}
diff --git a/sdk/lib/_http/http_session.dart b/sdk/lib/_http/http_session.dart
index 1e1ff5e..baca21b 100644
--- a/sdk/lib/_http/http_session.dart
+++ b/sdk/lib/_http/http_session.dart
@@ -79,7 +79,8 @@
Map<K, V> cast<K, V>() => _data.cast<K, V>();
- Map<K, V> retype<K, V>() => _data.retype<K, V>();
+ @Deprecated("Use cast instead.")
+ Map<K, V> retype<K, V>() => cast<K, V>();
update(key, update(value), {ifAbsent()}) =>
_data.update(key, update, ifAbsent: ifAbsent);
diff --git a/sdk/lib/_internal/js_runtime/lib/async_patch.dart b/sdk/lib/_internal/js_runtime/lib/async_patch.dart
index 0c5c995..eef525c 100644
--- a/sdk/lib/_internal/js_runtime/lib/async_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/async_patch.dart
@@ -8,14 +8,13 @@
show
patch,
ExceptionAndStackTrace,
- Primitives,
convertDartClosureToJS,
getTraceFromException,
requiresPreamble,
wrapException,
unwrapException;
-import 'dart:_isolate_helper'
- show IsolateNatives, TimerImpl, leaveJsAsync, enterJsAsync, isWorker;
+
+import 'dart:_isolate_helper' show TimerImpl;
import 'dart:_foreign_helper' show JS, JS_GET_FLAG;
@@ -47,7 +46,6 @@
var storedCallback;
internalCallback(_) {
- leaveJsAsync();
var f = storedCallback;
storedCallback = null;
f();
@@ -59,7 +57,6 @@
return (void callback()) {
assert(storedCallback == null);
- enterJsAsync();
storedCallback = callback;
// Because of a broken shadow-dom polyfill we have to change the
// children instead a cheap property.
@@ -76,24 +73,20 @@
static void _scheduleImmediateJsOverride(void callback()) {
internalCallback() {
- leaveJsAsync();
callback();
}
;
- enterJsAsync();
JS('void', 'self.scheduleImmediate(#)',
convertDartClosureToJS(internalCallback, 0));
}
static void _scheduleImmediateWithSetImmediate(void callback()) {
internalCallback() {
- leaveJsAsync();
callback();
}
;
- enterJsAsync();
JS('void', 'self.setImmediate(#)',
convertDartClosureToJS(internalCallback, 0));
}
diff --git a/sdk/lib/_internal/js_runtime/lib/constant_map.dart b/sdk/lib/_internal/js_runtime/lib/constant_map.dart
index cf0285a3..9f571b9 100644
--- a/sdk/lib/_internal/js_runtime/lib/constant_map.dart
+++ b/sdk/lib/_internal/js_runtime/lib/constant_map.dart
@@ -47,12 +47,10 @@
const ConstantMap._();
- Map<RK, RV> cast<RK, RV>() {
- Map<Object, Object> self = this;
- return self is Map<RK, RV> ? self : Map.castFrom<K, V, RK, RV>(this);
- }
+ Map<RK, RV> cast<RK, RV>() => Map.castFrom<K, V, RK, RV>(this);
- Map<RK, RV> retype<RK, RV>() => Map.castFrom<K, V, RK, RV>(this);
+ @Deprecated("Use cast instead.")
+ Map<RK, RV> retype<RK, RV>() => cast<RK, RV>();
bool get isEmpty => length == 0;
diff --git a/sdk/lib/_internal/js_runtime/lib/foreign_helper.dart b/sdk/lib/_internal/js_runtime/lib/foreign_helper.dart
index 0daec2f..4c6b4ab 100644
--- a/sdk/lib/_internal/js_runtime/lib/foreign_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/foreign_helper.dart
@@ -190,11 +190,6 @@
}
/**
- * Invokes [function] in the context of [isolate].
- */
-external JS_CALL_IN_ISOLATE(isolate, Function function);
-
-/**
* Converts the Dart closure [function] into a JavaScript closure.
*
* Warning: This is no different from [RAW_DART_FUNCTION_REF] which means care
diff --git a/sdk/lib/_internal/js_runtime/lib/internal_patch.dart b/sdk/lib/_internal/js_runtime/lib/internal_patch.dart
index fddf0aa..f10fb5b 100644
--- a/sdk/lib/_internal/js_runtime/lib/internal_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/internal_patch.dart
@@ -5,9 +5,9 @@
import 'dart:core' hide Symbol;
import 'dart:core' as core;
import 'dart:_js_primitives' show printString;
-import 'dart:_js_helper' show patch;
+import 'dart:_js_helper' show patch, NoInline;
import 'dart:_interceptors' show JSArray;
-import 'dart:_foreign_helper' show JS;
+import 'dart:_foreign_helper' show JS, JS_GET_FLAG;
@patch
class Symbol implements core.Symbol {
@@ -49,10 +49,18 @@
}
@patch
+@NoInline()
Object extractTypeArguments<T>(T instance, Function extract) {
- // TODO(31371): Implement this correctly for Dart 2.0.
+ // In Dart 2.0 this function is recognized and replaced with calls to
+ // js_runtime.
+ if (JS_GET_FLAG('STRONG_MODE')) throw new UnimplementedError();
+
// In Dart 1.0, instantiating the generic with dynamic (which this does),
// gives you an object that can be used anywhere a more specific type is
// expected, so this works for now.
+
+ // This call to [extract] is also required for Dart 2.0 to model that the
+ // function is called and the returned value flows to the result of
+ // extractTypeArguments.
return extract();
}
diff --git a/sdk/lib/_internal/js_runtime/lib/isolate_helper.dart b/sdk/lib/_internal/js_runtime/lib/isolate_helper.dart
index 86ef3ec..01f890b 100644
--- a/sdk/lib/_internal/js_runtime/lib/isolate_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/isolate_helper.dart
@@ -4,1420 +4,112 @@
library _isolate_helper;
-import 'dart:_js_embedded_names'
- show
- CLASS_ID_EXTRACTOR,
- CLASS_FIELDS_EXTRACTOR,
- CREATE_NEW_ISOLATE,
- CURRENT_SCRIPT,
- INITIALIZE_EMPTY_INSTANCE,
- INSTANCE_FROM_CLASS_ID,
- STATIC_FUNCTION_NAME_PROPERTY_NAME;
-
import 'dart:async';
-import 'dart:collection' show Queue;
import 'dart:isolate';
-import 'dart:_native_typed_data' show NativeByteBuffer, NativeTypedData;
+
+import 'dart:_js_embedded_names' show CURRENT_SCRIPT;
import 'dart:_js_helper'
- show
- Closure,
- InternalMap,
- Primitives,
- convertDartClosureToJS,
- createDartClosureFromNameOfStaticFunction,
- isDartObject,
- random64,
- requiresPreamble;
+ show convertDartClosureToJS, random64, requiresPreamble;
-import 'dart:_foreign_helper'
- show
- DART_CLOSURE_TO_JS,
- JS,
- JS_CURRENT_ISOLATE_CONTEXT,
- JS_EMBEDDED_GLOBAL,
- JS_SET_STATIC_STATE,
- IsolateContext;
+import 'dart:_foreign_helper' show JS, JS_EMBEDDED_GLOBAL;
-import 'dart:_interceptors'
- show
- Interceptor,
- JSArray,
- JSExtendableArray,
- JSFixedArray,
- JSIndexable,
- JSMutableArray,
- JSObject;
-
-part 'isolate_serialization.dart';
-
-/**
- * Called by the compiler to support switching
- * between isolates when we get a callback from the DOM.
- */
-_callInIsolate(_IsolateContext isolate, Function function) {
- var result = isolate.eval(function);
- // If we are not already running the event-loop start it now.
- if (!_currentIsolate()._isExecutingEvent) _globalState.topEventLoop.run();
- return result;
-}
-
-/// Marks entering a JavaScript async operation to keep the worker alive.
-///
-/// To be called by library code before starting an async operation controlled
-/// by the JavaScript event handler.
-///
-/// Also call [leaveJsAsync] in all callback handlers marking the end of that
-/// async operation (also error handlers) so the worker can be released.
-///
-/// These functions only has to be called for code that can be run from a
-/// worker-isolate (so not for general dom operations).
-enterJsAsync() {
- _globalState.topEventLoop._activeJsAsyncCount++;
-}
-
-/// Marks leaving a javascript async operation.
-///
-/// See [enterJsAsync].
-leaveJsAsync() {
- _globalState.topEventLoop._activeJsAsyncCount--;
- assert(_globalState.topEventLoop._activeJsAsyncCount >= 0);
-}
+import 'dart:_interceptors' show JSExtendableArray;
/// Returns true if we are currently in a worker context.
-bool isWorker() => _globalState.isWorker;
-
-/**
- * Called by the compiler to fetch the current isolate context.
- */
-_IsolateContext _currentIsolate() => _globalState.currentContext;
-
-/**
- * Wrapper that takes the dart entry point and runs it within an isolate. The
- * dart2js compiler will inject a call of the form
- * [: startRootIsolate(main); :] when it determines that this wrapping
- * is needed. For single-isolate applications (e.g. hello world), this
- * call is not emitted.
- */
-void startRootIsolate(entry, args) {
- if (args == null) args = [];
- if (args is! List) {
- throw new ArgumentError("Arguments to main must be a List: $args");
- }
- _globalState = new _Manager(entry);
- _globalState._initialize();
-
- // Don't start the main loop again, if we are in a worker.
- if (_globalState.isWorker) return;
- final rootContext = new _IsolateContext();
- _globalState.rootContext = rootContext;
- _globalState.isolates[rootContext.id] = rootContext;
-
- // BUG(5151491): Setting currentContext should not be necessary, but
- // because closures passed to the DOM as event handlers do not bind their
- // isolate automatically we try to give them a reasonable context to live in
- // by having a "default" isolate (the first one created).
- _globalState.currentContext = rootContext;
- if (entry is _MainFunctionArgs) {
- rootContext.eval(() {
- (entry as dynamic)(args);
- });
- } else if (entry is _MainFunctionArgsMessage) {
- rootContext.eval(() {
- (entry as dynamic)(args, null);
- });
- } else {
- rootContext.eval(entry);
- }
- _globalState.topEventLoop.run();
-}
-
-/********************************************************
- Inserted from lib/isolate/dart2js/isolateimpl.dart
- ********************************************************/
-
-/**
- * Concepts used here:
- *
- * "manager" - A manager contains one or more isolates, schedules their
- * execution, and performs other plumbing on their behalf. The isolate
- * present at the creation of the manager is designated as its "root isolate".
- * A manager may, for example, be implemented on a web Worker.
- *
- * [_Manager] - State present within a manager (exactly once, as a global).
- *
- * [_ManagerStub] - A handle held within one manager that allows interaction
- * with another manager. A target manager may be addressed by zero or more
- * [_ManagerStub]s.
- * TODO(ahe): The _ManagerStub concept is broken. It was an attempt
- * to create a common interface between the native Worker class and
- * _MainManagerStub.
- */
-
-/**
- * A native object that is shared across isolates. This object is visible to all
- * isolates running under the same manager (either UI or background web worker).
- *
- * This is code that is intended to 'escape' the isolate boundaries in order to
- * implement the semantics of isolates in JavaScript. Without this we would have
- * been forced to implement more code (including the top-level event loop) in
- * JavaScript itself.
- */
-// TODO(eub, sigmund): move the "manager" to be entirely in JS.
-// Running any Dart code outside the context of an isolate gives it
-// the chance to break the isolate abstraction.
-_Manager get _globalState => JS('_Manager', 'init.globalState');
-
-set _globalState(_Manager val) {
- JS('void', 'init.globalState = #', val);
-}
-
-/** State associated with the current manager. See [globalState]. */
-// TODO(sigmund): split in multiple classes: global, thread, main-worker states?
-class _Manager {
- /** Next available isolate id within this [_Manager]. */
- int nextIsolateId = 0;
-
- /** id assigned to this [_Manager]. */
- int currentManagerId = 0;
-
- /**
- * Next available manager id. Only used by the main manager to assign a unique
- * id to each manager created by it.
- */
- int nextManagerId = 1;
-
- /** Context for the currently running [Isolate]. */
- _IsolateContext currentContext = null;
-
- /** Context for the root [Isolate] that first run in this [_Manager]. */
- _IsolateContext rootContext = null;
-
- /** The top-level event loop. */
- _EventLoop topEventLoop;
-
- /** Whether this program is running from the command line. */
- bool fromCommandLine;
-
- /** Whether this [_Manager] is running as a web worker. */
- bool isWorker;
-
- /** Whether we support spawning web workers. */
- bool supportsWorkers;
-
- /**
- * Whether to use web workers when implementing isolates. Set to false for
- * debugging/testing.
- */
- bool get useWorkers => supportsWorkers;
-
- /**
- * Registry of isolates. Isolates must be registered if, and only if, receive
- * ports are alive. Normally no open receive-ports means that the isolate is
- * dead, but DOM callbacks could resurrect it.
- */
- Map<int, _IsolateContext> isolates;
-
- /** Reference to the main [_Manager]. Null in the main [_Manager] itself. */
- _MainManagerStub mainManager;
-
- /// Registry of active Web Workers. Only used in the main [_Manager].
- Map<int, dynamic /* Worker */ > managers;
-
- /** The entry point given by [startRootIsolate]. */
- final Function entry;
-
- _Manager(this.entry);
-
- _initialize() {
- _nativeDetectEnvironment();
- topEventLoop = new _EventLoop();
- isolates = new Map<int, _IsolateContext>();
- managers = new Map<int, dynamic>();
- if (isWorker) {
- // "if we are not the main manager ourself" is the intent.
- mainManager = new _MainManagerStub();
- _nativeInitWorkerMessageHandler();
- }
- }
-
- void _nativeDetectEnvironment() {
- bool isWindowDefined = globalWindow != null;
- bool isWorkerDefined = globalWorker != null;
-
- // `isWorker` must be initialized now, since `IsolateNatives.thisScript`
- // may access it.
- isWorker = !isWindowDefined && globalPostMessageDefined;
- supportsWorkers =
- isWorker || (isWorkerDefined && IsolateNatives.thisScript != null);
- fromCommandLine = !isWindowDefined && !isWorker;
- }
-
- void _nativeInitWorkerMessageHandler() {
- var function = JS(
- '',
- '(function (f, a) { return function (e) { f(a, e); }})(#, #)',
- DART_CLOSURE_TO_JS(IsolateNatives._processWorkerMessage),
- mainManager);
- JS('void', r'self.onmessage = #', function);
- // We ensure dartPrint is defined so that the implementation of the Dart
- // print method knows what to call.
- JS(
- '',
- '''self.dartPrint = self.dartPrint || (function(serialize) {
- return function (object) {
- if (self.console && self.console.log) {
- self.console.log(object)
- } else {
- self.postMessage(serialize(object));
- }
- }
-})(#)''',
- DART_CLOSURE_TO_JS(_serializePrintMessage));
- }
-
- static _serializePrintMessage(object) {
- return _serializeMessage({'command': 'print', 'msg': object});
- }
-
- /**
- * Close the worker running this code if all isolates are done and
- * there are no active async JavaScript tasks still running.
- */
- void maybeCloseWorker() {
- if (isWorker && isolates.isEmpty && topEventLoop._activeJsAsyncCount == 0) {
- mainManager.postMessage(_serializeMessage({'command': 'close'}));
- }
- }
-}
-
-/** Context information tracked for each isolate. */
-class _IsolateContext implements IsolateContext {
- /** Current isolate id. */
- final int id = _globalState.nextIsolateId++;
-
- /** Registry of receive ports currently active on this isolate. */
- final Map<int, RawReceivePortImpl> ports = new Map<int, RawReceivePortImpl>();
-
- /** Registry of weak receive ports currently active on this isolate. */
- final Set<int> weakPorts = new Set<int>();
-
- /** Holds isolate globals (statics and top-level properties). */
- // native object containing all globals of an isolate.
- final isolateStatics =
- JS('', '#()', JS_EMBEDDED_GLOBAL('', CREATE_NEW_ISOLATE));
-
- final RawReceivePortImpl controlPort = new RawReceivePortImpl._controlPort();
-
- final Capability pauseCapability = new Capability();
- final Capability terminateCapability = new Capability(); // License to kill.
-
- /// Boolean flag set when the initial method of the isolate has been executed.
- ///
- /// Used to avoid considering the isolate dead when it has no open
- /// receive ports and no scheduled timers, because it hasn't had time to
- /// create them yet.
- bool initialized = false;
-
- // TODO(lrn): Store these in single "PauseState" object, so they don't take
- // up as much room when not pausing.
- bool isPaused = false;
- List<_IsolateEvent> delayedEvents = [];
- Set<Capability> pauseTokens = new Set();
-
- // Container with the "on exit" handler send-ports and responses.
- var doneHandlers;
-
- /**
- * Queue of functions to call when the current event is complete.
- *
- * These events are not just put at the front of the event queue, because
- * they represent control messages, and should be handled even if the
- * event queue is paused.
- */
- var _scheduledControlEvents;
- bool _isExecutingEvent = false;
-
- /** Whether uncaught errors are considered fatal. */
- bool errorsAreFatal = true;
-
- // Set of ports that listen to uncaught errors.
- Set<SendPort> errorPorts = new Set();
-
- _IsolateContext() {
- this.registerWeak(controlPort._id, controlPort);
- }
-
- void addPause(Capability authentification, Capability resume) {
- if (pauseCapability != authentification) return;
- if (pauseTokens.add(resume) && !isPaused) {
- isPaused = true;
- }
- _updateGlobalState();
- }
-
- void removePause(Capability resume) {
- if (!isPaused) return;
- pauseTokens.remove(resume);
- if (pauseTokens.isEmpty) {
- while (delayedEvents.isNotEmpty) {
- _IsolateEvent event = delayedEvents.removeLast();
- _globalState.topEventLoop.prequeue(event);
- }
- isPaused = false;
- }
- _updateGlobalState();
- }
-
- void addDoneListener(SendPort responsePort, Object response) {
- if (doneHandlers == null) {
- doneHandlers = [];
- }
- for (int i = 0; i < doneHandlers.length; i += 2) {
- if (responsePort == doneHandlers[i]) {
- doneHandlers[i + 1] = response;
- return;
- }
- }
- doneHandlers.add(responsePort);
- doneHandlers.add(response);
- }
-
- void removeDoneListener(SendPort responsePort) {
- if (doneHandlers == null) return;
- for (int i = 0; i < doneHandlers.length; i += 2) {
- if (responsePort == doneHandlers[i]) {
- doneHandlers.removeRange(i, i + 2);
- return;
- }
- }
- }
-
- void setErrorsFatal(Capability authentification, bool errorsAreFatal) {
- if (terminateCapability != authentification) return;
- this.errorsAreFatal = errorsAreFatal;
- }
-
- void handlePing(SendPort responsePort, int pingType, Object response) {
- if (pingType == Isolate.immediate ||
- (pingType == Isolate.beforeNextEvent && !_isExecutingEvent)) {
- responsePort.send(response);
- return;
- }
- void respond() {
- responsePort.send(response);
- }
-
- assert(pingType == Isolate.beforeNextEvent);
- if (_scheduledControlEvents == null) {
- _scheduledControlEvents = new Queue();
- }
- _scheduledControlEvents.addLast(respond);
- }
-
- void handleKill(Capability authentification, int priority) {
- if (this.terminateCapability != authentification) return;
- if (priority == Isolate.immediate ||
- (priority == Isolate.beforeNextEvent && !_isExecutingEvent)) {
- kill();
- return;
- }
- assert(priority == Isolate.beforeNextEvent);
- if (_scheduledControlEvents == null) {
- _scheduledControlEvents = new Queue();
- }
- _scheduledControlEvents.addLast(kill);
- }
-
- void addErrorListener(SendPort port) {
- errorPorts.add(port);
- }
-
- void removeErrorListener(SendPort port) {
- errorPorts.remove(port);
- }
-
- /** Function called with an uncaught error. */
- void handleUncaughtError(error, StackTrace stackTrace) {
- // Just print the error if there is no error listener registered.
- if (errorPorts.isEmpty) {
- // An uncaught error in the root isolate will terminate the program?
- if (errorsAreFatal && identical(this, _globalState.rootContext)) {
- // The error will be rethrown to reach the global scope, so
- // don't print it.
- return;
- }
- if (JS('bool', 'self.console && self.console.error')) {
- JS('void', 'self.console.error(#, #)', error, stackTrace);
- } else {
- print(error);
- if (stackTrace != null) print(stackTrace);
- }
- return;
- }
- List message = new List(2)
- ..[0] = error.toString()
- ..[1] = (stackTrace == null) ? null : stackTrace.toString();
- for (SendPort port in errorPorts) port.send(message);
- }
-
- /**
- * Run [code] in the context of the isolate represented by [this].
- */
- dynamic eval(Function code) {
- var old = _globalState.currentContext;
- _globalState.currentContext = this;
- this._setGlobals();
- var result = null;
- var oldIsExecutingEvent = _isExecutingEvent;
- _isExecutingEvent = true;
- try {
- result = code();
- } catch (e, s) {
- handleUncaughtError(e, s);
- if (errorsAreFatal) {
- kill();
- // An uncaught error in the root context terminates all isolates.
- if (identical(this, _globalState.rootContext)) {
- rethrow;
- }
- }
- } finally {
- _isExecutingEvent = oldIsExecutingEvent;
- _globalState.currentContext = old;
- if (old != null) old._setGlobals();
- if (_scheduledControlEvents != null) {
- while (_scheduledControlEvents.isNotEmpty) {
- (_scheduledControlEvents.removeFirst())();
- }
- }
- }
- return result;
- }
-
- void _setGlobals() {
- JS_SET_STATIC_STATE(isolateStatics);
- }
-
- /**
- * Handle messages coming in on the control port.
- *
- * These events do not go through the event queue.
- * The `_globalState.currentContext` context is not set to this context
- * during the handling.
- */
- void handleControlMessage(message) {
- switch (message[0]) {
- case 'pause':
- addPause(message[1], message[2]);
- break;
- case 'resume':
- removePause(message[1]);
- break;
- case 'add-ondone':
- addDoneListener(message[1], message[2]);
- break;
- case 'remove-ondone':
- removeDoneListener(message[1]);
- break;
- case 'set-errors-fatal':
- setErrorsFatal(message[1], message[2]);
- break;
- case 'ping':
- handlePing(message[1], message[2], message[3]);
- break;
- case 'kill':
- handleKill(message[1], message[2]);
- break;
- case 'getErrors':
- addErrorListener(message[1]);
- break;
- case 'stopErrors':
- removeErrorListener(message[1]);
- break;
- default:
- }
- }
-
- /** Looks up a port registered for this isolate. */
- RawReceivePortImpl lookup(int portId) => ports[portId];
-
- void _addRegistration(int portId, RawReceivePortImpl port) {
- if (ports.containsKey(portId)) {
- throw new Exception('Registry: ports must be registered only once.');
- }
- ports[portId] = port;
- }
-
- /** Registers a port on this isolate. */
- void register(int portId, RawReceivePortImpl port) {
- _addRegistration(portId, port);
- _updateGlobalState();
- }
-
- /**
- * Registers a weak port on this isolate.
- *
- * The port does not keep the isolate active.
- */
- void registerWeak(int portId, RawReceivePortImpl port) {
- weakPorts.add(portId);
- _addRegistration(portId, port);
- }
-
- void _updateGlobalState() {
- if (ports.length - weakPorts.length > 0 || isPaused || !initialized) {
- _globalState.isolates[id] = this; // indicate this isolate is active
- } else {
- kill();
- }
- }
-
- void kill() {
- if (_scheduledControlEvents != null) {
- // Kill all pending events.
- _scheduledControlEvents.clear();
- }
- // Stop listening on all ports.
- // This should happen before sending events to done handlers, in case
- // we are listening on ourselves.
- // Closes all ports, including control port.
- for (var port in ports.values) {
- port._close();
- }
- ports.clear();
- weakPorts.clear();
- _globalState.isolates.remove(id); // indicate this isolate is not active
- errorPorts.clear();
- if (doneHandlers != null) {
- for (int i = 0; i < doneHandlers.length; i += 2) {
- SendPort responsePort = doneHandlers[i];
- Object response = doneHandlers[i + 1];
- responsePort.send(response);
- }
- doneHandlers = null;
- }
- }
-
- /** Unregister a port on this isolate. */
- void unregister(int portId) {
- ports.remove(portId);
- weakPorts.remove(portId);
- _updateGlobalState();
- }
-}
-
-/** Represent the event loop on a javascript thread (DOM or worker). */
-class _EventLoop {
- final Queue<_IsolateEvent> events = new Queue<_IsolateEvent>();
-
- /// The number of waiting callbacks not controlled by the dart event loop.
- ///
- /// This could be timers or http requests. The worker will only be killed if
- /// this count reaches 0.
- /// Access this by using [enterJsAsync] before starting a JavaScript async
- /// operation and [leaveJsAsync] when the callback has fired.
- int _activeJsAsyncCount = 0;
-
- _EventLoop();
-
- void enqueue(isolate, fn, msg) {
- events.addLast(new _IsolateEvent(isolate, fn, msg));
- }
-
- void prequeue(_IsolateEvent event) {
- events.addFirst(event);
- }
-
- _IsolateEvent dequeue() {
- if (events.isEmpty) return null;
- return events.removeFirst();
- }
-
- void checkOpenReceivePortsFromCommandLine() {
- if (_globalState.rootContext != null &&
- _globalState.isolates.containsKey(_globalState.rootContext.id) &&
- _globalState.fromCommandLine &&
- _globalState.rootContext.ports.isEmpty) {
- // We want to reach here only on the main [_Manager] and only
- // on the command-line. In the browser the isolate might
- // still be alive due to DOM callbacks, but the presumption is
- // that on the command-line, no future events can be injected
- // into the event queue once it's empty. Node has setTimeout
- // so this presumption is incorrect there. We think(?) that
- // in d8 this assumption is valid.
- throw new Exception('Program exited with open ReceivePorts.');
- }
- }
-
- /** Process a single event, if any. */
- bool runIteration() {
- final event = dequeue();
- if (event == null) {
- checkOpenReceivePortsFromCommandLine();
- _globalState.maybeCloseWorker();
- return false;
- }
- event.process();
- return true;
- }
-
- /**
- * Runs multiple iterations of the run-loop. If possible, each iteration is
- * run asynchronously.
- */
- void _runHelper() {
- if (globalWindow != null) {
- // Run each iteration from the browser's top event loop.
- void next() {
- if (!runIteration()) return;
- Timer.run(next);
- }
-
- next();
- } else {
- // Run synchronously until no more iterations are available.
- while (runIteration()) {}
- }
- }
-
- /**
- * Call [_runHelper] but ensure that worker exceptions are propagated.
- */
- void run() {
- if (!_globalState.isWorker) {
- _runHelper();
- } else {
- try {
- _runHelper();
- } catch (e, trace) {
- _globalState.mainManager.postMessage(
- _serializeMessage({'command': 'error', 'msg': '$e\n$trace'}));
- }
- }
- }
-}
-
-/** An event in the top-level event queue. */
-class _IsolateEvent {
- _IsolateContext isolate;
- Function fn;
- String message;
-
- _IsolateEvent(this.isolate, this.fn, this.message);
-
- void process() {
- if (isolate.isPaused) {
- isolate.delayedEvents.add(this);
- return;
- }
- isolate.eval(fn);
- }
-}
-
-/** A stub for interacting with the main manager. */
-class _MainManagerStub {
- void postMessage(msg) {
- // "self" is a way to refer to the global context object that
- // works in HTML pages and in Web Workers. It does not work in d8
- // and Firefox jsshell, because that would have been too easy.
- //
- // See: http://www.w3.org/TR/workers/#the-global-scope
- // and: http://www.w3.org/TR/Window/#dfn-self-attribute
- requiresPreamble();
- JS('void', r'self.postMessage(#)', msg);
- }
-}
-
-const String _SPAWNED_SIGNAL = 'spawned';
-const String _SPAWN_FAILED_SIGNAL = 'spawn failed';
-
-get globalWindow {
+bool isWorker() {
requiresPreamble();
- return JS('', 'self.window');
+ return JS('', '!self.window && !!self.postMessage');
}
-get globalWorker {
- requiresPreamble();
- return JS('', 'self.Worker');
+/// The src url for the script tag that loaded this code.
+String thisScript = computeThisScript();
+
+/// The src url for the script tag that loaded this function.
+///
+/// Used to create JavaScript workers and load deferred libraries.
+String computeThisScript() {
+ var currentScript = JS_EMBEDDED_GLOBAL('', CURRENT_SCRIPT);
+ if (currentScript != null) {
+ return JS('String', 'String(#.src)', currentScript);
+ }
+ // A worker has no script tag - so get an url from a stack-trace.
+ if (isWorker()) return _computeThisScriptFromTrace();
+ // An isolate that doesn't support workers, but doesn't have a
+ // currentScript either. This is most likely a Chrome extension.
+ return null;
}
-bool get globalPostMessageDefined {
- requiresPreamble();
- return JS('bool', '!!self.postMessage');
-}
-
-typedef _MainFunction();
-typedef _MainFunctionArgs(Null args);
-typedef _MainFunctionArgsMessage(Null args, Null message);
-
-/// Note: IsolateNatives depends on _globalState which is only set up correctly
-/// when 'dart:isolate' has been imported.
-class IsolateNatives {
- // We set [enableSpawnWorker] to true (not null) when calling isolate
- // primitives that require support for spawning workers. The field starts out
- // by being null, and dart2js' type inference will track if it can have a
- // non-null value. So by testing if this value is not null, we generate code
- // that dart2js knows is dead when worker support isn't needed.
- // TODO(herhut): Initialize this to false when able to track compile-time
- // constants.
- static var enableSpawnWorker;
-
- static String thisScript = computeThisScript();
-
- /// Returns the base path added to Uri.base to resolve `package:` Uris.
- ///
- /// This is used by `Isolate.resolvePackageUri` to load resources. The default
- /// value is `packages/` but users can override this by using the
- /// `defaultPackagesBase` hook.
- static String get packagesBase =>
- JS('String', r'self.defaultPackagesBase || "packages/"');
-
- /// Associates an ID with a native worker object.
- static final Expando<int> workerIds = new Expando<int>();
-
- /**
- * The src url for the script tag that loaded this function.
- *
- * Used to create JavaScript workers and load deferred libraries.
- */
- static String computeThisScript() {
- var currentScript = JS_EMBEDDED_GLOBAL('', CURRENT_SCRIPT);
- if (currentScript != null) {
- return JS('String', 'String(#.src)', currentScript);
- }
- // A worker has no script tag - so get an url from a stack-trace.
- if (_globalState.isWorker) return computeThisScriptFromTrace();
- // An isolate that doesn't support workers, but doesn't have a
- // currentScript either. This is most likely a Chrome extension.
- return null;
+String _computeThisScriptFromTrace() {
+ var stack = JS('String|Null', 'new Error().stack');
+ if (stack == null) {
+ // According to Internet Explorer documentation, the stack
+ // property is not set until the exception is thrown. The stack
+ // property was not provided until IE10.
+ stack = JS(
+ 'String|Null',
+ '(function() {'
+ 'try { throw new Error() } catch(e) { return e.stack }'
+ '})()');
+ if (stack == null) throw new UnsupportedError('No stack trace');
}
+ var pattern, matches;
- static String computeThisScriptFromTrace() {
- var stack = JS('String|Null', 'new Error().stack');
- if (stack == null) {
- // According to Internet Explorer documentation, the stack
- // property is not set until the exception is thrown. The stack
- // property was not provided until IE10.
- stack = JS(
- 'String|Null',
- '(function() {'
- 'try { throw new Error() } catch(e) { return e.stack }'
- '})()');
- if (stack == null) throw new UnsupportedError('No stack trace');
- }
- var pattern, matches;
+ // This pattern matches V8, Chrome, and Internet Explorer stack
+ // traces that look like this:
+ // Error
+ // at methodName (URI:LINE:COLUMN)
+ pattern = JS('', r'new RegExp("^ *at [^(]*\\((.*):[0-9]*:[0-9]*\\)$", "m")');
- // This pattern matches V8, Chrome, and Internet Explorer stack
- // traces that look like this:
- // Error
- // at methodName (URI:LINE:COLUMN)
- pattern =
- JS('', r'new RegExp("^ *at [^(]*\\((.*):[0-9]*:[0-9]*\\)$", "m")');
+ matches = JS('JSExtendableArray|Null', '#.match(#)', stack, pattern);
+ if (matches != null) return JS('String', '#[1]', matches);
- matches = JS('JSExtendableArray|Null', '#.match(#)', stack, pattern);
- if (matches != null) return JS('String', '#[1]', matches);
+ // This pattern matches Firefox stack traces that look like this:
+ // methodName@URI:LINE
+ pattern = JS('', r'new RegExp("^[^@]*@(.*):[0-9]*$", "m")');
- // This pattern matches Firefox stack traces that look like this:
- // methodName@URI:LINE
- pattern = JS('', r'new RegExp("^[^@]*@(.*):[0-9]*$", "m")');
+ matches = JS('JSExtendableArray|Null', '#.match(#)', stack, pattern);
+ if (matches != null) return JS('String', '#[1]', matches);
- matches = JS('JSExtendableArray|Null', '#.match(#)', stack, pattern);
- if (matches != null) return JS('String', '#[1]', matches);
-
- throw new UnsupportedError('Cannot extract URI from "$stack"');
- }
-
- /**
- * Assume that [e] is a browser message event and extract its message data.
- * We don't import the dom explicitly so, when workers are disabled, this
- * library can also run on top of nodejs.
- */
- static _getEventData(e) => JS('', '#.data', e);
-
- /**
- * Process messages on a worker, either to control the worker instance or to
- * pass messages along to the isolate running in the worker.
- */
- static void _processWorkerMessage(/* Worker */ sender, e) {
- // Since we are listening on a global event, be graceful about other
- // messages that may not belong to the isolate communication.
- // See Issue #32438
- var data = _getEventData(e);
- if (!_isIsolateMessage(data)) return;
-
- var msg = _deserializeMessage(data);
- if (msg is! JSObject && msg is! Map) return;
-
- switch (msg['command']) {
- case 'start':
- _globalState.currentManagerId = msg['id'];
- String functionName = msg['functionName'];
- Function entryPoint = (functionName == null)
- ? _globalState.entry
- : _getJSFunctionFromName(functionName);
- var args = msg['args'];
- var message = _deserializeMessage(msg['msg']);
- var isSpawnUri = msg['isSpawnUri'];
- var startPaused = msg['startPaused'];
- var replyTo = _deserializeMessage(msg['replyTo']);
- var context = new _IsolateContext();
- _globalState.topEventLoop.enqueue(context, () {
- _startIsolate(
- entryPoint, args, message, isSpawnUri, startPaused, replyTo);
- }, 'worker-start');
- // Make sure we always have a current context in this worker.
- // TODO(7907): This is currently needed because we're using
- // Timers to implement Futures, and this isolate library
- // implementation uses Futures. We should either stop using
- // Futures in this library, or re-adapt if Futures get a
- // different implementation.
- _globalState.currentContext = context;
- _globalState.topEventLoop.run();
- break;
- case 'spawn-worker':
- if (enableSpawnWorker != null) handleSpawnWorkerRequest(msg);
- break;
- case 'message':
- SendPort port = msg['port'];
- // If the port has been closed, we ignore the message.
- if (port != null) {
- msg['port'].send(msg['msg']);
- }
- _globalState.topEventLoop.run();
- break;
- case 'close':
- _globalState.managers.remove(workerIds[sender]);
- JS('void', '#.terminate()', sender);
- _globalState.topEventLoop.run();
- break;
- case 'log':
- _log(msg['msg']);
- break;
- case 'print':
- if (_globalState.isWorker) {
- _globalState.mainManager
- .postMessage(_serializeMessage({'command': 'print', 'msg': msg}));
- } else {
- print(msg['msg']);
- }
- break;
- case 'error':
- throw msg['msg'];
- }
- }
-
- static handleSpawnWorkerRequest(msg) {
- var replyPort = msg['replyPort'];
- spawn(msg['functionName'], msg['uri'], msg['args'], msg['msg'], false,
- msg['isSpawnUri'], msg['startPaused']).then((msg) {
- replyPort.send(msg);
- }, onError: (String errorMessage) {
- replyPort.send([_SPAWN_FAILED_SIGNAL, errorMessage]);
- });
- }
-
- /** Log a message, forwarding to the main [_Manager] if appropriate. */
- static _log(msg) {
- if (_globalState.isWorker) {
- _globalState.mainManager
- .postMessage(_serializeMessage({'command': 'log', 'msg': msg}));
- } else {
- try {
- _consoleLog(msg);
- } catch (e, trace) {
- throw new Exception(trace);
- }
- }
- }
-
- static void _consoleLog(msg) {
- requiresPreamble();
- JS('void', r'self.console.log(#)', msg);
- }
-
- static _getJSFunctionFromName(String functionName) {
- return createDartClosureFromNameOfStaticFunction(functionName);
- }
-
- /**
- * Get a string name for the function, if possible. The result for
- * anonymous functions is browser-dependent -- it may be "" or "anonymous"
- * but you should probably not count on this.
- */
- static String _getJSFunctionName(Function f) {
- return (f is Closure)
- ? JS('String|Null', r'#[#]', f, STATIC_FUNCTION_NAME_PROPERTY_NAME)
- : null;
- }
-
- /** Create a new JavaScript object instance given its constructor. */
- static dynamic _allocate(var ctor) {
- return JS('', 'new #()', ctor);
- }
-
- static Future<List> spawnFunction(
- void topLevelFunction(Null message), var message, bool startPaused) {
- IsolateNatives.enableSpawnWorker = true;
- final name = _getJSFunctionName(topLevelFunction);
- if (name == null) {
- throw new UnsupportedError('only top-level functions can be spawned.');
- }
- bool isLight = false;
- bool isSpawnUri = false;
- return spawn(name, null, null, message, isLight, isSpawnUri, startPaused);
- }
-
- static Future<List> spawnUri(
- Uri uri, List<String> args, var message, bool startPaused) {
- IsolateNatives.enableSpawnWorker = true;
- bool isLight = false;
- bool isSpawnUri = true;
- return spawn(
- null, uri.toString(), args, message, isLight, isSpawnUri, startPaused);
- }
-
- // TODO(sigmund): clean up above, after we make the new API the default:
-
- /// If [uri] is `null` it is replaced with the current script.
- static Future<List> spawn(String functionName, String uri, List<String> args,
- message, bool isLight, bool isSpawnUri, bool startPaused) {
- // Assume that the compiled version of the Dart file lives just next to the
- // dart file.
- // TODO(floitsch): support precompiled version of dart2js output.
- if (uri != null && uri.endsWith('.dart')) uri += '.js';
-
- ReceivePort port = new ReceivePort();
- Completer<List> completer = new Completer();
- port.first.then((msg) {
- if (msg[0] == _SPAWNED_SIGNAL) {
- completer.complete(msg);
- } else {
- assert(msg[0] == _SPAWN_FAILED_SIGNAL);
- completer.completeError(msg[1]);
- }
- });
-
- SendPort signalReply = port.sendPort;
-
- if (_globalState.useWorkers && !isLight) {
- _startWorker(functionName, uri, args, message, isSpawnUri, startPaused,
- signalReply, (String message) => completer.completeError(message));
- } else {
- _startNonWorker(functionName, uri, args, message, isSpawnUri, startPaused,
- signalReply);
- }
- return completer.future;
- }
-
- static void _startWorker(
- String functionName,
- String uri,
- List<String> args,
- message,
- bool isSpawnUri,
- bool startPaused,
- SendPort replyPort,
- void onError(String message)) {
- // Make sure that the args list is a fresh generic list. A newly spawned
- // isolate should be able to assume that the arguments list is an
- // extendable list.
- if (args != null) args = new List<String>.from(args);
- if (_globalState.isWorker) {
- _globalState.mainManager.postMessage(_serializeMessage({
- 'command': 'spawn-worker',
- 'functionName': functionName,
- 'args': args,
- 'msg': message,
- 'uri': uri,
- 'isSpawnUri': isSpawnUri,
- 'startPaused': startPaused,
- 'replyPort': replyPort
- }));
- } else {
- _spawnWorker(functionName, uri, args, message, isSpawnUri, startPaused,
- replyPort, onError);
- }
- }
-
- static void _startNonWorker(
- String functionName,
- String uri,
- List<String> args,
- var message,
- bool isSpawnUri,
- bool startPaused,
- SendPort replyPort) {
- // TODO(eub): support IE9 using an iframe -- Dart issue 1702.
- if (uri != null) {
- throw new UnsupportedError(
- 'Currently spawnUri is not supported without web workers.');
- }
- // Clone the message to enforce the restrictions we have on isolate
- // messages.
- message = _clone(message);
- // Make sure that the args list is a fresh generic list. A newly spawned
- // isolate should be able to assume that the arguments list is an
- // extendable list.
- if (args != null) args = new List<String>.from(args);
- _globalState.topEventLoop.enqueue(new _IsolateContext(), () {
- final func = _getJSFunctionFromName(functionName);
- _startIsolate(func, args, message, isSpawnUri, startPaused, replyPort);
- }, 'nonworker start');
- }
-
- static Isolate get currentIsolate {
- _IsolateContext context = JS_CURRENT_ISOLATE_CONTEXT();
- return new Isolate(context.controlPort.sendPort,
- pauseCapability: context.pauseCapability,
- terminateCapability: context.terminateCapability);
- }
-
- static void _startIsolate(Function topLevel, List<String> args, message,
- bool isSpawnUri, bool startPaused, SendPort replyTo) {
- _IsolateContext context = JS_CURRENT_ISOLATE_CONTEXT();
- Primitives.initializeStatics(context.id);
- // The isolate's port does not keep the isolate open.
- replyTo.send([
- _SPAWNED_SIGNAL,
- context.controlPort.sendPort,
- context.pauseCapability,
- context.terminateCapability
- ]);
-
- void runStartFunction() {
- context.initialized = true;
- if (!isSpawnUri) {
- topLevel(message);
- } else if (topLevel is _MainFunctionArgsMessage) {
- topLevel(args, message);
- } else if (topLevel is _MainFunctionArgs) {
- topLevel(args);
- } else {
- topLevel();
- }
- context._updateGlobalState();
- }
-
- if (startPaused) {
- context.addPause(context.pauseCapability, context.pauseCapability);
- _globalState.topEventLoop
- .enqueue(context, runStartFunction, 'start isolate');
- } else {
- runStartFunction();
- }
- }
-
- /**
- * Spawns an isolate in a worker. [factoryName] is the Javascript constructor
- * name for the isolate entry point class.
- */
- static void _spawnWorker(
- functionName,
- String uri,
- List<String> args,
- message,
- bool isSpawnUri,
- bool startPaused,
- SendPort replyPort,
- void onError(String message)) {
- if (uri == null) uri = thisScript;
- final worker = JS('var', 'new Worker(#)', uri);
- // Trampolines are used when wanting to call a Dart closure from
- // JavaScript. The helper function DART_CLOSURE_TO_JS only accepts
- // top-level or static methods, and the trampoline allows us to capture
- // arguments and values which can be passed to a static method.
- final onerrorTrampoline = JS(
- '',
- '''
-(function (f, u, c) {
- return function(e) {
- return f(e, u, c)
- }
-})(#, #, #)''',
- DART_CLOSURE_TO_JS(workerOnError),
- uri,
- onError);
- JS('void', '#.onerror = #', worker, onerrorTrampoline);
-
- var processWorkerMessageTrampoline = JS(
- '',
- """
-(function (f, a) {
- return function (e) {
- // We can stop listening for errors when the first message is received as
- // we only listen for messages to determine if the uri was bad.
- e.onerror = null;
- return f(a, e);
- }
-})(#, #)""",
- DART_CLOSURE_TO_JS(_processWorkerMessage),
- worker);
- JS('void', '#.onmessage = #', worker, processWorkerMessageTrampoline);
- var workerId = _globalState.nextManagerId++;
- // We also store the id on the worker itself so that we can unregister it.
- workerIds[worker] = workerId;
- _globalState.managers[workerId] = worker;
- JS(
- 'void',
- '#.postMessage(#)',
- worker,
- _serializeMessage({
- 'command': 'start',
- 'id': workerId,
- // Note: we serialize replyPort twice because the child worker needs to
- // first deserialize the worker id, before it can correctly deserialize
- // the port (port deserialization is sensitive to what is the current
- // workerId).
- 'replyTo': _serializeMessage(replyPort),
- 'args': args,
- 'msg': _serializeMessage(message),
- 'isSpawnUri': isSpawnUri,
- 'startPaused': startPaused,
- 'functionName': functionName
- }));
- }
-
- static bool workerOnError(
- /* Event */ event,
- String uri,
- void onError(String message)) {
- // Attempt to shut up the browser, as the error has been handled. Chrome
- // ignores this :-(
- JS('void', '#.preventDefault()', event);
- String message = JS('String|Null', '#.message', event);
- if (message == null) {
- // Some browsers, including Chrome, fail to provide a proper error
- // event.
- message = 'Error spawning worker for $uri';
- } else {
- message = 'Error spawning worker for $uri ($message)';
- }
- onError(message);
- return true;
- }
-}
-
-/********************************************************
- Inserted from lib/isolate/dart2js/ports.dart
- ********************************************************/
-
-/** Common functionality to all send ports. */
-abstract class _BaseSendPort implements SendPort {
- /** Id for the destination isolate. */
- final int _isolateId;
-
- const _BaseSendPort(this._isolateId);
-
- void _checkReplyTo(SendPort replyTo) {
- if (replyTo != null &&
- replyTo is! _NativeJsSendPort &&
- replyTo is! _WorkerSendPort) {
- throw new Exception('SendPort.send: Illegal replyTo port type');
- }
- }
-
- void send(var message);
- bool operator ==(var other);
- int get hashCode;
-}
-
-/** A send port that delivers messages in-memory via native JavaScript calls. */
-class _NativeJsSendPort extends _BaseSendPort implements SendPort {
- final RawReceivePortImpl _receivePort;
-
- const _NativeJsSendPort(this._receivePort, int isolateId) : super(isolateId);
-
- void send(var message) {
- // Check that the isolate still runs and the port is still open
- final isolate = _globalState.isolates[_isolateId];
- if (isolate == null) return;
- if (_receivePort._isClosed) return;
- // Clone the message to enforce the restrictions we have on isolate
- // messages.
- var msg = _clone(message);
- if (isolate.controlPort == _receivePort) {
- isolate.handleControlMessage(msg);
- return;
- }
- _globalState.topEventLoop.enqueue(isolate, () {
- if (!_receivePort._isClosed) {
- _receivePort._add(msg);
- }
- }, 'receive');
- }
-
- bool operator ==(var other) =>
- (other is _NativeJsSendPort) && (_receivePort == other._receivePort);
-
- int get hashCode => _receivePort._id;
-}
-
-/** A send port that delivers messages via worker.postMessage. */
-// TODO(eub): abstract this for iframes.
-class _WorkerSendPort extends _BaseSendPort implements SendPort {
- final int _workerId;
- final int _receivePortId;
-
- const _WorkerSendPort(this._workerId, int isolateId, this._receivePortId)
- : super(isolateId);
-
- void send(var message) {
- final workerMessage =
- _serializeMessage({'command': 'message', 'port': this, 'msg': message});
-
- if (_globalState.isWorker) {
- // Communication from one worker to another go through the
- // main worker.
- _globalState.mainManager.postMessage(workerMessage);
- } else {
- // Deliver the message only if the worker is still alive.
- /* Worker */ var manager = _globalState.managers[_workerId];
- if (manager != null) {
- JS('void', '#.postMessage(#)', manager, workerMessage);
- }
- }
- }
-
- bool operator ==(var other) {
- return (other is _WorkerSendPort) &&
- (_workerId == other._workerId) &&
- (_isolateId == other._isolateId) &&
- (_receivePortId == other._receivePortId);
- }
-
- int get hashCode {
- // TODO(sigmund): use a standard hash when we get one available in corelib.
- return (_workerId << 16) ^ (_isolateId << 8) ^ _receivePortId;
- }
-}
-
-class RawReceivePortImpl implements RawReceivePort {
- static int _nextFreeId = 1;
-
- final int _id;
- Function _handler;
- bool _isClosed = false;
-
- RawReceivePortImpl(this._handler) : _id = _nextFreeId++ {
- _globalState.currentContext.register(_id, this);
- }
-
- RawReceivePortImpl.weak(this._handler) : _id = _nextFreeId++ {
- _globalState.currentContext.registerWeak(_id, this);
- }
-
- // Creates the control port of an isolate.
- // This is created before the isolate context object itself,
- // so it cannot access the static _nextFreeId field.
- RawReceivePortImpl._controlPort()
- : _handler = null,
- _id = 0;
-
- void set handler(Function newHandler) {
- _handler = newHandler;
- }
-
- // Close the port without unregistering it.
- // Used by an isolate context to close all ports when shutting down.
- void _close() {
- _isClosed = true;
- _handler = null;
- }
-
- void close() {
- if (_isClosed) return;
- _isClosed = true;
- _handler = null;
- _globalState.currentContext.unregister(_id);
- }
-
- void _add(dataEvent) {
- if (_isClosed) return;
- _handler(dataEvent);
- }
-
- SendPort get sendPort {
- return new _NativeJsSendPort(this, _globalState.currentContext.id);
- }
+ throw new UnsupportedError('Cannot extract URI from "$stack"');
}
class ReceivePortImpl extends Stream implements ReceivePort {
- final RawReceivePort _rawPort;
- StreamController _controller;
-
- ReceivePortImpl() : this.fromRawReceivePort(new RawReceivePortImpl(null));
-
- ReceivePortImpl.weak()
- : this.fromRawReceivePort(new RawReceivePortImpl.weak(null));
-
- ReceivePortImpl.fromRawReceivePort(this._rawPort) {
- _controller = new StreamController(onCancel: close, sync: true);
- _rawPort.handler = _controller.add;
- }
+ ReceivePortImpl();
StreamSubscription listen(void onData(var event),
{Function onError, void onDone(), bool cancelOnError}) {
- return _controller.stream.listen(onData,
- onError: onError, onDone: onDone, cancelOnError: cancelOnError);
+ throw new UnsupportedError("ReceivePort.listen");
}
- void close() {
- _rawPort.close();
- _controller.close();
- }
+ void close() {}
- SendPort get sendPort => _rawPort.sendPort;
+ SendPort get sendPort => throw new UnsupportedError("ReceivePort.sendPort");
}
class TimerImpl implements Timer {
final bool _once;
- bool _inEventLoop = false;
int _handle;
int _tick = 0;
TimerImpl(int milliseconds, void callback()) : _once = true {
- if (milliseconds == 0 && (!hasTimer() || _globalState.isWorker)) {
+ if (_hasTimer()) {
void internalCallback() {
_handle = null;
- callback();
- }
-
- // Setting _handle to something different from null indicates that the
- // callback has not been run. Hence, the choice of 1 is arbitrary.
- _handle = 1;
-
- // This makes a dependency between the async library and the
- // event loop of the isolate library. The compiler makes sure
- // that the event loop is compiled if [Timer] is used.
- // TODO(7907): In case of web workers, we need to use the event
- // loop instead of setTimeout, to make sure the futures get executed in
- // order.
- _globalState.topEventLoop
- .enqueue(_globalState.currentContext, internalCallback, 'timer');
- _inEventLoop = true;
- } else if (hasTimer()) {
- void internalCallback() {
- _handle = null;
- leaveJsAsync();
this._tick = 1;
callback();
}
- enterJsAsync();
-
_handle = JS('int', 'self.setTimeout(#, #)',
convertDartClosureToJS(internalCallback, 0), milliseconds);
} else {
- assert(milliseconds > 0);
- throw new UnsupportedError('Timer greater than 0.');
+ throw new UnsupportedError('`setTimeout()` not found.');
}
}
TimerImpl.periodic(int milliseconds, void callback(Timer timer))
: _once = false {
- if (hasTimer()) {
- enterJsAsync();
+ if (_hasTimer()) {
int start = JS('int', 'Date.now()');
_handle = JS(
'int',
@@ -1439,15 +131,16 @@
}
}
+ @override
+ bool get isActive => _handle != null;
+
+ @override
int get tick => _tick;
+ @override
void cancel() {
- if (hasTimer()) {
- if (_inEventLoop) {
- throw new UnsupportedError('Timer in event loop cannot be canceled.');
- }
+ if (_hasTimer()) {
if (_handle == null) return;
- leaveJsAsync();
if (_once) {
JS('void', 'self.clearTimeout(#)', _handle);
} else {
@@ -1458,48 +151,9 @@
throw new UnsupportedError('Canceling a timer.');
}
}
-
- bool get isActive => _handle != null;
}
-bool hasTimer() {
+bool _hasTimer() {
requiresPreamble();
return JS('', 'self.setTimeout') != null;
}
-
-/**
- * Implementation class for [Capability].
- *
- * It has the same name to make it harder for users to distinguish.
- */
-class CapabilityImpl implements Capability {
- /** Internal random secret identifying the capability. */
- final int _id;
-
- CapabilityImpl() : this._internal(random64());
-
- CapabilityImpl._internal(this._id);
-
- int get hashCode {
- // Thomas Wang 32 bit Mix.
- // http://www.concentric.net/~Ttwang/tech/inthash.htm
- // (via https://gist.github.com/badboy/6267743)
- int hash = _id;
- hash = (hash >> 0) ^ (hash ~/ 0x100000000); // To 32 bit from ~64.
- hash = (~hash + (hash << 15)) & 0xFFFFFFFF;
- hash ^= hash >> 12;
- hash = (hash * 5) & 0xFFFFFFFF;
- hash ^= hash >> 4;
- hash = (hash * 2057) & 0xFFFFFFFF;
- hash ^= hash >> 16;
- return hash;
- }
-
- bool operator ==(Object other) {
- if (identical(other, this)) return true;
- if (other is CapabilityImpl) {
- return identical(_id, other._id);
- }
- return false;
- }
-}
diff --git a/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart b/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart
index 9cfeabf..cdb840b 100644
--- a/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/isolate_patch.dart
@@ -5,20 +5,16 @@
// Patch file for the dart:isolate library.
import "dart:async";
+import 'dart:_foreign_helper' show JS;
import 'dart:_js_helper' show patch;
-import 'dart:_isolate_helper'
- show CapabilityImpl, IsolateNatives, ReceivePortImpl, RawReceivePortImpl;
-
-typedef _UnaryFunction(Null arg);
+import 'dart:_isolate_helper' show ReceivePortImpl;
@patch
class Isolate {
- static final _currentIsolateCache = IsolateNatives.currentIsolate;
-
- // `current` must be a getter, not just a final field,
- // to match the external declaration.
@patch
- static Isolate get current => _currentIsolateCache;
+ static Isolate get current {
+ throw new UnsupportedError("Isolate.current");
+ }
@patch
static Future<Uri> get packageRoot {
@@ -30,15 +26,13 @@
throw new UnsupportedError("Isolate.packageConfig");
}
- static Uri _packageBase = Uri.base.resolve(IsolateNatives.packagesBase);
-
@patch
static Future<Uri> resolvePackageUri(Uri packageUri) {
if (packageUri.scheme != 'package') {
return new Future<Uri>.value(packageUri);
}
return new Future<Uri>.value(
- _packageBase.resolveUri(packageUri.replace(scheme: '')));
+ _packagesBase.resolveUri(packageUri.replace(scheme: '')));
}
@patch
@@ -47,41 +41,7 @@
bool errorsAreFatal,
SendPort onExit,
SendPort onError}) {
- bool forcePause =
- (errorsAreFatal != null) || (onExit != null) || (onError != null);
- try {
- // Check for the type of `entryPoint` on the spawning isolate to make
- // error-handling easier.
- if (entryPoint is! _UnaryFunction) {
- throw new ArgumentError(entryPoint);
- }
- // TODO: Consider passing the errorsAreFatal/onExit/onError values
- // as arguments to the internal spawnUri instead of setting
- // them after the isolate has been created.
- return IsolateNatives
- .spawnFunction(entryPoint, message, paused || forcePause)
- .then((msg) {
- var isolate = new Isolate(msg[1],
- pauseCapability: msg[2], terminateCapability: msg[3]);
- if (forcePause) {
- if (errorsAreFatal != null) {
- isolate.setErrorsFatal(errorsAreFatal);
- }
- if (onExit != null) {
- isolate.addOnExitListener(onExit);
- }
- if (onError != null) {
- isolate.addErrorListener(onError);
- }
- if (!paused) {
- isolate.resume(isolate.pauseCapability);
- }
- }
- return isolate;
- });
- } catch (e, st) {
- return new Future<Isolate>.error(e, st);
- }
+ throw new UnsupportedError("Isolate.spawn");
}
@patch
@@ -95,131 +55,55 @@
Uri packageRoot,
Uri packageConfig,
bool automaticPackageResolution: false}) {
- if (environment != null) throw new UnimplementedError("environment");
- if (packageRoot != null) throw new UnimplementedError("packageRoot");
- if (packageConfig != null) throw new UnimplementedError("packageConfig");
- // TODO(lrn): Figure out how to handle the automaticPackageResolution
- // parameter.
- bool forcePause =
- (errorsAreFatal != null) || (onExit != null) || (onError != null);
- try {
- if (args is List<String>) {
- for (int i = 0; i < args.length; i++) {
- if (args[i] is! String) {
- throw new ArgumentError("Args must be a list of Strings $args");
- }
- }
- } else if (args != null) {
- throw new ArgumentError("Args must be a list of Strings $args");
- }
- // TODO: Handle [packageRoot] somehow, possibly by throwing.
- // TODO: Consider passing the errorsAreFatal/onExit/onError values
- // as arguments to the internal spawnUri instead of setting
- // them after the isolate has been created.
- return IsolateNatives
- .spawnUri(uri, args, message, paused || forcePause)
- .then((msg) {
- var isolate = new Isolate(msg[1],
- pauseCapability: msg[2], terminateCapability: msg[3]);
- if (forcePause) {
- if (errorsAreFatal != null) {
- isolate.setErrorsFatal(errorsAreFatal);
- }
- if (onExit != null) {
- isolate.addOnExitListener(onExit);
- }
- if (onError != null) {
- isolate.addErrorListener(onError);
- }
- if (!paused) {
- isolate.resume(isolate.pauseCapability);
- }
- }
- return isolate;
- });
- } catch (e, st) {
- return new Future<Isolate>.error(e, st);
- }
+ throw new UnsupportedError("Isolate.spawnUri");
}
@patch
void _pause(Capability resumeCapability) {
- var message = new List(3)
- ..[0] = "pause"
- ..[1] = pauseCapability
- ..[2] = resumeCapability;
- controlPort.send(message);
+ throw new UnsupportedError("Isolate._pause");
}
@patch
void resume(Capability resumeCapability) {
- var message = new List(2)
- ..[0] = "resume"
- ..[1] = resumeCapability;
- controlPort.send(message);
+ throw new UnsupportedError("Isolate.resume");
}
@patch
void addOnExitListener(SendPort responsePort, {Object response}) {
- // TODO(lrn): Can we have an internal method that checks if the receiving
- // isolate of a SendPort is still alive?
- var message = new List(3)
- ..[0] = "add-ondone"
- ..[1] = responsePort
- ..[2] = response;
- controlPort.send(message);
+ throw new UnsupportedError("Isolate.addOnExitListener");
}
@patch
void removeOnExitListener(SendPort responsePort) {
- var message = new List(2)
- ..[0] = "remove-ondone"
- ..[1] = responsePort;
- controlPort.send(message);
+ throw new UnsupportedError("Isolate.removeOnExitListener");
}
@patch
void setErrorsFatal(bool errorsAreFatal) {
- var message = new List(3)
- ..[0] = "set-errors-fatal"
- ..[1] = terminateCapability
- ..[2] = errorsAreFatal;
- controlPort.send(message);
+ throw new UnsupportedError("Isolate.setErrorsFatal");
}
@patch
void kill({int priority: beforeNextEvent}) {
- controlPort.send(["kill", terminateCapability, priority]);
+ throw new UnsupportedError("Isolate.kill");
}
@patch
void ping(SendPort responsePort, {Object response, int priority: immediate}) {
- var message = new List(4)
- ..[0] = "ping"
- ..[1] = responsePort
- ..[2] = priority
- ..[3] = response;
- controlPort.send(message);
+ throw new UnsupportedError("Isolate.ping");
}
@patch
void addErrorListener(SendPort port) {
- var message = new List(2)
- ..[0] = "getErrors"
- ..[1] = port;
- controlPort.send(message);
+ throw new UnsupportedError("Isolate.addErrorListener");
}
@patch
void removeErrorListener(SendPort port) {
- var message = new List(2)
- ..[0] = "stopErrors"
- ..[1] = port;
- controlPort.send(message);
+ throw new UnsupportedError("Isolate.removeErrorListener");
}
}
-/** Default factory for receive ports. */
@patch
class ReceivePort {
@patch
@@ -227,7 +111,7 @@
@patch
factory ReceivePort.fromRawReceivePort(RawReceivePort rawPort) {
- return new ReceivePortImpl.fromRawReceivePort(rawPort);
+ throw new UnsupportedError('new ReceivePort.fromRawReceivePort');
}
}
@@ -235,12 +119,22 @@
class RawReceivePort {
@patch
factory RawReceivePort([Function handler]) {
- return new RawReceivePortImpl(handler);
+ throw new UnsupportedError('new RawReceivePort');
}
}
@patch
class Capability {
@patch
- factory Capability() = CapabilityImpl;
+ factory Capability() {
+ throw new UnsupportedError('new Capability');
+ }
}
+
+/// Returns the base path added to Uri.base to resolve `package:` Uris.
+///
+/// This is used by `Isolate.resolvePackageUri` to load resources. The default
+/// value is `packages/` but users can override this by using the
+/// `defaultPackagesBase` hook.
+Uri _packagesBase =
+ Uri.base.resolve(JS('String', r'self.defaultPackagesBase || "packages/"'));
diff --git a/sdk/lib/_internal/js_runtime/lib/isolate_serialization.dart b/sdk/lib/_internal/js_runtime/lib/isolate_serialization.dart
deleted file mode 100644
index 7872979..0000000
--- a/sdk/lib/_internal/js_runtime/lib/isolate_serialization.dart
+++ /dev/null
@@ -1,412 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-part of _isolate_helper;
-
-/// Serialize [message].
-_serializeMessage(message) {
- return new _Serializer().serialize(message);
-}
-
-/// Deserialize [message].
-_deserializeMessage(message) {
- return new _Deserializer().deserialize(message);
-}
-
-bool _isIsolateMessage(message) {
- if (_isPrimitive(message)) return true;
- if (message is! JSArray) return false;
- if (message.isEmpty) return false;
- switch (message.first) {
- case "ref":
- case "buffer":
- case "typed":
- case "fixed":
- case "extendable":
- case "mutable":
- case "const":
- case "map":
- case "sendport":
- case "raw sendport":
- case "js-object":
- case "function":
- case "capability":
- case "dart":
- return true;
- default:
- return false;
- }
-}
-
-/// Clones the message.
-///
-/// Contrary to a `_deserializeMessage(_serializeMessage(x))` the `_clone`
-/// function will not try to adjust SendPort values and pass them through.
-_clone(message) {
- _Serializer serializer = new _Serializer(serializeSendPorts: false);
- _Deserializer deserializer = new _Deserializer();
- return deserializer.deserialize(serializer.serialize(message));
-}
-
-class _Serializer {
- final bool _serializeSendPorts;
- Map<dynamic, int> serializedObjectIds = new Map<dynamic, int>.identity();
-
- _Serializer({serializeSendPorts: true})
- : _serializeSendPorts = serializeSendPorts;
-
- /// Returns a message that can be transmitted through web-worker channels.
- serialize(x) {
- if (_isPrimitive(x)) return serializePrimitive(x);
-
- int serializationId = serializedObjectIds[x];
- if (serializationId != null) return makeRef(serializationId);
-
- serializationId = serializedObjectIds.length;
- serializedObjectIds[x] = serializationId;
-
- if (x is NativeByteBuffer) return serializeByteBuffer(x);
- if (x is NativeTypedData) return serializeTypedData(x);
- if (x is JSIndexable) return serializeJSIndexable(x);
- if (x is InternalMap) return serializeMap(x as dynamic);
-
- if (x is JSObject) return serializeJSObject(x);
-
- // We should not have any interceptors any more.
- if (x is Interceptor) unsupported(x);
-
- if (x is RawReceivePort) {
- unsupported(x, "RawReceivePorts can't be transmitted:");
- }
-
- // SendPorts need their workerIds adjusted (either during serialization or
- // deserialization).
- if (x is _NativeJsSendPort) return serializeJsSendPort(x);
- if (x is _WorkerSendPort) return serializeWorkerSendPort(x);
-
- if (x is Closure) return serializeClosure(x);
- if (x is CapabilityImpl) return serializeCapability(x);
-
- return serializeDartObject(x);
- }
-
- void unsupported(x, [String message]) {
- if (message == null) message = "Can't transmit:";
- throw new UnsupportedError("$message $x");
- }
-
- makeRef(int serializationId) => ["ref", serializationId];
-
- serializePrimitive(primitive) => primitive;
-
- serializeByteBuffer(NativeByteBuffer buffer) {
- return ["buffer", buffer];
- }
-
- serializeTypedData(NativeTypedData data) {
- return ["typed", data];
- }
-
- serializeJSIndexable(JSIndexable indexable) {
- // Strings are JSIndexable but should have been treated earlier.
- assert(indexable is! String);
- List serialized = serializeArray(indexable);
- if (indexable is JSFixedArray) return ["fixed", serialized];
- if (indexable is JSExtendableArray) return ["extendable", serialized];
- // MutableArray check must be last, since JSFixedArray and JSExtendableArray
- // extend JSMutableArray.
- if (indexable is JSMutableArray) return ["mutable", serialized];
- // The only JSArrays left are the const Lists (as in `const [1, 2]`).
- if (indexable is JSArray) return ["const", serialized];
- unsupported(indexable, "Can't serialize indexable: ");
- return null;
- }
-
- serializeArray(JSArray x) {
- List serialized = [];
- serialized.length = x.length;
- for (int i = 0; i < x.length; i++) {
- serialized[i] = serialize(x[i]);
- }
- return serialized;
- }
-
- serializeArrayInPlace(JSArray x) {
- for (int i = 0; i < x.length; i++) {
- x[i] = serialize(x[i]);
- }
- return x;
- }
-
- serializeMap(Map x) {
- Function serializeTearOff = serialize;
- return [
- 'map',
- x.keys.map(serializeTearOff).toList(),
- x.values.map(serializeTearOff).toList()
- ];
- }
-
- serializeJSObject(JSObject x) {
- // Don't serialize objects if their `constructor` property isn't `Object`
- // or undefined/null.
- // A different constructor is taken as a sign that the object has complex
- // internal state, or that it is a function, and won't be serialized.
- if (JS('bool', '!!(#.constructor)', x) &&
- JS('bool', 'x.constructor !== Object')) {
- unsupported(x, "Only plain JS Objects are supported:");
- }
- List keys = JS('JSArray', 'Object.keys(#)', x);
- List values = [];
- values.length = keys.length;
- for (int i = 0; i < keys.length; i++) {
- values[i] = serialize(JS('', '#[#]', x, keys[i]));
- }
- return ['js-object', keys, values];
- }
-
- serializeWorkerSendPort(_WorkerSendPort x) {
- if (_serializeSendPorts) {
- return ['sendport', x._workerId, x._isolateId, x._receivePortId];
- }
- return ['raw sendport', x];
- }
-
- serializeJsSendPort(_NativeJsSendPort x) {
- if (_serializeSendPorts) {
- int workerId = _globalState.currentManagerId;
- return ['sendport', workerId, x._isolateId, x._receivePort._id];
- }
- return ['raw sendport', x];
- }
-
- serializeCapability(CapabilityImpl x) => ['capability', x._id];
-
- serializeClosure(Closure x) {
- final name = IsolateNatives._getJSFunctionName(x);
- if (name == null) {
- unsupported(x, "Closures can't be transmitted:");
- }
- return ['function', name];
- }
-
- serializeDartObject(x) {
- if (!isDartObject(x)) unsupported(x);
- var classExtractor = JS_EMBEDDED_GLOBAL('', CLASS_ID_EXTRACTOR);
- var fieldsExtractor = JS_EMBEDDED_GLOBAL('', CLASS_FIELDS_EXTRACTOR);
- String classId = JS('String', '#(#)', classExtractor, x);
- List fields = JS('JSArray', '#(#)', fieldsExtractor, x);
- return ['dart', classId, serializeArrayInPlace(fields)];
- }
-}
-
-class _Deserializer {
- /// When `true`, encodes sendports specially so that they can be adjusted on
- /// the receiving end.
- ///
- /// When `false`, sendports are cloned like any other object.
- final bool _adjustSendPorts;
-
- List<dynamic> deserializedObjects = new List<dynamic>();
-
- _Deserializer({adjustSendPorts: true}) : _adjustSendPorts = adjustSendPorts;
-
- /// Returns a message that can be transmitted through web-worker channels.
- deserialize(x) {
- if (_isPrimitive(x)) return deserializePrimitive(x);
-
- if (x is! JSArray) throw new ArgumentError("Bad serialized message: $x");
-
- switch (x.first) {
- case "ref":
- return deserializeRef(x);
- case "buffer":
- return deserializeByteBuffer(x);
- case "typed":
- return deserializeTypedData(x);
- case "fixed":
- return deserializeFixed(x);
- case "extendable":
- return deserializeExtendable(x);
- case "mutable":
- return deserializeMutable(x);
- case "const":
- return deserializeConst(x);
- case "map":
- return deserializeMap(x);
- case "sendport":
- return deserializeSendPort(x);
- case "raw sendport":
- return deserializeRawSendPort(x);
- case "js-object":
- return deserializeJSObject(x);
- case "function":
- return deserializeClosure(x);
- case "capability":
- return deserializeCapability(x);
- case "dart":
- return deserializeDartObject(x);
- default:
- throw "couldn't deserialize: $x";
- }
- }
-
- deserializePrimitive(x) => x;
-
- // ['ref', id].
- deserializeRef(x) {
- assert(x[0] == 'ref');
- int serializationId = x[1];
- return deserializedObjects[serializationId];
- }
-
- // ['buffer', <byte buffer>].
- NativeByteBuffer deserializeByteBuffer(x) {
- assert(x[0] == 'buffer');
- NativeByteBuffer result = x[1];
- deserializedObjects.add(result);
- return result;
- }
-
- // ['typed', <typed array>].
- NativeTypedData deserializeTypedData(x) {
- assert(x[0] == 'typed');
- NativeTypedData result = x[1];
- deserializedObjects.add(result);
- return result;
- }
-
- // Updates the given array in place with its deserialized content.
- List deserializeArrayInPlace(JSArray x) {
- for (int i = 0; i < x.length; i++) {
- x[i] = deserialize(x[i]);
- }
- return x;
- }
-
- // ['fixed', <array>].
- List deserializeFixed(x) {
- assert(x[0] == 'fixed');
- List result = x[1];
- deserializedObjects.add(result);
- return new JSArray.markFixed(deserializeArrayInPlace(result));
- }
-
- // ['extendable', <array>].
- List deserializeExtendable(x) {
- assert(x[0] == 'extendable');
- List result = x[1];
- deserializedObjects.add(result);
- return new JSArray.markGrowable(deserializeArrayInPlace(result));
- }
-
- // ['mutable', <array>].
- List deserializeMutable(x) {
- assert(x[0] == 'mutable');
- List result = x[1];
- deserializedObjects.add(result);
- return deserializeArrayInPlace(result);
- }
-
- // ['const', <array>].
- List deserializeConst(x) {
- assert(x[0] == 'const');
- List result = x[1];
- deserializedObjects.add(result);
- // TODO(floitsch): need to mark list as non-changeable.
- return new JSArray.markFixed(deserializeArrayInPlace(result));
- }
-
- // ['map', <key-list>, <value-list>].
- Map deserializeMap(x) {
- assert(x[0] == 'map');
- List keys = x[1];
- List values = x[2];
- Map result = {};
- deserializedObjects.add(result);
- // We need to keep the order of how objects were serialized.
- // First deserialize all keys, and then only deserialize the values.
- keys = keys.map(deserialize).toList();
-
- for (int i = 0; i < keys.length; i++) {
- result[keys[i]] = deserialize(values[i]);
- }
- return result;
- }
-
- // ['sendport', <managerId>, <isolateId>, <receivePortId>].
- SendPort deserializeSendPort(x) {
- assert(x[0] == 'sendport');
- int managerId = x[1];
- int isolateId = x[2];
- int receivePortId = x[3];
- SendPort result;
- // If two isolates are in the same manager, we use NativeJsSendPorts to
- // deliver messages directly without using postMessage.
- if (managerId == _globalState.currentManagerId) {
- var isolate = _globalState.isolates[isolateId];
- if (isolate == null) return null; // Isolate has been closed.
- var receivePort = isolate.lookup(receivePortId);
- if (receivePort == null) return null; // Port has been closed.
- result = new _NativeJsSendPort(receivePort, isolateId);
- } else {
- result = new _WorkerSendPort(managerId, isolateId, receivePortId);
- }
- deserializedObjects.add(result);
- return result;
- }
-
- // ['raw sendport', <sendport>].
- SendPort deserializeRawSendPort(x) {
- assert(x[0] == 'raw sendport');
- SendPort result = x[1];
- deserializedObjects.add(result);
- return result;
- }
-
- // ['js-object', <key-list>, <value-list>].
- deserializeJSObject(x) {
- assert(x[0] == 'js-object');
- List keys = x[1];
- List values = x[2];
- var o = JS('', '{}');
- deserializedObjects.add(o);
- for (int i = 0; i < keys.length; i++) {
- JS('', '#[#]=#', o, keys[i], deserialize(values[i]));
- }
- return o;
- }
-
- // ['function', <name>].
- Function deserializeClosure(x) {
- assert(x[0] == 'function');
- String name = x[1];
- Function result = IsolateNatives._getJSFunctionFromName(name);
- deserializedObjects.add(result);
- return result;
- }
-
- // ['capability', <id>].
- Capability deserializeCapability(x) {
- assert(x[0] == 'capability');
- return new CapabilityImpl._internal(x[1]);
- }
-
- // ['dart', <class-id>, <field-list>].
- deserializeDartObject(x) {
- assert(x[0] == 'dart');
- String classId = x[1];
- List fields = x[2];
- var instanceFromClassId = JS_EMBEDDED_GLOBAL('', INSTANCE_FROM_CLASS_ID);
- var initializeObject = JS_EMBEDDED_GLOBAL('', INITIALIZE_EMPTY_INSTANCE);
-
- var emptyInstance = JS('', '#(#)', instanceFromClassId, classId);
- deserializedObjects.add(emptyInstance);
- deserializeArrayInPlace(fields);
- return JS(
- '', '#(#, #, #)', initializeObject, classId, emptyInstance, fields);
- }
-}
-
-bool _isPrimitive(x) => x == null || x is String || x is num || x is bool;
diff --git a/sdk/lib/_internal/js_runtime/lib/js_array.dart b/sdk/lib/_internal/js_runtime/lib/js_array.dart
index 04e8f49..df03003 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_array.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_array.dart
@@ -119,12 +119,10 @@
}
}
- List<R> cast<R>() {
- List<Object> self = this;
- return self is List<R> ? self : List.castFrom<E, R>(this);
- }
+ List<R> cast<R>() => List.castFrom<E, R>(this);
- List<R> retype<R>() => List.castFrom<E, R>(this);
+ @Deprecated("Use cast instead.")
+ List<R> retype<R>() => cast<R>();
void add(E value) {
checkGrowable('add');
diff --git a/sdk/lib/_internal/js_runtime/lib/js_helper.dart b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
index a89baa8..2af7e18 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
@@ -6,6 +6,7 @@
import 'dart:_js_embedded_names'
show
+ CURRENT_SCRIPT,
DEFERRED_LIBRARY_PARTS,
DEFERRED_PART_URIS,
DEFERRED_PART_HASHES,
@@ -24,28 +25,16 @@
import 'dart:collection';
-import 'dart:_isolate_helper'
- show IsolateNatives, enterJsAsync, isWorker, leaveJsAsync;
+import 'dart:_isolate_helper' show thisScript, isWorker;
-import 'dart:async'
- show
- Completer,
- DeferredLoadException,
- Future,
- StreamController,
- Stream,
- StreamSubscription,
- scheduleMicrotask,
- Zone;
+import 'dart:async' show Completer, DeferredLoadException, Future;
import 'dart:_foreign_helper'
show
DART_CLOSURE_TO_JS,
JS,
JS_BUILTIN,
- JS_CALL_IN_ISOLATE,
JS_CONST,
- JS_CURRENT_ISOLATE_CONTEXT,
JS_EFFECT,
JS_EMBEDDED_GLOBAL,
JS_GET_FLAG,
@@ -62,11 +51,7 @@
import 'dart:_native_typed_data';
import 'dart:_js_names'
- show
- extractKeys,
- mangledNames,
- unmangleGlobalNameIfPreservedAnyways,
- unmangleAllIdentifiersIfPreservedAnyways;
+ show extractKeys, mangledNames, unmangleAllIdentifiersIfPreservedAnyways;
part 'annotations.dart';
part 'constant_map.dart';
@@ -226,16 +211,6 @@
'returns:var;effects:none;depends:none', JsBuiltin.getType, index);
}
-/// Returns a Dart closure for the global function with the given [name].
-///
-/// The [name] is the globally unique (minified) JavaScript name of the
-/// function. The name must be in correspondence with the propertyName that is
-/// used when creating a tear-off (see [fromTearOff]).
-Function createDartClosureFromNameOfStaticFunction(String name) {
- return JS_BUILTIN('returns:Function',
- JsBuiltin.createDartClosureFromNameOfStaticFunction, name);
-}
-
/// No-op method that is called to inform the compiler that preambles might
/// be needed when executing the resulting JS file in a command-line
/// JS engine.
@@ -2471,19 +2446,19 @@
return result;
}
-invokeClosure(Function closure, var isolate, int numberOfArguments, var arg1,
- var arg2, var arg3, var arg4) {
+invokeClosure(Function closure, int numberOfArguments, var arg1, var arg2,
+ var arg3, var arg4) {
switch (numberOfArguments) {
case 0:
- return JS_CALL_IN_ISOLATE(isolate, () => closure());
+ return closure();
case 1:
- return JS_CALL_IN_ISOLATE(isolate, () => closure(arg1));
+ return closure(arg1);
case 2:
- return JS_CALL_IN_ISOLATE(isolate, () => closure(arg1, arg2));
+ return closure(arg1, arg2);
case 3:
- return JS_CALL_IN_ISOLATE(isolate, () => closure(arg1, arg2, arg3));
+ return closure(arg1, arg2, arg3);
case 4:
- return JS_CALL_IN_ISOLATE(isolate, () => closure(arg1, arg2, arg3, arg4));
+ return closure(arg1, arg2, arg3, arg4);
}
throw new Exception('Unsupported number of arguments for wrapped closure');
}
@@ -2500,14 +2475,13 @@
function = JS(
'var',
r'''
- (function(closure, arity, context, invoke) {
+ (function(closure, arity, invoke) {
return function(a1, a2, a3, a4) {
- return invoke(closure, context, arity, a1, a2, a3, a4);
+ return invoke(closure, arity, a1, a2, a3, a4);
};
- })(#,#,#,#)''',
+ })(#,#,#)''',
closure,
arity,
- JS_CURRENT_ISOLATE_CONTEXT(),
DART_CLOSURE_TO_JS(invokeClosure));
JS('void', r'#.$identity = #', closure, function);
@@ -2548,9 +2522,6 @@
*
* In other words, creates a tear-off closure.
*
- * The [propertyName] argument is used by
- * [JsBuiltin.createDartClosureFromNameOfStaticFunction].
- *
* Called from [closureFromTearOff] as well as from reflection when tearing
* of a method via `getField`.
*
@@ -3818,6 +3789,15 @@
});
}
+/// The `nonce` value on the current script used for strict-CSP, if any.
+String _cspNonce = _computeCspNonce();
+
+String _computeCspNonce() {
+ var currentScript = JS_EMBEDDED_GLOBAL('', CURRENT_SCRIPT);
+ if (currentScript == null) return null;
+ return JS('String', 'String(#.nonce)', currentScript);
+}
+
Future<Null> _loadHunk(String hunkName) {
Future<Null> future = _loadingLibraries[hunkName];
_eventLog.add(' - _loadHunk: $hunkName');
@@ -3826,7 +3806,7 @@
return future.then((_) => null);
}
- String uri = IsolateNatives.thisScript;
+ String uri = thisScript;
int index = uri.lastIndexOf('/');
uri = '${uri.substring(0, index + 1)}$hunkName';
@@ -3865,11 +3845,6 @@
}
} else if (isWorker()) {
// We are in a web worker. Load the code with an XMLHttpRequest.
- enterJsAsync();
- Future<Null> leavingFuture = completer.future.whenComplete(() {
- leaveJsAsync();
- });
-
int index = uri.lastIndexOf('/');
uri = '${uri.substring(0, index + 1)}$hunkName';
var xhr = JS('var', 'new XMLHttpRequest()');
@@ -3907,6 +3882,9 @@
var script = JS('', 'document.createElement("script")');
JS('', '#.type = "text/javascript"', script);
JS('', '#.src = #', script, uri);
+ if (_cspNonce != null && _cspNonce != '') {
+ JS('', '#.nonce = #', script, _cspNonce);
+ }
JS('', '#.addEventListener("load", #, false)', script, jsSuccess);
JS('', '#.addEventListener("error", #, false)', script, jsFailure);
JS('', 'document.body.appendChild(#)', script);
diff --git a/sdk/lib/_internal/js_runtime/lib/js_rti.dart b/sdk/lib/_internal/js_runtime/lib/js_rti.dart
index 9a0627c..44df4af 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_rti.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_rti.dart
@@ -575,7 +575,6 @@
// Interceptor is needed for JSArray and native classes.
// TODO(sra): It could be a more specialized interceptor since [object] is not
// `null` or a primitive.
- // TODO(9586): Move type info for static functions onto an interceptor.
var interceptor = getInterceptor(object);
var isSubclass = getField(interceptor, isField);
// When we read the field and it is not there, [isSubclass] will be `null`.
@@ -592,7 +591,6 @@
// Interceptor is needed for JSArray and native classes.
// TODO(sra): It could be a more specialized interceptor since [object] is not
// `null` or a primitive.
- // TODO(9586): Move type info for static functions onto an interceptor.
var interceptor = getInterceptor(object);
var isSubclass = getField(interceptor, isField);
// When we read the field and it is not there, [isSubclass] will be `null`.
diff --git a/sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart b/sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart
index 36c5e25..284232a 100644
--- a/sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart
+++ b/sdk/lib/_internal/js_runtime/lib/shared/embedded_names.dart
@@ -138,43 +138,6 @@
/// This embedded global is set at startup, just before invoking `main`.
const CURRENT_SCRIPT = 'currentScript';
-/// Returns a function that creates a new Isolate (its static state).
-///
-/// (floitsch): Note that this embedded global will probably go away, since one
-/// JS heap will only contain one Dart isolate.
-const CREATE_NEW_ISOLATE = 'createNewIsolate';
-
-/// Returns a class-id of the given instance.
-///
-/// The extracted id can be used to built a new instance of the same type
-/// (see [INSTANCE_FROM_CLASS_ID].
-///
-/// This embedded global is used for serialization in the isolate-library.
-const CLASS_ID_EXTRACTOR = 'classIdExtractor';
-
-/// Returns an empty instance of the given class-id.
-///
-/// Given a class-id (see [CLASS_ID_EXTRACTOR]) returns an empty instance.
-///
-/// This embedded global is used for deserialization in the isolate-library.
-const INSTANCE_FROM_CLASS_ID = "instanceFromClassId";
-
-/// Returns a list of (mangled) field names for the given instance.
-///
-/// The list of fields can be used to extract the instance's values and then
-/// initialize an empty instance (see [INITIALIZE_EMPTY_INSTANCE].
-///
-/// This embedded global is used for serialization in the isolate-library.
-const CLASS_FIELDS_EXTRACTOR = 'classFieldsExtractor';
-
-/// Initializes the given empty instance with the given fields.
-///
-/// The given fields are in an array and must be in the same order as the
-/// field-names obtained by [CLASS_FIELDS_EXTRACTOR].
-///
-/// This embedded global is used for deserialization in the isolate-library.
-const INITIALIZE_EMPTY_INSTANCE = "initializeEmptyInstance";
-
/// Contains a map from load-ids to lists of part indexes.
///
/// To load the deferred library that is represented by the load-id, the runtime
@@ -250,29 +213,6 @@
/// An emitter-internal embedded global. This global is not used by the runtime.
const FINISHED_CLASSES = 'finishedClasses';
-/// An emitter-internal embedded global. This global is not used by the runtime.
-///
-/// The constant remains in this file to make sure that other embedded globals
-/// don't clash with it.
-///
-/// It can be used by the compiler to store a mapping from static function names
-/// to dart-closure getters (which can be useful for
-/// [JsBuiltin.createDartClosureFromNameOfStaticFunction].
-const GLOBAL_FUNCTIONS = 'globalFunctions';
-
-/// An emitter-internal embedded global. This global is not used by the runtime.
-///
-/// The constant remains in this file to make sure that other embedded globals
-/// don't clash with it.
-///
-/// This embedded global stores a function that returns a dart-closure getter
-/// for a given static function name.
-///
-/// This embedded global is used to implement
-/// [JsBuiltin.createDartClosureFromNameOfStaticFunction], and is only
-/// used with isolates.
-const STATIC_FUNCTION_NAME_TO_CLOSURE = 'staticFunctionNameToClosure';
-
/// A JavaScript object literal that maps the (minified) JavaScript constructor
/// name (as given by [JsBuiltin.rawRtiToJsConstructorName] to the
/// JavaScript constructor.
@@ -475,16 +415,4 @@
/// JS_BUILTIN('returns:var;effects:none;depends:none',
/// JsBuiltin.getType, index);
getType,
-
- /// Returns a Dart closure for the global function with the given [name].
- ///
- /// The [name] is the globally unique (minified) JavaScript name of the
- /// function (same as the one stored in [STATIC_FUNCTION_NAME_PROPERTY_NAME])
- ///
- /// This builtin is used when a static closure was sent to a different
- /// isolate.
- ///
- /// JS_BUILTIN('returns:Function',
- /// JsBuiltin.createDartClosureFromNameOfStaticFunction, name);
- createDartClosureFromNameOfStaticFunction,
}
diff --git a/sdk/lib/async/stream.dart b/sdk/lib/async/stream.dart
index 4f9f8a9..5df84c5 100644
--- a/sdk/lib/async/stream.dart
+++ b/sdk/lib/async/stream.dart
@@ -935,22 +935,13 @@
/**
* Adapt this stream to be a `Stream<R>`.
*
- * If this stream already has the desired type, its returned directly.
- * Otherwise it is wrapped as a `Stream<R>` which checks at run-time that
- * each data event emitted by this stream is also an instance of [R].
- */
- Stream<R> cast<R>() {
- Stream<Object> self = this;
- return self is Stream<R> ? self : retype<R>();
- }
-
- /**
- * Adapt this stream to be a `Stream<R>`.
- *
* This stream is wrapped as a `Stream<R>` which checks at run-time that
* each data event emitted by this stream is also an instance of [R].
*/
- Stream<R> retype<R>() => Stream.castFrom<T, R>(this);
+ Stream<R> cast<R>() => Stream.castFrom<T, R>(this);
+
+ @Deprecated("Use cast instead.")
+ Stream<R> retype<R>() => cast<R>();
/**
* Collects all elements of this stream in a [List].
@@ -2021,15 +2012,6 @@
Stream<T> bind(Stream<S> stream);
/**
- * Provides a `StreamTransformer<RS, RT>` view of this stream transformer.
- *
- * If this transformer already has the desired type, or a subtype,
- * it is returned directly,
- * otherwise returns the result of `retype<RS, RT>()`.
- */
- StreamTransformer<RS, RT> cast<RS, RT>();
-
- /**
* Provides a `StreamTrasformer<RS, RT>` view of this stream transformer.
*
* The resulting transformer will check at run-time that all data events
@@ -2037,6 +2019,9 @@
* and it will check that all data events produced by this transformer
* are acually instances of [RT].
*/
+ StreamTransformer<RS, RT> cast<RS, RT>();
+
+ @Deprecated("Use cast instead.")
StreamTransformer<RS, RT> retype<RS, RT>();
}
@@ -2048,13 +2033,11 @@
abstract class StreamTransformerBase<S, T> implements StreamTransformer<S, T> {
const StreamTransformerBase();
- StreamTransformer<RS, RT> cast<RS, RT>() {
- StreamTransformer<Object, Object> self = this;
- return self is StreamTransformer<RS, RT> ? self : retype<RS, RT>();
- }
-
- StreamTransformer<RS, RT> retype<RS, RT>() =>
+ StreamTransformer<RS, RT> cast<RS, RT>() =>
StreamTransformer.castFrom<S, T, RS, RT>(this);
+
+ @Deprecated("Use cast instead.")
+ StreamTransformer<RS, RT> retype<RS, RT>() => cast<RS, RT>();
}
/**
diff --git a/sdk/lib/collection/collections.dart b/sdk/lib/collection/collections.dart
index 743e27a..f20b5ce 100644
--- a/sdk/lib/collection/collections.dart
+++ b/sdk/lib/collection/collections.dart
@@ -21,13 +21,10 @@
*/
UnmodifiableListView(Iterable<E> source) : _source = source;
- List<R> cast<R>() {
- List<Object> self = this;
- if (self is List<R>) return self;
- return new UnmodifiableListView<R>(_source.cast<R>());
- }
+ List<R> cast<R>() => new UnmodifiableListView(_source.cast<R>());
- List<R> retype<R>() => new UnmodifiableListView(_source.retype<R>());
+ @Deprecated("Use cast instead.")
+ List<R> retype<R>() => cast<R>();
int get length => _source.length;
diff --git a/sdk/lib/collection/hash_set.dart b/sdk/lib/collection/hash_set.dart
index b652da3..b75dc44 100644
--- a/sdk/lib/collection/hash_set.dart
+++ b/sdk/lib/collection/hash_set.dart
@@ -14,14 +14,10 @@
Set<R> _newSimilarSet<R>();
- Set<R> cast<R>() {
- Set<Object> self = this;
- return self is Set<R>
- ? self
- : Set.castFrom<E, R>(this, newSet: _newSimilarSet);
- }
+ Set<R> cast<R>() => Set.castFrom<E, R>(this, newSet: _newSimilarSet);
- Set<R> retype<R>() => Set.castFrom<E, R>(this, newSet: _newSimilarSet);
+ @Deprecated("Use cast instead.")
+ Set<R> retype<R>() => cast<R>();
Set<E> difference(Set<Object> other) {
Set<E> result = _newSet();
diff --git a/sdk/lib/collection/iterable.dart b/sdk/lib/collection/iterable.dart
index 6b88ff9..fe1873a 100644
--- a/sdk/lib/collection/iterable.dart
+++ b/sdk/lib/collection/iterable.dart
@@ -15,12 +15,10 @@
// - SetMixin
// If changing a method here, also change the other copies.
- Iterable<R> cast<R>() {
- Iterable<Object> self = this;
- return self is Iterable<R> ? self : Iterable.castFrom<E, R>(this);
- }
+ Iterable<R> cast<R>() => Iterable.castFrom<E, R>(this);
- Iterable<R> retype<R>() => Iterable.castFrom<E, R>(this);
+ @Deprecated("Use cast instead.")
+ Iterable<R> retype<R>() => cast<R>();
Iterable<T> map<T>(T f(E element)) => new MappedIterable<E, T>(this, f);
diff --git a/sdk/lib/collection/list.dart b/sdk/lib/collection/list.dart
index 4ced94b..fb430a7 100644
--- a/sdk/lib/collection/list.dart
+++ b/sdk/lib/collection/list.dart
@@ -329,12 +329,10 @@
this.length = 0;
}
- List<R> cast<R>() {
- List<Object> self = this;
- return self is List<R> ? self : List.castFrom<E, R>(this);
- }
+ List<R> cast<R>() => List.castFrom<E, R>(this);
- List<R> retype<R>() => List.castFrom<E, R>(this);
+ @Deprecated("Use cast instead.")
+ List<R> retype<R>() => cast<R>();
E removeLast() {
if (length == 0) {
diff --git a/sdk/lib/collection/maps.dart b/sdk/lib/collection/maps.dart
index bdd775a..5bc178d 100644
--- a/sdk/lib/collection/maps.dart
+++ b/sdk/lib/collection/maps.dart
@@ -118,12 +118,10 @@
// It should clear the map even if some keys are not equal to themselves.
void clear();
- Map<RK, RV> cast<RK, RV>() {
- Map<Object, Object> self = this;
- return self is Map<RK, RV> ? self : Map.castFrom<K, V, RK, RV>(this);
- }
+ Map<RK, RV> cast<RK, RV>() => Map.castFrom<K, V, RK, RV>(this);
- Map<RK, RV> retype<RK, RV>() => Map.castFrom<K, V, RK, RV>(this);
+ @Deprecated("Use cast instead.")
+ Map<RK, RV> retype<RK, RV>() => cast<RK, RV>();
void forEach(void action(K key, V value)) {
for (K key in keys) {
@@ -318,7 +316,8 @@
Map<RK, RV> cast<RK, RV>() => _map.cast<RK, RV>();
- Map<RK, RV> retype<RK, RV>() => _map.retype<RK, RV>();
+ @Deprecated("Use cast instead.")
+ Map<RK, RV> retype<RK, RV>() => cast<RK, RV>();
V operator [](Object key) => _map[key];
void operator []=(K key, V value) {
@@ -380,12 +379,9 @@
with _UnmodifiableMapMixin<K, V> {
UnmodifiableMapView(Map<K, V> map) : super(map);
- Map<RK, RV> cast<RK, RV>() {
- Map<Object, Object> self = this;
- if (self is Map<RK, RV>) return self;
- return new UnmodifiableMapView<RK, RV>(_map.cast<RK, RV>());
- }
+ Map<RK, RV> cast<RK, RV>() =>
+ new UnmodifiableMapView<RK, RV>(_map.cast<RK, RV>());
- Map<RK, RV> retype<RK, RV>() =>
- new UnmodifiableMapView<RK, RV>(_map.retype<RK, RV>());
+ @Deprecated("Use cast instead.")
+ Map<RK, RV> retype<RK, RV>() => cast<RK, RV>();
}
diff --git a/sdk/lib/collection/queue.dart b/sdk/lib/collection/queue.dart
index 48136e6..2242fb2 100644
--- a/sdk/lib/collection/queue.dart
+++ b/sdk/lib/collection/queue.dart
@@ -66,9 +66,7 @@
new CastQueue<S, T>(source);
/**
- * Provides a view of this queue as a queue of [R] instances.
- *
- * If this queue is already a `Queue<R>`, it is returned unchanged.
+ * Provides a view of this queue as a queue of [R] instances, if necessary.
*
* If this queue contains only instances of [R], all read operations
* will work correctly. If any operation tries to access an element
@@ -81,18 +79,7 @@
*/
Queue<R> cast<R>();
- /**
- * Provides a view of this queue as a queue of [R] instances, if necessary.
- *
- * If this queue contains only instances of [R], all read operations
- * will work correctly. If any operation tries to access an element
- * that is not an instance of [R], the access will throw instead.
- *
- * Elements added to the queue (e.g., by using [addFirst] or [addAll])
- * must be instance of [R] to be valid arguments to the adding function,
- * and they must be instances of [E] as well to be accepted by
- * this queue as well.
- */
+ @Deprecated("Use cast instead.")
Queue<R> retype<R>();
/**
@@ -356,12 +343,10 @@
factory DoubleLinkedQueue.of(Iterable<E> elements) =>
new DoubleLinkedQueue<E>()..addAll(elements);
- Queue<R> cast<R>() {
- Queue<Object> self = this;
- return self is Queue<R> ? self : Queue.castFrom<E, R>(this);
- }
+ Queue<R> cast<R>() => Queue.castFrom<E, R>(this);
- Queue<R> retype<R>() => Queue.castFrom<E, R>(this);
+ @Deprecated("Use cast instead.")
+ Queue<R> retype<R>() => cast<R>();
int get length => _elementCount;
@@ -657,12 +642,10 @@
// Iterable interface.
- Queue<R> cast<R>() {
- Queue<Object> self = this;
- return self is Queue<R> ? self : this.retype<R>();
- }
+ Queue<R> cast<R>() => Queue.castFrom<E, R>(this);
- Queue<R> retype<R>() => Queue.castFrom<E, R>(this);
+ @Deprecated("Use cast instead.")
+ Queue<R> retype<R>() => cast<R>();
Iterator<E> get iterator => new _ListQueueIterator<E>(this);
diff --git a/sdk/lib/collection/set.dart b/sdk/lib/collection/set.dart
index 377d574..86e8329 100644
--- a/sdk/lib/collection/set.dart
+++ b/sdk/lib/collection/set.dart
@@ -23,10 +23,6 @@
* Implementations of `Set` using this mixin should consider also implementing
* `clear` in constant time. The default implementation works by removing every
* element.
- *
- * The [cast] implementation uses [retype] to do the actual cast, so if
- * the cast operation wants to pass a custom `newSet` to [Set.castFrom],
- * it only needs to override [retype].
*/
abstract class SetMixin<E> implements Set<E> {
// This class reimplements all of [IterableMixin].
@@ -51,12 +47,10 @@
bool get isNotEmpty => length != 0;
- Set<R> cast<R>() {
- Set<Object> self = this;
- return self is Set<R> ? self : this.retype<R>();
- }
+ Set<R> cast<R>() => Set.castFrom<E, R>(this);
- Set<R> retype<R>() => Set.castFrom<E, R>(this);
+ @Deprecated("Use cast instead.")
+ Set<R> retype<R>() => cast<R>();
Iterable<E> followedBy(Iterable<E> other) =>
new FollowedByIterable<E>.firstEfficient(this, other);
diff --git a/sdk/lib/collection/splay_tree.dart b/sdk/lib/collection/splay_tree.dart
index fad3ce8..dce7dc5 100644
--- a/sdk/lib/collection/splay_tree.dart
+++ b/sdk/lib/collection/splay_tree.dart
@@ -765,12 +765,10 @@
Set<T> _newSet<T>() =>
new SplayTreeSet<T>((T a, T b) => _comparator(a as E, b as E), _validKey);
- Set<R> cast<R>() {
- Set<Object> self = this;
- return self is Set<R> ? self : Set.castFrom<E, R>(this, newSet: _newSet);
- }
+ Set<R> cast<R>() => Set.castFrom<E, R>(this, newSet: _newSet);
- Set<R> retype<R>() => Set.castFrom<E, R>(this, newSet: _newSet);
+ @Deprecated("Use cast instead.")
+ Set<R> retype<R>() => cast<R>();
int _compare(E e1, E e2) => _comparator(e1, e2);
diff --git a/sdk/lib/convert/converter.dart b/sdk/lib/convert/converter.dart
index 01d6186..3fdcb4c 100644
--- a/sdk/lib/convert/converter.dart
+++ b/sdk/lib/convert/converter.dart
@@ -59,24 +59,15 @@
/**
* Provides a `Converter<RS, RT>` view of this stream transformer.
*
- * If this transformer already has the desired type, or a subtype,
- * it is returned directly,
- * otherwise returns the result of `retype<RS, RT>()`.
- */
- Converter<RS, RT> cast<RS, RT>() {
- Converter<Object, Object> self = this;
- return self is Converter<RS, RT> ? self : retype<RS, RT>();
- }
-
- /**
- * Provides a `Converter<RS, RT>` view of this stream transformer.
- *
* The resulting transformer will check at run-time that all conversion
* inputs are actually instances of [S],
* and it will check that all conversion output produced by this converter
* are acually instances of [RT].
*/
- Converter<RS, RT> retype<RS, RT>() => Converter.castFrom<S, T, RS, RT>(this);
+ Converter<RS, RT> cast<RS, RT>() => Converter.castFrom<S, T, RS, RT>(this);
+
+ @Deprecated("Use cast instead.")
+ Converter<RS, RT> retype<RS, RT>() => cast<RS, RT>();
}
/**
diff --git a/sdk/lib/core/iterable.dart b/sdk/lib/core/iterable.dart
index 2187812..99361f7 100644
--- a/sdk/lib/core/iterable.dart
+++ b/sdk/lib/core/iterable.dart
@@ -154,20 +154,6 @@
Iterator<E> get iterator;
/**
- * Makes this iterable useful as an `Iterable<R>`, if necessary.
- *
- * Like [retype] except that this iterable is returned as-is
- * if it is already an `Iterable<R>`.
- *
- * It means that `someIterable.cast<Object>().toList()` is not guaranteed
- * to return precisely a `List<Object>`, but it may return a subtype.
- */
- Iterable<R> cast<R>() {
- Iterable<Object> self = this;
- return self is Iterable<R> ? self : Iterable.castFrom<E, R>(this);
- }
-
- /**
* Provides a view of this iterable as an iterable of [R] instances.
*
* If this iterable only contains instances of [R], all operations
@@ -177,7 +163,10 @@
* When the returned iterable creates a new object that depends on
* the type [R], e.g., from [toList], it will have exactly the type [R].
*/
- Iterable<R> retype<R>() => Iterable.castFrom<E, R>(this);
+ Iterable<R> cast<R>() => Iterable.castFrom<E, R>(this);
+
+ @Deprecated("Use cast instead.")
+ Iterable<R> retype<R>() => cast<R>();
/**
* Returns the lazy concatentation of this iterable and [other].
diff --git a/sdk/lib/core/list.dart b/sdk/lib/core/list.dart
index 8df6ca5..bff5b31 100644
--- a/sdk/lib/core/list.dart
+++ b/sdk/lib/core/list.dart
@@ -254,22 +254,6 @@
}
/**
- * Returns a view of this list as a list of [R] instances, if necessary.
- *
- * If this list is already a `List<R>`, it is returned unchanged.
- *
- * If this list contains only instances of [R], all read operations
- * will work correctly. If any operation tries to access an element
- * that is not an instance of [R], the access will throw instead.
- *
- * Elements added to the list (e.g., by using [add] or [addAll])
- * must be instance of [R] to be valid arguments to the adding function,
- * and they must be instances of [E] as well to be accepted by
- * this list as well.
- */
- List<R> cast<R>();
-
- /**
* Returns a view of this list as a list of [R] instances.
*
* If this list contains only instances of [R], all read operations
@@ -283,6 +267,9 @@
*
* Typically implemented as `List.castFrom<E, R>(this)`.
*/
+ List<R> cast<R>();
+
+ @Deprecated("Use cast instead.")
List<R> retype<R>();
/**
diff --git a/sdk/lib/core/map.dart b/sdk/lib/core/map.dart
index 9009dff..51fda37f 100644
--- a/sdk/lib/core/map.dart
+++ b/sdk/lib/core/map.dart
@@ -181,20 +181,6 @@
* Provides a view of this map as having [RK] keys and [RV] instances,
* if necessary.
*
- * If this set contains only keys of type [RK] and values of type [RV],
- * all read operations will work correctly.
- * If any operation exposes a non-[RK] key or non-[RV] value,
- * the operation will throw instead.
- *
- * Entries added to the map must be valid for both a `Map<K, V>` and a
- * `Map<RK, RV>`.
- */
- Map<RK, RV> cast<RK, RV>();
-
- /**
- * Provides a view of this map as having [RK] keys and [RV] instances,
- * if necessary.
- *
* If this map is already a `Map<RK, RV>`, it is returned unchanged.
*
* If this set contains only keys of type [RK] and values of type [RV],
@@ -205,6 +191,9 @@
* Entries added to the map must be valid for both a `Map<K, V>` and a
* `Map<RK, RV>`.
*/
+ Map<RK, RV> cast<RK, RV>();
+
+ @Deprecated("Use cast instead.")
Map<RK, RV> retype<RK, RV>();
/**
diff --git a/sdk/lib/core/set.dart b/sdk/lib/core/set.dart
index e7c36be..d85ae2b 100644
--- a/sdk/lib/core/set.dart
+++ b/sdk/lib/core/set.dart
@@ -114,9 +114,7 @@
new CastSet<S, T>(source, newSet);
/**
- * Provides a view of this set as a set of [R] instances, if necessary.
- *
- * If this set is already a `Set<R>`, it is returned unchanged.
+ * Provides a view of this set as a set of [R] instances.
*
* If this set contains only instances of [R], all read operations
* will work correctly. If any operation tries to access an element
@@ -129,18 +127,7 @@
*/
Set<R> cast<R>();
- /**
- * Provides a view of this set as a set of [R] instances.
- *
- * If this set contains only instances of [R], all read operations
- * will work correctly. If any operation tries to access an element
- * that is not an instance of [R], the access will throw instead.
- *
- * Elements added to the set (e.g., by using [add] or [addAll])
- * must be instance of [R] to be valid arguments to the adding function,
- * and they must be instances of [E] as well to be accepted by
- * this set as well.
- */
+ @Deprecated("Use cast instead.")
Set<R> retype<R>();
/**
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index acf0390..1f622c4 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -46414,12 +46414,10 @@
});
}
- Map<K, V> cast<K, V>() {
- Map<Object, Object> self = this;
- return self is Map<K, V> ? self : Map.castFrom<String, String, K, V>(this);
- }
+ Map<K, V> cast<K, V>() => Map.castFrom<String, String, K, V>(this);
- Map<K, V> retype<K, V>() => Map.castFrom<String, String, K, V>(this);
+ @Deprecated("Use cast instead.")
+ Map<K, V> retype<K, V>() => cast<K, V>();
bool containsValue(Object value) {
for (var v in this.values) {
@@ -46581,12 +46579,10 @@
});
}
- Map<K, V> cast<K, V>() {
- Map<Object, Object> self = this;
- return self is Map<K, V> ? self : Map.castFrom<String, String, K, V>(this);
- }
+ Map<K, V> cast<K, V>() => Map.castFrom<String, String, K, V>(this);
- Map<K, V> retype<K, V>() => Map.castFrom<String, String, K, V>(this);
+ @Deprecated("Use cast instead.")
+ Map<K, V> retype<K, V>() => cast<K, V>();
// TODO: Use lazy iterator when it is available on Map.
bool containsValue(Object value) => values.any((v) => v == value);
diff --git a/sdk/lib/internal/async_cast.dart b/sdk/lib/internal/async_cast.dart
index 924ac53..eb59a7d 100644
--- a/sdk/lib/internal/async_cast.dart
+++ b/sdk/lib/internal/async_cast.dart
@@ -18,12 +18,10 @@
..onData(onData);
}
- Stream<R> cast<R>() {
- Stream<Object> self = this;
- return self is Stream<R> ? self : this.retype<R>();
- }
+ Stream<R> cast<R>() => new CastStream<S, R>(_source);
- Stream<R> retype<R>() => new CastStream<S, R>(_source);
+ @Deprecated("Use cast instead.")
+ Stream<R> retype<R>() => cast<R>();
}
class CastStreamSubscription<S, T> implements StreamSubscription<T> {
@@ -63,11 +61,12 @@
final StreamTransformer<SS, ST> _source;
CastStreamTransformer(this._source);
- // cast is inherited from StreamTransformerBase.
-
- StreamTransformer<RS, RT> retype<RS, RT>() =>
+ StreamTransformer<RS, RT> cast<RS, RT>() =>
new CastStreamTransformer<SS, ST, RS, RT>(_source);
+ @Deprecated("Use cast instead.")
+ StreamTransformer<RS, RT> retype<RS, RT>() => cast<RS, RT>();
+
Stream<TT> bind(Stream<TS> stream) =>
_source.bind(stream.cast<SS>()).cast<TT>();
}
@@ -83,6 +82,9 @@
Stream<TT> bind(Stream<TS> stream) =>
_source.bind(stream.cast<SS>()).cast<TT>();
- Converter<RS, RT> retype<RS, RT>() =>
+ Converter<RS, RT> cast<RS, RT>() =>
new CastConverter<SS, ST, RS, RT>(_source);
+
+ @Deprecated("Use cast instead.")
+ Converter<RS, RT> retype<RS, RT>() => cast<RS, RT>();
}
diff --git a/sdk/lib/internal/cast.dart b/sdk/lib/internal/cast.dart
index 9765253..c2a6ce4 100644
--- a/sdk/lib/internal/cast.dart
+++ b/sdk/lib/internal/cast.dart
@@ -188,13 +188,10 @@
static Set<R> _defaultEmptySet<R>() => new Set<R>();
- Set<R> cast<R>() {
- Set<Object> self = this;
- if (self is Set<R>) return self;
- return this.retype<R>();
- }
+ Set<R> cast<R>() => new CastSet<S, R>(_source, _emptySet);
- Set<R> retype<R>() => new CastSet<S, R>(_source, _emptySet);
+ @Deprecated("Use cast instead.")
+ Set<R> retype<R>() => cast<R>();
bool add(T value) => _source.add(value as S);
@@ -370,13 +367,10 @@
with _CastQueueMixin<S, T> {
final Queue<S> _source;
CastQueue(this._source);
- Queue<R> cast<R>() {
- Queue<Object> self = this;
- if (self is Queue<R>) return self;
- return retype<R>();
- }
+ Queue<R> cast<R>() => new CastQueue<S, R>(_source);
- Queue<R> retype<R>() => new CastQueue<S, R>(_source);
+ @Deprecated("Use cast instead.")
+ Queue<R> retype<R>() => cast<R>();
}
// TODO(lrn): Use when ListQueue implements List.
diff --git a/sdk/lib/io/process.dart b/sdk/lib/io/process.dart
index e1d4c23..3c7e1c2 100644
--- a/sdk/lib/io/process.dart
+++ b/sdk/lib/io/process.dart
@@ -159,7 +159,7 @@
@Deprecated("Use detachedWithStdio instead")
static const DETACHED_WITH_STDIO = detachedWithStdio;
- List<ProcessStartMode> get values => const <ProcessStartMode>[
+ static List<ProcessStartMode> get values => const <ProcessStartMode>[
normal,
inheritStdio,
detached,
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index ceb2592..d802885 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -40,6 +40,7 @@
Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t07: MissingCompileTimeError # Issue 24332
Language/Expressions/Property_Extraction/Getter_Access_and_Method_Extraction/class_object_member_t08: MissingCompileTimeError # Issue 24332
Language/Expressions/Shift/syntax_t01/14: MissingRuntimeError # Please triage this failure
+Language/Expressions/Spawning_an_Isolate/new_isolate_t01: SkipByDesign
Language/Libraries_and_Scripts/Imports/invalid_uri_deferred_t02: CompileTimeError # Please triage this failure
Language/Metadata/before_export_t01: RuntimeError # Please triage this failure
Language/Metadata/before_import_t01: RuntimeError # Please triage this failure
@@ -179,17 +180,7 @@
LibTest/html/IFrameElement/addEventListener_A01_t04: Skip # https://github.com/dart-lang/sdk/issues/28873
LibTest/html/IFrameElement/enteredView_A01_t01: CompileTimeError # co19-roll r706: Please triage this failure
LibTest/html/Window/postMessage_A01_t01: Skip # https://github.com/dart-lang/sdk/issues/28873
-LibTest/isolate/Isolate/spawnUri_A01_t01: Fail # Dart issue 15974
-LibTest/isolate/Isolate/spawnUri_A01_t02: Fail # Dart issue 15974
-LibTest/isolate/Isolate/spawnUri_A01_t03: Fail # Dart issue 15974
-LibTest/isolate/Isolate/spawnUri_A01_t04: Fail # Dart issue 15974
-LibTest/isolate/Isolate/spawnUri_A01_t05: Fail # Dart issue 15974
-LibTest/isolate/Isolate/spawnUri_A01_t06: RuntimeError # Dart issue 15974
-LibTest/isolate/Isolate/spawnUri_A01_t07: RuntimeError # Dart issue 15974
-LibTest/isolate/Isolate/spawnUri_A02_t01: RuntimeError, Pass # Dart issue 15617
-LibTest/isolate/Isolate/spawn_A02_t02: RuntimeError, Pass # Dart issue 15617
-LibTest/isolate/Isolate/spawn_A04_t01: RuntimeError # Dart issue 15974
-LibTest/isolate/Isolate/spawn_A06_t06: Skip # Times out. Please triage this failure.
+LibTest/isolate/*: SkipByDesign # dart:isolate not supported.
LibTest/math/MutableRectangle/boundingBox_A01_t01: RuntimeError, Pass # co19-roll r706: Please triage this failure.
LibTest/math/Rectangle/boundingBox_A01_t01: RuntimeError, Pass # co19-roll r706: Please triage this failure.
LibTest/math/pow_A04_t01: Fail # co19-roll r587: Please triage this failure
@@ -1281,7 +1272,6 @@
LayoutTests/fast/text/line-break-after-question-mark_t01: RuntimeError # Please triage this failure
LayoutTests/fast/text/text-combine-shrink-to-fit_t01: RuntimeError # Please triage this failure
LibTest/async/Timer/Timer.periodic_A01_t01: Skip # Times out. Please triage this failure
-LibTest/isolate/Isolate/spawn_A01_t05: Skip # Times out. Please triage this failure
WebPlatformTest/shadow-dom/events/retargeting-focus-events/test-002_t01: Skip # Times out. Please triage this failure
[ $compiler == dart2js && $runtime == chrome && $system != macos ]
@@ -1466,13 +1456,6 @@
LibTest/core/int/remainder_A01_t01: Fail # Please triage this failure.
LibTest/core/int/remainder_A01_t03: Fail # Please triage this failure.
LibTest/core/int/toRadixString_A01_t01: Fail # Please triage this failure.
-LibTest/isolate/Isolate/spawnUri_A01_t01: Skip # Please triage this failure.
-LibTest/isolate/Isolate/spawnUri_A01_t02: Skip # Please triage this failure.
-LibTest/isolate/Isolate/spawnUri_A01_t03: Skip # Please triage this failure.
-LibTest/isolate/Isolate/spawnUri_A02_t01: RuntimeError # Please triage this failure.
-LibTest/isolate/Isolate/spawnUri_A02_t02: Skip # Please triage this failure.
-LibTest/isolate/Isolate/spawnUri_A02_t03: Skip # Please triage this failure.
-LibTest/isolate/Isolate/spawnUri_A02_t04: Skip # Please triage this failure.
LibTest/math/log_A01_t01: Fail # Please triage this failure.
LibTest/typed_data/Float32x4List/Float32x4List.view_A01_t02: RuntimeError # Please triage this failure.
LibTest/typed_data/Float32x4List/Float32x4List.view_A06_t01: RuntimeError # Please triage this failure.
@@ -1483,8 +1466,6 @@
LibTest/typed_data/Uint8ClampedList/map_A02_t01: Pass, Slow # Please triage this failure.
[ $compiler == dart2js && $runtime == d8 ]
-LibTest/isolate/Isolate/spawn_A03_t01: Pass # co19 issue 77
-LibTest/isolate/Isolate/spawn_A04_t02: RuntimeError # Please triage this failure.
LibTest/typed_data/Float32x4List/Float32x4List.view_A06_t01: Fail # co19-roll r587: Please triage this failure
LibTest/typed_data/Int32x4/operator_OR_A01_t01: RuntimeError # Issue 7728, timer not supported in jsshell
@@ -1493,9 +1474,6 @@
Language/Expressions/Instance_Creation/New/redirecting_factory_constructor_t02: RuntimeError
Language/Generics/malformed_t02: Crash
-[ $compiler == dart2js && $runtime == d8 && $fast_startup ]
-LibTest/isolate/Isolate/spawn_A04_t04: Pass # Technically fails, but since sync-async was turned on, this test completes before it fails. Underlying issue: #27558
-
[ $compiler == dart2js && $runtime == d8 && $fasta ]
LayoutTests/*: SkipByDesign
LibTest/html/*: SkipByDesign
@@ -5592,22 +5570,6 @@
LibTest/core/Stopwatch/start_A01_t03: RuntimeError # Issue 7728, timer not supported in jsshell
LibTest/core/Stopwatch/stop_A01_t01: RuntimeError # Issue 7728, timer not supported in jsshell
LibTest/core/Uri/Uri_A06_t03: Pass, Slow
-LibTest/isolate/Isolate/spawn_A03_t01: RuntimeError # Please triage this failure
-LibTest/isolate/Isolate/spawn_A03_t03: RuntimeError # Please triage this failure
-LibTest/isolate/Isolate/spawn_A03_t04: RuntimeError # Please triage this failure
-LibTest/isolate/Isolate/spawn_A04_t02: RuntimeError # Please triage this failure
-LibTest/isolate/Isolate/spawn_A04_t03: Fail # Please triage this failure
-LibTest/isolate/Isolate/spawn_A04_t04: Fail # Issue 27558
-LibTest/isolate/Isolate/spawn_A04_t05: Fail # Please triage this failure
-LibTest/isolate/Isolate/spawn_A06_t02: Fail # Please triage this failure
-LibTest/isolate/Isolate/spawn_A06_t03: Fail # Please triage this failure
-LibTest/isolate/Isolate/spawn_A06_t04: RuntimeError # Please triage this failure
-LibTest/isolate/Isolate/spawn_A06_t05: RuntimeError # Please triage this failure
-LibTest/isolate/Isolate/spawn_A06_t07: Fail # Please triage this failure
-LibTest/isolate/RawReceivePort/close_A01_t01: RuntimeError # Issue 7728, timer not supported in jsshell
-LibTest/isolate/ReceivePort/asBroadcastStream_A03_t01: RuntimeError # Issue 7728, timer not supported in jsshell
-LibTest/isolate/ReceivePort/asBroadcastStream_A04_t03: RuntimeError # Issue 7728, timer not supported in jsshell
-LibTest/isolate/ReceivePort/close_A01_t01: RuntimeError # Issue 7728, timer not supported in jsshell
LibTest/typed_data/Float32List/toList_A01_t01: Skip # co19-roll r559: Please triage this failure
LibTest/typed_data/Float32x4List/Float32x4List.view_A06_t01: Fail # co19-roll r587: Please triage this failure
LibTest/typed_data/Float64List/toList_A01_t01: Skip # co19-roll r559: Please triage this failure
@@ -5625,9 +5587,6 @@
LibTest/core/Uri/Uri_A06_t03: Skip # Issue 18093, timeout.
LibTest/core/Uri/encodeQueryComponent_A01_t02: Skip # Issue 18093, timeout.
-[ $compiler == dart2js && $runtime == jsshell && $fast_startup ]
-LibTest/isolate/ReceivePort/asBroadcastStream_A03_t01: Fail # please triage
-
[ $compiler == dart2js && $runtime == safari ]
LayoutTests/fast/alignment/parse-align-items_t01: RuntimeError # Please triage this failure
LayoutTests/fast/alignment/parse-align-self_t01: RuntimeError # Please triage this failure
@@ -7107,7 +7066,6 @@
LibTest/html/Window/requestFileSystem_A01_t01: Crash
LibTest/html/Window/requestFileSystem_A01_t02: Crash
LibTest/html/Window/requestFileSystem_A02_t01: Crash
-LibTest/isolate/SendPort/send_A01_t03: RuntimeError
WebPlatformTest/html/semantics/embedded-content/the-audio-element/audio_constructor_t01: RuntimeError
[ $compiler == dart2js && $fasta && $host_checked ]
@@ -7260,9 +7218,6 @@
Language/Variables/final_t01/01: CompileTimeError # co19 issue 77
Language/Variables/final_t02/01: CompileTimeError # co19 issue 77
Language/Variables/local_variable_t01: MissingCompileTimeError # Issue 21050
-LibTest/isolate/SendPort/send_A01_t01: CompileTimeError # co19-roll r706: Please triage this failure
-LibTest/isolate/SendPort/send_A01_t02: CompileTimeError # co19-roll r706: Please triage this failure
-LibTest/isolate/SendPort/send_A01_t03: CompileTimeError # co19-roll r706: Please triage this failure
[ $compiler == dart2js && $jscl ]
LibTest/core/RegExp/Pattern_semantics/firstMatch_NonEmptyClassRanges_A01_t01: RuntimeError, OK # This is not rejected by V8. Issue 22200
diff --git a/tests/compiler/dart2js/async_await/async_await_js_transform_test.dart b/tests/compiler/dart2js/async_await/async_await_js_transform_test.dart
index adefec8..f86c1f1 100644
--- a/tests/compiler/dart2js/async_await/async_await_js_transform_test.dart
+++ b/tests/compiler/dart2js/async_await/async_await_js_transform_test.dart
@@ -31,7 +31,7 @@
asyncReturn: new VariableUse("returnHelper"),
asyncRethrow: new VariableUse("rethrowHelper"),
completerFactory: new VariableUse("NewCompleter"),
- completerFactoryTypeArgument: new VariableUse("CompleterType"),
+ completerFactoryTypeArguments: [new VariableUse("CompleterType")],
wrapBody: new VariableUse("_wrapJsFunctionForAsync"),
safeVariableName: (String name) => "__$name",
bodyName: new StringBackedName("body")));
@@ -44,7 +44,7 @@
new SyncStarRewriter(null, null,
endOfIteration: new VariableUse("endOfIteration"),
iterableFactory: new VariableUse("NewIterable"),
- iterableFactoryTypeArgument: new VariableUse("IterableType"),
+ iterableFactoryTypeArguments: [new VariableUse("IterableType")],
yieldStarExpression: new VariableUse("yieldStar"),
uncaughtErrorExpression: new VariableUse("uncaughtError"),
safeVariableName: (String name) => "__$name",
diff --git a/tests/compiler/dart2js/closure/closure_test.dart b/tests/compiler/dart2js/closure/closure_test.dart
index 9cd4a87..96f99de 100644
--- a/tests/compiler/dart2js/closure/closure_test.dart
+++ b/tests/compiler/dart2js/closure/closure_test.dart
@@ -8,12 +8,10 @@
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
-import 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/kernel/element_map.dart';
import 'package:compiler/src/kernel/kernel_backend_strategy.dart';
import 'package:compiler/src/js_model/locals.dart';
-import 'package:compiler/src/tree/nodes.dart' as ast;
import 'package:compiler/src/universe/world_builder.dart';
import 'package:compiler/src/util/util.dart';
import 'package:expect/expect.dart';
@@ -26,27 +24,11 @@
main(List<String> args) {
asyncTest(() async {
Directory dataDir = new Directory.fromUri(Platform.script.resolve('data'));
- await checkTests(dataDir, computeClosureData, computeKernelClosureData,
+ await checkTests(dataDir, computeKernelClosureData,
skipForKernel: skipForKernel, args: args);
});
}
-/// Compute closure data mapping for [_member] as a [MemberElement].
-///
-/// Fills [actualMap] with the data and [sourceSpanMap] with the source spans
-/// for the data origin.
-void computeClosureData(
- Compiler compiler, MemberEntity _member, Map<Id, ActualData> actualMap,
- {bool verbose: false}) {
- MemberElement member = _member;
- ClosureDataLookup<ast.Node> closureDataLookup =
- compiler.backendStrategy.closureDataLookup as ClosureDataLookup<ast.Node>;
- new ClosureAstComputer(compiler.reporter, actualMap, member.resolvedAst,
- closureDataLookup, compiler.codegenWorldBuilder,
- verbose: verbose)
- .run();
-}
-
/// Compute closure data mapping for [member] as a kernel based element.
///
/// Fills [actualMap] with the data and [sourceSpanMap] with the source spans
@@ -75,61 +57,6 @@
.run(definition.node);
}
-/// Ast visitor for computing closure data.
-class ClosureAstComputer extends AstDataExtractor with ComputeValueMixin {
- final ClosureDataLookup<ast.Node> closureDataLookup;
- final CodegenWorldBuilder codegenWorldBuilder;
- final bool verbose;
-
- ClosureAstComputer(DiagnosticReporter reporter, Map<Id, ActualData> actualMap,
- ResolvedAst resolvedAst, this.closureDataLookup, this.codegenWorldBuilder,
- {this.verbose: false})
- : super(reporter, actualMap, resolvedAst) {
- pushMember(resolvedAst.element as MemberElement);
- }
-
- visitFunctionExpression(ast.FunctionExpression node) {
- Entity localFunction = resolvedAst.elements.getFunctionDefinition(node);
- if (localFunction is LocalFunctionElement) {
- pushMember(localFunction.callMethod);
- pushLocalFunction(node);
- super.visitFunctionExpression(node);
- popLocalFunction();
- popMember();
- } else {
- super.visitFunctionExpression(node);
- }
- }
-
- visitLoop(ast.Loop node) {
- pushLoopNode(node);
- super.visitLoop(node);
- popLoop();
- }
-
- @override
- String computeNodeValue(Id id, ast.Node node, [AstElement element]) {
- if (element != null && element.isLocal) {
- if (element.isFunction) {
- LocalFunctionElement localFunction = element;
- return computeObjectValue(localFunction.callMethod);
- } else {
- LocalElement local = element;
- return computeLocalValue(local);
- }
- }
- // TODO(johnniwinther,efortuna): Collect data for other nodes?
- return null;
- }
-
- @override
- String computeElementValue(Id id, covariant MemberElement element) {
- // TODO(johnniwinther,efortuna): Collect data for the member
- // (has thisLocal, has box, etc.).
- return computeObjectValue(element);
- }
-}
-
/// Kernel IR visitor for computing closure data.
class ClosureIrChecker extends IrDataExtractor with ComputeValueMixin<ir.Node> {
final MemberEntity member;
diff --git a/tests/compiler/dart2js/closure/data/test_type.dart b/tests/compiler/dart2js/closure/data/test_type.dart
index c74d190..aaadba2 100644
--- a/tests/compiler/dart2js/closure/data/test_type.dart
+++ b/tests/compiler/dart2js/closure/data/test_type.dart
@@ -38,7 +38,6 @@
class Class3<T> {
/*element: Class3.method3:hasThis*/
method3(dynamic o) {
- /*ast.fields=[o],free=[o],hasThis*/
/*kernel.fields=[o],free=[o],hasThis*/
/*strong.fields=[o,this],free=[o,this],hasThis*/
T local() => o;
diff --git a/tests/compiler/dart2js/closure/data/type_annotations.dart b/tests/compiler/dart2js/closure/data/type_annotations.dart
index 329252f..112565e 100644
--- a/tests/compiler/dart2js/closure/data/type_annotations.dart
+++ b/tests/compiler/dart2js/closure/data/type_annotations.dart
@@ -48,7 +48,6 @@
class Class2<T> {
/*element: Class2.method2:hasThis*/
method2() {
- /*ast.hasThis*/
/*kernel.hasThis*/
/*strong.fields=[this],free=[this],hasThis*/
dynamic local(T t) => t;
@@ -64,7 +63,6 @@
class Class3<T> {
/*element: Class3.method3:hasThis*/
method3(dynamic o) {
- /*ast.fields=[o],free=[o],hasThis*/
/*kernel.fields=[o],free=[o],hasThis*/
/*strong.fields=[o,this],free=[o,this],hasThis*/
T local() => o;
@@ -108,7 +106,6 @@
class Class6<T> {
/*element: Class6.method6:hasThis*/
method6() {
- /*ast.hasThis*/
/*kernel.hasThis*/
/*strong.fields=[this],free=[this],hasThis*/
dynamic local(T t) {
@@ -129,7 +126,6 @@
class Class7<T> {
/*element: Class7.method7:hasThis*/
method7(dynamic o) {
- /*ast.fields=[o],free=[o],hasThis*/
/*kernel.fields=[o],free=[o],hasThis*/
/*strong.fields=[o,this],free=[o,this],hasThis*/
T local() {
diff --git a/tests/compiler/dart2js/closure/show.dart b/tests/compiler/dart2js/closure/show.dart
index ae6eb5e..870eea9 100644
--- a/tests/compiler/dart2js/closure/show.dart
+++ b/tests/compiler/dart2js/closure/show.dart
@@ -16,7 +16,6 @@
argParser.addFlag('callers', defaultsTo: false);
ArgResults results = argParser.parse(args);
- ComputeMemberDataFunction astFunction = computeClosureData;
ComputeMemberDataFunction kernelFunction = computeKernelClosureData;
- await show(results, astFunction, kernelFunction);
+ await show(results, kernelFunction);
}
diff --git a/tests/compiler/dart2js/codegen/type_inference8_test.dart b/tests/compiler/dart2js/codegen/type_inference8_test.dart
index e1be1bb..502aa96 100644
--- a/tests/compiler/dart2js/codegen/type_inference8_test.dart
+++ b/tests/compiler/dart2js/codegen/type_inference8_test.dart
@@ -5,10 +5,10 @@
/// TODO(johnniwinther): Move this test to the codegen folder.
import "package:async_helper/async_helper.dart";
+import "package:compiler/src/commandline_options.dart";
import "package:compiler/src/constants/values.dart";
import "package:compiler/src/types/types.dart";
import "package:expect/expect.dart";
-import '../compiler_helper.dart';
import '../memory_compiler.dart';
import 'dart:async';
@@ -35,21 +35,26 @@
Future runTest1() async {
var result = await runCompiler(
memorySourceFiles: {'main.dart': TEST1},
- options: ['--use-old-frontend', '--disable-inlining']);
+ options: [Flags.disableInlining]);
var compiler = result.compiler;
var typesInferrer = compiler.globalInference.typesInferrerInternal;
- var commonMasks = typesInferrer.closedWorld.abstractValueDomain;
- MemberElement element = findElement(compiler, "foo");
+ var closedWorld = typesInferrer.closedWorld;
+ var elementEnvironment = closedWorld.elementEnvironment;
+ var commonMasks = closedWorld.abstractValueDomain;
+ var element = elementEnvironment.lookupLibraryMember(
+ elementEnvironment.mainLibrary, 'foo');
var mask = typesInferrer.getReturnTypeOfMember(element);
var falseType =
new ValueTypeMask(commonMasks.boolType, new FalseConstantValue());
// 'foo' should always return false
Expect.equals(falseType, mask);
// the argument to 'bar' is always false
- dynamic bar = findElement(compiler, "bar");
- var barArg = bar.parameters.first;
- var barArgMask = typesInferrer.getTypeOfParameter(barArg);
- Expect.equals(falseType, barArgMask);
+ dynamic bar = elementEnvironment.lookupLibraryMember(
+ elementEnvironment.mainLibrary, 'bar');
+ compiler.codegenWorldBuilder.forEachParameterAsLocal(bar, (barArg) {
+ var barArgMask = typesInferrer.getTypeOfParameter(barArg);
+ Expect.equals(falseType, barArgMask);
+ });
var barCode = compiler.backend.getGeneratedCode(bar);
Expect.isTrue(barCode.contains('"bbb"'));
Expect.isFalse(barCode.contains('"aaa"'));
@@ -78,19 +83,24 @@
Future runTest2() async {
var result = await runCompiler(
memorySourceFiles: {'main.dart': TEST2},
- options: ['--use-old-frontend', '--disable-inlining']);
+ options: [Flags.disableInlining]);
var compiler = result.compiler;
var typesInferrer = compiler.globalInference.typesInferrerInternal;
var commonMasks = typesInferrer.closedWorld.abstractValueDomain;
- MemberElement element = findElement(compiler, "foo");
+ var closedWorld = typesInferrer.closedWorld;
+ var elementEnvironment = closedWorld.elementEnvironment;
+ var element = elementEnvironment.lookupLibraryMember(
+ elementEnvironment.mainLibrary, 'foo');
var mask = typesInferrer.getReturnTypeOfMember(element);
// Can't infer value for foo's return type, it could be either true or false
Expect.identical(commonMasks.boolType, mask);
- dynamic bar = findElement(compiler, "bar");
- var barArg = bar.parameters.first;
- var barArgMask = typesInferrer.getTypeOfParameter(barArg);
- // The argument to bar should have the same type as the return type of foo
- Expect.identical(commonMasks.boolType, barArgMask);
+ dynamic bar = elementEnvironment.lookupLibraryMember(
+ elementEnvironment.mainLibrary, 'bar');
+ compiler.codegenWorldBuilder.forEachParameterAsLocal(bar, (barArg) {
+ var barArgMask = typesInferrer.getTypeOfParameter(barArg);
+ // The argument to bar should have the same type as the return type of foo
+ Expect.identical(commonMasks.boolType, barArgMask);
+ });
var barCode = compiler.backend.getGeneratedCode(bar);
Expect.isTrue(barCode.contains('"bbb"'));
// Still must output the print for "aaa"
diff --git a/tests/compiler/dart2js/dart2js.status b/tests/compiler/dart2js/dart2js.status
index de4f98d..1360b6c 100644
--- a/tests/compiler/dart2js/dart2js.status
+++ b/tests/compiler/dart2js/dart2js.status
@@ -36,6 +36,8 @@
rti/rti_need0_test: Pass, Slow
rti/rti_need1_test: Pass, Slow
show_package_warnings_test: RuntimeError # missing errors from the FE
+sourcemaps/d2js_validity_test: RuntimeError # Issue 33072
+sourcemaps/deferred_d2js_validity_test: RuntimeError # Issue 33072
sourcemaps/pub_build_validity_test: Pass, RuntimeError # Investigate: passes locally, but only fails in bots.
sourcemaps/source_mapping_invokes_test: Pass, Slow
sourcemaps/source_mapping_operators_test: Pass, Slow
diff --git a/tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart b/tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart
index 37b9fed..8abed7c 100644
--- a/tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart
+++ b/tests/compiler/dart2js/deferred_loading/deferred_loading_test.dart
@@ -7,7 +7,6 @@
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/deferred_load.dart';
-import 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/kernel/element_map.dart';
import 'package:compiler/src/kernel/kernel_backend_strategy.dart';
@@ -32,9 +31,7 @@
main(List<String> args) {
asyncTest(() async {
Directory dataDir = new Directory.fromUri(Platform.script.resolve('data'));
- await checkTests(
- dataDir, computeAstOutputUnitData, computeKernelOutputUnitData,
- computeClassDataFromAst: computeAstClassOutputUnitData,
+ await checkTests(dataDir, computeKernelOutputUnitData,
computeClassDataFromKernel: computeKernelClassOutputUnitData,
libDirectory: new Directory.fromUri(Platform.script.resolve('libs')),
skipForKernel: skipForKernel,
@@ -81,46 +78,6 @@
return 'OutputUnit(${unit.name}, {$sb})';
}
-/// Compute closure data mapping for [member] as a [MemberElement].
-///
-/// Fills [actualMap] with the data computed about what the resulting OutputUnit
-/// is.
-void computeAstOutputUnitData(
- Compiler compiler, MemberEntity _member, Map<Id, ActualData> actualMap,
- {bool verbose: false}) {
- MemberElement member = _member;
- OutputUnitData data = compiler.backend.outputUnitData;
- String value = outputUnitString(data.outputUnitForEntity(member));
-
- _registerValue(computeElementId(member), value, member, member.sourcePosition,
- actualMap, compiler.reporter);
-
- if (member is FieldElement && member.isConst) {
- var node = member.initializer;
- var constant = compiler.constants.getConstantValue(member.constant);
- if (constant.isPrimitive) return;
- _registerValue(
- new NodeId(node.getBeginToken().charOffset, IdKind.node),
- outputUnitString(data.outputUnitForConstant(constant)),
- member,
- new SourceSpan(member.resolvedAst.sourceUri,
- node.getBeginToken().charOffset, node.getEndToken().charEnd),
- actualMap,
- compiler.reporter);
- }
-}
-
-void computeAstClassOutputUnitData(
- Compiler compiler, ClassEntity _cls, Map<Id, ActualData> actualMap,
- {bool verbose: false}) {
- ClassElement cls = _cls;
- OutputUnitData data = compiler.backend.outputUnitData;
- String value = outputUnitString(data.outputUnitForEntity(cls));
-
- _registerValue(new ClassId(cls.name), value, cls, cls.sourcePosition,
- actualMap, compiler.reporter);
-}
-
/// OutputData for [member] as a kernel based element.
///
/// At this point the compiler has already been run, so it is holding the
diff --git a/tests/compiler/dart2js/deferred_loading/libs/deferred_typed_map_lib1.dart b/tests/compiler/dart2js/deferred_loading/libs/deferred_typed_map_lib1.dart
index 36d7d4a..e5b0dc7 100644
--- a/tests/compiler/dart2js/deferred_loading/libs/deferred_typed_map_lib1.dart
+++ b/tests/compiler/dart2js/deferred_loading/libs/deferred_typed_map_lib1.dart
@@ -9,8 +9,7 @@
/*element: table:OutputUnit(1, {lib})*/
const table =
-/*ast.null*/
-/*!ast.OutputUnit(1, {lib})*/
+/*OutputUnit(1, {lib})*/
const <int, FF>{1: f1, 2: f2};
/*element: f1:OutputUnit(1, {lib})*/
diff --git a/tests/compiler/dart2js/deferred_loading/libs/type_argument_dependency_lib2.dart b/tests/compiler/dart2js/deferred_loading/libs/type_argument_dependency_lib2.dart
index bf70190..a5a50fd 100644
--- a/tests/compiler/dart2js/deferred_loading/libs/type_argument_dependency_lib2.dart
+++ b/tests/compiler/dart2js/deferred_loading/libs/type_argument_dependency_lib2.dart
@@ -2,7 +2,6 @@
// 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.
-/*ast.class: A:OutputUnit(1, {c})*/
/*kernel.class: A:OutputUnit(1, {c})*/
/*strong.class: A:OutputUnit(main, {})*/
/*omit.class: A:OutputUnit(main, {})*/
diff --git a/tests/compiler/dart2js/end_to_end/exit_code_test.dart b/tests/compiler/dart2js/end_to_end/exit_code_test.dart
index a6549af..f12e914 100644
--- a/tests/compiler/dart2js/end_to_end/exit_code_test.dart
+++ b/tests/compiler/dart2js/end_to_end/exit_code_test.dart
@@ -10,9 +10,8 @@
import 'package:expect/expect.dart';
import 'package:compiler/compiler_new.dart' as api;
+import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/common/codegen.dart';
-import 'package:compiler/src/common/resolution.dart';
-import 'package:compiler/src/compile_time_constants.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/dart2js.dart' as entry;
import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
@@ -20,14 +19,11 @@
import 'package:compiler/src/diagnostics/messages.dart';
import 'package:compiler/src/diagnostics/spannable.dart';
import 'package:compiler/src/apiimpl.dart' as apiimpl;
-import 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/js_backend/js_backend.dart';
import 'package:compiler/src/library_loader.dart';
import 'package:compiler/src/null_compiler_output.dart';
import 'package:compiler/src/options.dart' show CompilerOptions;
-import 'package:compiler/src/resolution/resolution.dart';
-import 'package:compiler/src/scanner/scanner_task.dart';
import 'package:compiler/src/universe/world_impact.dart';
import 'package:compiler/src/world.dart';
import 'diagnostic_reporter_helper.dart';
@@ -58,17 +54,6 @@
return new TestBackend(this);
}
- @override
- ScannerTask createScannerTask() => new TestScanner(this);
-
- @override
- Resolution createResolution() => new TestResolution(this);
-
- @override
- ResolverTask createResolverTask() {
- return new TestResolver(this, backend.constantCompilerTask);
- }
-
Future<bool> run(Uri uri) {
test('Compiler.run');
return super.run(uri);
@@ -146,46 +131,6 @@
}
}
-class TestScanner extends ScannerTask {
- final TestCompiler compiler;
-
- TestScanner(TestCompiler compiler)
- : compiler = compiler,
- super(compiler.dietParser, compiler.reporter, compiler.measurer);
-
- void scanElements(CompilationUnitElement compilationUnit) {
- compiler.test('ScannerTask.scanElements');
- super.scanElements(compilationUnit);
- }
-}
-
-class TestResolver extends ResolverTask {
- final TestCompiler compiler;
-
- TestResolver(TestCompiler compiler, ConstantCompiler constantCompiler)
- : this.compiler = compiler,
- super(compiler.resolution, constantCompiler, compiler.measurer);
-
- void computeClassMembers(ClassElement element) {
- compiler.test('ResolverTask.computeClassMembers');
- super.computeClassMembers(element);
- }
-}
-
-class TestResolution extends CompilerResolution {
- TestCompiler compiler;
-
- TestResolution(TestCompiler compiler)
- : this.compiler = compiler,
- super(compiler);
-
- @override
- WorldImpact computeWorldImpact(Element element) {
- compiler.test('Compiler.analyzeElement');
- return super.computeWorldImpact(element);
- }
-}
-
int checkedResults = 0;
Future testExitCode(
@@ -242,7 +187,6 @@
List<String> args = new List<String>.from(options)
// TODO(sigmund): convert to support the new CFE
- ..add("--use-old-frontend")
..add("--library-root=${Uri.base.resolve('sdk/')}")
..add("tests/compiler/dart2js/end_to_end/data/exit_code_helper.dart");
Future result = entry.internalMain(args);
@@ -293,11 +237,8 @@
'Compiler': beforeRun,
'Compiler.run': beforeRun,
'Compiler.processLoadedLibraries': beforeRun,
- 'ScannerTask.scanElements': duringRun,
'Compiler.withCurrentElement': duringRun,
- 'Compiler.analyzeElement': duringRun,
'Compiler.codegen': duringRun,
- 'ResolverTask.computeClassMembers': duringRun,
};
int totalExpectedErrors = 0;
@@ -310,7 +251,7 @@
expected =
_expectedExitCode(beforeRun: tests[marker], fatalWarnings: true);
totalExpectedErrors += expected.length;
- await testExitCodes(marker, expected, ['--fatal-warnings']);
+ await testExitCodes(marker, expected, [Flags.fatalWarnings]);
}
Expect.equals(totalExpectedErrors, checkedResults);
diff --git a/tests/compiler/dart2js/equivalence/check_functions.dart b/tests/compiler/dart2js/equivalence/check_functions.dart
index b06c4ed..1a0222c 100644
--- a/tests/compiler/dart2js/equivalence/check_functions.dart
+++ b/tests/compiler/dart2js/equivalence/check_functions.dart
@@ -458,8 +458,6 @@
usage2.isInvokeOnUsed);
check(usage1, usage2, 'isRuntimeTypeUsed', usage1.isRuntimeTypeUsed,
usage2.isRuntimeTypeUsed);
- check(usage1, usage2, 'isIsolateInUse', usage1.isIsolateInUse,
- usage2.isIsolateInUse);
check(usage1, usage2, 'isFunctionApplyUsed', usage1.isFunctionApplyUsed,
usage2.isFunctionApplyUsed);
check(usage1, usage2, 'isNoSuchMethodUsed', usage1.isNoSuchMethodUsed,
@@ -915,8 +913,6 @@
backendUsage1.isRuntimeTypeUsed,
backendUsage2.isRuntimeTypeUsed,
"JavaScriptBackend.hasRuntimeTypeSupport mismatch");
- Expect.equals(backendUsage1.isIsolateInUse, backendUsage2.isIsolateInUse,
- "JavaScriptBackend.hasIsolateSupport mismatch");
}
void checkCodegenEnqueuers(CodegenEnqueuer enqueuer1, CodegenEnqueuer enqueuer2,
@@ -1026,8 +1022,6 @@
program1.outputContainsConstantList, program2.outputContainsConstantList);
check(program1, program2, 'needsNativeSupport', program1.needsNativeSupport,
program2.needsNativeSupport);
- check(program1, program2, 'hasIsolateSupport', program1.hasIsolateSupport,
- program2.hasIsolateSupport);
check(program1, program2, 'hasSoftDeferredClasses',
program1.hasSoftDeferredClasses, program2.hasSoftDeferredClasses);
checkMaps(
diff --git a/tests/compiler/dart2js/equivalence/id_equivalence.dart b/tests/compiler/dart2js/equivalence/id_equivalence.dart
index 93500b0..c2828f6 100644
--- a/tests/compiler/dart2js/equivalence/id_equivalence.dart
+++ b/tests/compiler/dart2js/equivalence/id_equivalence.dart
@@ -3,13 +3,8 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:compiler/src/common.dart';
-import 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/kernel/element_map.dart';
import 'package:compiler/src/js_model/locals.dart';
-import 'package:compiler/src/resolution/access_semantics.dart';
-import 'package:compiler/src/resolution/send_structure.dart';
-import 'package:compiler/src/resolution/tree_elements.dart';
-import 'package:compiler/src/tree/nodes.dart' as ast;
import 'package:expect/expect.dart';
import 'package:kernel/ast.dart' as ir;
@@ -258,361 +253,6 @@
}
}
-/// Abstract AST visitor for computing data corresponding to a node or element,
-// and record it with a generic [Id].
-abstract class AstDataExtractor extends ast.Visitor with DataRegistry {
- final DiagnosticReporter reporter;
- final Map<Id, ActualData> actualMap;
- final ResolvedAst resolvedAst;
-
- AstDataExtractor(this.reporter, this.actualMap, this.resolvedAst);
-
- /// Implement this to compute the data corresponding to [element].
- ///
- /// If `null` is returned, [element] has no associated data.
- String computeElementValue(Id id, AstElement element);
-
- /// Implement this to compute the data corresponding to [node]. If [node] has
- /// a corresponding [AstElement] this is provided in [element].
- ///
- /// If `null` is returned, [node] has no associated data.
- String computeNodeValue(Id id, ast.Node node, AstElement element);
-
- TreeElements get elements => resolvedAst.elements;
-
- ast.Node computeAccessPosition(ast.Send node, AccessSemantics access) {
- switch (access.kind) {
- case AccessKind.THIS_PROPERTY:
- case AccessKind.DYNAMIC_PROPERTY:
- case AccessKind.CONDITIONAL_DYNAMIC_PROPERTY:
- case AccessKind.LOCAL_VARIABLE:
- case AccessKind.FINAL_LOCAL_VARIABLE:
- case AccessKind.LOCAL_FUNCTION:
- case AccessKind.PARAMETER:
- case AccessKind.FINAL_PARAMETER:
- case AccessKind.EXPRESSION:
- return node.selector;
- default:
- return null;
- }
- }
-
- ast.Node computeUpdatePosition(ast.Send node, AccessSemantics access) {
- switch (access.kind) {
- case AccessKind.THIS_PROPERTY:
- case AccessKind.DYNAMIC_PROPERTY:
- case AccessKind.LOCAL_VARIABLE:
- case AccessKind.PARAMETER:
- return node.selector;
- default:
- return null;
- }
- }
-
- void computeForElement(AstElement element) {
- ElementId id = computeElementId(element);
- if (id == null) return;
- String value = computeElementValue(id, element);
- registerValue(element.sourcePosition, id, value, element);
- }
-
- void computeForNode(ast.Node node, NodeId id, [AstElement element]) {
- if (id == null) return;
- String value = computeNodeValue(id, node, element);
- SourceSpan sourceSpan = computeSourceSpan(node);
- registerValue(sourceSpan, id, value, element ?? node);
- }
-
- SourceSpan computeSourceSpan(ast.Node node) {
- return new SourceSpan(resolvedAst.sourceUri,
- node.getBeginToken().charOffset, node.getEndToken().charEnd);
- }
-
- NodeId computeDefaultNodeId(ast.Node node) {
- return new NodeId(node.getBeginToken().charOffset, IdKind.node);
- }
-
- NodeId createAccessId(ast.Node node) {
- return new NodeId(node.getBeginToken().charOffset, IdKind.node);
- }
-
- NodeId createInvokeId(ast.Node node) {
- return new NodeId(node.getBeginToken().charOffset, IdKind.invoke);
- }
-
- NodeId createUpdateId(ast.Node node) {
- return new NodeId(node.getBeginToken().charOffset, IdKind.update);
- }
-
- NodeId createIteratorId(ast.ForIn node) {
- return new NodeId(node.getBeginToken().charOffset, IdKind.iterator);
- }
-
- NodeId createCurrentId(ast.ForIn node) {
- return new NodeId(node.getBeginToken().charOffset, IdKind.current);
- }
-
- NodeId createMoveNextId(ast.ForIn node) {
- return new NodeId(node.getBeginToken().charOffset, IdKind.moveNext);
- }
-
- NodeId createLabeledStatementId(ast.LabeledStatement node) =>
- computeDefaultNodeId(node.statement);
-
- NodeId createLoopId(ast.Node node) => computeDefaultNodeId(node);
-
- NodeId createGotoId(ast.Node node) => computeDefaultNodeId(node);
-
- NodeId createSwitchId(ast.SwitchStatement node) => computeDefaultNodeId(node);
-
- NodeId createSwitchCaseId(ast.SwitchCase node) {
- ast.Node position;
- for (ast.Node child in node.labelsAndCases) {
- if (child.asCaseMatch() != null) {
- ast.CaseMatch caseMatch = child;
- position = caseMatch.expression;
- break;
- }
- }
- if (position != null) {
- return computeDefaultNodeId(position);
- }
- return null;
- }
-
- void run() {
- if (resolvedAst.kind == ResolvedAstKind.PARSED) {
- reporter.withCurrentElement(resolvedAst.element.implementation, () {
- resolvedAst.node.accept(this);
- });
- } else {
- computeForElement(resolvedAst.element);
- }
- }
-
- visitNode(ast.Node node) {
- node.visitChildren(this);
- }
-
- visitVariableDefinitions(ast.VariableDefinitions node) {
- for (ast.Node child in node.definitions) {
- if (child == null) continue;
- AstElement element = elements[child];
- if (element == null) {
- reportHere(reporter, child, 'No element for variable.');
- } else if (element.isField) {
- if (element == elements.analyzedElement) {
- computeForElement(element);
- }
- } else if (!element.isLocal) {
- computeForElement(element);
- } else if (element.isInitializingFormal) {
- ast.Send send = child;
- computeForNode(child, computeDefaultNodeId(send.selector), element);
- } else if (child is ast.FunctionExpression) {
- computeForNode(child, computeDefaultNodeId(child.name), element);
- } else {
- computeForNode(child, computeDefaultNodeId(child), element);
- }
- }
- visitNode(node);
- }
-
- visitFunctionExpression(ast.FunctionExpression node) {
- AstElement element = elements.getFunctionDefinition(node);
- if (element != null) {
- if (!element.isLocal) {
- computeForElement(element);
- } else {
- computeForNode(node, computeDefaultNodeId(node), element);
- }
- visitNode(node);
- }
- }
-
- visitSend(ast.Send node) {
- dynamic sendStructure = elements.getSendStructure(node);
- if (sendStructure != null) {
- switch (sendStructure.kind) {
- case SendStructureKind.GET:
- ast.Node position =
- computeAccessPosition(node, sendStructure.semantics);
- if (position != null) {
- computeForNode(node, computeDefaultNodeId(position));
- }
- break;
- case SendStructureKind.INVOKE:
- case SendStructureKind.INCOMPATIBLE_INVOKE:
- switch (sendStructure.semantics.kind) {
- case AccessKind.EXPRESSION:
- computeForNode(node,
- createInvokeId(node.typeArgumentsNode ?? node.argumentsNode));
- break;
- case AccessKind.LOCAL_VARIABLE:
- case AccessKind.FINAL_LOCAL_VARIABLE:
- case AccessKind.PARAMETER:
- case AccessKind.FINAL_PARAMETER:
- computeForNode(node, createAccessId(node));
- computeForNode(node,
- createInvokeId(node.typeArgumentsNode ?? node.argumentsNode));
- break;
- case AccessKind.STATIC_FIELD:
- case AccessKind.FINAL_STATIC_FIELD:
- case AccessKind.TOPLEVEL_FIELD:
- case AccessKind.FINAL_TOPLEVEL_FIELD:
- case AccessKind.STATIC_GETTER:
- case AccessKind.SUPER_FIELD:
- case AccessKind.SUPER_FINAL_FIELD:
- case AccessKind.SUPER_GETTER:
- computeForNode(node,
- createInvokeId(node.typeArgumentsNode ?? node.argumentsNode));
- break;
- case AccessKind.TOPLEVEL_GETTER:
- if (elements[node].isDeferredLoaderGetter) {
- computeForNode(node, createInvokeId(node.selector));
- } else {
- computeForNode(
- node,
- createInvokeId(
- node.typeArgumentsNode ?? node.argumentsNode));
- }
- break;
- default:
- ast.Node position =
- computeAccessPosition(node, sendStructure.semantics);
- if (position != null) {
- computeForNode(node, createInvokeId(position));
- }
- }
- break;
- case SendStructureKind.BINARY:
- case SendStructureKind.UNARY:
- case SendStructureKind.EQUALS:
- case SendStructureKind.NOT_EQUALS:
- ast.Node position =
- computeAccessPosition(node, sendStructure.semantics);
- if (position != null) {
- computeForNode(node, createInvokeId(position));
- }
- break;
- case SendStructureKind.INDEX:
- ast.Node position =
- computeAccessPosition(node, sendStructure.semantics);
- if (position != null) {
- computeForNode(node, createAccessId(position));
- }
- break;
- case SendStructureKind.SET:
- break;
- default:
- }
- }
- visitNode(node);
- }
-
- visitSendSet(ast.SendSet node) {
- dynamic sendStructure = elements.getSendStructure(node);
- if (sendStructure != null) {
- outer:
- switch (sendStructure.kind) {
- case SendStructureKind.SET:
- ast.Node position =
- computeUpdatePosition(node, sendStructure.semantics);
- if (position != null) {
- computeForNode(node, createUpdateId(position));
- }
- break;
- case SendStructureKind.INDEX_SET:
- computeForNode(node, createUpdateId(node.selector));
- break;
- case SendStructureKind.COMPOUND_INDEX_SET:
- case SendStructureKind.INDEX_PREFIX:
- case SendStructureKind.INDEX_POSTFIX:
- computeForNode(node, createInvokeId(node.assignmentOperator));
- switch (sendStructure.semantics.kind) {
- case AccessKind.UNRESOLVED_SUPER:
- break outer;
- case AccessKind.COMPOUND:
- switch (sendStructure.semantics.compoundAccessKind) {
- case CompoundAccessKind.SUPER_GETTER_SETTER:
- case CompoundAccessKind.UNRESOLVED_SUPER_GETTER:
- case CompoundAccessKind.UNRESOLVED_SUPER_SETTER:
- break outer;
- default:
- }
- break;
- default:
- }
- computeForNode(node, createAccessId(node.selector));
- computeForNode(node, createUpdateId(node.selector));
- break;
- case SendStructureKind.PREFIX:
- case SendStructureKind.POSTFIX:
- case SendStructureKind.COMPOUND:
- switch (sendStructure.semantics.kind) {
- case AccessKind.COMPOUND:
- case AccessKind.TOPLEVEL_FIELD:
- case AccessKind.STATIC_FIELD:
- computeForNode(node, createInvokeId(node.assignmentOperator));
- break;
- default:
- computeForNode(node, createAccessId(node.selector));
- computeForNode(node, createInvokeId(node.assignmentOperator));
- computeForNode(node, createUpdateId(node.selector));
- break;
- }
- break;
- default:
- }
- }
- visitNode(node);
- }
-
- visitLoop(ast.Loop node) {
- computeForNode(node, createLoopId(node));
- visitNode(node);
- }
-
- visitGotoStatement(ast.GotoStatement node) {
- computeForNode(node, createGotoId(node));
- visitNode(node);
- }
-
- visitLabeledStatement(ast.LabeledStatement node) {
- if (node.statement is! ast.Loop && node.statement is! ast.SwitchStatement) {
- computeForNode(node, createLabeledStatementId(node));
- }
- visitNode(node);
- }
-
- visitSwitchStatement(ast.SwitchStatement node) {
- computeForNode(node, createSwitchId(node));
- visitNode(node);
- }
-
- visitSwitchCase(ast.SwitchCase node) {
- computeForNode(node, createSwitchCaseId(node));
- visitNode(node);
- }
-
- visitForIn(ast.ForIn node) {
- computeForNode(node, createIteratorId(node));
- computeForNode(node, createCurrentId(node));
- computeForNode(node, createMoveNextId(node));
- visitLoop(node);
- }
-}
-
-/// Compute a canonical [Id] for AST-based nodes.
-ElementId computeElementId(AstElement element) {
- String memberName = element.name;
- if (element.isSetter) {
- memberName += '=';
- }
- String className = element.enclosingClass?.name;
- return new ElementId.internal(memberName, className: className);
-}
-
/// Compute a canonical [Id] for kernel-based nodes.
Id computeEntityId(ir.Member node) {
String className;
diff --git a/tests/compiler/dart2js/equivalence/id_equivalence1_test.dart b/tests/compiler/dart2js/equivalence/id_equivalence1_test.dart
deleted file mode 100644
index 553ae8f..0000000
--- a/tests/compiler/dart2js/equivalence/id_equivalence1_test.dart
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright (c) 2018, 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 'id_equivalence_tester.dart';
-
-main(List<String> args) {
- mainInternal(args, dataDirectories1);
-}
diff --git a/tests/compiler/dart2js/equivalence/id_equivalence2_test.dart b/tests/compiler/dart2js/equivalence/id_equivalence2_test.dart
deleted file mode 100644
index c7c81cf..0000000
--- a/tests/compiler/dart2js/equivalence/id_equivalence2_test.dart
+++ /dev/null
@@ -1,9 +0,0 @@
-// Copyright (c) 2018, 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 'id_equivalence_tester.dart';
-
-main(List<String> args) {
- mainInternal(args, dataDirectories2);
-}
diff --git a/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart b/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart
index 82bea10..6c824ed 100644
--- a/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart
+++ b/tests/compiler/dart2js/equivalence/id_equivalence_helper.dart
@@ -11,16 +11,12 @@
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/elements/entities.dart';
-import 'package:compiler/src/elements/elements.dart';
-import 'package:compiler/src/io/source_file.dart';
-import 'package:compiler/src/source_file_provider.dart';
import 'package:compiler/src/world.dart';
import 'package:expect/expect.dart';
import 'package:sourcemap_testing/src/annotated_code_helper.dart';
import '../memory_compiler.dart';
import '../equivalence/id_equivalence.dart';
-import '../kernel/test_helpers.dart';
/// `true` if ANSI colors are supported by stdout.
bool useColors = stdout.supportsAnsiEscapes;
@@ -108,9 +104,6 @@
.reportErrorMessage(spannable, MessageKind.GENERIC, {'text': message});
}
-/// Display name used for compilation using the old dart2js frontend.
-const String astName = 'dart2js old frontend';
-
/// Display name used for compilation using the new common frontend.
const String kernelName = 'kernel';
@@ -157,15 +150,9 @@
Map<Id, ActualData> globalData = <Id, ActualData>{};
Map<Id, ActualData> actualMapFor(Entity entity) {
- if (entity is Element) {
- // TODO(johnniwinther): Remove this when patched members from kernel are
- // no longer ascribed to the patch file.
- Element element = entity;
- entity = element.implementation;
- }
SourceSpan span =
compiler.backendStrategy.spanFromSpannable(entity, entity);
- Uri uri = resolveFastaUri(span.uri);
+ Uri uri = span.uri;
return actualMaps.putIfAbsent(uri, () => <Id, ActualData>{});
}
@@ -173,9 +160,6 @@
if (member.isAbstract) {
return;
}
- if (member is ConstructorElement && member.isRedirectingFactory) {
- return;
- }
if (skipUnprocessedMembers &&
!closedWorld.processedMembers.contains(member)) {
return;
@@ -463,10 +447,9 @@
/// [setUpFunction] is called once for every test that is executed.
/// If [forUserSourceFilesOnly] is true, we examine the elements in the main
/// file and any supporting libraries.
-Future checkTests(Directory dataDir, ComputeMemberDataFunction computeFromAst,
- ComputeMemberDataFunction computeFromKernel,
+Future checkTests(
+ Directory dataDir, ComputeMemberDataFunction computeFromKernel,
{bool testStrongMode: true,
- List<String> skipForAst: const <String>[],
List<String> skipForKernel: const <String>[],
List<String> skipForStrong: const <String>[],
bool filterActualData(IdValue idValue, ActualData actualData),
@@ -475,7 +458,6 @@
Directory libDirectory: null,
bool forUserLibrariesOnly: true,
Callback setUpFunction,
- ComputeClassDataFunction computeClassDataFromAst,
ComputeClassDataFunction computeClassDataFromKernel,
int shards: 1,
int shardIndex: 0,
@@ -532,7 +514,6 @@
new AnnotatedCode.fromText(annotatedCode, commentStart, commentEnd)
};
Map<String, MemberAnnotations<IdValue>> expectedMaps = {
- astMarker: new MemberAnnotations<IdValue>(),
kernelMarker: new MemberAnnotations<IdValue>(),
strongMarker: new MemberAnnotations<IdValue>(),
omitMarker: new MemberAnnotations<IdValue>(),
@@ -564,27 +545,6 @@
if (setUpFunction != null) setUpFunction();
- if (skipForAst.contains(name) || strongModeOnlyTest) {
- print('--skipped for ast-----------------------------------------------');
- } else {
- print('--from ast------------------------------------------------------');
- List<String> options = [Flags.useOldFrontend]..addAll(testOptions);
- if (trustTypeAnnotations) {
- options.add(Flags.trustTypeAnnotations);
- }
- MemberAnnotations<IdValue> annotations = expectedMaps[astMarker];
- CompiledData compiledData1 = await computeData(
- entryPoint, memorySourceFiles, computeFromAst,
- computeClassData: computeClassDataFromAst,
- options: options,
- verbose: verbose,
- forUserLibrariesOnly: forUserLibrariesOnly,
- globalIds: annotations.globalData.keys);
- if (await checkCode(astName, entity.uri, code, annotations, compiledData1,
- fatalErrors: !testAfterFailures)) {
- hasFailures = true;
- }
- }
if (skipForKernel.contains(name) ||
(testStrongMode && strongModeOnlyTest)) {
print('--skipped for kernel--------------------------------------------');
@@ -816,7 +776,6 @@
throw new UnsupportedError('Unsupported id $id.');
}
-const String astMarker = 'ast.';
const String kernelMarker = 'kernel.';
const String strongMarker = 'strong.';
const String omitMarker = 'omit.';
@@ -836,7 +795,7 @@
/// annotations without prefixes.
void computeExpectedMap(Uri sourceUri, AnnotatedCode code,
Map<String, MemberAnnotations<IdValue>> maps) {
- List<String> mapKeys = [astMarker, kernelMarker, strongMarker, omitMarker];
+ List<String> mapKeys = [kernelMarker, strongMarker, omitMarker];
Map<String, AnnotatedCode> split = splitByPrefixes(code, mapKeys);
split.forEach((String marker, AnnotatedCode code) {
@@ -863,144 +822,6 @@
});
}
-Future<bool> compareData(
- Uri mainFileUri,
- Uri entryPoint,
- Map<String, String> memorySourceFiles,
- ComputeMemberDataFunction computeAstData,
- ComputeMemberDataFunction computeIrData,
- {List<String> options: const <String>[],
- bool forUserLibrariesOnly: true,
- bool skipUnprocessedMembers: false,
- bool skipFailedCompilations: false,
- bool verbose: false,
- bool whiteList(Uri uri, Id id)}) async {
- print('--from ast----------------------------------------------------------');
- CompiledData data1 = await computeData(
- entryPoint, memorySourceFiles, computeAstData,
- options: [Flags.useOldFrontend]..addAll(options),
- forUserLibrariesOnly: forUserLibrariesOnly,
- skipUnprocessedMembers: skipUnprocessedMembers,
- skipFailedCompilations: skipFailedCompilations);
- if (data1 == null) return false;
- print('--from kernel-------------------------------------------------------');
- CompiledData data2 = await computeData(
- entryPoint, memorySourceFiles, computeIrData,
- options: options,
- forUserLibrariesOnly: forUserLibrariesOnly,
- skipUnprocessedMembers: skipUnprocessedMembers,
- skipFailedCompilations: skipFailedCompilations);
- if (data2 == null) return false;
- await compareCompiledData(mainFileUri, data1, data2,
- whiteList: whiteList,
- skipMissingUris: !forUserLibrariesOnly,
- verbose: verbose);
- return true;
-}
-
-Future compareCompiledData(
- Uri mainFileUri, CompiledData data1, CompiledData data2,
- {bool skipMissingUris: false,
- bool verbose: false,
- bool whiteList(Uri uri, Id id)}) async {
- if (whiteList == null) {
- whiteList = (uri, id) => false;
- }
- bool hasErrors = false;
- String libraryRoot1;
-
- SourceFileProvider provider1 = data1.compiler.provider;
- SourceFileProvider provider2 = data2.compiler.provider;
- for (Uri uri1 in data1.actualMaps.keys) {
- Uri uri2 = uri1;
- bool hasErrorsInUri = false;
- Map<Id, ActualData> actualMap1 = data1.actualMaps[uri1];
- Map<Id, ActualData> actualMap2 = data2.actualMaps[uri2];
- if (actualMap2 == null && skipMissingUris) {
- libraryRoot1 ??= '${data1.compiler.options.libraryRoot}';
- String uriText = '$uri1';
- if (uriText.startsWith(libraryRoot1)) {
- String relativePath = uriText.substring(libraryRoot1.length);
- uri2 =
- resolveFastaUri(Uri.parse('patched_dart2js_sdk/${relativePath}'));
- actualMap2 = data2.actualMaps[uri2];
- }
- if (actualMap2 == null) {
- continue;
- }
- }
- Expect.isNotNull(actualMap2,
- "No data for $uri1 in:\n ${data2.actualMaps.keys.join('\n ')}");
- SourceFile sourceFile1 = await provider1.getUtf8SourceFile(uri1) ??
- await provider1.autoReadFromFile(uri1);
- Expect.isNotNull(sourceFile1, 'No source file for $uri1');
- String sourceCode1 = sourceFile1.slowText();
- if (uri1 != uri2) {
- SourceFile sourceFile2 = await provider2.getUtf8SourceFile(uri2) ??
- await provider2.autoReadFromFile(uri2);
- Expect.isNotNull(sourceFile2, 'No source file for $uri2');
- String sourceCode2 = sourceFile2.slowText();
- if (sourceCode1.length != sourceCode2.length) {
- continue;
- }
- }
-
- actualMap1.forEach((Id id, ActualData actualData1) {
- IdValue value1 = actualData1.value;
- IdValue value2 = actualMap2[id]?.value;
-
- if (value1 != value2) {
- String message;
- if (value2 != null) {
- String prefix = 'DATA MISMATCH for ${id.descriptor}';
- message = '$prefix: Data from $astName: ${value1}, '
- 'data from $kernelName: ${value2}';
- } else {
- String prefix = 'MISSING $kernelName DATA for ${id.descriptor}, '
- 'object = ${actualData1.objectText}';
- message = '$prefix: Data from $astName: ${value1}, '
- 'no data from $kernelName';
- }
- reportError(data1.compiler.reporter, actualData1.sourceSpan, message);
- if (!whiteList(uri1, id)) {
- hasErrors = hasErrorsInUri = true;
- }
- }
- });
- actualMap2.forEach((Id id, ActualData actualData2) {
- IdValue value2 = actualData2.value;
- IdValue value1 = actualMap1[id]?.value;
- if (value1 != value2) {
- String prefix = 'EXTRA $kernelName DATA for ${id.descriptor}, '
- 'object = ${actualData2.objectText}';
- String message =
- '$prefix: Data from $kernelName: ${value2}, no data from $astName';
- reportError(data1.compiler.reporter, actualData2.sourceSpan, message);
- if (!whiteList(uri1, id)) {
- hasErrors = hasErrorsInUri = true;
- }
- }
- });
- if (hasErrorsInUri) {
- Uri fileUri;
- if (data1.compiler.mainLibraryUri == uri1) {
- fileUri = mainFileUri;
- } else {
- fileUri = uri1;
- }
- print('--annotations diff for: $fileUri -------------------------------');
- print(withAnnotations(
- sourceCode1,
- data1.computeDiffAnnotationsAgainst(actualMap1, actualMap2, uri1,
- includeMatches: verbose)));
- print('----------------------------------------------------------');
- }
- }
- if (hasErrors) {
- Expect.fail('Annotations mismatch');
- }
-}
-
/// Set of features used in annotations.
class Features {
Map<String, Object> _features = <String, Object>{};
diff --git a/tests/compiler/dart2js/equivalence/id_equivalence_tester.dart b/tests/compiler/dart2js/equivalence/id_equivalence_tester.dart
deleted file mode 100644
index 93832e4..0000000
--- a/tests/compiler/dart2js/equivalence/id_equivalence_tester.dart
+++ /dev/null
@@ -1,365 +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 'dart:io';
-import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/commandline_options.dart';
-import 'package:compiler/src/common.dart';
-import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
-import 'package:compiler/src/elements/elements.dart';
-import 'package:compiler/src/elements/entities.dart';
-import 'package:compiler/src/kernel/element_map.dart';
-import 'package:compiler/src/kernel/kernel_backend_strategy.dart';
-import 'package:compiler/src/resolution/access_semantics.dart';
-import 'package:compiler/src/resolution/send_structure.dart';
-import 'package:compiler/src/tree/nodes.dart' as ast;
-import 'package:expect/expect.dart';
-import 'package:kernel/ast.dart' as ir;
-import 'package:sourcemap_testing/src/annotated_code_helper.dart';
-import 'id_equivalence.dart';
-import 'id_equivalence_helper.dart';
-
-const List<String> dataDirectories1 = const <String>[
- '../closure/data',
- '../inference/data',
- '../inlining/data',
-];
-
-const List<String> dataDirectories2 = const <String>[
- '../jumps/data',
- '../rti/data',
- '../rti/emission',
-];
-
-const List<String> skipList = const <String>[
- // Unpatched external functions are not supported in the legacy frontend.
- 'external.dart',
- // Id equivalence doesn't support libraries.
- 'mixin_constructor_default_parameter_values.dart',
- // Id equivalence doesn't support unused constructors.
- 'final_field2.dart',
- // TODO(johnniwinther): Fix ast equivalence on instance fields in for.
- 'field_type.dart',
-
- // Kernel add synthetic nodes for tear off of loadLibrary.
- 'deferred_load_get.dart',
-];
-
-main(List<String> args) {
- mainInternal(args, []..addAll(dataDirectories1)..addAll(dataDirectories2));
-}
-
-mainInternal(List<String> args, Iterable<String> dataDirectories) {
- args = args.toList();
- bool shouldContinue = args.remove('-c');
- bool continued = false;
- asyncTest(() async {
- bool hasFailures = false;
- for (String path in dataDirectories) {
- Directory dataDir = new Directory.fromUri(Platform.script.resolve(path));
- await for (FileSystemEntity entity in dataDir.list()) {
- String name = entity.uri.pathSegments.last;
- if (args.isNotEmpty && !args.contains(name) && !continued) continue;
- if (shouldContinue) continued = true;
- if (skipList.contains(name)) {
- print('Skipping ${entity.uri}');
- continue;
- }
- print('Checking ${entity.uri}');
- String annotatedCode =
- await new File.fromUri(entity.uri).readAsString();
- AnnotatedCode code =
- new AnnotatedCode.fromText(annotatedCode, commentStart, commentEnd);
- // Pretend this is a dart2js_native test to allow use of 'native'
- // keyword and import of private libraries.
- Uri entryPoint =
- Uri.parse('memory:sdk/tests/compiler/dart2js_native/main.dart');
- Map<String, String> memorySourceFiles = {
- entryPoint.path: code.sourceCode
- };
- if (!await compareData(entity.uri, entryPoint, memorySourceFiles,
- computeAstMemberData, computeIrMemberData,
- options: [Flags.disableTypeInference, stopAfterTypeInference])) {
- hasFailures = true;
- }
- }
- }
- Expect.isFalse(hasFailures, 'Errors found.');
- });
-}
-
-/// Compute a descriptive mapping of the [Id]s in [_member] as a
-/// [MemberElement].
-///
-/// Fills [actualMap] with the data and [sourceSpanMap] with the source spans
-/// for the data origin.
-void computeAstMemberData(
- Compiler compiler, MemberEntity _member, Map<Id, ActualData> actualMap,
- {bool verbose: false}) {
- MemberElement member = _member;
- ResolvedAst resolvedAst = member.resolvedAst;
- new ResolvedAstComputer(compiler.reporter, actualMap, resolvedAst).run();
-}
-
-/// Mixin used for computing a descriptive mapping of the [Id]s in a member.
-class ComputerMixin {
- String computeMemberName(String className, String memberName) {
- if (className != null) {
- return 'member:$className.$memberName';
- }
- return 'member:$memberName';
- }
-
- String computeLocalName(String localName) {
- return 'local:$localName';
- }
-
- String computeGetName(String propertyName) {
- return 'get:$propertyName';
- }
-
- String computeInvokeName(String propertyName) {
- return 'invoke:$propertyName';
- }
-
- String computeSetName(String propertyName) {
- return 'set:$propertyName';
- }
-
- String get loopName => 'loop';
-
- String get gotoName => 'goto';
-
- String get switchName => 'switch';
-
- String get switchCaseName => 'case';
-
- String get labelName => 'label';
-}
-
-/// AST visitor for computing a descriptive mapping of the [Id]s in a member.
-class ResolvedAstComputer extends AstDataExtractor with ComputerMixin {
- ResolvedAstComputer(DiagnosticReporter reporter,
- Map<Id, ActualData> actualMap, ResolvedAst resolvedAst)
- : super(reporter, actualMap, resolvedAst);
-
- @override
- String computeNodeValue(Id id, ast.Node node, AstElement element) {
- if (element != null && element.isLocal) {
- return computeLocalName(element.name);
- }
- if (node is ast.Loop) {
- return loopName;
- } else if (node is ast.GotoStatement) {
- return gotoName;
- } else if (node is ast.SwitchStatement) {
- return switchName;
- } else if (node is ast.SwitchCase) {
- return switchCaseName;
- } else if (node is ast.LabeledStatement) {
- return labelName;
- }
-
- dynamic sendStructure;
- if (node is ast.Send) {
- sendStructure = elements.getSendStructure(node);
- if (sendStructure == null) return null;
-
- String getDynamicName() {
- switch (sendStructure.semantics.kind) {
- case AccessKind.PARAMETER:
- case AccessKind.FINAL_PARAMETER:
- case AccessKind.LOCAL_VARIABLE:
- case AccessKind.FINAL_LOCAL_VARIABLE:
- case AccessKind.LOCAL_FUNCTION:
- return sendStructure.semantics.element.name;
- case AccessKind.THIS_PROPERTY:
- case AccessKind.DYNAMIC_PROPERTY:
- case AccessKind.CONDITIONAL_DYNAMIC_PROPERTY:
- DynamicAccess access = sendStructure.semantics;
- return access.name.text;
- default:
- return null;
- }
- }
-
- switch (sendStructure.kind) {
- case SendStructureKind.GET:
- String dynamicName = getDynamicName();
- if (dynamicName != null) return computeGetName(dynamicName);
- break;
- case SendStructureKind.BINARY:
- case SendStructureKind.UNARY:
- return computeInvokeName(sendStructure.operator.selectorName);
- case SendStructureKind.INDEX:
- return computeGetName('[]');
- case SendStructureKind.INDEX_SET:
- return computeSetName('[]=');
- case SendStructureKind.COMPOUND_INDEX_SET:
- case SendStructureKind.INDEX_PREFIX:
- case SendStructureKind.INDEX_POSTFIX:
- if (id.kind == IdKind.update) {
- return computeSetName('[]=');
- } else if (id.kind == IdKind.invoke) {
- return computeInvokeName(
- sendStructure.operator.binaryOperator.name);
- } else {
- return computeGetName('[]');
- }
- break;
- case SendStructureKind.EQUALS:
- return computeInvokeName('==');
- case SendStructureKind.NOT_EQUALS:
- return computeInvokeName('==');
- case SendStructureKind.INVOKE:
- case SendStructureKind.INCOMPATIBLE_INVOKE:
- switch (sendStructure.semantics.kind) {
- case AccessKind.LOCAL_VARIABLE:
- case AccessKind.FINAL_LOCAL_VARIABLE:
- case AccessKind.PARAMETER:
- case AccessKind.FINAL_PARAMETER:
- case AccessKind.EXPRESSION:
- if (id.kind == IdKind.invoke) {
- return computeInvokeName('call');
- } else if (id.kind == IdKind.node) {
- String dynamicName = getDynamicName();
- if (dynamicName != null) return computeGetName(dynamicName);
- }
- break;
- case AccessKind.STATIC_FIELD:
- case AccessKind.FINAL_STATIC_FIELD:
- case AccessKind.TOPLEVEL_FIELD:
- case AccessKind.FINAL_TOPLEVEL_FIELD:
- case AccessKind.STATIC_GETTER:
- case AccessKind.TOPLEVEL_GETTER:
- case AccessKind.SUPER_FIELD:
- case AccessKind.SUPER_FINAL_FIELD:
- case AccessKind.SUPER_GETTER:
- if (id.kind == IdKind.invoke) {
- return computeInvokeName('call');
- }
- break;
- default:
- String dynamicName = getDynamicName();
- if (dynamicName != null) return computeInvokeName(dynamicName);
- }
- break;
- case SendStructureKind.SET:
- String dynamicName = getDynamicName();
- if (dynamicName != null) return computeSetName(dynamicName);
- break;
- case SendStructureKind.PREFIX:
- case SendStructureKind.POSTFIX:
- case SendStructureKind.COMPOUND:
- if (id.kind == IdKind.invoke) {
- return computeInvokeName(
- sendStructure.operator.binaryOperator.name);
- } else {
- String dynamicName = getDynamicName();
- if (dynamicName != null) {
- if (id.kind == IdKind.update) {
- return computeSetName(dynamicName);
- } else {
- return computeGetName(dynamicName);
- }
- }
- }
- break;
- default:
- }
- }
- if (sendStructure != null) {
- return '<unknown:$node (${node.runtimeType}) $sendStructure>';
- }
- return '<unknown:$node (${node.runtimeType})>';
- }
-
- @override
- String computeElementValue(Id id, AstElement element) {
- return computeMemberName(element.enclosingClass?.name, element.name);
- }
-}
-
-/// Compute a descriptive mapping of the [Id]s in [member] as a kernel based
-/// member.
-///
-/// Fills [actualMap] with the data and [sourceSpanMap] with the source spans
-/// for the data origin.
-void computeIrMemberData(
- Compiler compiler, MemberEntity member, Map<Id, ActualData> actualMap,
- {bool verbose: false}) {
- KernelBackendStrategy backendStrategy = compiler.backendStrategy;
- KernelToElementMapForBuilding elementMap = backendStrategy.elementMap;
- MemberDefinition definition = elementMap.getMemberDefinition(member);
- assert(
- definition.kind == MemberKind.regular ||
- definition.kind == MemberKind.constructor,
- failedAt(member, "Unexpected member definition $definition"));
- new IrComputer(compiler.reporter, actualMap).run(definition.node);
-}
-
-/// IR visitor for computing a descriptive mapping of the [Id]s in a member.
-class IrComputer extends IrDataExtractor with ComputerMixin {
- IrComputer(DiagnosticReporter reporter, Map<Id, ActualData> actualMap)
- : super(reporter, actualMap);
-
- @override
- String computeNodeValue(Id id, ir.TreeNode node) {
- if (node is ir.VariableDeclaration) {
- return computeLocalName(node.name);
- } else if (node is ir.FunctionDeclaration) {
- return computeLocalName(node.variable.name);
- } else if (node is ir.FunctionExpression) {
- return computeLocalName('');
- } else if (node is ir.MethodInvocation) {
- ir.TreeNode receiver = node.receiver;
- if (receiver is ir.VariableGet &&
- receiver.variable.parent is ir.FunctionDeclaration) {
- // This is an invocation of a named local function.
- return computeInvokeName(receiver.variable.name);
- } else if (node.name.name == '[]') {
- return computeGetName('[]');
- } else if (node.name.name == '[]=') {
- return computeSetName('[]=');
- } else {
- return computeInvokeName(node.name.name);
- }
- } else if (node is ir.PropertyGet) {
- return computeGetName(node.name.name);
- } else if (node is ir.PropertySet) {
- return computeSetName(node.name.name);
- } else if (node is ir.VariableGet) {
- return computeGetName(node.variable.name);
- } else if (node is ir.VariableSet) {
- return computeSetName(node.variable.name);
- } else if (node is ir.DoStatement) {
- return loopName;
- } else if (node is ir.ForStatement) {
- return loopName;
- } else if (node is ir.ForInStatement) {
- return loopName;
- } else if (node is ir.WhileStatement) {
- return loopName;
- } else if (node is ir.BreakStatement) {
- return gotoName;
- } else if (node is ir.ContinueSwitchStatement) {
- return gotoName;
- } else if (node is ir.SwitchStatement) {
- return switchName;
- } else if (node is ir.SwitchCase) {
- return switchCaseName;
- } else if (node is ir.LabeledStatement) {
- return labelName;
- } else if (node is ir.LoadLibrary) {
- return computeInvokeName('call');
- }
- return '<unknown:$node (${node.runtimeType})>';
- }
-
- @override
- String computeMemberValue(Id id, ir.Member member) {
- return computeMemberName(member.enclosingClass?.name, member.name.name);
- }
-}
diff --git a/tests/compiler/dart2js/equivalence/show_helper.dart b/tests/compiler/dart2js/equivalence/show_helper.dart
index bbf0b1d..fa2eb40 100644
--- a/tests/compiler/dart2js/equivalence/show_helper.dart
+++ b/tests/compiler/dart2js/equivalence/show_helper.dart
@@ -10,7 +10,6 @@
import 'package:compiler/src/filenames.dart';
import 'package:compiler/src/io/source_file.dart';
import 'package:compiler/src/source_file_provider.dart';
-import '../kernel/test_helpers.dart';
import 'id_equivalence_helper.dart';
ArgParser createArgParser() {
@@ -18,7 +17,6 @@
argParser.addFlag('verbose', negatable: true, defaultsTo: false);
argParser.addFlag('colors', negatable: true);
argParser.addFlag('all', negatable: false, defaultsTo: false);
- argParser.addFlag('use-kernel', negatable: false, defaultsTo: false);
argParser.addFlag('strong', negatable: false, defaultsTo: false);
argParser.addFlag('omit-implicit-checks',
negatable: false, defaultsTo: false);
@@ -27,17 +25,14 @@
return argParser;
}
-show(ArgResults argResults, ComputeMemberDataFunction computeAstData,
- ComputeMemberDataFunction computeKernelData,
- {ComputeClassDataFunction computeAstClassData,
- ComputeClassDataFunction computeKernelClassData,
+show(ArgResults argResults, ComputeMemberDataFunction computeKernelData,
+ {ComputeClassDataFunction computeKernelClassData,
List<String> options: const <String>[]}) async {
if (argResults.wasParsed('colors')) {
useColors = argResults['colors'];
}
bool verbose = argResults['verbose'];
bool strongMode = argResults['strong'];
- bool useKernel = argResults['use-kernel'] || strongMode;
bool omitImplicitChecks = argResults['omit-implicit-checks'];
bool trustTypeAnnotations = argResults['trust-type-annotations'];
@@ -53,9 +48,6 @@
}
options = new List<String>.from(options);
- if (!useKernel) {
- options.add(Flags.useOldFrontend);
- }
if (strongMode) {
options.add(Flags.strongMode);
}
@@ -65,10 +57,8 @@
if (omitImplicitChecks) {
options.add(Flags.omitImplicitChecks);
}
- CompiledData data = await computeData(
- entryPoint, const {}, useKernel ? computeKernelData : computeAstData,
- computeClassData:
- useKernel ? computeKernelClassData : computeAstClassData,
+ CompiledData data = await computeData(entryPoint, const {}, computeKernelData,
+ computeClassData: computeKernelClassData,
options: options,
forUserLibrariesOnly: false,
skipUnprocessedMembers: true,
@@ -82,7 +72,6 @@
if (show != null && !show.any((f) => '$uri'.endsWith(f))) {
continue;
}
- uri = resolveFastaUri(uri);
SourceFile sourceFile = await provider.autoReadFromFile(uri);
String sourceCode = sourceFile?.slowText();
if (sourceCode == null) {
diff --git a/tests/compiler/dart2js/generic_methods/generic_method_test.dart b/tests/compiler/dart2js/generic_methods/generic_method_test.dart
index 14ccaa6..cbe8247 100644
--- a/tests/compiler/dart2js/generic_methods/generic_method_test.dart
+++ b/tests/compiler/dart2js/generic_methods/generic_method_test.dart
@@ -10,7 +10,7 @@
import 'package:compiler/src/js/js.dart' as js;
import 'package:compiler/src/world.dart';
import 'package:expect/expect.dart';
-import '../kernel/compiler_helper.dart';
+import '../helpers/d8_helper.dart';
const String SOURCE = r'''
import 'package:meta/dart2js.dart';
diff --git a/tests/compiler/dart2js/helpers/d8_helper.dart b/tests/compiler/dart2js/helpers/d8_helper.dart
new file mode 100644
index 0000000..801a3fa
--- /dev/null
+++ b/tests/compiler/dart2js/helpers/d8_helper.dart
@@ -0,0 +1,74 @@
+// 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.
+
+// Partial test that the closed world computed from [WorldImpact]s derived from
+// kernel is equivalent to the original computed from resolution.
+library dart2js.kernel.compiler_helper;
+
+import 'dart:async';
+import 'dart:io';
+
+import 'package:compiler/compiler_new.dart';
+import 'package:compiler/src/compiler.dart';
+import 'package:compiler/src/dart2js.dart' as dart2js;
+import 'package:compiler/src/filenames.dart';
+import 'package:expect/expect.dart';
+import 'package:sourcemap_testing/src/stacktrace_helper.dart';
+import '../memory_compiler.dart';
+
+Future createTemp(Uri entryPoint, Map<String, String> memorySourceFiles,
+ {bool printSteps: false}) async {
+ if (memorySourceFiles.isNotEmpty) {
+ Directory dir = await Directory.systemTemp.createTemp('dart2js-with-dill');
+ if (printSteps) {
+ print('--- create temp directory $dir -------------------------------');
+ }
+ memorySourceFiles.forEach((String name, String source) {
+ new File.fromUri(dir.uri.resolve(name)).writeAsStringSync(source);
+ });
+ entryPoint = dir.uri.resolve(entryPoint.path);
+ }
+ return entryPoint;
+}
+
+Future<Compiler> runWithD8(
+ {Uri entryPoint,
+ Map<String, String> memorySourceFiles: const <String, String>{},
+ List<String> options: const <String>[],
+ String expectedOutput,
+ bool printJs: false}) async {
+ entryPoint ??= Uri.parse('memory:main.dart');
+ Uri mainFile =
+ await createTemp(entryPoint, memorySourceFiles, printSteps: true);
+ String output = uriPathToNative(mainFile.resolve('out.js').path);
+ List<String> dart2jsArgs = [
+ mainFile.toString(),
+ '-o$output',
+ '--packages=${Platform.packageConfig}',
+ ]..addAll(options);
+ print('Running: dart2js ${dart2jsArgs.join(' ')}');
+
+ CompilationResult result = await dart2js.internalMain(dart2jsArgs);
+ Expect.isTrue(result.isSuccess);
+ if (printJs) {
+ print('dart2js output:');
+ print(new File(output).readAsStringSync());
+ }
+
+ List<String> d8Args = [
+ 'sdk/lib/_internal/js_runtime/lib/preambles/d8.js',
+ output
+ ];
+ print('Running: d8 ${d8Args.join(' ')}');
+ ProcessResult runResult = Process.runSync(d8executable, d8Args);
+ String out = '${runResult.stderr}\n${runResult.stdout}';
+ print('d8 output:');
+ print(out);
+ if (expectedOutput != null) {
+ Expect.equals(0, runResult.exitCode);
+ Expect.stringEquals(expectedOutput.trim(),
+ runResult.stdout.replaceAll('\r\n', '\n').trim());
+ }
+ return result.compiler;
+}
diff --git a/tests/compiler/dart2js/inference/callers_test.dart b/tests/compiler/dart2js/inference/callers_test.dart
index b88f07f..60bc82f 100644
--- a/tests/compiler/dart2js/inference/callers_test.dart
+++ b/tests/compiler/dart2js/inference/callers_test.dart
@@ -8,13 +8,11 @@
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
-import 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/inferrer/inferrer_engine.dart';
import 'package:compiler/src/inferrer/type_graph_inferrer.dart';
import 'package:compiler/src/kernel/element_map.dart';
import 'package:compiler/src/kernel/kernel_backend_strategy.dart';
-import 'package:compiler/src/tree/nodes.dart' as ast;
import 'package:kernel/ast.dart' as ir;
import '../equivalence/id_equivalence.dart';
import '../equivalence/id_equivalence_helper.dart';
@@ -24,26 +22,11 @@
asyncTest(() async {
Directory dataDir =
new Directory.fromUri(Platform.script.resolve('callers'));
- await checkTests(dataDir, computeMemberAstCallers, computeMemberIrCallers,
+ await checkTests(dataDir, computeMemberIrCallers,
args: args, options: [stopAfterTypeInference]);
});
}
-/// Compute callers data for [_member] as a [MemberElement].
-///
-/// Fills [actualMap] with the data.
-void computeMemberAstCallers(
- Compiler compiler, MemberEntity _member, Map<Id, ActualData> actualMap,
- {bool verbose: false}) {
- MemberElement member = _member;
- ResolvedAst resolvedAst = member.resolvedAst;
- compiler.reporter.withCurrentElement(member.implementation, () {
- new CallersAstComputer(compiler.reporter, actualMap, resolvedAst,
- compiler.globalInference.typesInferrerInternal)
- .run();
- });
-}
-
abstract class ComputeValueMixin<T> {
TypeGraphInferrer get inferrer;
@@ -69,37 +52,6 @@
}
}
-/// AST visitor for computing side effects data for a member.
-class CallersAstComputer extends AstDataExtractor
- with ComputeValueMixin<ast.Node> {
- final TypeGraphInferrer inferrer;
-
- CallersAstComputer(DiagnosticReporter reporter, Map<Id, ActualData> actualMap,
- ResolvedAst resolvedAst, this.inferrer)
- : super(reporter, actualMap, resolvedAst);
-
- @override
- String computeElementValue(Id id, AstElement element) {
- if (element.isParameter) {
- return null;
- } else if (element.isLocal && element.isFunction) {
- LocalFunctionElement localFunction = element;
- return getMemberValue(localFunction.callMethod);
- } else {
- MemberElement member = element.declaration;
- return getMemberValue(member);
- }
- }
-
- @override
- String computeNodeValue(Id id, ast.Node node, [AstElement element]) {
- if (element != null && element.isLocal && element.isFunction) {
- return computeElementValue(id, element);
- }
- return null;
- }
-}
-
/// Compute callers data for [member] from kernel based inference.
///
/// Fills [actualMap] with the data.
diff --git a/tests/compiler/dart2js/inference/data/await.dart b/tests/compiler/dart2js/inference/data/await.dart
index 03099d8..07c562b 100644
--- a/tests/compiler/dart2js/inference/data/await.dart
+++ b/tests/compiler/dart2js/inference/data/await.dart
@@ -17,7 +17,6 @@
/*element: _method1:[null]*/
_method1(
- /*ast.[null|subclass=Object]*/
/*kernel.[null|subclass=Object]*/
/*strong.[null|subclass=JSInt]*/
o) {}
@@ -35,7 +34,6 @@
/*element: _method2:[null]*/
_method2(
- /*ast.[null|subclass=Object]*/
/*kernel.[null|subclass=Object]*/
/*strong.[null|subclass=JSInt]*/
o) {}
@@ -56,7 +54,6 @@
/*element: _method4:[null]*/
_method4(
- /*ast.[null|subclass=Object]*/
/*kernel.[null|subclass=Object]*/
/*strong.[null|subclass=JSInt]*/
o) {}
diff --git a/tests/compiler/dart2js/inference/data/call_method_function_typed_value.dart b/tests/compiler/dart2js/inference/data/call_method_function_typed_value.dart
index e938ddb..5d5c0f4 100644
--- a/tests/compiler/dart2js/inference/data/call_method_function_typed_value.dart
+++ b/tests/compiler/dart2js/inference/data/call_method_function_typed_value.dart
@@ -6,7 +6,6 @@
import "package:expect/expect.dart";
-/*ast.element: f:[subclass=JSNumber]*/
/*kernel.element: f:[subclass=JSNumber]*/
/*strong.element: f:[subclass=JSInt]*/
int f(int /*[null|subclass=Object]*/ i) => 2 /*invoke: [exact=JSUInt31]*/ * i;
diff --git a/tests/compiler/dart2js/inference/data/closure_tracer_28919.dart b/tests/compiler/dart2js/inference/data/closure_tracer_28919.dart
index 96ea43a..eb8b96c 100644
--- a/tests/compiler/dart2js/inference/data/closure_tracer_28919.dart
+++ b/tests/compiler/dart2js/inference/data/closure_tracer_28919.dart
@@ -64,11 +64,9 @@
probe2methods(methods);
}
-/*ast.element: probe2res:[null|subclass=Object]*/
/*kernel.element: probe2res:[null|subclass=Object]*/
/*strong.element: probe2res:[null|subclass=JSInt]*/
probe2res(
- /*ast.[null|subclass=Object]*/
/*kernel.[null|subclass=Object]*/
/*strong.[null|subclass=JSInt]*/
x) =>
diff --git a/tests/compiler/dart2js/inference/data/closurization_instance_call.dart b/tests/compiler/dart2js/inference/data/closurization_instance_call.dart
index 0c98bcc..d42efcd 100644
--- a/tests/compiler/dart2js/inference/data/closurization_instance_call.dart
+++ b/tests/compiler/dart2js/inference/data/closurization_instance_call.dart
@@ -28,21 +28,18 @@
var local = c. /*[exact=Class]*/ method;
local
.
- /*ast.invoke: [subtype=Function]*/
/*kernel.invoke: [subtype=Function]*/
/*strong.invoke: [subclass=Closure]*/
toString();
local();
local
.
- /*ast.invoke: [subtype=Function]*/
/*kernel.invoke: [subtype=Function]*/
/*strong.invoke: [subclass=Closure]*/
toString();
local.call();
return local
.
- /*ast.invoke: [subtype=Function]*/
/*kernel.invoke: [subtype=Function]*/
/*strong.invoke: [subclass=Closure]*/
toString();
diff --git a/tests/compiler/dart2js/inference/data/closurization_local_call.dart b/tests/compiler/dart2js/inference/data/closurization_local_call.dart
index 25e3bcd..c14d3c4 100644
--- a/tests/compiler/dart2js/inference/data/closurization_local_call.dart
+++ b/tests/compiler/dart2js/inference/data/closurization_local_call.dart
@@ -25,21 +25,18 @@
var local = /*[exact=JSUInt31]*/ () => 42;
local
.
- /*ast.invoke: [subtype=Function]*/
/*kernel.invoke: [subtype=Function]*/
/*strong.invoke: [subclass=Closure]*/
toString();
local();
local
.
- /*ast.invoke: [subtype=Function]*/
/*kernel.invoke: [subtype=Function]*/
/*strong.invoke: [subclass=Closure]*/
toString();
local.call();
return local
.
- /*ast.invoke: [subtype=Function]*/
/*kernel.invoke: [subtype=Function]*/
/*strong.invoke: [subclass=Closure]*/
toString();
diff --git a/tests/compiler/dart2js/inference/data/closurization_static_call.dart b/tests/compiler/dart2js/inference/data/closurization_static_call.dart
index 6a28213..7881009 100644
--- a/tests/compiler/dart2js/inference/data/closurization_static_call.dart
+++ b/tests/compiler/dart2js/inference/data/closurization_static_call.dart
@@ -28,21 +28,18 @@
var local = method;
local
.
- /*ast.invoke: [subtype=Function]*/
/*kernel.invoke: [subtype=Function]*/
/*strong.invoke: [subclass=Closure]*/
toString();
local();
local
.
- /*ast.invoke: [subtype=Function]*/
/*kernel.invoke: [subtype=Function]*/
/*strong.invoke: [subclass=Closure]*/
toString();
local.call();
return local
.
- /*ast.invoke: [subtype=Function]*/
/*kernel.invoke: [subtype=Function]*/
/*strong.invoke: [subclass=Closure]*/
toString();
diff --git a/tests/compiler/dart2js/inference/data/expose_this_closure.dart b/tests/compiler/dart2js/inference/data/expose_this_closure.dart
index b60e4c9..d49b4e2 100644
--- a/tests/compiler/dart2js/inference/data/expose_this_closure.dart
+++ b/tests/compiler/dart2js/inference/data/expose_this_closure.dart
@@ -59,7 +59,6 @@
abstract class SuperClass1 {
/*element: SuperClass1.:[exact=Class3]*/
SuperClass1(
- /*ast.[null|subclass=Object]*/
/*kernel.[null|subclass=Object]*/
/*strong.[null|subclass=JSInt]*/
o);
diff --git a/tests/compiler/dart2js/inference/data/expose_this_mask.dart b/tests/compiler/dart2js/inference/data/expose_this_mask.dart
index b1033c6..84feb4a 100644
--- a/tests/compiler/dart2js/inference/data/expose_this_mask.dart
+++ b/tests/compiler/dart2js/inference/data/expose_this_mask.dart
@@ -167,9 +167,7 @@
class Class6 {
/*element: Class6.field6a:[exact=JSUInt31]*/
var field6a;
- /*ast.element: Class6.field6b:[exact=JSUInt31]*/
- /*kernel.element: Class6.field6b:[null|exact=JSUInt31]*/
- /*strong.element: Class6.field6b:[null|exact=JSUInt31]*/
+ /*element: Class6.field6b:[null|exact=JSUInt31]*/
var field6b;
/*element: Class6.:[exact=Class6]*/
@@ -185,15 +183,11 @@
/*element: SubClass6.:[exact=SubClass6]*/
SubClass6() : field6b = 42;
- /*ast.element: SubClass6.access:[exact=JSUInt31]*/
- /*kernel.element: SubClass6.access:[null|exact=JSUInt31]*/
- /*strong.element: SubClass6.access:[null|exact=JSUInt31]*/
+ /*element: SubClass6.access:[null|exact=JSUInt31]*/
get access => super.field6b;
}
-/*ast.element: subclassFieldWrite:[exact=JSUInt31]*/
-/*kernel.element: subclassFieldWrite:[null|exact=JSUInt31]*/
-/*strong.element: subclassFieldWrite:[null|exact=JSUInt31]*/
+/*element: subclassFieldWrite:[null|exact=JSUInt31]*/
subclassFieldWrite() {
new Class6();
return new SubClass6(). /*[exact=SubClass6]*/ access;
@@ -207,9 +201,7 @@
class Class9 {
/*element: Class9.field9a:[exact=JSUInt31]*/
var field9a;
- /*ast.element: Class9.field9b:[exact=JSUInt31]*/
- /*kernel.element: Class9.field9b:[null|exact=JSUInt31]*/
- /*strong.element: Class9.field9b:[null|exact=JSUInt31]*/
+ /*element: Class9.field9b:[null|exact=JSUInt31]*/
var field9b;
/*element: Class9.:[exact=Class9]*/
@@ -225,18 +217,14 @@
/*element: SubClass9a.:[exact=SubClass9a]*/
SubClass9a() : field9b = 42;
- /*ast.element: SubClass9a.access:[exact=JSUInt31]*/
- /*kernel.element: SubClass9a.access:[null|exact=JSUInt31]*/
- /*strong.element: SubClass9a.access:[null|exact=JSUInt31]*/
+ /*element: SubClass9a.access:[null|exact=JSUInt31]*/
get access => super.field9b;
}
/*element: SubClass9b.:[exact=SubClass9b]*/
class SubClass9b extends Class9 {}
-/*ast.element: subclassesFieldWrite:[exact=JSUInt31]*/
-/*kernel.element: subclassesFieldWrite:[null|exact=JSUInt31]*/
-/*strong.element: subclassesFieldWrite:[null|exact=JSUInt31]*/
+/*element: subclassesFieldWrite:[null|exact=JSUInt31]*/
subclassesFieldWrite() {
new Class9();
new SubClass9b();
diff --git a/tests/compiler/dart2js/inference/data/field_type.dart b/tests/compiler/dart2js/inference/data/field_type.dart
index 5fe9757..51b672d 100644
--- a/tests/compiler/dart2js/inference/data/field_type.dart
+++ b/tests/compiler/dart2js/inference/data/field_type.dart
@@ -348,8 +348,8 @@
}
class A16 {
- // TODO(johnniwinther): Investigate with these differ.
- /*ast.element: A16.f16:Union([exact=JSString], [exact=JSUInt31])*/
+ // TODO(johnniwinther): Investigate why these include `null`. The ast version
+ // didn't.
/*kernel.element: A16.f16:Union([exact=JSString], [null|exact=JSUInt31])*/
/*strong.element: A16.f16:Union([exact=JSString], [null|exact=JSUInt31])*/
var f16;
@@ -609,7 +609,6 @@
/*element: A24.+:Value([exact=JSString], value: "foo")*/
operator +(
- /*ast.[exact=JSUInt31]*/
/*kernel.[exact=JSUInt31]*/
/*strong.[empty]*/
other) =>
diff --git a/tests/compiler/dart2js/inference/data/for_in.dart b/tests/compiler/dart2js/inference/data/for_in.dart
index d71083f..562897a 100644
--- a/tests/compiler/dart2js/inference/data/for_in.dart
+++ b/tests/compiler/dart2js/inference/data/for_in.dart
@@ -32,7 +32,6 @@
// Return element from a for-in loop on a list literal.
////////////////////////////////////////////////////////////////////////////////
-/*ast.element: forInReturn:[null|subclass=Object]*/
/*kernel.element: forInReturn:[null|subclass=Object]*/
/*strong.element: forInReturn:[null|subclass=JSInt]*/
forInReturn() {
diff --git a/tests/compiler/dart2js/inference/data/general.dart b/tests/compiler/dart2js/inference/data/general.dart
index 1ca6af3..ea317d5 100644
--- a/tests/compiler/dart2js/inference/data/general.dart
+++ b/tests/compiler/dart2js/inference/data/general.dart
@@ -589,8 +589,7 @@
var a = topLevelGetter();
// Make [a] a captured variable. This should disable receiver
// specialization on [a].
- (/*ast.[null|subclass=Object]*/
- /*kernel.[null|subclass=Object]*/
+ (/*kernel.[null|subclass=Object]*/
/*strong.[null|exact=JSString]*/
() => a.toString())();
a - 42;
@@ -671,7 +670,6 @@
/*element: A.generative:[exact=A]*/
A.generative();
- /*ast.element: A.==:Union([exact=JSBool], [exact=JSUInt31])*/
/*kernel.element: A.==:Union([exact=JSBool], [exact=JSUInt31])*/
/*strong.element: A.==:[exact=JSBool]*/
operator ==(/*Union([exact=JSString], [exact=JSUInt31])*/ other) =>
diff --git a/tests/compiler/dart2js/inference/data/if_null.dart b/tests/compiler/dart2js/inference/data/if_null.dart
index d9cca46..640ef25 100644
--- a/tests/compiler/dart2js/inference/data/if_null.dart
+++ b/tests/compiler/dart2js/inference/data/if_null.dart
@@ -29,9 +29,7 @@
/*element: _ifNotNullInvoke:[null|exact=JSBool]*/
_ifNotNullInvoke(/*[null|exact=JSUInt31]*/ o) {
return o?.
- /*ast.[null|exact=JSUInt31]*/
- /*kernel.[exact=JSUInt31]*/
- /*strong.[exact=JSUInt31]*/
+ /*[exact=JSUInt31]*/
isEven;
}
diff --git a/tests/compiler/dart2js/inference/data/js_interop.dart b/tests/compiler/dart2js/inference/data/js_interop.dart
index 168b52e..c20543d 100644
--- a/tests/compiler/dart2js/inference/data/js_interop.dart
+++ b/tests/compiler/dart2js/inference/data/js_interop.dart
@@ -20,7 +20,6 @@
{/*[exact=JSUInt31]*/ a, /*Value([exact=JSString], value: "")*/ b});
}
-/*ast.element: anonymousClass:[null|subclass=Object]*/
/*kernel.element: anonymousClass:[null|subclass=Object]*/
/*strong.element: anonymousClass:[null|subclass=JavaScriptObject]*/
anonymousClass() => new Class1(a: 1, b: '');
diff --git a/tests/compiler/dart2js/inference/data/list.dart b/tests/compiler/dart2js/inference/data/list.dart
index 1b31de9..6592f98 100644
--- a/tests/compiler/dart2js/inference/data/list.dart
+++ b/tests/compiler/dart2js/inference/data/list.dart
@@ -104,9 +104,7 @@
// Create a Uint32List using a parenthesized literal int as length.
////////////////////////////////////////////////////////////////////////////////
-/*ast.element: newUint32List:Container([exact=NativeUint32List], element: [subclass=JSUInt32], length: null)*/
-/*kernel.element: newUint32List:Container([exact=NativeUint32List], element: [subclass=JSUInt32], length: 13)*/
-/*strong.element: newUint32List:Container([exact=NativeUint32List], element: [subclass=JSUInt32], length: 13)*/
+/*element: newUint32List:Container([exact=NativeUint32List], element: [subclass=JSUInt32], length: 13)*/
newUint32List() => new Uint32List((13));
////////////////////////////////////////////////////////////////////////////////
diff --git a/tests/compiler/dart2js/inference/data/logical_if.dart b/tests/compiler/dart2js/inference/data/logical_if.dart
index 9313a84..596907a 100644
--- a/tests/compiler/dart2js/inference/data/logical_if.dart
+++ b/tests/compiler/dart2js/inference/data/logical_if.dart
@@ -248,9 +248,7 @@
if (!(o is! Class10)) {
o
.
- /*ast.invoke: Union([exact=Class10], [exact=JSUInt31])*/
- /*kernel.invoke: [exact=Class10]*/
- /*strong.invoke: [exact=Class10]*/
+ /*invoke: [exact=Class10]*/
toString();
}
}
@@ -278,9 +276,7 @@
} else {
o
.
- /*ast.invoke: Union([exact=Class11], [exact=JSUInt31])*/
- /*kernel.invoke: [exact=Class11]*/
- /*strong.invoke: [exact=Class11]*/
+ /*invoke: [exact=Class11]*/
toString();
}
}
diff --git a/tests/compiler/dart2js/inference/data/map_tracer_const.dart b/tests/compiler/dart2js/inference/data/map_tracer_const.dart
index 2bfe52f..4da5254 100644
--- a/tests/compiler/dart2js/inference/data/map_tracer_const.dart
+++ b/tests/compiler/dart2js/inference/data/map_tracer_const.dart
@@ -2,7 +2,6 @@
// 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.
-/*ast.element: closure:Union([exact=JSDouble], [exact=JSUInt31])*/
/*kernel.element: closure:Union([exact=JSDouble], [exact=JSUInt31])*/
/*strong.element: closure:[exact=JSUInt31]*/
int closure(int /*Union([exact=JSDouble], [exact=JSUInt31])*/ x) {
diff --git a/tests/compiler/dart2js/inference/data/optimizer_hints.dart b/tests/compiler/dart2js/inference/data/optimizer_hints.dart
index bf8463c..57ea72c 100644
--- a/tests/compiler/dart2js/inference/data/optimizer_hints.dart
+++ b/tests/compiler/dart2js/inference/data/optimizer_hints.dart
@@ -57,7 +57,6 @@
// As above but without the annotation.
////////////////////////////////////////////////////////////////////////////////
-/*ast.element: notTrustReturnTypeString:[null|subclass=Object]*/
/*kernel.element: notTrustReturnTypeString:[null|subclass=Object]*/
/*strong.element: notTrustReturnTypeString:[null|exact=JSString]*/
String notTrustReturnTypeString() {
@@ -84,7 +83,6 @@
/*element: _notTrustParameterTypeString:[null]*/
_notTrustParameterTypeString(
String
- /*ast.[null|subclass=Object]*/
/*kernel.[null|subclass=Object]*/
/*strong.[null|exact=JSString]*/
o) {}
diff --git a/tests/compiler/dart2js/inference/data/parameters_notrust.dart b/tests/compiler/dart2js/inference/data/parameters_notrust.dart
index 41503d2..d031544 100644
--- a/tests/compiler/dart2js/inference/data/parameters_notrust.dart
+++ b/tests/compiler/dart2js/inference/data/parameters_notrust.dart
@@ -20,7 +20,6 @@
// within the method and therefore infer the return type to be an int.
////////////////////////////////////////////////////////////////////////////////
-/*ast.element: _dontTrustParameters:Union([exact=JSString], [exact=JSUInt31])*/
/*kernel.element: _dontTrustParameters:Union([exact=JSString], [exact=JSUInt31])*/
/*strong.element: _dontTrustParameters:[exact=JSUInt31]*/
_dontTrustParameters(int /*Union([exact=JSString], [exact=JSUInt31])*/ i) {
diff --git a/tests/compiler/dart2js/inference/data/postfix_prefix.dart b/tests/compiler/dart2js/inference/data/postfix_prefix.dart
index f7428dd..9ede9a2 100644
--- a/tests/compiler/dart2js/inference/data/postfix_prefix.dart
+++ b/tests/compiler/dart2js/inference/data/postfix_prefix.dart
@@ -18,10 +18,7 @@
/*element: A.[]=:[null]*/
operator []=(/*[empty]*/ index, /*[subclass=JSNumber]*/ value) {}
- // TODO(johnniwinther): Investigate why these differ.
- /*ast.element: A.returnDynamic1:Union([exact=JSString], [exact=JSUInt31])*/
- /*kernel.element: A.returnDynamic1:[exact=JSUInt31]*/
- /*strong.element: A.returnDynamic1:[exact=JSUInt31]*/
+ /*element: A.returnDynamic1:[exact=JSUInt31]*/
returnDynamic1() => /*[subclass=A]*/ /*update: [subclass=A]*/ foo
/*invoke: Union([exact=JSString], [exact=JSUInt31])*/ --;
@@ -33,10 +30,7 @@
returnNum2() => /*[subclass=A]*/ /*update: [subclass=A]*/ foo
/*invoke: Union([exact=JSString], [exact=JSUInt31])*/ -= 42;
- // TODO(johnniwinther): Investigate why these differ.
- /*ast.element: A.returnDynamic2:Union([exact=JSString], [exact=JSUInt31])*/
- /*kernel.element: A.returnDynamic2:[exact=JSUInt31]*/
- /*strong.element: A.returnDynamic2:[exact=JSUInt31]*/
+ /*element: A.returnDynamic2:[exact=JSUInt31]*/
returnDynamic2() => this
/*[subclass=A]*/ /*update: [subclass=A]*/ [index]
/*invoke: Union([exact=JSString], [exact=JSUInt31])*/ --;
@@ -55,9 +49,7 @@
returnEmpty3() {
dynamic a = this;
return a. /*[subclass=A]*/
- /*ast.update: [subclass=A]*/
- /*kernel.update: [empty]*/
- /*strong.update: [empty]*/
+ /*update: [empty]*/
bar
/*invoke: [empty]*/ --;
}
@@ -84,10 +76,7 @@
/*element: B.[]:[exact=JSUInt31]*/
operator [](/*[empty]*/ index) => 42;
- // TODO(johnniwinther): Investigate why these differ.
- /*ast.element: B.returnString1:Value([exact=JSString], value: "string")*/
- /*kernel.element: B.returnString1:[empty]*/
- /*strong.element: B.returnString1:[empty]*/
+ /*element: B.returnString1:[empty]*/
returnString1() =>
super.foo /*invoke: Value([exact=JSString], value: "string")*/ --;
@@ -100,10 +89,7 @@
returnDynamic2() =>
super.foo /*invoke: Value([exact=JSString], value: "string")*/ -= 42;
- // TODO(johnniwinther): Investigate why these differ.
- /*ast.element: B.returnString2:Value([exact=JSString], value: "string")*/
- /*kernel.element: B.returnString2:[empty]*/
- /*strong.element: B.returnString2:[empty]*/
+ /*element: B.returnString2:[empty]*/
returnString2() => super[index]
/*invoke: Value([exact=JSString], value: "string")*/ --;
diff --git a/tests/compiler/dart2js/inference/data/refine_locals.dart b/tests/compiler/dart2js/inference/data/refine_locals.dart
index 54a4013..8711587 100644
--- a/tests/compiler/dart2js/inference/data/refine_locals.dart
+++ b/tests/compiler/dart2js/inference/data/refine_locals.dart
@@ -114,21 +114,15 @@
/*Union([exact=Class2], [null|exact=Class1])*/ o) {
o
?.
- /*ast.invoke: Union([exact=Class2], [null|exact=Class1])*/
- /*kernel.invoke: Union([exact=Class1], [exact=Class2])*/
- /*strong.invoke: Union([exact=Class1], [exact=Class2])*/
+ /*invoke: Union([exact=Class1], [exact=Class2])*/
method1();
o
?.
- /*ast.invoke: [null|exact=Class1]*/
- /*kernel.invoke: [exact=Class1]*/
- /*strong.invoke: [exact=Class1]*/
+ /*invoke: [exact=Class1]*/
method0();
o
?.
- /*ast.invoke: [null|exact=Class1]*/
- /*kernel.invoke: [exact=Class1]*/
- /*strong.invoke: [exact=Class1]*/
+ /*invoke: [exact=Class1]*/
method2();
return o;
}
diff --git a/tests/compiler/dart2js/inference/inference_equivalence.dart b/tests/compiler/dart2js/inference/inference_equivalence.dart
deleted file mode 100644
index 638eab5..0000000
--- a/tests/compiler/dart2js/inference/inference_equivalence.dart
+++ /dev/null
@@ -1,82 +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.
-
-/// Helper program that tests the equivalence between old and new inferrer data
-/// on a dart program or directory of dart programs.
-
-import 'dart:async';
-import 'dart:io';
-import 'package:args/args.dart';
-import 'package:compiler/src/filenames.dart';
-import 'package:compiler/src/inferrer/inferrer_engine.dart';
-import '../equivalence/id_equivalence_helper.dart';
-import 'inference_test_helper.dart';
-import '../equivalence/id_equivalence.dart';
-
-main(List<String> args) {
- mainInternal(args);
-}
-
-Future<bool> mainInternal(List<String> args,
- {bool whiteList(Uri uri, Id id)}) async {
- ArgParser argParser = new ArgParser(allowTrailingOptions: true);
- argParser.addFlag('verbose', negatable: true, defaultsTo: false);
- argParser.addFlag('colors', negatable: true);
- ArgResults argResults = argParser.parse(args);
- if (argResults.options.contains('colors')) {
- useColors = true;
- }
- bool verbose = argResults['verbose'];
-
- InferrerEngineImpl.useSorterForTesting = true;
-
- bool success = true;
- for (String arg in argResults.rest) {
- Uri uri = Uri.base.resolve(nativeToUriPath(arg));
- List<Uri> uris = <Uri>[];
- if (FileSystemEntity.isDirectorySync(arg)) {
- for (FileSystemEntity file in new Directory.fromUri(uri).listSync()) {
- if (file is File && file.path.endsWith('.dart')) {
- uris.add(file.uri);
- }
- }
- } else {
- uris.add(uri);
- }
- for (Uri uri in uris) {
- StringBuffer sb = new StringBuffer();
- ZoneSpecification specification = new ZoneSpecification(
- print: (self, parent, zone, line) => sb.writeln(line));
-
- try {
- print('--$uri------------------------------------------------------');
- bool isSuccess = await runZoned(() {
- return testUri(uri, verbose: verbose, whiteList: whiteList);
- }, zoneSpecification: specification);
- if (!isSuccess) {
- success = false;
- print(' skipped due to compile-time errors');
- }
- } catch (e, s) {
- success = false;
- print(sb);
- print('Failed: $e\n$s');
- }
- }
- }
-
- return success;
-}
-
-Future<bool> testUri(Uri uri,
- {bool verbose: false, bool whiteList(Uri uri, Id id)}) {
- return compareData(
- uri, uri, const {}, computeMemberAstTypeMasks, computeMemberIrTypeMasks,
- options: [stopAfterTypeInference],
- forUserLibrariesOnly: false,
- skipUnprocessedMembers: true,
- skipFailedCompilations: true,
- verbose: verbose,
- whiteList: whiteList);
-}
diff --git a/tests/compiler/dart2js/inference/inference_test_helper.dart b/tests/compiler/dart2js/inference/inference_test_helper.dart
index 2b9c68f..7796132 100644
--- a/tests/compiler/dart2js/inference/inference_test_helper.dart
+++ b/tests/compiler/dart2js/inference/inference_test_helper.dart
@@ -8,10 +8,7 @@
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
-import 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/elements/entities.dart';
-import 'package:compiler/src/resolution/send_structure.dart';
-import 'package:compiler/src/tree/nodes.dart' as ast;
import 'package:compiler/src/types/types.dart';
import 'package:compiler/src/js_model/locals.dart';
import 'package:compiler/src/kernel/element_map.dart';
@@ -45,8 +42,7 @@
runTests(List<String> args, [int shardIndex]) {
asyncTest(() async {
Directory dataDir = new Directory.fromUri(Platform.script.resolve('data'));
- await checkTests(
- dataDir, computeMemberAstTypeMasks, computeMemberIrTypeMasks,
+ await checkTests(dataDir, computeMemberIrTypeMasks,
libDirectory: new Directory.fromUri(Platform.script.resolve('libs')),
forUserLibrariesOnly: true,
args: args,
@@ -58,21 +54,6 @@
});
}
-/// Compute type inference data for [_member] as a [MemberElement].
-///
-/// Fills [actualMap] with the data.
-void computeMemberAstTypeMasks(
- Compiler compiler, MemberEntity _member, Map<Id, ActualData> actualMap,
- {bool verbose: false}) {
- MemberElement member = _member;
- ResolvedAst resolvedAst = member.resolvedAst;
- compiler.reporter.withCurrentElement(member.implementation, () {
- new TypeMaskAstComputer(compiler.reporter, actualMap, resolvedAst,
- compiler.globalInference.results)
- .run();
- });
-}
-
abstract class ComputeValueMixin<T> {
GlobalTypeInferenceResults<T> get results;
@@ -103,63 +84,6 @@
}
}
-/// AST visitor for computing inference data for a member.
-class TypeMaskAstComputer extends AstDataExtractor
- with ComputeValueMixin<ast.Node> {
- final GlobalTypeInferenceResults<ast.Node> results;
- final GlobalTypeInferenceElementResult<ast.Node> result;
-
- TypeMaskAstComputer(DiagnosticReporter reporter,
- Map<Id, ActualData> actualMap, ResolvedAst resolvedAst, this.results)
- : result = results.resultOfMember(resolvedAst.element as MemberElement),
- super(reporter, actualMap, resolvedAst);
-
- @override
- String computeElementValue(Id id, AstElement element) {
- if (element.isParameter) {
- ParameterElement parameter = element.implementation;
- return getParameterValue(parameter);
- } else if (element.isLocal && element.isFunction) {
- LocalFunctionElement localFunction = element;
- return getMemberValue(localFunction.callMethod);
- } else {
- MemberElement member = element.declaration;
- return getMemberValue(member);
- }
- }
-
- @override
- String computeNodeValue(Id id, ast.Node node, [AstElement element]) {
- if (element != null && element.isLocal && element.isFunction) {
- return computeElementValue(id, element);
- } else if (element != null && element.isParameter) {
- return computeElementValue(id, element);
- } else if (node is ast.SendSet) {
- SendStructure sendStructure = elements.getSendStructure(node);
- if (sendStructure?.kind == SendStructureKind.INDEX_SET) {
- return getTypeMaskValue(result.typeOfSend(node));
- } else if (id.kind == IdKind.invoke) {
- return getTypeMaskValue(result.typeOfOperator(node));
- } else if (id.kind == IdKind.update) {
- return getTypeMaskValue(result.typeOfSend(node));
- } else if (id.kind == IdKind.node) {
- return getTypeMaskValue(result.typeOfGetter(node));
- }
- } else if (node is ast.Send) {
- return getTypeMaskValue(result.typeOfSend(node));
- } else if (node is ast.ForIn) {
- if (id.kind == IdKind.iterator) {
- return getTypeMaskValue(result.typeOfIterator(node));
- } else if (id.kind == IdKind.current) {
- return getTypeMaskValue(result.typeOfIteratorCurrent(node));
- } else if (id.kind == IdKind.moveNext) {
- return getTypeMaskValue(result.typeOfIteratorMoveNext(node));
- }
- }
- return null;
- }
-}
-
/// Compute type inference data for [member] from kernel based inference.
///
/// Fills [actualMap] with the data.
diff --git a/tests/compiler/dart2js/inference/show.dart b/tests/compiler/dart2js/inference/show.dart
index 94402a7..0602a54 100644
--- a/tests/compiler/dart2js/inference/show.dart
+++ b/tests/compiler/dart2js/inference/show.dart
@@ -19,21 +19,16 @@
argParser.addFlag('callers', defaultsTo: false);
ArgResults results = argParser.parse(args);
- ComputeMemberDataFunction astFunction;
ComputeMemberDataFunction kernelFunction;
if (results['side-effects']) {
- astFunction = computeMemberAstSideEffects;
kernelFunction = computeMemberIrSideEffects;
}
if (results['callers']) {
InferrerEngineImpl.retainDataForTesting = true;
- astFunction = computeMemberAstCallers;
kernelFunction = computeMemberIrCallers;
} else {
InferrerEngineImpl.useSorterForTesting = true;
- astFunction = computeMemberAstTypeMasks;
kernelFunction = computeMemberIrTypeMasks;
}
- await show(results, astFunction, kernelFunction,
- options: [/*stopAfterTypeInference*/]);
+ await show(results, kernelFunction, options: [/*stopAfterTypeInference*/]);
}
diff --git a/tests/compiler/dart2js/inference/side_effects_test.dart b/tests/compiler/dart2js/inference/side_effects_test.dart
index a92944e..e60006d 100644
--- a/tests/compiler/dart2js/inference/side_effects_test.dart
+++ b/tests/compiler/dart2js/inference/side_effects_test.dart
@@ -8,11 +8,9 @@
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
-import 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/kernel/element_map.dart';
import 'package:compiler/src/kernel/kernel_backend_strategy.dart';
-import 'package:compiler/src/tree/nodes.dart' as ast;
import 'package:compiler/src/world.dart';
import 'package:kernel/ast.dart' as ir;
import '../equivalence/id_equivalence.dart';
@@ -22,29 +20,13 @@
asyncTest(() async {
Directory dataDir =
new Directory.fromUri(Platform.script.resolve('side_effects'));
- await checkTests(
- dataDir, computeMemberAstSideEffects, computeMemberIrSideEffects,
+ await checkTests(dataDir, computeMemberIrSideEffects,
args: args,
options: [stopAfterTypeInference],
skipForStrong: ['closure_call.dart']);
});
}
-/// Compute side effects data for [_member] as a [MemberElement].
-///
-/// Fills [actualMap] with the data.
-void computeMemberAstSideEffects(
- Compiler compiler, MemberEntity _member, Map<Id, ActualData> actualMap,
- {bool verbose: false}) {
- MemberElement member = _member;
- ResolvedAst resolvedAst = member.resolvedAst;
- compiler.reporter.withCurrentElement(member.implementation, () {
- new SideEffectsAstComputer(compiler.reporter, actualMap, resolvedAst,
- compiler.backendClosedWorldForTesting)
- .run();
- });
-}
-
abstract class ComputeValueMixin<T> {
ClosedWorld get closedWorld;
@@ -56,37 +38,6 @@
}
}
-/// AST visitor for computing side effects data for a member.
-class SideEffectsAstComputer extends AstDataExtractor
- with ComputeValueMixin<ast.Node> {
- final ClosedWorld closedWorld;
-
- SideEffectsAstComputer(DiagnosticReporter reporter,
- Map<Id, ActualData> actualMap, ResolvedAst resolvedAst, this.closedWorld)
- : super(reporter, actualMap, resolvedAst);
-
- @override
- String computeElementValue(Id id, AstElement element) {
- if (element.isParameter) {
- return null;
- } else if (element.isLocal && element.isFunction) {
- LocalFunctionElement localFunction = element;
- return getMemberValue(localFunction.callMethod);
- } else {
- MemberElement member = element.declaration;
- return getMemberValue(member);
- }
- }
-
- @override
- String computeNodeValue(Id id, ast.Node node, [AstElement element]) {
- if (element != null && element.isLocal && element.isFunction) {
- return computeElementValue(id, element);
- }
- return null;
- }
-}
-
/// Compute side effects data for [member] from kernel based inference.
///
/// Fills [actualMap] with the data.
diff --git a/tests/compiler/dart2js/inference/swarm_test.dart b/tests/compiler/dart2js/inference/swarm_test.dart
deleted file mode 100644
index c374b3f..0000000
--- a/tests/compiler/dart2js/inference/swarm_test.dart
+++ /dev/null
@@ -1,24 +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:async_helper/async_helper.dart';
-import 'package:expect/expect.dart';
-import '../equivalence/id_equivalence.dart';
-import 'inference_equivalence.dart';
-
-main(List<String> args) {
- asyncTest(() async {
- Expect.isTrue(
- await mainInternal(['samples-dev/swarm/swarm.dart']..addAll(args),
- whiteList: (Uri uri, Id id) {
- if (uri.pathSegments.last == 'date_time.dart' &&
- '$id' == 'IdKind.node:15944') {
- // DateTime.== uses `if (!(other is DateTime))` for which kernel is
- // smarter.
- return true;
- }
- return false;
- }));
- });
-}
diff --git a/tests/compiler/dart2js/inlining/inlining_test.dart b/tests/compiler/dart2js/inlining/inlining_test.dart
index 36e7b3f..18951fc 100644
--- a/tests/compiler/dart2js/inlining/inlining_test.dart
+++ b/tests/compiler/dart2js/inlining/inlining_test.dart
@@ -8,13 +8,10 @@
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
-import 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/elements/entities.dart';
-import 'package:compiler/src/tree/nodes.dart' as ast;
import 'package:compiler/src/js_backend/backend.dart';
import 'package:compiler/src/kernel/element_map.dart';
import 'package:compiler/src/kernel/kernel_backend_strategy.dart';
-import 'package:compiler/src/ssa/builder.dart' as ast;
import 'package:compiler/src/ssa/builder_kernel.dart' as kernel;
import 'package:compiler/src/universe/world_impact.dart';
import 'package:compiler/src/universe/use.dart';
@@ -26,24 +23,7 @@
JavaScriptBackend.cacheCodegenImpactForTesting = true;
asyncTest(() async {
Directory dataDir = new Directory.fromUri(Platform.script.resolve('data'));
- await checkTests(
- dataDir, computeMemberAstInlinings, computeMemberIrInlinings,
- args: args, skipForAst: ['external.dart']);
- });
-}
-
-/// Compute type inference data for [_member] as a [MemberElement].
-///
-/// Fills [actualMap] with the data.
-void computeMemberAstInlinings(
- Compiler compiler, MemberEntity _member, Map<Id, ActualData> actualMap,
- {bool verbose: false}) {
- MemberElement member = _member;
- ResolvedAst resolvedAst = member.resolvedAst;
- compiler.reporter.withCurrentElement(member.implementation, () {
- new InliningAstComputer(
- compiler.reporter, actualMap, resolvedAst, compiler.backend)
- .run();
+ await checkTests(dataDir, computeMemberIrInlinings, args: args);
});
}
@@ -98,55 +78,6 @@
}
}
-/// AST visitor for computing inlining data for a member.
-class InliningAstComputer extends AstDataExtractor
- with ComputeValueMixin<ast.Node> {
- final JavaScriptBackend backend;
-
- InliningAstComputer(DiagnosticReporter reporter,
- Map<Id, ActualData> actualMap, ResolvedAst resolvedAst, this.backend)
- : super(reporter, actualMap, resolvedAst);
-
- @override
- ConstructorBodyEntity getConstructorBody(
- covariant ConstructorElement constructor) {
- return constructor.enclosingClass.lookupConstructorBody(constructor.name);
- }
-
- @override
- String getTooDifficultReason(MemberEntity member) {
- if (member is MethodElement) {
- if (member is ConstructorElement && member.isDefaultConstructor) {
- return null;
- }
- return ast.InlineWeeder.cannotBeInlinedReason(member.resolvedAst, null,
- enableUserAssertions: true);
- }
- return null;
- }
-
- @override
- String computeElementValue(Id id, AstElement element) {
- if (element.isParameter) {
- return null;
- } else if (element.isLocal && element.isFunction) {
- LocalFunctionElement localFunction = element;
- return getMemberValue(localFunction.callMethod);
- } else {
- MemberElement member = element.declaration;
- return getMemberValue(member);
- }
- }
-
- @override
- String computeNodeValue(Id id, ast.Node node, [AstElement element]) {
- if (element != null && element.isLocal && element.isFunction) {
- return computeElementValue(id, element);
- }
- return null;
- }
-}
-
/// Compute type inference data for [member] from kernel based inference.
///
/// Fills [actualMap] with the data.
diff --git a/tests/compiler/dart2js/inlining/inlining_viewer.dart b/tests/compiler/dart2js/inlining/inlining_viewer.dart
index 9ec0739..9b11031 100644
--- a/tests/compiler/dart2js/inlining/inlining_viewer.dart
+++ b/tests/compiler/dart2js/inlining/inlining_viewer.dart
@@ -10,6 +10,5 @@
main(List<String> args) async {
JavaScriptBackend.cacheCodegenImpactForTesting = true;
- await show(createArgParser().parse(args), computeMemberAstInlinings,
- computeMemberIrInlinings);
+ await show(createArgParser().parse(args), computeMemberIrInlinings);
}
diff --git a/tests/compiler/dart2js/jumps/data/complex_loops.dart b/tests/compiler/dart2js/jumps/data/complex_loops.dart
index 5495006..d5f73e2 100644
--- a/tests/compiler/dart2js/jumps/data/complex_loops.dart
+++ b/tests/compiler/dart2js/jumps/data/complex_loops.dart
@@ -22,11 +22,9 @@
}
complexForInLoopWithContinueLookalike2(list) {
- /*kernel.0@continue*/
- /*strong.0@continue*/
+ /*0@continue*/
for (int i in list) {
label:
- /*ast.0@break*/
{
if (i % 2 == 0) /*target=0*/ break label;
print(i);
diff --git a/tests/compiler/dart2js/jumps/jump_test.dart b/tests/compiler/dart2js/jumps/jump_test.dart
index b18da0e..ddc8766 100644
--- a/tests/compiler/dart2js/jumps/jump_test.dart
+++ b/tests/compiler/dart2js/jumps/jump_test.dart
@@ -8,13 +8,11 @@
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
-import 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/elements/jumps.dart';
import 'package:compiler/src/js_model/locals.dart';
import 'package:compiler/src/kernel/element_map.dart';
import 'package:compiler/src/kernel/kernel_backend_strategy.dart';
-import 'package:compiler/src/tree/nodes.dart' as ast;
import '../equivalence/id_equivalence.dart';
import '../equivalence/id_equivalence_helper.dart';
import 'package:kernel/ast.dart' as ir;
@@ -22,23 +20,12 @@
main(List<String> args) {
asyncTest(() async {
Directory dataDir = new Directory.fromUri(Platform.script.resolve('data'));
- await checkTests(dataDir, computeJumpsData, computeKernelJumpsData,
+ await checkTests(dataDir, computeKernelJumpsData,
options: [Flags.disableTypeInference, stopAfterTypeInference],
args: args);
});
}
-/// Compute closure data mapping for [_member] as a [MemberElement].
-///
-/// Fills [actualMap] with the data and [sourceSpanMap] with the source spans
-/// for the data origin.
-void computeJumpsData(
- Compiler compiler, MemberEntity _member, Map<Id, ActualData> actualMap,
- {bool verbose: false}) {
- MemberElement member = _member;
- new JumpsAstComputer(compiler.reporter, actualMap, member.resolvedAst).run();
-}
-
/// Compute closure data mapping for [member] as a kernel based element.
///
/// Fills [actualMap] with the data and [sourceSpanMap] with the source spans
@@ -116,85 +103,6 @@
}
}
-/// Ast visitor for computing jump data.
-class JumpsAstComputer extends AstDataExtractor with JumpsMixin {
- JumpsAstComputer(DiagnosticReporter reporter, Map<Id, ActualData> actualMap,
- ResolvedAst resolvedAst)
- : super(reporter, actualMap, resolvedAst);
-
- void run() {
- super.run();
- processData();
- }
-
- @override
- String computeNodeValue(Id id, ast.Node node, [AstElement element]) {
- // Node values are computed post-visit in [processData].
- return null;
- }
-
- @override
- String computeElementValue(Id id, AstElement element) {
- return null;
- }
-
- @override
- visitLoop(ast.Loop node) {
- JumpTarget target = elements.getTargetDefinition(node);
- if (target != null) {
- NodeId id = createLoopId(node);
- SourceSpan sourceSpan = computeSourceSpan(node);
- targets[target] = new TargetData(index++, id, sourceSpan, target);
- }
- super.visitLoop(node);
- }
-
- @override
- visitGotoStatement(ast.GotoStatement node) {
- JumpTarget target = elements.getTargetOf(node);
- assert(target != null, 'No target for $node.');
- NodeId id = createGotoId(node);
- SourceSpan sourceSpan = computeSourceSpan(node);
- gotos.add(new GotoData(id, sourceSpan, target));
- super.visitGotoStatement(node);
- }
-
- @override
- visitLabeledStatement(ast.LabeledStatement node) {
- if (node.statement is! ast.Loop && node.statement is! ast.SwitchStatement) {
- JumpTarget target = elements.getTargetDefinition(node.statement);
- if (target != null) {
- NodeId id = createLabeledStatementId(node);
- SourceSpan sourceSpan = computeSourceSpan(node);
- targets[target] = new TargetData(index++, id, sourceSpan, target);
- }
- }
- super.visitLabeledStatement(node);
- }
-
- @override
- visitSwitchStatement(ast.SwitchStatement node) {
- JumpTarget target = elements.getTargetDefinition(node);
- if (target != null) {
- NodeId id = createLoopId(node);
- SourceSpan sourceSpan = computeSourceSpan(node);
- targets[target] = new TargetData(index++, id, sourceSpan, target);
- }
- super.visitSwitchStatement(node);
- }
-
- @override
- visitSwitchCase(ast.SwitchCase node) {
- JumpTarget target = elements.getTargetDefinition(node);
- if (target != null) {
- NodeId id = createSwitchCaseId(node);
- SourceSpan sourceSpan = computeSourceSpan(node);
- targets[target] = new TargetData(index++, id, sourceSpan, target);
- }
- super.visitSwitchCase(node);
- }
-}
-
/// Kernel IR visitor for computing jump data.
class JumpsIrChecker extends IrDataExtractor with JumpsMixin {
final KernelToLocalsMap _localsMap;
diff --git a/tests/compiler/dart2js/kernel/arguments.dart b/tests/compiler/dart2js/kernel/arguments.dart
deleted file mode 100644
index 11374c0..0000000
--- a/tests/compiler/dart2js/kernel/arguments.dart
+++ /dev/null
@@ -1,44 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library dart2js.kernel.arguments;
-
-import 'package:compiler/src/filenames.dart';
-
-class Arguments {
- final String filename;
- final int start;
- final int end;
- final bool verbose;
-
- const Arguments({this.filename, this.start, this.end, this.verbose: false});
-
- factory Arguments.from(List<String> arguments) {
- String filename;
- int start;
- int end;
- for (String arg in arguments) {
- if (!arg.startsWith('-')) {
- int index = int.parse(arg, onError: (_) => null);
- if (index == null) {
- filename = arg;
- } else if (start == null) {
- start = index;
- } else {
- end = index;
- }
- }
- }
- bool verbose = arguments.contains('-v');
- return new Arguments(
- filename: filename, start: start, end: end, verbose: verbose);
- }
-
- Uri get uri {
- if (filename != null) {
- return Uri.base.resolve(nativeToUriPath(filename));
- }
- return null;
- }
-}
diff --git a/tests/compiler/dart2js/kernel/assert_test.dart b/tests/compiler/dart2js/kernel/assert_test.dart
deleted file mode 100644
index 700bf42..0000000
--- a/tests/compiler/dart2js/kernel/assert_test.dart
+++ /dev/null
@@ -1,31 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:compiler/src/commandline_options.dart' show Flags;
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- test('assert without message', () {
- String code = '''
-bool foo() => 2 + 2 == 4;
-main() {
- assert(foo());
-}''';
- return check(code, extraOptions: const <String>[Flags.enableCheckedMode]);
- });
-
- test('assert with message', () {
- String code = '''
-bool foo() => 2 + 2 == 4;
-main() {
- assert(foo(), "foo failed");
-}''';
- return check(code, extraOptions: const <String>[
- Flags.enableCheckedMode,
- Flags.enableAssertMessage,
- ]);
- });
-}
diff --git a/tests/compiler/dart2js/kernel/binary_operators_test.dart b/tests/compiler/dart2js/kernel/binary_operators_test.dart
deleted file mode 100644
index 96f3fdb..0000000
--- a/tests/compiler/dart2js/kernel/binary_operators_test.dart
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- group('compile binary operators', () {
- test('plus on ints', () {
- return check('main() { return 1 + 2; }');
- });
- test('plus on strings', () {
- return check('main() { return "a" + "b"; }');
- });
- test('plus on non-constants', () {
- String code = '''
- foo() => 1;
- main() => foo() + foo();''';
- return check(code);
- });
- test('other arithmetic operators', () {
- return check('main() { return 1 + 2 * 3 - 4 / 5 % 6; }');
- });
- });
-}
diff --git a/tests/compiler/dart2js/kernel/closed_world2_test.dart b/tests/compiler/dart2js/kernel/closed_world2_test.dart
deleted file mode 100644
index d21a95d..0000000
--- a/tests/compiler/dart2js/kernel/closed_world2_test.dart
+++ /dev/null
@@ -1,274 +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.
-
-// Partial test that the closed world computed from [WorldImpact]s derived from
-// kernel is equivalent to the original computed from resolution.
-library dart2js.kernel.closed_world2_test;
-
-import 'dart:async';
-
-import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/commandline_options.dart';
-import 'package:compiler/src/common.dart';
-import 'package:compiler/src/common_elements.dart';
-import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/elements/types.dart';
-import 'package:compiler/src/enqueue.dart';
-import 'package:compiler/src/js_backend/backend_usage.dart';
-import 'package:compiler/src/kernel/element_map.dart';
-import 'package:compiler/src/kernel/kernel_strategy.dart';
-import 'package:compiler/src/universe/world_builder.dart';
-import 'package:compiler/src/util/util.dart';
-import 'package:compiler/src/world.dart';
-import 'package:expect/expect.dart';
-import '../memory_compiler.dart';
-import '../equivalence/check_functions.dart';
-import '../equivalence/equivalence_helper.dart';
-import 'arguments.dart';
-import 'compiler_helper.dart';
-import 'test_helpers.dart';
-
-const SOURCE = const {
- 'main.dart': '''
-import 'dart:html';
-import 'dart:typed_data';
-import 'package:expect/expect.dart';
-
-class ClassWithSetter {
- void set setter(_) {}
-}
-
-class Mixin {
- method1() {}
- method2() {}
- method3() {}
-}
-class Class1 = Object with Mixin;
-class Class2 extends Object with Mixin {
- method3() {}
-}
-
-method1() {} // Deliberately the same name as the instance member in Mixin.
-
-class ClassWithCallBase {
- void call() {}
-}
-
-class ClassWithCallRequired {
- void call(int i) {}
-}
-
-class ClassWithCallGeneric<T> {
- void call(T t) {}
-}
-
-class ClassWithCallOptional<T> {
- void call([T t]) {}
-}
-
-class ClassWithCallNamed<T> {
- void call({T t}) {}
-}
-
-class ClassWithCallGetter {
- int get call => 0;
-}
-
-class ClassWithCallSetter {
- void set call(int i) {}
-}
-
-// Inherits the call type:
-class ClassWithCall1 extends ClassWithCallBase {}
-class ClassWithCall2 extends ClassWithCallRequired {}
-class ClassWithCall3 extends ClassWithCallGeneric<String> {}
-class ClassWithCall4 extends ClassWithCallOptional<String> {}
-class ClassWithCall5 extends ClassWithCallNamed<String> {}
-
-// Inherits the same call type twice:
-class ClassWithCall6 extends ClassWithCallRequired
- implements ClassWithCallGeneric<int> {}
-
-// Inherits different but compatible call types:
-class ClassWithCall7 extends ClassWithCallRequired
- implements ClassWithCallGeneric<String> {}
-class ClassWithCall8 extends ClassWithCallRequired
- implements ClassWithCallOptional<int> {}
-class ClassWithCall9 extends ClassWithCallRequired
- implements ClassWithCallOptional<String> {}
-class ClassWithCall10 extends ClassWithCallBase
- implements ClassWithCallNamed<String> {}
-
-// Inherits incompatible call types:
-class ClassWithCall11 extends ClassWithCallNamed<int>
- implements ClassWithCallOptional<int> {}
-class ClassWithCall12 extends ClassWithCallGetter {}
-class ClassWithCall13 extends ClassWithCallSetter {}
-class ClassWithCall14 extends ClassWithCallBase
- implements ClassWithCallGetter {}
-class ClassWithCall15 extends ClassWithCallBase
- implements ClassWithCallSetter {}
-
-class ClassImplementsFunction implements Function {}
-
-abstract class A {
- // redirecting factory in abstract class to other class
- factory A.a() = D.a;
- // redirecting factory in abstract class to factory in abstract class
- factory A.b() = B.a;
-}
-abstract class B implements A {
- factory B.a() => null;
-}
-class C implements B {
- // redirecting factory in concrete to other class
- factory C.a() = D.a;
-}
-class D implements C {
- D.a();
-}
-
-@NoInline()
-main() {
- print('Hello World');
- ''.contains; // Trigger member closurization.
- new Element.div();
- new ClassWithSetter().setter = null;
- new Class1().method1();
- new Class2().method2();
- new Class2().method3();
- null is List<int>; // Use generic test
- method1(); // Both top level and instance method named 'method1' are live.
- #main; // Use a const symbol.
- const Symbol('foo'); // Use the const Symbol constructor directly
- new Int8List(0); // Use redirect factory to abstract native class
-
- new ClassWithCall1();
- new ClassWithCall2();
- new ClassWithCall3();
- new ClassWithCall4();
- new ClassWithCall5();
- new ClassWithCall6();
- new ClassWithCall7();
- new ClassWithCall8();
- new ClassWithCall9();
- new ClassWithCall10();
- new ClassWithCall11();
- new ClassWithCall12();
- new ClassWithCall13();
- new ClassWithCall14();
- new ClassWithCall15();
- new ClassImplementsFunction();
-
- new A.a();
- new A.b();
- new C.a();
-}
-'''
-};
-
-main(List<String> args) {
- asyncTest(() async {
- await mainInternal(args);
- });
-}
-
-enum ResultKind { crashes, errors, warnings, success, failure }
-
-Future<ResultKind> mainInternal(List<String> args,
- {bool skipWarnings: false, bool skipErrors: false}) async {
- Arguments arguments = new Arguments.from(args);
- Uri entryPoint;
- Map<String, String> memorySourceFiles;
- if (arguments.uri != null) {
- entryPoint = arguments.uri;
- memorySourceFiles = const <String, String>{};
- } else {
- entryPoint = Uri.parse('memory:main.dart');
- memorySourceFiles = SOURCE;
- }
-
- enableDebugMode();
- ElementResolutionWorldBuilder.useInstantiationMap = true;
-
- print('---- analyze-only ------------------------------------------------');
- DiagnosticCollector collector = new DiagnosticCollector();
- CompilationResult result = await runCompiler(
- entryPoint: entryPoint,
- memorySourceFiles: memorySourceFiles,
- diagnosticHandler: collector,
- options: [
- Flags.useOldFrontend,
- Flags.analyzeOnly,
- Flags.enableAssertMessage
- ],
- beforeRun: (compiler) {
- compiler.impactCacheDeleter.retainCachesForTesting = true;
- });
- Compiler compiler1 = result.compiler;
- if (collector.crashes.isNotEmpty) {
- print('Skipping due to crashes.');
- return ResultKind.crashes;
- }
- if (collector.errors.isNotEmpty && skipErrors) {
- print('Skipping due to errors.');
- return ResultKind.errors;
- }
- if (collector.warnings.isNotEmpty && skipWarnings) {
- print('Skipping due to warnings.');
- return ResultKind.warnings;
- }
- Expect.isFalse(compiler1.compilationFailed);
- ResolutionEnqueuer enqueuer1 = compiler1.enqueuer.resolution;
- ClosedWorld closedWorld1 = compiler1.resolutionWorldBuilder.closeWorld();
- BackendUsage backendUsage1 = closedWorld1.backendUsage;
-
- Pair<Compiler, Compiler> compilers =
- await analyzeOnly(entryPoint, memorySourceFiles, printSteps: true);
- Compiler compiler = compilers.a;
- compiler.resolutionWorldBuilder.closeWorld();
- ElementEnvironment environment1 =
- compiler.frontendStrategy.elementEnvironment;
-
- Compiler compiler2 = compilers.b;
- KernelFrontEndStrategy frontendStrategy = compiler2.frontendStrategy;
- KernelToElementMapForImpact elementMap = frontendStrategy.elementMap;
- Expect.isFalse(compiler2.compilationFailed);
-
- KernelEquivalence equivalence = new KernelEquivalence(elementMap);
- TestStrategy strategy = equivalence.defaultStrategy;
-
- ElementEnvironment environment2 =
- compiler2.frontendStrategy.elementEnvironment;
- checkElementEnvironment(
- environment1,
- environment2,
- compiler1.frontendStrategy.dartTypes,
- compiler2.frontendStrategy.dartTypes,
- strategy);
-
- ResolutionEnqueuer enqueuer2 = compiler2.enqueuer.resolution;
- ClosedWorld closedWorld2 = compiler2.resolutionWorldBuilder.closeWorld();
- BackendUsage backendUsage2 = closedWorld2.backendUsage;
-
- checkNativeClasses(compiler1, compiler2, strategy);
-
- checkBackendUsage(backendUsage1, backendUsage2, strategy);
-
- checkResolutionEnqueuers(backendUsage1, backendUsage2, enqueuer1, enqueuer2,
- elementEquivalence: (a, b) => equivalence.entityEquivalence(a, b),
- typeEquivalence: (DartType a, DartType b) {
- return equivalence.typeEquivalence(unalias(a), b);
- },
- elementFilter: elementFilter,
- // TODO(johnniwinther): Support class usage testing in presence of
- // redirecting constructors.
- skipClassUsageTesting: ['C'],
- verbose: arguments.verbose);
-
- checkClosedWorlds(closedWorld1, closedWorld2,
- strategy: equivalence.defaultStrategy, verbose: arguments.verbose);
-
- return ResultKind.success;
-}
diff --git a/tests/compiler/dart2js/kernel/closed_world_from_dill_test.dart b/tests/compiler/dart2js/kernel/closed_world_from_dill_test.dart
deleted file mode 100644
index 21dd30e..0000000
--- a/tests/compiler/dart2js/kernel/closed_world_from_dill_test.dart
+++ /dev/null
@@ -1,173 +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.
-
-// Partial test that the closed world computed from [WorldImpact]s derived from
-// kernel is equivalent to the original computed from resolution.
-library dart2js.kernel.closed_world_from_dill_test;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/commandline_options.dart';
-import 'package:compiler/src/common.dart';
-import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/elements/types.dart';
-import 'package:compiler/src/enqueue.dart';
-import 'package:compiler/src/kernel/element_map.dart';
-import 'package:compiler/src/kernel/kernel_strategy.dart';
-import 'package:compiler/src/universe/world_builder.dart';
-import 'package:compiler/src/world.dart';
-import 'package:expect/expect.dart';
-import '../memory_compiler.dart';
-import '../equivalence/check_functions.dart';
-import 'arguments.dart';
-import 'compiler_helper.dart';
-import 'test_helpers.dart';
-
-const SOURCE = const {
- 'main.dart': '''
-import 'dart:html';
-import 'dart:typed_data';
-import 'package:expect/expect.dart';
-
-class ClassWithSetter {
- void set setter(_) {}
-}
-
-class Mixin {
- method1() {}
- method2() {}
- method3() {}
- method4() {}
- var field;
- get property => 0;
- set property(_) {}
-}
-class Class1 = Object with Mixin;
-class Class2 extends Object with Mixin {
- method3() {}
- method5() {
- super.method4();
- super.property;
- super.property = null;
- super.field;
- super.field = null;
- }
-}
-
-method1() {} // Deliberately the same name as the instance member in Mixin.
-
-@NoInline()
-main() {
- print('Hello World');
- ''.contains; // Trigger member closurization.
- new ClassWithSetter().setter = null;
- new Class1().method1();
- new Class2().method2();
- new Class2().method3();
- new Class2().method5();
- new Element.div();
- null is List<int>; // Use generic test
- method1(); // Both top level and instance method named 'method1' are live.
- #main; // Use a const symbol.
- const Symbol('foo'); // Use the const Symbol constructor directly
- new Int8List(0); // Use redirect factory to abstract native class
-}
-'''
-};
-
-main(List<String> args) {
- asyncTest(() async {
- await mainInternal(args);
- });
-}
-
-enum ResultKind { crashes, errors, warnings, success, failure }
-
-Future<ResultKind> mainInternal(List<String> args,
- {bool skipWarnings: false, bool skipErrors: false}) async {
- Arguments arguments = new Arguments.from(args);
- Uri entryPoint;
- Map<String, String> memorySourceFiles;
- if (arguments.uri != null) {
- entryPoint = arguments.uri;
- memorySourceFiles = const <String, String>{};
- } else {
- entryPoint = Uri.parse('memory:main.dart');
- memorySourceFiles = SOURCE;
- }
-
- enableDebugMode();
-
- Directory dir = await Directory.systemTemp.createTemp('dart2js-with-dill');
- print('--- create temp directory $dir -------------------------------');
- memorySourceFiles.forEach((String name, String source) {
- new File.fromUri(dir.uri.resolve(name)).writeAsStringSync(source);
- });
- entryPoint = dir.uri.resolve(entryPoint.path);
-
- print('---- analyze-only ------------------------------------------------');
- DiagnosticCollector collector = new DiagnosticCollector();
- ElementResolutionWorldBuilder.useInstantiationMap = true;
- CompilationResult result = await runCompiler(
- entryPoint: entryPoint,
- diagnosticHandler: collector,
- options: [
- Flags.useOldFrontend,
- Flags.analyzeOnly,
- Flags.enableAssertMessage
- ],
- beforeRun: (compiler) {
- compiler.impactCacheDeleter.retainCachesForTesting = true;
- });
- Compiler compiler1 = result.compiler;
- if (collector.crashes.isNotEmpty) {
- print('Skipping due to crashes.');
- return ResultKind.crashes;
- }
- if (collector.errors.isNotEmpty && skipErrors) {
- print('Skipping due to errors.');
- return ResultKind.errors;
- }
- if (collector.warnings.isNotEmpty && skipWarnings) {
- print('Skipping due to warnings.');
- return ResultKind.warnings;
- }
- Expect.isFalse(compiler1.compilationFailed);
- ResolutionEnqueuer enqueuer1 = compiler1.enqueuer.resolution;
- ClosedWorld closedWorld1 = compiler1.resolutionWorldBuilder.closeWorld();
-
- Compiler compiler2 = await compileWithDill(
- entryPoint: entryPoint,
- options: [Flags.analyzeOnly, Flags.enableAssertMessage],
- printSteps: true);
-
- KernelFrontEndStrategy frontendStrategy = compiler2.frontendStrategy;
- KernelToElementMap elementMap = frontendStrategy.elementMap;
-
- Expect.isFalse(compiler2.compilationFailed);
-
- KernelEquivalence equivalence = new KernelEquivalence(elementMap);
-
- ResolutionEnqueuer enqueuer2 = compiler2.enqueuer.resolution;
- ClosedWorld closedWorld2 = compiler2.resolutionWorldBuilder.closeWorld();
-
- checkBackendUsage(closedWorld1.backendUsage, closedWorld2.backendUsage,
- equivalence.defaultStrategy);
-
- checkResolutionEnqueuers(closedWorld1.backendUsage, closedWorld2.backendUsage,
- enqueuer1, enqueuer2,
- elementEquivalence: (a, b) => equivalence.entityEquivalence(a, b),
- typeEquivalence: (DartType a, DartType b) {
- return equivalence.typeEquivalence(unalias(a), b);
- },
- elementFilter: elementFilter,
- verbose: arguments.verbose);
-
- checkClosedWorlds(closedWorld1, closedWorld2,
- strategy: equivalence.defaultStrategy, verbose: arguments.verbose);
-
- return ResultKind.success;
-}
diff --git a/tests/compiler/dart2js/kernel/closed_world_tester.dart b/tests/compiler/dart2js/kernel/closed_world_tester.dart
deleted file mode 100644
index e1710af..0000000
--- a/tests/compiler/dart2js/kernel/closed_world_tester.dart
+++ /dev/null
@@ -1,138 +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.
-
-/// Helper application to run `closed_world2_test` on multiple files or
-/// directories.
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:args/args.dart';
-import 'package:compiler/src/filenames.dart';
-import 'closed_world2_test.dart';
-
-const String ERROR_MARKER = '---';
-
-main(List<String> args) async {
- ArgParser parser = new ArgParser();
- parser.addOption('log');
-
- ArgResults argsResults = parser.parse(args);
- String logName = argsResults['log'];
- IOSink log;
- Map<String, Result> results;
- if (logName != null) {
- if (FileSystemEntity.isFileSync(logName)) {
- // Log a previous log file if it exists and use it to only test files that
- // previously failed.
- results = readLogResults(logName);
- }
- log = new File(logName).openWrite();
- }
-
- if (results != null) {
- for (String fileName in results.keys) {
- Result result = results[fileName];
- if (result.kind == ResultKind.failure) {
- if (FileSystemEntity.isFileSync(fileName)) {
- await testFile(new File(fileName), log);
- } else {
- print("$fileName doesn't exist");
- }
- } else {
- log?.writeln('${fileName}: ${result.kind}');
- }
- }
- }
-
- for (String arg in argsResults.rest) {
- String path = nativeToUriPath(arg);
- if (FileSystemEntity.isDirectorySync(path)) {
- Directory dir = new Directory(path);
- for (FileSystemEntity file in dir.listSync(recursive: true)) {
- if (file is File && file.path.endsWith('.dart')) {
- if (results == null || !results.containsKey(file.path)) {
- await testFile(file, log);
- }
- }
- }
- } else if (FileSystemEntity.isFileSync(path)) {
- if (results == null || !results.containsKey(path)) {
- await testFile(new File(path), log);
- }
- } else {
- print("$arg doesn't exist");
- }
- }
-
- await log?.close();
-}
-
-/// Read the log file in [logName] and returns the map from test file name to
-/// [Result] stored in the log file.
-Map<String, Result> readLogResults(String logName) {
- Map<String, Result> results = <String, Result>{};
- String text = new File(logName).readAsStringSync();
- // Make a backup of the log file.
- new File('$logName~').writeAsStringSync(text);
- List<String> lines = text.split('\n');
- int index = 0;
- while (index < lines.length) {
- String line = lines[index];
- int colonPos = line.lastIndexOf(':');
- if (colonPos == -1) {
- if (!line.isEmpty) {
- print('Invalid log line @ $index: $line');
- }
- } else {
- String fileName = line.substring(0, colonPos);
- String kindName = line.substring(colonPos + 1).trim();
- ResultKind kind =
- ResultKind.values.firstWhere((kind) => '$kind' == kindName);
- String error;
- if (kind == ResultKind.failure) {
- assert(lines[index + 1] == ERROR_MARKER);
- index += 2;
- StringBuffer sb = new StringBuffer();
- while (lines[index] != ERROR_MARKER) {
- sb.writeln(lines[index]);
- index++;
- }
- error = sb.toString();
- }
- results[fileName] = new Result(kind, error);
- }
- index++;
- }
- return results;
-}
-
-Future testFile(File file, IOSink log) async {
- print('====================================================================');
- print('testing ${file.path}');
- ResultKind kind;
- String error;
- try {
- kind =
- await mainInternal([file.path], skipWarnings: true, skipErrors: true);
- } catch (e, s) {
- kind = ResultKind.failure;
- error = '$e:\n$s';
- print(error);
- }
- log?.writeln('${file.path}: ${kind}');
- if (error != null) {
- log?.writeln(ERROR_MARKER);
- log?.writeln(error);
- log?.writeln(ERROR_MARKER);
- }
- await log.flush();
-}
-
-class Result {
- final ResultKind kind;
- final String error;
-
- Result(this.kind, [this.error]);
-}
diff --git a/tests/compiler/dart2js/kernel/compile_from_dill_fast_startup_test.dart b/tests/compiler/dart2js/kernel/compile_from_dill_fast_startup_test.dart
deleted file mode 100644
index 5ca5fa0..0000000
--- a/tests/compiler/dart2js/kernel/compile_from_dill_fast_startup_test.dart
+++ /dev/null
@@ -1,18 +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.
-
-// Test compilation equivalence between source and .dill based
-// compilation using the fast_startup emitter.
-library dart2js.kernel.compile_from_dill_fast_startup_test;
-
-import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/commandline_options.dart';
-
-import 'compile_from_dill_test_helper.dart';
-
-main(List<String> args) {
- asyncTest(() async {
- await runTests(args, options: [Flags.fastStartup]);
- });
-}
diff --git a/tests/compiler/dart2js/kernel/compile_from_dill_test.dart b/tests/compiler/dart2js/kernel/compile_from_dill_test.dart
deleted file mode 100644
index ac7886c..0000000
--- a/tests/compiler/dart2js/kernel/compile_from_dill_test.dart
+++ /dev/null
@@ -1,17 +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.
-
-// Test compilation equivalence between source and .dill based
-// compilation using the default emitter (full_emitter).
-library dart2js.kernel.compile_from_dill_test;
-
-import 'package:async_helper/async_helper.dart';
-
-import 'compile_from_dill_test_helper.dart';
-
-main(List<String> args) {
- asyncTest(() async {
- await runTests(args);
- });
-}
diff --git a/tests/compiler/dart2js/kernel/compile_from_dill_test_helper.dart b/tests/compiler/dart2js/kernel/compile_from_dill_test_helper.dart
deleted file mode 100644
index 0de692d..0000000
--- a/tests/compiler/dart2js/kernel/compile_from_dill_test_helper.dart
+++ /dev/null
@@ -1,543 +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.
-
-// Helper to test compilation equivalence between source and .dill based
-// compilation.
-library dart2js.kernel.compile_from_dill_test_helper;
-
-import 'dart:async';
-
-import 'package:compiler/compiler_new.dart';
-import 'package:compiler/src/commandline_options.dart';
-import 'package:compiler/src/common.dart';
-import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/elements/elements.dart';
-import 'package:compiler/src/elements/types.dart';
-import 'package:compiler/src/kernel/element_map.dart';
-import 'package:compiler/src/kernel/kernel_backend_strategy.dart';
-import 'package:compiler/src/kernel/kernel_strategy.dart';
-import 'package:compiler/src/universe/world_builder.dart';
-import 'package:compiler/src/world.dart';
-import 'package:expect/expect.dart';
-import '../memory_compiler.dart';
-import '../equivalence/check_functions.dart';
-import '../equivalence/check_helpers.dart';
-import '../equivalence/equivalence_helper.dart';
-
-import 'arguments.dart';
-import 'compiler_helper.dart';
-import 'test_helpers.dart';
-
-class Test {
- final Uri uri;
- final Map<String, String> sources;
- final bool expectIdenticalOutput;
-
- const Test(this.sources, {this.expectIdenticalOutput: true}) : uri = null;
-
- Test.fromUri(this.uri, {this.expectIdenticalOutput: true})
- : sources = const {};
-
- Uri get entryPoint => uri ?? Uri.parse('memory:main.dart');
-
- String toString() => uri != null ? '$uri' : sources.values.first;
-}
-
-const List<Test> TESTS = const <Test>[
- const Test(const {
- 'main.dart': '''
-import 'dart:html';
-import 'package:expect/expect.dart';
-
-foo({named}) => 1;
-bar(a) => !a;
-class Class {
- var field;
- static var staticField;
-
- Class();
- Class.named(this.field) {
- staticField = 42;
- }
-
- method() {}
-}
-
-class SubClass extends Class {
- method() {
- super.method();
- }
-}
-
-class Generic<T> {
- method(o) => o is T;
-}
-
-var toplevel;
-
-typedef Typedef();
-
-class Mixin1 {
- var field1;
-}
-
-class Mixin2 {
- var field2;
-}
-
-class MixinSub1 extends Object with Mixin1 {
-}
-
-class MixinSub2 extends Object with Mixin1, Mixin2 {
-}
-
-main() {
- foo();
- bar(true);
- [];
- <int>[];
- {};
- new Object();
- new Class.named('');
- new SubClass().method();
- Class.staticField;
- var x = null;
- var y1 = x == null;
- var y2 = null == x;
- var z1 = x?.toString();
- var z2 = x ?? y1;
- var z3 = x ??= y2;
- var w = x == null ? null : x.toString();
- for (int i = 0; i < 10; i++) {
- if (i == 5) continue;
- x = i;
- if (i == 5) break;
- }
- int i = 0;
- while (i < 10) {
- if (i == 5) continue;
- x = i;
- if (i == 7) break;
- i++;
- }
- for (var v in [3, 5]) {
- if (v == 5) continue;
- x = v;
- if (v == 7) break;
- }
- do {
- x = i;
- if (i == 7) break;
- i++;
- } while (i < 10);
- switch (x) {
- case 0:
- x = 7;
- break;
- case 1:
- x = 9;
- break;
- default:
- x = 11;
- break;
- }
- x = toplevel;
- x = testIs(x);
- x = new Generic<int>().method(x);
- x = testAsGeneric(x);
- x = testAsFunction(x);
- print(x);
- var f = (x) {
- return 400 + x;
- };
- x = f(x);
- x = Object;
- x = Typedef;
- new MixinSub2();
- new MixinSub1();
- return x;
-}
-typedef NoArg();
-@NoInline()
-testIs(o) => o is Generic<int> || o is NoArg;
-@NoInline()
-testAsGeneric(o) => o as Generic<int>;
-@NoInline()
-testAsFunction(o) => o as NoArg;
-'''
- }),
- const Test(const {
- 'main.dart': '''
-
-main() {
- var x;
- int i = 0;
- do {
- if (i == 5) continue;
- x = i;
- if (i == 7) break;
- i++;
- } while (i < 10);
- outer1: for (var a in [3, 5]) {
- for (var b in [2, 4]) {
- if (a == b) break outer1;
- }
- }
- outer2: for (var a in [3, 5]) {
- for (var b in [2, 4]) {
- if (a != b) continue outer2;
- }
- }
- outer3: for (var a in [3, 5]) {
- for (var b in [2, 4]) {
- if (a == b) break outer3;
- if (a != b) continue outer3;
- }
- }
- print(x);
-}
-'''
- }, expectIdenticalOutput: false),
- const Test(const {
- 'main.dart': '''
-main() {
- var x = 42;
- int i = 0;
- switch (i) {
- case 0:
- print(x);
- continue label1;
- label1:
- case 1:
- print(x);
- break;
- }
-}
-'''
- }, expectIdenticalOutput: false),
- const Test(const {
- 'main.dart': '''
-main() {
- int x = 1;
- switch(x) {
- case 1:
- print('spider');
- continue world;
- case 5:
- print('beetle');
- break;
- world:
- case 6:
- print('cricket');
- break;
- default:
- print('bat');
- }
-}
-'''
- }, expectIdenticalOutput: false),
- const Test(const {
- 'main.dart': '''
-main() {
- int x = 1;
- switch(x) {
- case 1:
- print('spider');
- continue world;
- world:
- case 5:
- print('beetle');
- break;
- case 6:
- print('cricket');
- break;
- default:
- print('bat');
- }
-}'''
- }, expectIdenticalOutput: false),
- const Test(const {
- 'main.dart': '''
-main() {
- int x = 1;
- switch(x) {
- case 1:
- print('spider');
- continue world;
- world:
- case 5:
- print('beetle');
- break;
- case 6:
- print('cricket');
- break;
- }
-}'''
- }, expectIdenticalOutput: false),
- const Test(const {
- 'main.dart': '''
-main() {
- int x = 8;
- switch(x) {
- case 1:
- print('spider');
- continue world;
- world:
- case 5:
- print('beetle');
- break;
- case 6:
- print('cricket');
- break;
- }
-}'''
- }, expectIdenticalOutput: false),
- const Test(const {
- 'main.dart': '''
-class A<U,V> {
- var a = U;
- var b = V;
-}
-class B<Q, R> extends A<R, W<Q>> {
-}
-class C<Y> extends B<Y, W<Y>> {
-}
-class W<Z> {}
-main() {
- print(new C<String>().a);
-}
-'''
- }, expectIdenticalOutput: true),
- const Test(const {
- 'main.dart': '''
-class _Marker { const _Marker(); }
-const _MARKER = const _Marker();
-class Thing<X> {
- Thing([length = _MARKER]);
-}
-foo(x) {
- print(new List(x).length);
-}
-main() {
- print(new Thing<String>(100));
-
- print(new List());
- print(new List(4));
- foo(3);
- foo(4);
-}
-'''
- }, expectIdenticalOutput: true),
-];
-
-enum ResultKind { crashes, errors, warnings, success, failure }
-
-const List<String> commonOptions = const <String>[
- Flags.disableTypeInference,
- Flags.disableInlining,
- Flags.enableAssertMessage
-];
-
-Future runTests(List<String> args,
- {bool skipWarnings: false,
- bool skipErrors: false,
- List<String> options: const <String>[]}) async {
- Arguments arguments = new Arguments.from(args);
- List<Test> tests = TESTS;
- if (arguments.start != null) {
- int start = arguments.start;
- int end = arguments.end ?? 0; // Default 'end' to single test.
- if (end > tests.length) end = tests.length; // Large 'end' means all.
- if (end <= start) end = start + 1; // Always at least one test (else Error).
- tests = tests.sublist(start, end);
- } else if (arguments.uri != null) {
- tests = <Test>[new Test.fromUri(arguments.uri)];
- }
- for (Test test in tests) {
- if (test.uri != null) {
- print('--- running test uri ${test.uri} -------------------------------');
- } else {
- print(
- '--- running test code -------------------------------------------');
- print(test.sources.values.first);
- print('----------------------------------------------------------------');
- }
- await runTest(test.entryPoint, test.sources,
- verbose: arguments.verbose,
- skipWarnings: skipWarnings,
- skipErrors: skipErrors,
- options: options,
- expectIdenticalOutput: test.expectIdenticalOutput);
- }
-}
-
-Future<ResultKind> runTest(
- Uri entryPoint, Map<String, String> memorySourceFiles,
- {bool skipWarnings: false,
- bool skipErrors: false,
- bool verbose: false,
- List<String> options: const <String>[],
- bool expectAstEquivalence: false,
- bool expectIdenticalOutput: true}) async {
- enableDebugMode();
- Elements.useCFEOrder = true;
-
- print('---- compile from ast ----------------------------------------------');
- DiagnosticCollector collector = new DiagnosticCollector();
- OutputCollector collector1 = new OutputCollector();
- ElementResolutionWorldBuilder.useInstantiationMap = true;
- CompilationResult result = await runCompiler(
- entryPoint: entryPoint,
- memorySourceFiles: memorySourceFiles,
- diagnosticHandler: collector,
- outputProvider: collector1,
- options: <String>[]..addAll(commonOptions)..addAll(options),
- beforeRun: (compiler) {
- compiler.impactCacheDeleter.retainCachesForTesting = true;
- });
- Compiler compiler1 = result.compiler;
- if (collector.crashes.isNotEmpty) {
- print('Skipping due to crashes.');
- return ResultKind.crashes;
- }
- if (collector.errors.isNotEmpty && skipErrors) {
- print('Skipping due to errors.');
- return ResultKind.errors;
- }
- if (collector.warnings.isNotEmpty && skipWarnings) {
- print('Skipping due to warnings.');
- return ResultKind.warnings;
- }
- Expect.isFalse(compiler1.compilationFailed);
- ClosedWorld closedWorld1 =
- compiler1.resolutionWorldBuilder.closedWorldForTesting;
-
- OutputCollector collector2 = new OutputCollector();
- Compiler compiler2 = await compileWithDill(
- entryPoint: entryPoint,
- memorySourceFiles: memorySourceFiles,
- options: <String>[]..addAll(commonOptions)..addAll(options),
- printSteps: true,
- compilerOutput: collector2);
-
- // Print the middle section of the outputs if they are not line-wise
- // identical.
- collector1.outputMap
- .forEach((OutputType outputType, Map<String, BufferedOutputSink> map1) {
- if (outputType == OutputType.sourceMap) {
- return;
- }
- Map<String, BufferedOutputSink> map2 = collector2.outputMap[outputType];
- checkSets(map1.keys, map2.keys, 'output', equality);
- map1.forEach((String name, BufferedOutputSink output1) {
- BufferedOutputSink output2 = map2[name];
- if (output1.text == output2.text) return;
- List<String> lines1 = output1.text.split('\n');
- List<String> lines2 = output2.text.split('\n');
- int prefix = 0;
- while (prefix < lines1.length && prefix < lines2.length) {
- if (lines1[prefix] != lines2[prefix]) {
- break;
- }
- prefix++;
- }
- if (prefix > 0) prefix--;
- int suffix1 = lines1.length - 1;
- int suffix2 = lines2.length - 1;
- while (suffix1 >= 0 && suffix2 >= 0) {
- if (lines1[suffix1] != lines2[suffix2]) {
- break;
- }
- suffix1--;
- suffix2--;
- }
- if (suffix1 + 1 < lines1.length) suffix1++;
- if (suffix2 + 1 < lines2.length) suffix2++;
- print('--- from source, lines [${prefix}-${suffix1}] ------------------');
- lines1.sublist(prefix, suffix1 + 1).forEach(print);
- print('--- from dill, lines [${prefix}-${suffix2}] --------------------');
- lines2.sublist(prefix, suffix2 + 1).forEach(print);
- });
- });
-
- KernelFrontEndStrategy frontendStrategy = compiler2.frontendStrategy;
- KernelToElementMap elementMap = frontendStrategy.elementMap;
-
- Expect.isFalse(compiler2.compilationFailed);
-
- KernelEquivalence equivalence1 = new KernelEquivalence(elementMap);
-
- ClosedWorld closedWorld2 =
- compiler2.resolutionWorldBuilder.closedWorldForTesting;
-
- checkBackendUsage(closedWorld1.backendUsage, closedWorld2.backendUsage,
- equivalence1.defaultStrategy);
-
- print('--- checking resolution enqueuers ----------------------------------');
- checkResolutionEnqueuers(closedWorld1.backendUsage, closedWorld2.backendUsage,
- compiler1.enqueuer.resolution, compiler2.enqueuer.resolution,
- elementEquivalence: (a, b) => equivalence1.entityEquivalence(a, b),
- typeEquivalence: (DartType a, DartType b) {
- return equivalence1.typeEquivalence(unalias(a), b);
- },
- elementFilter: elementFilter,
- verbose: verbose);
-
- print('--- checking closed worlds -----------------------------------------');
- checkClosedWorlds(closedWorld1, closedWorld2,
- strategy: equivalence1.defaultStrategy,
- verbose: verbose,
- // TODO(johnniwinther,efortuna): Require closure class equivalence when
- // these are supported.
- allowMissingClosureClasses: true);
-
- // TODO(johnniwinther): Perform equivalence tests on the model: codegen world
- // impacts, program model, etc.
-
- print('--- checking codegen enqueuers--------------------------------------');
-
- KernelBackendStrategy backendStrategy = compiler2.backendStrategy;
- KernelEquivalence equivalence2 =
- new KernelEquivalence(backendStrategy.elementMap);
-
- checkCodegenEnqueuers(compiler1.enqueuer.codegenEnqueuerForTesting,
- compiler2.enqueuer.codegenEnqueuerForTesting,
- elementEquivalence: (a, b) => equivalence2.entityEquivalence(a, b),
- typeEquivalence: (DartType a, DartType b) {
- return equivalence2.typeEquivalence(unalias(a), b);
- },
- elementFilter: elementFilter,
- verbose: verbose);
-
- checkEmitters(compiler1.backend.emitter, compiler2.backend.emitter,
- equivalence2.defaultStrategy,
- elementEquivalence: (a, b) => equivalence2.entityEquivalence(a, b),
- typeEquivalence: (DartType a, DartType b) {
- return equivalence2.typeEquivalence(unalias(a), b);
- },
- verbose: verbose);
-
- if (expectAstEquivalence) {
- checkGeneratedCode(compiler1.backend, compiler2.backend,
- elementEquivalence: (a, b) => equivalence2.entityEquivalence(a, b));
- }
-
- if (expectIdenticalOutput) {
- print('--- checking output------- ---------------------------------------');
- collector1.outputMap
- .forEach((OutputType outputType, Map<String, BufferedOutputSink> map1) {
- if (outputType == OutputType.sourceMap) {
- // TODO(johnniwinther): Support source map from .dill.
- return;
- }
- Map<String, BufferedOutputSink> map2 = collector2.outputMap[outputType];
- checkSets(map1.keys, map2.keys, 'output', equality);
- map1.forEach((String name, BufferedOutputSink output1) {
- BufferedOutputSink output2 = map2[name];
- Expect.stringEquals(output1.text, output2.text);
- });
- });
- }
- return ResultKind.success;
-}
diff --git a/tests/compiler/dart2js/kernel/compiler_helper.dart b/tests/compiler/dart2js/kernel/compiler_helper.dart
deleted file mode 100644
index 7c5101a..0000000
--- a/tests/compiler/dart2js/kernel/compiler_helper.dart
+++ /dev/null
@@ -1,157 +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.
-
-// Partial test that the closed world computed from [WorldImpact]s derived from
-// kernel is equivalent to the original computed from resolution.
-library dart2js.kernel.compiler_helper;
-
-import 'dart:async';
-import 'dart:io';
-
-import 'package:compiler/compiler_new.dart';
-import 'package:compiler/src/commandline_options.dart';
-import 'package:compiler/src/common.dart';
-import 'package:compiler/src/common/tasks.dart';
-import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/dart2js.dart' as dart2js;
-import 'package:compiler/src/filenames.dart';
-import 'package:compiler/src/kernel/element_map.dart';
-import 'package:compiler/src/library_loader.dart';
-import 'package:compiler/src/universe/world_builder.dart';
-import 'package:compiler/src/util/util.dart';
-import 'package:expect/expect.dart';
-import 'package:kernel/ast.dart' as ir;
-import 'package:sourcemap_testing/src/stacktrace_helper.dart';
-import '../memory_compiler.dart';
-
-/// Analyze [memorySourceFiles] with [entryPoint] as entry-point using the
-/// kernel based element model. The returned [Pair] contains the compiler used
-/// to create the IR and the kernel based compiler.
-Future<Pair<Compiler, Compiler>> analyzeOnly(
- Uri entryPoint, Map<String, String> memorySourceFiles,
- {bool printSteps: false}) async {
- if (printSteps) {
- print('---- analyze-all -------------------------------------------------');
- }
- CompilationResult result1 = await runCompiler(
- entryPoint: entryPoint,
- memorySourceFiles: memorySourceFiles,
- options: [
- Flags.useOldFrontend,
- Flags.analyzeAll,
- Flags.enableAssertMessage
- ],
- beforeRun: (compiler) {
- compiler.impactCacheDeleter.retainCachesForTesting = true;
- });
-
- if (printSteps) {
- print('---- closed world from kernel ------------------------------------');
- }
- ElementResolutionWorldBuilder.useInstantiationMap = true;
- CompilationResult result2 = await runCompiler(
- entryPoint: entryPoint,
- memorySourceFiles: memorySourceFiles,
- options: [Flags.analyzeOnly, Flags.enableAssertMessage],
- beforeRun: (compiler) {
- compiler.impactCacheDeleter.retainCachesForTesting = true;
- });
- return new Pair<Compiler, Compiler>(result1.compiler, result2.compiler);
-}
-
-class MemoryKernelLibraryLoaderTask extends KernelLibraryLoaderTask {
- final ir.Component component;
-
- MemoryKernelLibraryLoaderTask(KernelToElementMapForImpact elementMap,
- DiagnosticReporter reporter, Measurer measurer, this.component)
- : super(null, null, null, elementMap, null, reporter, measurer);
-
- Future<LoadedLibraries> loadLibrary(Uri resolvedUri,
- {bool skipFileWithPartOfTag: false}) async {
- return createLoadedLibraries(component);
- }
-}
-
-Future createTemp(Uri entryPoint, Map<String, String> memorySourceFiles,
- {bool printSteps: false}) async {
- if (memorySourceFiles.isNotEmpty) {
- Directory dir = await Directory.systemTemp.createTemp('dart2js-with-dill');
- if (printSteps) {
- print('--- create temp directory $dir -------------------------------');
- }
- memorySourceFiles.forEach((String name, String source) {
- new File.fromUri(dir.uri.resolve(name)).writeAsStringSync(source);
- });
- entryPoint = dir.uri.resolve(entryPoint.path);
- }
- return entryPoint;
-}
-
-Future<Compiler> runWithD8(
- {Uri entryPoint,
- Map<String, String> memorySourceFiles: const <String, String>{},
- List<String> options: const <String>[],
- String expectedOutput,
- bool printJs: false}) async {
- entryPoint ??= Uri.parse('memory:main.dart');
- Uri mainFile =
- await createTemp(entryPoint, memorySourceFiles, printSteps: true);
- String output = uriPathToNative(mainFile.resolve('out.js').path);
- List<String> dart2jsArgs = [
- mainFile.toString(),
- '-o$output',
- '--packages=${Platform.packageConfig}',
- ]..addAll(options);
- print('Running: dart2js ${dart2jsArgs.join(' ')}');
-
- CompilationResult result = await dart2js.internalMain(dart2jsArgs);
- Expect.isTrue(result.isSuccess);
- if (printJs) {
- print('dart2js output:');
- print(new File(output).readAsStringSync());
- }
-
- List<String> d8Args = [
- 'sdk/lib/_internal/js_runtime/lib/preambles/d8.js',
- output
- ];
- print('Running: d8 ${d8Args.join(' ')}');
- ProcessResult runResult = Process.runSync(d8executable, d8Args);
- String out = '${runResult.stderr}\n${runResult.stdout}';
- print('d8 output:');
- print(out);
- if (expectedOutput != null) {
- Expect.equals(0, runResult.exitCode);
- Expect.stringEquals(expectedOutput.trim(),
- runResult.stdout.replaceAll('\r\n', '\n').trim());
- }
- return result.compiler;
-}
-
-Future<Compiler> compileWithDill(
- {Uri entryPoint,
- Map<String, String> memorySourceFiles: const <String, String>{},
- List<String> options: const <String>[],
- CompilerDiagnostics diagnosticHandler,
- bool printSteps: false,
- CompilerOutput compilerOutput,
- void beforeRun(Compiler compiler)}) async {
- if (printSteps) {
- print('---- compile from dill -------------------------------------------');
- }
- CompilationResult result = await runCompiler(
- entryPoint: entryPoint,
- memorySourceFiles: memorySourceFiles,
- options: options,
- diagnosticHandler: diagnosticHandler,
- outputProvider: compilerOutput,
- beforeRun: (compiler) {
- ElementResolutionWorldBuilder.useInstantiationMap = true;
- compiler.impactCacheDeleter.retainCachesForTesting = true;
- if (beforeRun != null) {
- beforeRun(compiler);
- }
- });
- return result.compiler;
-}
diff --git a/tests/compiler/dart2js/kernel/constructors_test.dart b/tests/compiler/dart2js/kernel/constructors_test.dart
deleted file mode 100644
index bf7c564..0000000
--- a/tests/compiler/dart2js/kernel/constructors_test.dart
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:compiler/src/common_elements.dart';
-import 'package:compiler/src/compiler.dart' show Compiler;
-import 'package:compiler/src/elements/entities.dart';
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- test('simple default constructor', () {
- String code = '''
-class A {
-}
-
-main() {
- var a = new A();
- return a;
-}''';
- return check(code, lookup: defaultConstructorFor('A'));
- });
-
- test('simple default constructor with field', () {
- String code = '''
-class A {
- int x = 1;
-}
-
-main() {
- var a = new A();
- return a;
-}''';
- return check(code, lookup: defaultConstructorFor('A'));
- });
-
- test('redirecting constructor with field', () {
- String code = '''
-class Foo {
- final int value;
- const Foo({int number: 0}) : this.poodle(number * 2);
- const Foo.poodle(this.value);
-}
-
-main() => new Foo(number: 3);
-''';
- return check(code, lookup: defaultConstructorFor('Foo'));
- });
-
- // TODO(efortuna): Kernel needs to have some additional constructor
- // implementation work before this is legitimately equivalent code to the
- // original AST.
-/* test('initialized field and constructor', () {
- String code = '''
-import 'dart:_foreign_helper' show JS, JS_EMBEDDED_GLOBAL;
-import 'package:expect/expect.dart';
-
-
-class Foo {
- final value = JS('bool', '#()', JS_EMBEDDED_GLOBAL('', 'foo'));
- Foo() {
- print('hello world');
- }
-}
-
-main() => new Foo();
-''';
- return check(code, lookup: defaultConstructorFor('Foo'));
- });*/
-}
-
-defaultConstructorFor(String className) => (Compiler compiler) {
- ElementEnvironment elementEnvironment =
- compiler.backendClosedWorldForTesting.elementEnvironment;
- LibraryEntity mainLibrary = elementEnvironment.mainLibrary;
- ClassEntity clazz =
- elementEnvironment.lookupClass(mainLibrary, className);
- return elementEnvironment.lookupConstructor(clazz, '');
- };
diff --git a/tests/compiler/dart2js/kernel/control_flow_test.dart b/tests/compiler/dart2js/kernel/control_flow_test.dart
deleted file mode 100644
index c6ffe84..0000000
--- a/tests/compiler/dart2js/kernel/control_flow_test.dart
+++ /dev/null
@@ -1,41 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- group('compile control flow', () {
- test('simple if statement', () {
- String code = '''
- main() {
- if (true) {
- return 1;
- } else {
- return 2;
- }
- }''';
- return check(code);
- });
- test('simple if statement no else', () {
- String code = '''
- main() {
- if (true) {
- return 1;
- }
- }''';
- return check(code);
- });
- test('simple dead if statement', () {
- String code = '''
- main() {
- if (false) {
- return 1;
- }
- }''';
- return check(code);
- });
- });
-}
diff --git a/tests/compiler/dart2js/kernel/empty_test.dart b/tests/compiler/dart2js/kernel/empty_test.dart
deleted file mode 100644
index f3fe00b..0000000
--- a/tests/compiler/dart2js/kernel/empty_test.dart
+++ /dev/null
@@ -1,9 +0,0 @@
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- test('compile empty function', () {
- return check("main() {}");
- });
-}
diff --git a/tests/compiler/dart2js/kernel/expressions_test.dart b/tests/compiler/dart2js/kernel/expressions_test.dart
deleted file mode 100644
index 7074c4c..0000000
--- a/tests/compiler/dart2js/kernel/expressions_test.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- group('string literals', () {
- test('juxtaposition', () {
- return check('main() { return "abc" "def"; }');
- });
- test('literal interpolation', () {
- return check('main() { return "abc\${1}def"; }');
- });
- test('complex interpolation', () {
- String code = '''
-foo() => 1;
-main() => "abc\${foo()}"
- "\${foo()}def";''';
- return check(code);
- });
- });
-}
diff --git a/tests/compiler/dart2js/kernel/getters_setters_test.dart b/tests/compiler/dart2js/kernel/getters_setters_test.dart
deleted file mode 100644
index 31a3809..0000000
--- a/tests/compiler/dart2js/kernel/getters_setters_test.dart
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- group('compile getters with kernel', () {
- test('top-level', () {
- String code = '''
-int get foo => 1;
-main() => foo;
-''';
- return check(code);
- });
-
- test('static', () {
- String code = '''
-class A {
- static int get foo => 1;
-}
-main() => A.foo;
-''';
- return check(code);
- });
-
- test('super get', () {
- String code = '''
-class A {
- int get foo => 1;
-}
-
-class B extends A {
-
- int get rotations => super.foo * 3;
-}
-
-main() => new B().foo;
-''';
- return check(code);
- });
-
- test('super get no such method', () {
- String code = '''
-class A {
- static int get foo => 1;
-}
-
-class B extends A {
-
- int get rotations => super.nothing * 3;
-}
-
-main() => new B().foo;
-''';
- return check(code);
- });
- });
-
- group('compile setters with kernel', () {
- test('top-level', () {
- String code = '''
-set foo(int newFoo) {
- // do nothing
-}
-main() {
- foo = 1;
-}''';
- return check(code);
- });
-
- test('static', () {
- String code = '''
-class A {
- static set foo(int newFoo) {
- // do nothing
- }
-}
-main() {
- A.foo = 1;
-}
-''';
- return check(code);
- });
- });
-
- test('super set', () {
- String code = '''
-class A {
- set ferocious(int newFerocious) {}
-}
-
-class B extends A {
- bar() {
- super.ferocious = 87;
- }
-}
-main() {
- new B().bar();
-}''';
- return check(code);
- });
-
- test('super set no such method', () {
- String code = '''
-class A {
- final ferocious = 0;
- noSuchMethod(_) => 42;
-}
-
-class B extends A {
- bar() {
- super.ferocious = 87;
- }
-}
-main() {
- new B().bar();
-}''';
- return check(code);
- });
-}
diff --git a/tests/compiler/dart2js/kernel/helper.dart b/tests/compiler/dart2js/kernel/helper.dart
deleted file mode 100644
index b8e6ae9..0000000
--- a/tests/compiler/dart2js/kernel/helper.dart
+++ /dev/null
@@ -1,72 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:async';
-
-import 'package:compiler/src/common_elements.dart';
-import 'package:compiler/src/compiler.dart' show Compiler;
-import 'package:compiler/src/elements/entities.dart';
-import 'package:compiler/src/js_backend/backend.dart' as js
- show JavaScriptBackend;
-import 'package:compiler/src/commandline_options.dart' show Flags;
-import 'package:js_ast/js_ast.dart' as jsAst;
-import 'package:test/test.dart';
-
-import '../equivalence/check_functions.dart';
-import '../memory_compiler.dart';
-
-Future<jsAst.Expression> compile(String code,
- {dynamic lookup: 'main',
- bool useKernel: false,
- bool disableTypeInference: true,
- List<String> extraOptions: const <String>[]}) async {
- List<String> options = <String>[
- Flags.disableInlining,
- ];
- if (disableTypeInference) options.add(Flags.disableTypeInference);
- if (!useKernel) options.add(Flags.useOldFrontend);
- options.addAll(extraOptions);
-
- if (lookup is String && lookup != 'main' && !code.contains('main')) {
- code = "$code\n\nmain() => $lookup;";
- }
- CompilationResult result = await runCompiler(
- memorySourceFiles: {'main.dart': code}, options: options);
- expect(result.isSuccess, isTrue);
- Compiler compiler = result.compiler;
- ElementEnvironment elementEnvironment =
- compiler.backendClosedWorldForTesting.elementEnvironment;
- MemberEntity element;
- if (lookup is String) {
- LibraryEntity mainLibrary = elementEnvironment.mainLibrary;
- element = elementEnvironment.lookupLibraryMember(mainLibrary, lookup);
- } else {
- element = lookup(compiler);
- }
- js.JavaScriptBackend backend = compiler.backend;
- return backend.generatedCode[element];
-}
-
-/// Checks that the given Dart [code] compiles to the same JS in kernel and
-/// normal mode.
-///
-/// The function to check at the end is given by [lookup]. If [lookup] is a
-/// String, then the generated code for a top-level element named [lookup] is
-/// checked. Otherwise, [lookup] is a function that takes a [Compiler] and
-/// returns an [MemberEntity], and the returned [MemberEntity] is checked.
-Future check(String code,
- {dynamic lookup: 'main',
- bool disableTypeInference: true,
- List<String> extraOptions: const <String>[]}) async {
- jsAst.Expression original = await compile(code,
- lookup: lookup,
- disableTypeInference: disableTypeInference,
- extraOptions: extraOptions);
- jsAst.Expression kernel = await compile(code,
- lookup: lookup,
- useKernel: true,
- disableTypeInference: disableTypeInference,
- extraOptions: extraOptions);
- expect(areJsNodesEquivalent(original, kernel), isTrue);
-}
diff --git a/tests/compiler/dart2js/kernel/impact_test.dart b/tests/compiler/dart2js/kernel/impact_test.dart
deleted file mode 100644
index 0138247..0000000
--- a/tests/compiler/dart2js/kernel/impact_test.dart
+++ /dev/null
@@ -1,988 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library dart2js.kernel.impact_test;
-
-import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/common.dart';
-import 'package:compiler/src/common_elements.dart';
-import 'package:compiler/src/common/names.dart';
-import 'package:compiler/src/common/resolution.dart';
-import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/constants/expressions.dart';
-import 'package:compiler/src/elements/elements.dart';
-import 'package:compiler/src/elements/entities.dart';
-import 'package:compiler/src/elements/resolution_types.dart';
-import 'package:compiler/src/kernel/element_map_impl.dart';
-import 'package:compiler/src/kernel/kernel_strategy.dart';
-import 'package:compiler/src/resolution/registry.dart';
-import 'package:compiler/src/universe/call_structure.dart';
-import 'package:compiler/src/universe/feature.dart';
-import 'package:compiler/src/universe/use.dart';
-import 'package:compiler/src/util/util.dart';
-import 'package:expect/expect.dart';
-import '../equivalence/check_helpers.dart';
-import '../equivalence/equivalence_helper.dart';
-import 'compiler_helper.dart';
-import 'test_helpers.dart';
-
-const Map<String, String> SOURCE = const <String, String>{
- // Pretend this is a dart2js_native test to allow use of 'native' keyword.
- 'sdk/tests/compiler/dart2js_native/main.dart': r'''
-import 'dart:_foreign_helper' as foreign show JS;
-import 'dart:_foreign_helper' hide JS;
-import 'dart:_js_helper';
-import 'dart:_interceptors';
-import 'dart:_native_typed_data';
-import 'dart:indexed_db';
-import 'dart:html';
-import 'dart:html_common';
-import 'dart:math';
-import 'dart:typed_data';
-import 'dart:web_sql';
-import 'helper.dart';
-import 'jsinterop.dart';
-
-main() {
- testEmpty();
- testNull();
- testTrue();
- testFalse();
- testInt();
- testDouble();
- testString();
- testStringInterpolation();
- testStringInterpolationConst();
- testStringJuxtaposition();
- testSymbol();
- testConstSymbol();
- testComplexConstSymbol();
- testIfNullConstSymbol();
- testTypeLiteral();
- testBoolFromEnvironment();
- testEmptyListLiteral();
- testEmptyListLiteralDynamic();
- testEmptyListLiteralTyped();
- testEmptyListLiteralConstant();
- testNonEmptyListLiteral();
- testEmptyMapLiteral();
- testEmptyMapLiteralDynamic();
- testEmptyMapLiteralTyped();
- testEmptyMapLiteralConstant();
- testNonEmptyMapLiteral();
- testNot();
- testUnaryMinus();
- testConditional();
- testPostInc(null);
- testPostDec(null);
- testPreInc(null);
- testPreDec(null);
- testIs();
- testIsGeneric();
- testIsGenericRaw();
- testIsGenericDynamic();
- testIsNot();
- testIsNotGeneric();
- testIsNotGenericRaw();
- testIsNotGenericDynamic();
- testIsTypedef();
- testIsTypedefGeneric();
- testIsTypedefGenericRaw();
- testIsTypedefGenericDynamic();
- testIsTypedefDeep();
- testAs();
- testAsGeneric();
- testAsGenericRaw();
- testAsGenericDynamic();
- testThrow();
- testIfNotNull(null);
- testIfNotNullSet(null);
- testIfNull(null);
- testSetIfNull(null);
- // Following tests are disabled because we changed the Kernel version to
- // register helper function calls with explicit type arguments.
- //testSyncStar();
- //testAsync();
- //testAsyncStar();
- //testLocalSyncStar();
- //testLocalAsync();
- //testLocalAsyncStar();
- //testAnonymousSyncStar();
- //testAnonymousAsync();
- //testAnonymousAsyncStar();
- //testAsyncForIn(null);
- //testAsyncForInTyped(null);
- testIfThen();
- testIfThenElse();
- testForIn(null);
- testForInTyped(null);
- testTryCatch();
- testTryCatchOn();
- testTryCatchStackTrace();
- testTryFinally();
- testSwitchWithoutFallthrough(null);
- testSwitchWithFallthrough(null);
- testTopLevelInvoke();
- testTopLevelInvokeTyped();
- testTopLevelFunctionTyped();
- testTopLevelFunctionGet();
- testTopLevelGetterGet();
- testTopLevelGetterGetTyped();
- testTopLevelSetterSet();
- testTopLevelSetterSetTyped();
- testTopLevelField();
- testTopLevelFieldLazy();
- testTopLevelFieldConst();
- testTopLevelFieldFinal();
- testTopLevelFieldTyped();
- testTopLevelFieldGeneric1();
- testTopLevelFieldGeneric2();
- testTopLevelFieldGeneric3();
- testTopLevelFieldWrite();
- testStaticFunctionGet();
- testDynamicInvoke(null);
- testDynamicGet(null);
- testDynamicSet(null);
- testLocalWithoutInitializer();
- testLocalWithInitializer();
- testLocalWithInitializerTyped();
- testLocalFunction();
- testLocalFunctionTyped();
- testLocalFunctionInvoke();
- testLocalFunctionGet();
- testClosure();
- testClosureInvoke();
- testInvokeIndex(null);
- testInvokeIndexSet(null);
- testAssert();
- testAssertWithMessage();
- testConstructorInvoke();
- testConstructorInvokeGeneric();
- testConstructorInvokeGenericRaw();
- testConstructorInvokeGenericDynamic();
- testFactoryInvoke();
- testFactoryInvokeGeneric();
- testFactoryInvokeGenericRaw();
- testFactoryInvokeGenericDynamic();
- testRedirectingFactoryInvoke();
- testRedirectingFactoryInvokeGeneric();
- testRedirectingFactoryInvokeGenericRaw();
- testRedirectingFactoryInvokeGenericDynamic();
- testConstRedirectingFactoryInvoke();
- testConstRedirectingFactoryInvokeGeneric();
- testConstRedirectingFactoryInvokeGenericRaw();
- testConstRedirectingFactoryInvokeGenericDynamic();
- testImplicitConstructor();
- testFactoryConstructor();
- testDefaultValuesPositional();
- testDefaultValuesNamed();
- testFieldInitializer1();
- testFieldInitializer2();
- testFieldInitializer3();
- testInstanceFieldWithInitializer();
- testInstanceFieldTyped();
- testThisInitializer();
- testSuperInitializer();
- testGenericClass();
- testSuperCall();
- testSuperGet();
- testSuperFieldSet();
- testSuperSetterSet();
- testSuperClosurization();
- testForwardingConstructor();
- testForwardingConstructorTyped();
- testForwardingConstructorGeneric();
- testEnum();
- testStaticGenericMethod();
- testInstanceGenericMethod();
- testAbstractClassWithField();
- testDynamicPrivateMethodInvoke();
- testJSCall();
- testNativeMethod();
- testNativeMethodCreates();
- testNativeMethodReturns();
- testNativeField(null);
- testMixinInstantiation();
- testNamedMixinInstantiation();
- testGenericMixinInstantiation();
- testGenericNamedMixinInstantiation();
- testJsInteropMethod();
- testJsInteropClass();
-}
-
-testEmpty() {}
-testNull() => null;
-testTrue() => true;
-testFalse() => false;
-testInt() => 42;
-testDouble() => 37.5;
-testString() => 'foo';
-testStringInterpolation() => '${0}';
-testStringInterpolationConst() {
- const b = '${0}';
-}
-testStringJuxtaposition() => 'a' 'b';
-testSymbol() => #main;
-testConstSymbol() => const Symbol('main');
-
-const complexSymbolField1 = "true".length == 4;
-const complexSymbolField2 = "true" "false" "${4}${null}";
-const complexSymbolField3 = const {
- 0.1: const bool.fromEnvironment('a', defaultValue: true),
- false: const int.fromEnvironment('b', defaultValue: 42),
- const <int>[]: const String.fromEnvironment('c'),
- testComplexConstSymbol: #testComplexConstSymbol,
- 1 + 2: identical(0, -0),
- true || false: false && true,
- override: const GenericClass<int, String>.generative(),
-};
-const complexSymbolField =
- complexSymbolField1 ? complexSymbolField2 : complexSymbolField3;
-testComplexConstSymbol() => const Symbol(complexSymbolField);
-
-testIfNullConstSymbol() => const Symbol(null ?? 'foo');
-
-testTypeLiteral() => Object;
-testBoolFromEnvironment() => const bool.fromEnvironment('FOO');
-testEmptyListLiteral() => [];
-testEmptyListLiteralDynamic() => <dynamic>[];
-testEmptyListLiteralTyped() => <String>[];
-testEmptyListLiteralConstant() => const [];
-testNonEmptyListLiteral() => [0];
-testEmptyMapLiteral() => {};
-testEmptyMapLiteralDynamic() => <dynamic, dynamic>{};
-testEmptyMapLiteralTyped() => <String, int>{};
-testEmptyMapLiteralConstant() => const {};
-testNonEmptyMapLiteral() => {0: true};
-testNot() => !false;
-testUnaryMinus() => -1;
-testConditional() => true ? 1 : '';
-testPostInc(o) => o++;
-testPostDec(o) => o--;
-testPreInc(o) => ++o;
-testPreDec(o) => --o;
-
-testIs() => null is Class;
-testIsGeneric() => null is GenericClass<int, String>;
-testIsGenericRaw() => null is GenericClass;
-testIsGenericDynamic() => null is GenericClass<dynamic, dynamic>;
-testIsNot() => null is! Class;
-testIsNotGeneric() => null is! GenericClass<int, String>;
-testIsNotGenericRaw() => null is! GenericClass;
-testIsNotGenericDynamic() => null is! GenericClass<dynamic, dynamic>;
-testIsTypedef() => null is Typedef;
-testIsTypedefGeneric() => null is GenericTypedef<int, String>;
-testIsTypedefGenericRaw() => null is GenericTypedef;
-testIsTypedefGenericDynamic() => null is GenericTypedef<dynamic, dynamic>;
-testIsTypedefDeep() => null is List<GenericTypedef<int, GenericTypedef>>;
-testAs() => null as Class;
-testAsGeneric() => null as GenericClass<int, String>;
-testAsGenericRaw() => null as GenericClass;
-testAsGenericDynamic() => null as GenericClass<dynamic, dynamic>;
-testThrow() => throw '';
-testIfNotNull(o) => o?.foo;
-testIfNotNullSet(o) => o?.foo = 42;
-testIfNull(o) => o ?? 42;
-testSetIfNull(o) => o ??= 42;
-
-// Following tests are disabled because we changed the Kernel version to
-// register helper function calls with explicit type arguments.
-//testSyncStar() sync* {}
-//testAsync() async {}
-//testAsyncStar() async* {}
-//testLocalSyncStar() {
-// local() sync* {}
-// return local;
-//}
-//testLocalAsync() {
-// local() async {}
-// return local;
-//}
-//testLocalAsyncStar() {
-// local() async* {}
-// return local;
-//}
-//testAnonymousSyncStar() {
-// return () sync* {};
-//}
-//testAnonymousAsync() {
-// return () async {};
-//}
-//testAnonymousAsyncStar() {
-// return () async* {};
-//}
-
-testIfThen() {
- if (false) return 42;
- return 1;
-}
-testIfThenElse() {
- if (true) {
- return 42;
- } else {
- return 1;
- }
-}
-testForIn(o) {
- for (var e in o) {}
-}
-testForInTyped(o) {
- for (int e in o) {}
-}
-//testAsyncForIn(o) async {
-// await for (var e in o) {}
-//}
-//testAsyncForInTyped(o) async {
-// await for (int e in o) {}
-//}
-testTryCatch() {
- try {} catch (e) {}
-}
-testTryCatchOn() {
- try {} on String catch (e) {}
-}
-testTryCatchStackTrace() {
- try {} catch (e, s) {}
-}
-testTryFinally() {
- try {} finally {}
-}
-testSwitchWithoutFallthrough(o) {
- switch (o) {
- case 0:
- case 1:
- o = 2;
- break;
- case 2:
- o = 3;
- return;
- case 3:
- throw '';
- case 4:
- default:
- }
-}
-testSwitchWithFallthrough(o) {
- switch (o) {
- case 0:
- case 1:
- o = 2;
- case 2:
- o = 3;
- return;
- case 3:
- default:
- }
-}
-topLevelFunction1(a) {}
-topLevelFunction2(a, [b, c]) {}
-topLevelFunction3(a, {b, c}) {}
-testTopLevelInvoke() {
- topLevelFunction1(0);
- topLevelFunction2(1);
- topLevelFunction2(2, 3);
- topLevelFunction2(4, 5, 6);
- topLevelFunction3(7);
- topLevelFunction3(8, b: 9);
- topLevelFunction3(10, c: 11);
- topLevelFunction3(12, b: 13, c: 14);
- topLevelFunction3(15, c: 16, b: 17);
-}
-void topLevelFunction1Typed(int a) {}
-int topLevelFunction2Typed(String a, [num b, double c]) => null;
-double topLevelFunction3Typed(bool a, {List<int> b, Map<String, bool> c}) {
- return null;
-}
-testTopLevelInvokeTyped() {
- topLevelFunction1Typed(0);
- topLevelFunction2Typed('1');
- topLevelFunction2Typed('2', 3);
- topLevelFunction2Typed('3', 5, 6.0);
- topLevelFunction3Typed(true);
- topLevelFunction3Typed(false, b: []);
- topLevelFunction3Typed(null, c: {});
- topLevelFunction3Typed(true, b: [13], c: {'14': true});
- topLevelFunction3Typed(false, c: {'16': false}, b: [17]);
-}
-
-topLevelFunctionTyped1(void a(num b)) {}
-topLevelFunctionTyped2(void a(num b, [String c])) {}
-topLevelFunctionTyped3(void a(num b, {String c, int d})) {}
-topLevelFunctionTyped4(void a(num b, {String d, int c})) {}
-testTopLevelFunctionTyped() {
- topLevelFunctionTyped1(null);
- topLevelFunctionTyped2(null);
- topLevelFunctionTyped3(null);
- topLevelFunctionTyped4(null);
-}
-testTopLevelFunctionGet() => topLevelFunction1;
-get topLevelGetter => 0;
-testTopLevelGetterGet() => topLevelGetter;
-int get topLevelGetterTyped => 0;
-testTopLevelGetterGetTyped() => topLevelGetterTyped;
-set topLevelSetter(_) {}
-testTopLevelSetterSet() => topLevelSetter = 0;
-void set topLevelSetterTyped(int value) {}
-testTopLevelSetterSetTyped() => topLevelSetterTyped = 0;
-
-var topLevelField;
-testTopLevelField() => topLevelField;
-var topLevelFieldLazy = topLevelFunction1(null);
-testTopLevelFieldLazy() => topLevelFieldLazy;
-const topLevelFieldConst = 0;
-testTopLevelFieldConst() => topLevelFieldConst;
-final topLevelFieldFinal = topLevelFunction1(null);
-testTopLevelFieldFinal() => topLevelFieldFinal;
-int topLevelFieldTyped;
-testTopLevelFieldTyped() => topLevelFieldTyped;
-GenericClass topLevelFieldGeneric1;
-testTopLevelFieldGeneric1() => topLevelFieldGeneric1;
-GenericClass<dynamic, dynamic> topLevelFieldGeneric2;
-testTopLevelFieldGeneric2() => topLevelFieldGeneric2;
-GenericClass<int, String> topLevelFieldGeneric3;
-testTopLevelFieldGeneric3() => topLevelFieldGeneric3;
-testTopLevelFieldWrite() => topLevelField = 3;
-class StaticFunctionGetClass {
- static foo() {}
-}
-testStaticFunctionGet() => StaticFunctionGetClass.foo;
-
-testDynamicInvoke(o) {
- o.f1(0);
- o.f2(1);
- o.f3(2, 3);
- o.f4(4, 5, 6);
- o.f5(7);
- o.f6(8, b: 9);
- o.f7(10, c: 11);
- o.f8(12, b: 13, c: 14);
- o.f9(15, c: 16, b: 17);
-}
-testDynamicGet(o) => o.foo;
-testDynamicSet(o) => o.foo = 42;
-testLocalWithoutInitializer() {
- var l;
-}
-testLocalWithInitializer() {
- var l = 42;
-}
-testLocalWithInitializerTyped() {
- int l = 42;
-}
-testLocalFunction() {
- localFunction() {}
-}
-testLocalFunctionTyped() {
- int localFunction(String a) => 42;
-}
-testLocalFunctionInvoke() {
- localFunction() {}
- localFunction();
-}
-testLocalFunctionGet() {
- localFunction() {}
- localFunction;
-}
-testClosure() {
- () {};
-}
-testClosureInvoke() {
- () {} ();
-}
-testInvokeIndex(o) => o[42];
-testInvokeIndexSet(o) => o[42] = null;
-testAssert() {
- assert(true);
-}
-testAssertWithMessage() {
- assert(true, 'ok');
-}
-testConstructorInvoke() {
- new Class.generative();
-}
-testConstructorInvokeGeneric() {
- new GenericClass<int, String>.generative();
-}
-testConstructorInvokeGenericRaw() {
- new GenericClass.generative();
-}
-testConstructorInvokeGenericDynamic() {
- new GenericClass<dynamic, dynamic>.generative();
-}
-testFactoryInvoke() {
- new Class.fact();
-}
-testFactoryInvokeGeneric() {
- new GenericClass<int, String>.fact();
-}
-testFactoryInvokeGenericRaw() {
- new GenericClass.fact();
-}
-testFactoryInvokeGenericDynamic() {
- new GenericClass<dynamic, dynamic>.fact();
-}
-testRedirectingFactoryInvoke() {
- new Class.redirect();
-}
-testRedirectingFactoryInvokeGeneric() {
- new GenericClass<int, String>.redirect();
-}
-testRedirectingFactoryInvokeGenericRaw() {
- new GenericClass.redirect();
-}
-testRedirectingFactoryInvokeGenericDynamic() {
- new GenericClass<dynamic, dynamic>.redirect();
-}
-testConstRedirectingFactoryInvoke() {
- const Class.redirect();
-}
-testConstRedirectingFactoryInvokeGeneric() {
- const GenericClass<int, String>.redirect();
-}
-testConstRedirectingFactoryInvokeGenericRaw() {
- const GenericClass.redirect();
-}
-testConstRedirectingFactoryInvokeGenericDynamic() {
- const GenericClass<dynamic, dynamic>.redirect();
-}
-class ClassImplicitConstructor {}
-testImplicitConstructor() => new ClassImplicitConstructor();
-class ClassFactoryConstructor {
- factory ClassFactoryConstructor() => null;
-}
-testFactoryConstructor() => new ClassFactoryConstructor();
-testDefaultValuesPositional([bool value = false]) {}
-testDefaultValuesNamed({bool value: false}) {}
-
-class ClassFieldInitializer1 {
- var field;
- ClassFieldInitializer1(this.field);
-}
-testFieldInitializer1() => new ClassFieldInitializer1(42);
-class ClassFieldInitializer2 {
- var field;
- ClassFieldInitializer2(value) : field = value;
-}
-testFieldInitializer2() => new ClassFieldInitializer2(42);
-class ClassFieldInitializer3 {
- var field;
- ClassFieldInitializer3.a()
- // TODO(johnniwinther): Remove this when kernel has a more consistent
- // handling of uninitialized fields.
- : field = null;
- ClassFieldInitializer3.b(value) : field = value;
-}
-testFieldInitializer3() {
- new ClassFieldInitializer3.a();
- new ClassFieldInitializer3.b(42);
-}
-class ClassInstanceFieldWithInitializer {
- var field = false;
-}
-testInstanceFieldWithInitializer() => new ClassInstanceFieldWithInitializer();
-class ClassInstanceFieldTyped {
- int field;
-}
-testInstanceFieldTyped() => new ClassInstanceFieldTyped();
-class ClassGeneric<T> {
- ClassGeneric(T arg);
-}
-class ClassThisInitializer {
- ClassThisInitializer() : this.internal();
- ClassThisInitializer.internal();
-}
-testThisInitializer() => new ClassThisInitializer();
-class ClassSuperInitializer extends ClassThisInitializer {
- ClassSuperInitializer() : super.internal();
-}
-testSuperInitializer() => new ClassSuperInitializer();
-testGenericClass() => new ClassGeneric<int>(0);
-class Super1 {
- foo() {}
-}
-class Sub1 extends Super1 {
- Sub1() {
- super.foo();
- }
-}
-testSuperCall() => new Sub1();
-class Super2 {
- var foo;
-}
-class Sub2 extends Super2 {
- Sub2() {
- super.foo;
- }
-}
-testSuperGet() => new Sub2();
-class Super3 {
- var foo;
-}
-class Sub3 extends Super3 {
- Sub3() {
- super.foo = 42;
- }
-}
-testSuperFieldSet() => new Sub3();
-class Super4 {
- set foo(_) {}
-}
-class Sub4 extends Super4 {
- Sub4() {
- super.foo = 42;
- }
-}
-testSuperSetterSet() => new Sub4();
-class Super5 {
- foo() {}
-}
-class Sub5 extends Super5 {
- Sub5() {
- super.foo;
- }
-}
-testSuperClosurization() => new Sub5();
-
-class EmptyMixin {}
-class ForwardingConstructorSuperClass {
- ForwardingConstructorSuperClass(arg);
-}
-class ForwardingConstructorClass =
- ForwardingConstructorSuperClass with EmptyMixin;
-testForwardingConstructor() => new ForwardingConstructorClass(null);
-
-class ForwardingConstructorTypedSuperClass {
- ForwardingConstructorTypedSuperClass(int arg);
-}
-class ForwardingConstructorTypedClass =
- ForwardingConstructorTypedSuperClass with EmptyMixin;
-testForwardingConstructorTyped() => new ForwardingConstructorTypedClass(null);
-
-class ForwardingConstructorGenericSuperClass<T> {
- ForwardingConstructorGenericSuperClass(T arg);
-}
-class ForwardingConstructorGenericClass<S> =
- ForwardingConstructorGenericSuperClass<S> with EmptyMixin;
-testForwardingConstructorGeneric() {
- new ForwardingConstructorGenericClass<int>(null);
-}
-
-enum Enum { A }
-testEnum() => Enum.A;
-
-List<T> staticGenericMethod<T>(T arg) => [arg];
-testStaticGenericMethod() {
- staticGenericMethod<int>(0);
-}
-
-testInstanceGenericMethod() {
- new GenericClass<int, String>.generative().genericMethod<bool>(false);
-}
-
-abstract class AbstractClass {
- final _field;
-
- factory AbstractClass() => null;
-}
-testAbstractClassWithField() => new AbstractClass();
-
-testDynamicPrivateMethodInvoke([o]) => o._privateMethod();
-testJSCall() => foreign.JS('int|bool|NativeUint8List|Rectangle|IdbFactory|'
- 'SqlDatabase|TypedData|ContextAttributes', '#', null);
-@JSName('foo')
-@SupportedBrowser(SupportedBrowser.CHROME)
-testNativeMethod() native;
-@Creates('int|Null|JSArray')
-testNativeMethodCreates() native;
-@Returns('String|Null|JSArray')
-testNativeMethodReturns() native;
-
-@Native("NativeClass")
-class NativeClass {
- @annotation_Creates_SerializedScriptValue
- final Object field;
-
- factory NativeClass._() { throw new UnsupportedError("Not supported"); }
-}
-testNativeField(NativeClass c) => c.field;
-testMixinInstantiation() => new Sub();
-testNamedMixinInstantiation() => new NamedMixin();
-testGenericMixinInstantiation() => new GenericSub<int, String>();
-testGenericNamedMixinInstantiation() => new GenericNamedMixin<int, String>();
-''',
- 'sdk/tests/compiler/dart2js_native/jsinterop.dart': '''
-@JS()
-library jsinterop;
-
-import 'package:js/js.dart';
-
-@JS()
-external int testJsInteropMethod();
-
-@JS()
-class JsInteropClass {
- external JsInteropClass();
-
- @JS()
- external double method();
-}
-
-testJsInteropClass() => new JsInteropClass().method();
-''',
- 'sdk/tests/compiler/dart2js_native/helper.dart': '''
-import 'dart:_js_helper';
-class Class {
- const Class.generative();
- factory Class.fact() => null;
- const factory Class.redirect() = Class.generative;
-}
-class GenericClass<X, Y> {
- const GenericClass.generative();
- factory GenericClass.fact() => null;
- const factory GenericClass.redirect() = GenericClass<X, Y>.generative;
-
- Map<X, T> genericMethod<T>(T arg) => { null: arg };
-}
-typedef Typedef();
-typedef X GenericTypedef<X, Y>(Y y);
-
-class Super {}
-class Mixin1 {}
-class Mixin2 {}
-class Sub extends Super with Mixin1, Mixin2 {}
-class NamedMixin = Super with Mixin1, Mixin2;
-
-class GenericSuper<X1, Y1> {}
-class GenericMixin1<X2, Y2> {}
-class GenericMixin2<X3, Y3> {}
-class GenericSub<X4, Y4> extends GenericSuper<X4, Y4>
- with GenericMixin1<X4, Y4>, GenericMixin2<X4, Y4> {}
-class GenericNamedMixin<X5, Y5> = GenericSuper<X5, Y5>
- with GenericMixin1<X5, Y5>, GenericMixin2<X5, Y5>;
-''',
-};
-
-main(List<String> args) {
- bool fullTest = args.contains('--full');
- asyncTest(() async {
- enableDebugMode();
- Uri entryPoint =
- Uri.parse('memory:sdk/tests/compiler/dart2js_native/main.dart');
-
- Pair<Compiler, Compiler> pair =
- await analyzeOnly(entryPoint, SOURCE, printSteps: true);
- Compiler compiler1 = pair.a;
- Compiler compiler2 = pair.b;
- ElementEnvironment elementEnvironment1 =
- compiler1.frontendStrategy.elementEnvironment;
- ElementEnvironment elementEnvironment2 =
- compiler2.frontendStrategy.elementEnvironment;
- KernelFrontEndStrategy kernelStrategy = compiler2.frontendStrategy;
- KernelToElementMapForImpactImpl elementMap = kernelStrategy.elementMap;
- KernelEquivalence equivalence = new KernelEquivalence(elementMap);
-
- ConstantExpression emptyString = new StringConstantExpression("");
-
- void checkMembers(MemberEntity member1, MemberEntity member2) {
- if (!fullTest && !compiler1.resolution.hasResolutionImpact(member1)) {
- print('Skipping member without impact: $member1');
- return;
- }
- compiler1.reporter.withCurrentElement(member1, () {
- ResolutionImpact astImpact =
- compiler1.resolution.getResolutionImpact(member1);
- ResolutionImpact laxAstImpact =
- laxImpact(compiler1, member1, astImpact);
- ResolutionImpact kernelImpact = elementMap.computeWorldImpact(member2);
- testResolutionImpactEquivalence(laxAstImpact, kernelImpact,
- strategy: new CheckStrategy(
- elementEquivalence: equivalence.entityEquivalence,
- typeEquivalence: equivalence.typeEquivalence),
- filterConstantLiterals: (Iterable<ConstantExpression> constants,
- {bool fromFirstImpact}) {
- if (!fromFirstImpact) {
- if (astImpact.features.contains(Feature.STRING_INTERPOLATION)) {
- if (laxAstImpact.constantLiterals.contains(emptyString)) {
- // The old frontend adds empty string around interpolations.
- constants = new Set<ConstantExpression>.from(constants)
- ..add(emptyString);
- }
- }
- if (astImpact.features.contains(Feature.FALL_THROUGH_ERROR)) {
- // Remove the constant arguments passed to the
- // `new FallThroughError._create(<fileName>, <fileOffset>)` call
- // generated by fasta.
- Set<ConstantExpression> newConstants =
- new Set<ConstantExpression>();
- bool fileNameRemoved = false;
- bool fileOffsetRemoved = false;
- for (ConstantExpression constant in constants) {
- if (constant.kind == ConstantExpressionKind.STRING) {
- if (!fileNameRemoved &&
- !laxAstImpact.constantLiterals.contains(constant)) {
- fileNameRemoved = true;
- continue;
- }
- } else if (constant.kind == ConstantExpressionKind.INT) {
- if (!fileOffsetRemoved &&
- !laxAstImpact.constantLiterals.contains(constant)) {
- fileOffsetRemoved = true;
- continue;
- }
- }
- newConstants.add(constant);
- }
- if (fileNameRemoved && fileOffsetRemoved) {
- constants = newConstants;
- }
- }
- }
- return constants;
- });
- });
- }
-
- void checkLibraries(LibraryEntity library1, LibraryEntity library2) {
- if (!fullTest && library1.canonicalUri.scheme == 'dart') {
- print('Skipping library: $library1');
- return;
- }
- elementEnvironment1.forEachClass(library1, (ClassEntity cls1) {
- ClassEntity cls2 = elementEnvironment2.lookupClass(library2, cls1.name);
- elementEnvironment1.forEachClassMember(cls1,
- (ClassEntity declarer, MemberEntity member1) {
- if (declarer != cls1) return;
- MemberEntity member2 = elementEnvironment2
- .lookupClassMember(cls2, member1.name, setter: member1.isSetter);
- Expect.isNotNull(
- member2, "Missing class member for '${member1.name}' in $cls2");
- checkMembers(member1, member2);
- });
- elementEnvironment1.forEachConstructor(cls1,
- (ConstructorEntity constructor1) {
- ConstructorEntity constructor2 =
- elementEnvironment2.lookupConstructor(cls2, constructor1.name);
- checkMembers(constructor1, constructor2);
- });
- });
-
- elementEnvironment1.forEachLibraryMember(library1,
- (MemberEntity member1) {
- MemberEntity member2 = elementEnvironment2.lookupLibraryMember(
- library2, member1.name,
- setter: member1.isSetter);
- checkMembers(member1, member2);
- });
- }
-
- checkLibraries(
- elementEnvironment1.mainLibrary, elementEnvironment2.mainLibrary);
- elementEnvironment1.libraries.forEach((LibraryEntity library1) {
- if (library1 == elementEnvironment1.mainLibrary) return;
- LibraryEntity library2 =
- elementEnvironment2.lookupLibrary(library1.canonicalUri);
- checkLibraries(library1, library2);
- });
- });
-}
-
-/// Lax the precision of [impact] to meet expectancy of the corresponding impact
-/// generated from kernel.
-ResolutionImpact laxImpact(
- Compiler compiler, MemberElement element, ResolutionImpact impact) {
- ResolutionWorldImpactBuilder builder =
- new ResolutionWorldImpactBuilder('Lax impact of ${element}');
- for (StaticUse staticUse in impact.staticUses) {
- switch (staticUse.kind) {
- case StaticUseKind.CONSTRUCTOR_INVOKE:
- case StaticUseKind.CONST_CONSTRUCTOR_INVOKE:
- ConstructorElement constructor = staticUse.element;
- ConstructorElement effectiveTarget = constructor.effectiveTarget;
- ResolutionInterfaceType effectiveTargetType =
- constructor.computeEffectiveTargetType(staticUse.type);
- ConstructorElement effectiveTargetDeclaration =
- effectiveTarget.declaration;
- builder.registerStaticUse(
- staticUse.kind == StaticUseKind.CONST_CONSTRUCTOR_INVOKE
- ? new StaticUse.constConstructorInvoke(
- effectiveTargetDeclaration, null, effectiveTargetType)
- : new StaticUse.typedConstructorInvoke(
- effectiveTargetDeclaration, null, effectiveTargetType));
- break;
- default:
- builder.registerStaticUse(staticUse);
- break;
- }
- }
- impact.dynamicUses.forEach(builder.registerDynamicUse);
- for (TypeUse typeUse in impact.typeUses) {
- builder.registerTypeUse(
- new TypeUse.internal(unalias(typeUse.type), typeUse.kind));
- }
- impact.constantLiterals.forEach(builder.registerConstantLiteral);
- impact.constSymbolNames.forEach(builder.registerConstSymbolName);
- for (ListLiteralUse listLiteralUse in impact.listLiterals) {
- if (element.enclosingClass != null &&
- element.enclosingClass.isEnumClass &&
- element.name == 'values') {
- // The type argument is not added to the generated list constant.
- ResolutionInterfaceType enumType = element.enclosingClass.thisType;
- listLiteralUse = new ListLiteralUse(
- compiler.frontendStrategy.commonElements.listType(enumType),
- isConstant: listLiteralUse.isConstant,
- isEmpty: listLiteralUse.isEmpty);
- builder.registerTypeUse(new TypeUse.checkedModeCheck(enumType));
- }
- builder.registerListLiteral(listLiteralUse);
- }
- for (MapLiteralUse mapLiteralUse in impact.mapLiterals) {
- if (element.enclosingClass != null &&
- element.enclosingClass.isEnumClass &&
- element.name == 'toString') {
- // The type argument is not added to the generated map constant.
- ResolutionInterfaceType keyType =
- compiler.frontendStrategy.commonElements.intType;
- ResolutionInterfaceType valueType =
- compiler.frontendStrategy.commonElements.stringType;
- mapLiteralUse = new MapLiteralUse(
- compiler.frontendStrategy.commonElements.mapType(keyType, valueType),
- isConstant: mapLiteralUse.isConstant,
- isEmpty: mapLiteralUse.isEmpty);
- builder.registerTypeUse(new TypeUse.checkedModeCheck(keyType));
- builder.registerTypeUse(new TypeUse.checkedModeCheck(valueType));
- }
- builder.registerMapLiteral(mapLiteralUse);
- }
-
- for (Feature feature in impact.features) {
- switch (feature) {
- case Feature.FIELD_WITHOUT_INITIALIZER:
- builder.registerConstantLiteral(new NullConstantExpression());
- break;
- case Feature.STRING_INTERPOLATION:
- case Feature.STRING_JUXTAPOSITION:
- // These are both converted into a string concatenation in kernel so
- // we cannot tell the difference.
- builder.registerFeature(Feature.STRING_INTERPOLATION);
- builder.registerFeature(Feature.STRING_JUXTAPOSITION);
- break;
- case Feature.FALL_THROUGH_ERROR:
- LibraryElement library =
- compiler.libraryLoader.lookupLibrary(Uris.dart_core);
- ClassElement cls =
- library.implementation.localLookup('FallThroughError');
- ConstructorElement constructor =
- cls.lookupConstructor('_create').declaration;
- builder.registerStaticUse(new StaticUse.typedConstructorInvoke(
- constructor, CallStructure.NO_ARGS, cls.thisType));
- builder.registerFeature(Feature.THROW_EXPRESSION);
- break;
- default:
- builder.registerFeature(feature);
- break;
- }
- }
- impact.nativeData.forEach(builder.registerNativeData);
- return builder;
-}
diff --git a/tests/compiler/dart2js/kernel/literals_test.dart b/tests/compiler/dart2js/kernel/literals_test.dart
deleted file mode 100644
index 5cc337a..0000000
--- a/tests/compiler/dart2js/kernel/literals_test.dart
+++ /dev/null
@@ -1,25 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- test('compile function that returns a literal list', () {
- return check('main() { return [1, 2, 3]; }');
- });
- test('compile function that returns a const list', () {
- return check('main() { return const [1, 2, 3]; }');
- });
- test('compile function that returns a literal map', () {
- return check('main() { return {"a": 1, "b": 2, "c": 3}; }');
- });
- test('compile function that returns a const map', () {
- return check('main() { return const {"a": 1, "b": 2, "c": 3}; }');
- });
- test('compile top level string field ', () {
- return check('String foo = (() { return "a";})(); main() { return foo; }');
- });
-}
diff --git a/tests/compiler/dart2js/kernel/loops_test.dart b/tests/compiler/dart2js/kernel/loops_test.dart
deleted file mode 100644
index 259539b..0000000
--- a/tests/compiler/dart2js/kernel/loops_test.dart
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- test('for loop', () {
- String code = '''
-main() {
- var a = 0;
- for (var i = 0; i < 10; i++) {
- a += i;
- }
- return a;
-}''';
- return check(code);
- });
-
- test('while loop', () {
- String code = '''
-main() {
- var a = 0;
- while (a < 100) {
- a *= 2;
- }
- return a;
-}''';
- return check(code);
- });
-
- test('do-while loop', () {
- String code = '''
-main() {
- var a = 0;
- do {
- a *= 2;
- } while (a < 100);
- return a;
-}''';
- return check(code);
- });
-
- test('for-in loop', () {
- String code = '''
-main() {
- var sum = 0;
- for (var a in [1, 2, 3]) {
- sum += a;
- }
- return sum;
-}''';
- return check(code);
- });
-
- test('for-in loop optimized', () {
- String code = '''
-main() {
- var sum = 0;
- for (var a in [1, 2, 3]) {
- sum += a;
- }
- return sum;
-}''';
- // This is the same test as above, but by enabling type inference
- // we allow the compiler to detect that it can iterate over the
- // array using indexing.
- return check(code, disableTypeInference: false);
- });
-
- test('for-in loop top-level variable', () {
- String code = '''
-var a = 0;
-main() {
- var sum = 0;
- for (a in [1, 2, 3]) {
- sum += a;
- }
- return sum;
-}''';
- return check(code, disableTypeInference: false);
- });
-
- test('for loop with break to label', () {
- String code = '''
-main() {
- var sum = 0;
- outer: for (var a in [1, 2, 3]) {
- for (int i = 0; i < 10; i++) {
- sum += a;
- if (a + i < 5)
- break outer;
- }
- }
- return sum;
-}''';
- return check(code, disableTypeInference: false);
- });
-}
diff --git a/tests/compiler/dart2js/kernel/mixin_test.dart b/tests/compiler/dart2js/kernel/mixin_test.dart
deleted file mode 100644
index 62e4dfa..0000000
--- a/tests/compiler/dart2js/kernel/mixin_test.dart
+++ /dev/null
@@ -1,208 +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.
-
-// Test that the optimized algorithm for mixin applications matches the mixins
-// generated by fasta.
-library dart2js.kernel.mixins_test;
-
-import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/commandline_options.dart';
-import 'package:compiler/src/common_elements.dart';
-import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/elements/entities.dart';
-import 'package:compiler/src/elements/types.dart';
-import 'package:compiler/src/kernel/kernel_strategy.dart';
-import 'package:compiler/src/universe/class_set.dart';
-import 'package:compiler/src/world.dart';
-import 'package:expect/expect.dart';
-import '../memory_compiler.dart';
-import '../equivalence/check_helpers.dart';
-import 'test_helpers.dart';
-import 'compiler_helper.dart';
-
-const SOURCE = const {
- 'main.dart': '''
-
-class Super {}
-class Mixin1 {}
-class Mixin2 {}
-class Sub1 extends Super with Mixin1 {}
-class Sub2 extends Super with Mixin1, Mixin2 {}
-class NamedSub1 = Super with Mixin1;
-class NamedSub2 = Super with Mixin1, Mixin2;
-
-
-class GenericSuper<T> {}
-class GenericMixin1<T> {}
-class GenericMixin2<T> {}
-class GenericSub1<T> extends GenericSuper<T> with GenericMixin1<T> {}
-class GenericSub2<T> extends GenericSuper<T>
- with GenericMixin1<T>, GenericMixin2<T> {}
-class GenericNamedSub1<T> = GenericSuper<T> with GenericMixin1<T>;
-class GenericNamedSub2<T> = GenericSuper<T>
- with GenericMixin1<T>, GenericMixin2<T>;
-
-class FixedSub1a extends GenericSuper<int> with GenericMixin1<int> {}
-class FixedSub1b extends GenericSuper<int> with GenericMixin1<double> {}
-class FixedSub2a extends GenericSuper<int>
- with GenericMixin1<int>, GenericMixin2<int> {}
-class FixedSub2b extends GenericSuper<double>
- with GenericMixin1<double>, GenericMixin2<double> {}
-
-class GenericMultiMixin<T, S> {}
-class GenericSub<T, S> = Object with GenericMultiMixin<T, S>;
-class FixedSub = Object with GenericMultiMixin<int, String>;
-
-
-main() {
- new Super();
- new Mixin1();
- new Mixin2();
- new Sub1();
- new Sub2();
- new NamedSub1();
- new NamedSub2();
-
- new GenericSuper<int>();
- new GenericMixin1<int>();
- new GenericMixin2<int>();
- new GenericSub1<int>();
- new GenericSub2<int>();
- new GenericNamedSub1<int>();
- new GenericNamedSub2<int>();
-
- new FixedSub1a();
- new FixedSub1b();
- new FixedSub2a();
- new FixedSub2b();
-
- new GenericSub<int, String>();
- new FixedSub();
-}
-'''
-};
-
-Map<ClassEntity, String> generateClassEnv(
- ElementEnvironment env, DartTypes types) {
- Map<ClassEntity, String> classEnv = <ClassEntity, String>{};
-
- void createEnv(ClassEntity cls) {
- classEnv.putIfAbsent(cls, () {
- InterfaceType thisType = env.getThisType(cls);
- StringBuffer sb = new StringBuffer();
- sb.write('class ');
- sb.write(env.getThisType(cls));
- ClassEntity superclass = env.getSuperClass(cls);
- if (superclass != null) {
- createEnv(superclass);
- sb.write(' extends ');
- sb.write(types.asInstanceOf(thisType, superclass));
- }
- return sb.toString();
- });
- }
-
- env.forEachClass(env.mainLibrary, createEnv);
-
- return classEnv;
-}
-
-main(List<String> args) {
- asyncTest(() async {
- Uri entryPoint = await createTemp(Uri.parse('memory:main.dart'), SOURCE,
- printSteps: true);
-
- print(
- '---- compiler from ast -----------------------------------------------');
- var result = await runCompiler(
- entryPoint: entryPoint,
- options: [Flags.analyzeOnly, Flags.useOldFrontend]);
- Compiler compiler1 = result.compiler;
-
- Compiler compiler2 = await compileWithDill(
- entryPoint: entryPoint,
- memorySourceFiles: {},
- options: [Flags.analyzeOnly],
- printSteps: true);
-
- ElementEnvironment env1 = compiler1.frontendStrategy.elementEnvironment;
- DartTypes types1 = compiler1.frontendStrategy.dartTypes;
- ClosedWorld closedWorld1 = compiler1.resolutionWorldBuilder.closeWorld();
-
- KernelFrontEndStrategy frontendStrategy = compiler2.frontendStrategy;
- ElementEnvironment env2 = frontendStrategy.elementEnvironment;
- DartTypes types2 = frontendStrategy.dartTypes;
- ClosedWorld closedWorld2 = compiler2.resolutionWorldBuilder.closeWorld();
-
- KernelEquivalence equivalence =
- new KernelEquivalence(frontendStrategy.elementMap);
-
- if (args.contains('-v')) {
- Map<ClassEntity, String> classEnv1 = generateClassEnv(env1, types1);
- Map<ClassEntity, String> classEnv2 = generateClassEnv(env2, types2);
-
- print('----');
- classEnv1.forEach((ClassEntity cls, String env) {
- print(env);
- });
- print('----');
- classEnv2.forEach((ClassEntity cls, String env) {
- print(env);
- });
- }
-
- void checkClasses(ClassEntity cls1, ClassEntity cls2) {
- if (cls1 == cls2) return;
- Expect.isNotNull(cls1, 'Missing class ${cls2.name}');
- Expect.isNotNull(cls2, 'Missing class ${cls1.name}');
-
- check(cls1.library, cls2.library, 'class ${cls1.name}', cls1, cls2,
- equivalence.entityEntityEquivalence);
- InterfaceType thisType1 = types1.getThisType(cls1);
- InterfaceType thisType2 = types2.getThisType(cls2);
- check(cls1, cls2, 'thisType', thisType1, thisType2,
- equivalence.typeTypeEquivalence);
- check(cls1, cls2, 'supertype', types1.getSupertype(cls1),
- types2.getSupertype(cls2), equivalence.typeTypeEquivalence);
- checkClasses(env1.getSuperClass(cls1), env2.getSuperClass(cls2));
-
- List<DartType> mixins1 = <DartType>[];
- env1.forEachMixin(cls1, (ClassEntity mixin) {
- mixins1.add(types1.asInstanceOf(thisType1, mixin));
- });
- List<DartType> mixins2 = <DartType>[];
- env2.forEachMixin(cls2, (ClassEntity mixin) {
- mixins2.add(types2.asInstanceOf(thisType2, mixin));
- });
- checkLists(mixins1, mixins2, '${cls1.name} mixins',
- equivalence.typeTypeEquivalence);
-
- checkLists(
- types1.getInterfaces(cls1).toList(),
- types2.getInterfaces(cls2).toList(),
- '${cls1.name} interfaces',
- equivalence.typeTypeEquivalence);
- checkLists(
- types1.getSupertypes(cls1).toList(),
- types2.getSupertypes(cls2).toList(),
- '${cls1.name} supertypes',
- equivalence.typeTypeEquivalence);
-
- if (cls1 == compiler1.frontendStrategy.commonElements.objectClass) return;
-
- ClassHierarchyNode node1 = closedWorld1.getClassHierarchyNode(cls1);
- ClassHierarchyNode node2 = closedWorld2.getClassHierarchyNode(cls2);
- checkSets(
- new Set.from(node1.directSubclasses),
- new Set.from(node2.directSubclasses),
- '${cls1.name} direct subclasses',
- (a, b) => equivalence.entityEquivalence(a.cls, b.cls));
- }
-
- env1.forEachClass(env1.mainLibrary, (ClassEntity cls1) {
- ClassEntity cls2 = env2.lookupClass(env2.mainLibrary, cls1.name);
- checkClasses(cls1, cls2);
- });
- });
-}
diff --git a/tests/compiler/dart2js/kernel/run_from_dill_test.dart b/tests/compiler/dart2js/kernel/run_from_dill_test.dart
deleted file mode 100644
index 29e526e..0000000
--- a/tests/compiler/dart2js/kernel/run_from_dill_test.dart
+++ /dev/null
@@ -1,109 +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.
-
-// Test that we can compile from dill and run the generated code with d8.
-library dart2js.kernel.run_from_dill_test;
-
-import 'dart:async';
-
-import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/commandline_options.dart';
-
-import 'arguments.dart';
-import 'compiler_helper.dart';
-
-const SOURCE = const {
- 'main.dart': r'''
-import "package:expect/expect.dart";
-
-class K {}
-
-class A<T> {
- foo() {
- bar() => T;
- return bar();
- }
-}
-
-class B extends A<K> {}
-
-class X<T> {}
-
-// [globalMethod] and [format] are copied from
-// `language/named_parameters_with_dollars_test`. This test failed because
-// when inlining [globalMethod] the named arguments where processed unsorted,
-// passing `[a, a$b, a$$b, b]` to [format] instead of `[a, b, a$b, a$$b]`.
-globalMethod({a, b, a$b, a$$b}) => [a, b, a$b, a$$b];
-
-format(thing) {
- if (thing == null) return '-';
- if (thing is List) {
- var fragments = ['['];
- var sep;
- for (final item in thing) {
- if (sep != null) fragments.add(sep);
- sep = ', ';
- fragments.add(format(item));
- }
- fragments.add(']');
- return fragments.join();
- }
- return thing.toString();
-}
-
-main() {
- for (int i = 0; i < 10; i++) {
- if (i == 5) continue;
- print('Hello World: $i!');
- if (i == 7) break;
- }
- Expect.equals(new A<int>().foo(), int);
- var v = new DateTime.now().millisecondsSinceEpoch != 42
- ? new X<B>()
- : new X<A<String>>();
- Expect.isFalse(v is X<A<String>>);
- Expect.equals('[1, 2, -, -]', format(globalMethod(a: 1, b: 2)));
-}
-'''
-};
-
-const OUTPUT = '''
-Hello World: 0!
-Hello World: 1!
-Hello World: 2!
-Hello World: 3!
-Hello World: 4!
-Hello World: 6!
-Hello World: 7!
-''';
-
-main(List<String> args) {
- asyncTest(() async {
- await mainInternal(args);
- });
-}
-
-enum ResultKind { crashes, errors, warnings, success, failure }
-
-Future<ResultKind> mainInternal(List<String> args,
- {bool skipWarnings: false, bool skipErrors: false}) async {
- Arguments arguments = new Arguments.from(args);
- Uri entryPoint;
- Map<String, String> memorySourceFiles;
- if (arguments.uri != null) {
- entryPoint = arguments.uri;
- memorySourceFiles = const <String, String>{};
- } else {
- entryPoint = Uri.parse('memory:main.dart');
- memorySourceFiles = SOURCE;
- }
-
- await runWithD8(
- entryPoint: entryPoint,
- memorySourceFiles: memorySourceFiles,
- options: [Flags.enableAssertMessage],
- expectedOutput: OUTPUT);
-
- return ResultKind.success;
-}
diff --git a/tests/compiler/dart2js/kernel/simple_function_test.dart b/tests/compiler/dart2js/kernel/simple_function_test.dart
deleted file mode 100644
index d58ca33..0000000
--- a/tests/compiler/dart2js/kernel/simple_function_test.dart
+++ /dev/null
@@ -1,47 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- group('compile function that returns a value', () {
- test('constant int', () {
- return check('main() { return 1; }');
- });
-
- test('constant double', () {
- return check('main() { return 1.0; }');
- });
-
- test('constant string', () {
- return check('main() { return "hello"; }');
- });
-
- test('constant bool', () {
- return check('main() { return true; }');
- });
-
- test('constant symbol', () {
- return check('main() { return #hello; }');
- });
-
- test('null', () {
- return check('main() { return null; }');
- });
- });
-
- test('compile function that returns its argument', () {
- String code = '''
- foo(x) {
- return x;
- }
-
- main() {
- foo(1);
- }''';
- return check(code, lookup: 'foo');
- });
-}
diff --git a/tests/compiler/dart2js/kernel/switch_test.dart b/tests/compiler/dart2js/kernel/switch_test.dart
deleted file mode 100644
index 1ae2ceb..0000000
--- a/tests/compiler/dart2js/kernel/switch_test.dart
+++ /dev/null
@@ -1,99 +0,0 @@
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- test('simple switch statement', () {
- String code = '''
-main() {
- int x = 2;
- switch(x) {
- case 1:
- print('spider');
- break;
- case 2:
- print('grasshopper');
- break;
- }
-}''';
- return check(code);
- });
-
- test('switch with default', () {
- String code = '''
-main() {
- int x = 5;
- switch(x) {
- case 1:
- print('spider');
- break;
- case 2:
- print('grasshopper');
- break;
- default:
- print('ladybug');
- }
-}''';
- return check(code);
- });
-
-/*
- // TODO(efortuna): Uncomment. Because of patch file weirdness, the original
- // SSA vs the Kernel version is instantiating a subclass of the
- // FallThroughError, so it produces slightly different code. Fix that.
- test('switch with fall through error', () {
- String code = '''
-main() {
- int x = 2;
- switch(x) {
- case 1:
- print('spider');
- break;
- case 2:
- print('grasshopper');
- case 3:
- print('ant');
- break;
- default:
- print('ladybug');
- }
-}''';
- return check(code);
- });
-*/
- test('switch with multi-case branch', () {
- String code = '''
-main() {
- int x = 3;
- switch(x) {
- case 1:
- print('spider');
- break;
- case 2:
- case 3:
- case 4:
- print('grasshopper');
- print('ant');
- break;
- }
-}''';
- return check(code);
- });
-
- test('switch with weird fall-through end case', () {
- String code = '''
-main() {
- int x = 6;
- switch(x) {
- case 1:
- print('spider');
- break;
- case 5:
- print('beetle');
- break;
- case 6:
- }
-}''';
- return check(code);
- });
-}
diff --git a/tests/compiler/dart2js/kernel/test_helpers.dart b/tests/compiler/dart2js/kernel/test_helpers.dart
deleted file mode 100644
index 3f24c19..0000000
--- a/tests/compiler/dart2js/kernel/test_helpers.dart
+++ /dev/null
@@ -1,307 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library dart2js.kernel.equivalence;
-
-import 'dart:io';
-import 'package:compiler/src/constants/expressions.dart';
-import 'package:compiler/src/constants/values.dart';
-import 'package:compiler/src/elements/elements.dart';
-import 'package:compiler/src/elements/entities.dart';
-import 'package:compiler/src/elements/resolution_types.dart';
-import 'package:compiler/src/elements/types.dart';
-import 'package:compiler/src/kernel/element_map.dart';
-import 'package:compiler/src/kernel/element_map_impl.dart';
-import 'package:compiler/src/kernel/indexed.dart';
-import 'package:compiler/src/kernel/kelements.dart' show KLocalFunction;
-import 'package:compiler/src/util/util.dart';
-
-import '../equivalence/equivalence_helper.dart';
-
-class KernelEquivalence {
- final WorldDeconstructionForTesting testing;
-
- /// Set of mixin applications assumed to be equivalent.
- ///
- /// We need co-inductive reasoning because mixin applications are compared
- /// structurally and therefore, in the case of generic mixin applications,
- /// meet themselves through the equivalence check of their type variables.
- Set<Pair<ClassEntity, ClassEntity>> assumedMixinApplications =
- new Set<Pair<ClassEntity, ClassEntity>>();
-
- KernelEquivalence(KernelToElementMap builder)
- : testing = new WorldDeconstructionForTesting(builder);
-
- TestStrategy get defaultStrategy => new TestStrategy(
- elementEquivalence: entityEquivalence,
- typeEquivalence: typeEquivalence,
- constantEquivalence: constantEquivalence,
- constantValueEquivalence: constantValueEquivalence);
-
- bool entityEntityEquivalence(Entity a, Entity b, {TestStrategy strategy}) =>
- entityEquivalence(a, b, strategy: strategy);
-
- bool entityEquivalence(Element a, Entity b, {TestStrategy strategy}) {
- if (identical(a, b)) return true;
- if (a == null || b == null) return false;
- strategy ??= defaultStrategy;
- switch (a.kind) {
- case ElementKind.GENERATIVE_CONSTRUCTOR:
- if (b is IndexedConstructor && b.isGenerativeConstructor) {
- return strategy.test(a, b, 'name', a.name, b.name) &&
- strategy.testElements(
- a, b, 'enclosingClass', a.enclosingClass, b.enclosingClass);
- }
- return false;
- case ElementKind.FACTORY_CONSTRUCTOR:
- if (b is IndexedConstructor && b.isFactoryConstructor) {
- return strategy.test(a, b, 'name', a.name, b.name) &&
- strategy.testElements(
- a, b, 'enclosingClass', a.enclosingClass, b.enclosingClass);
- }
- return false;
- case ElementKind.GENERATIVE_CONSTRUCTOR_BODY:
- ConstructorBodyElement aConstructorBody = a;
- if (b is ConstructorBodyEntity) {
- return entityEquivalence(aConstructorBody.constructor, b.constructor);
- }
- return false;
- case ElementKind.CLASS:
- if (b is IndexedClass) {
- List<InterfaceType> aMixinTypes = [];
- List<InterfaceType> bMixinTypes = [];
- ClassElement aClass = a;
- if (aClass.isUnnamedMixinApplication) {
- if (!testing.isUnnamedMixinApplication(b)) {
- return false;
- }
- while (aClass.isMixinApplication) {
- MixinApplicationElement aMixinApplication = aClass;
- aMixinTypes.add(aMixinApplication.mixinType);
- aClass = aMixinApplication.superclass;
- }
- IndexedClass bClass = b;
- while (bClass != null) {
- InterfaceType mixinType = testing.getMixinTypeForClass(bClass);
- if (mixinType == null) break;
- bMixinTypes.add(mixinType);
- bClass = testing.getSuperclassForClass(bClass);
- }
- if (aMixinTypes.isNotEmpty || aMixinTypes.isNotEmpty) {
- Pair<ClassEntity, ClassEntity> pair =
- new Pair<ClassEntity, ClassEntity>(aClass, bClass);
- if (assumedMixinApplications.contains(pair)) {
- return true;
- } else {
- assumedMixinApplications.add(pair);
- bool result = strategy.testTypeLists(
- a, b, 'mixinTypes', aMixinTypes, bMixinTypes);
- assumedMixinApplications.remove(pair);
- return result;
- }
- }
- } else {
- if (testing.isUnnamedMixinApplication(b)) {
- return false;
- }
- }
- return strategy.test(a, b, 'name', a.name, b.name) &&
- strategy.testElements(a, b, 'library', a.library, b.library);
- }
- return false;
- case ElementKind.LIBRARY:
- if (b is IndexedLibrary) {
- LibraryElement libraryA = a;
- return libraryA.canonicalUri == b.canonicalUri;
- }
- return false;
- case ElementKind.FUNCTION:
- if (b is IndexedFunction && b.isFunction) {
- return strategy.test(a, b, 'name', a.name, b.name) &&
- strategy.testElements(
- a, b, 'enclosingClass', a.enclosingClass, b.enclosingClass) &&
- strategy.testElements(a, b, 'library', a.library, b.library);
- } else if (b is KLocalFunction) {
- LocalFunctionElement aLocalFunction = a;
- return strategy.test(a, b, 'name', a.name, b.name ?? '') &&
- strategy.testElements(a, b, 'executableContext',
- aLocalFunction.executableContext, b.executableContext) &&
- strategy.testElements(a, b, 'memberContext',
- aLocalFunction.memberContext, b.memberContext);
- }
- return false;
- case ElementKind.GETTER:
- if (b is IndexedFunction && b.isGetter) {
- return strategy.test(a, b, 'name', a.name, b.name) &&
- strategy.testElements(
- a, b, 'enclosingClass', a.enclosingClass, b.enclosingClass) &&
- strategy.testElements(a, b, 'library', a.library, b.library);
- }
- return false;
- case ElementKind.SETTER:
- if (b is IndexedFunction && b.isSetter) {
- return strategy.test(a, b, 'name', a.name, b.name) &&
- strategy.testElements(
- a, b, 'enclosingClass', a.enclosingClass, b.enclosingClass) &&
- strategy.testElements(a, b, 'library', a.library, b.library);
- }
- return false;
- case ElementKind.FIELD:
- if (b is IndexedField) {
- return strategy.test(a, b, 'name', a.name, b.name) &&
- strategy.testElements(
- a, b, 'enclosingClass', a.enclosingClass, b.enclosingClass) &&
- strategy.testElements(a, b, 'library', a.library, b.library);
- }
- return false;
- case ElementKind.TYPE_VARIABLE:
- if (b is IndexedTypeVariable) {
- TypeVariableElement aElement = a;
- return strategy.test(a, b, 'index', aElement.index, b.index) &&
- strategy.testElements(a, b, 'typeDeclaration',
- aElement.typeDeclaration, b.typeDeclaration);
- }
- return false;
- default:
- throw new UnsupportedError('Unsupported equivalence: '
- '$a (${a.runtimeType}) vs $b (${b.runtimeType})');
- }
- }
-
- bool typeTypeEquivalence(DartType a, DartType b, {TestStrategy strategy}) =>
- typeEquivalence(a, b, strategy: strategy);
-
- bool typeEquivalence(ResolutionDartType a, DartType b,
- {TestStrategy strategy}) {
- if (identical(a, b)) return true;
- if (a == null || b == null) return false;
- a = unalias(a);
- strategy ??= defaultStrategy;
- switch (a.kind) {
- case ResolutionTypeKind.DYNAMIC:
- return b is DynamicType ||
- // The resolver encodes 'FutureOr' as a dynamic type!
- (b is InterfaceType && b.element.name == 'FutureOr');
- case ResolutionTypeKind.VOID:
- return b is VoidType;
- case ResolutionTypeKind.INTERFACE:
- if (b is InterfaceType) {
- ResolutionInterfaceType aType = a;
- return strategy.testElements(a, b, 'element', a.element, b.element) &&
- strategy.testTypeLists(
- a, b, 'typeArguments', aType.typeArguments, b.typeArguments);
- }
- return false;
- case ResolutionTypeKind.TYPE_VARIABLE:
- if (b is TypeVariableType) {
- return strategy.testElements(a, b, 'element', a.element, b.element);
- }
- return false;
- case ResolutionTypeKind.FUNCTION:
- if (b is FunctionType) {
- ResolutionFunctionType aType = a;
- return strategy.testTypes(
- a, b, 'returnType', aType.returnType, b.returnType) &&
- strategy.testTypeLists(a, b, 'parameterTypes',
- aType.parameterTypes, b.parameterTypes) &&
- strategy.testTypeLists(a, b, 'optionalParameterTypes',
- aType.optionalParameterTypes, b.optionalParameterTypes) &&
- strategy.testLists(a, b, 'namedParameters', aType.namedParameters,
- b.namedParameters) &&
- strategy.testTypeLists(a, b, 'namedParameterTypes',
- aType.namedParameterTypes, b.namedParameterTypes);
- }
- return false;
- default:
- throw new UnsupportedError('Unsupported equivalence: '
- '$a (${a.runtimeType}) vs $b (${b.runtimeType})');
- }
- }
-
- bool constantEquivalence(ConstantExpression exp1, ConstantExpression exp2,
- {TestStrategy strategy}) {
- strategy ??= defaultStrategy;
- return areConstantsEquivalent(exp1, exp2, strategy: strategy);
- }
-
- bool constantValueEquivalence(ConstantValue value1, ConstantValue value2,
- {TestStrategy strategy}) {
- strategy ??= defaultStrategy;
- return areConstantValuesEquivalent(value1, value2, strategy: strategy);
- }
-}
-
-/// Visitor the performers unaliasing of all typedefs nested within a
-/// [ResolutionDartType].
-class Unaliaser
- extends BaseResolutionDartTypeVisitor<dynamic, ResolutionDartType> {
- const Unaliaser();
-
- @override
- ResolutionDartType visit(ResolutionDartType type, [_]) =>
- // ignore: ARGUMENT_TYPE_NOT_ASSIGNABLE
- type.accept(this, null);
-
- @override
- ResolutionDartType visitType(ResolutionDartType type, _) => type;
-
- List<ResolutionDartType> visitList(List<ResolutionDartType> types) =>
- types.map(visit).toList();
-
- @override
- ResolutionDartType visitInterfaceType(ResolutionInterfaceType type, _) {
- return type.createInstantiation(visitList(type.typeArguments));
- }
-
- @override
- ResolutionDartType visitTypedefType(ResolutionTypedefType type, _) {
- return visit(type.unaliased);
- }
-
- @override
- ResolutionDartType visitFunctionType(ResolutionFunctionType type, _) {
- return new ResolutionFunctionType.synthesized(
- visit(type.returnType),
- visitList(type.parameterTypes),
- visitList(type.optionalParameterTypes),
- type.namedParameters,
- visitList(type.namedParameterTypes));
- }
-}
-
-/// Perform unaliasing of all typedefs nested within a [ResolutionDartType].
-ResolutionDartType unalias(ResolutionDartType type) {
- return const Unaliaser().visit(type);
-}
-
-bool elementFilter(Entity element) {
- if (element is ConstructorElement && element.isRedirectingFactory) {
- // Redirecting factory constructors are skipped in kernel.
- return false;
- }
- if (element is ClassElement) {
- for (ConstructorElement constructor in element.constructors) {
- if (!constructor.isRedirectingFactory) {
- return true;
- }
- }
- // The class cannot itself be instantiated.
- return false;
- }
- return true;
-}
-
-/// Create an absolute uri from the [uri] created by fasta.
-Uri resolveFastaUri(Uri uri) {
- if (!uri.isAbsolute) {
- // TODO(johnniwinther): Remove this when fasta uses patching.
- if (uri.path.startsWith('patched_dart2js_sdk/')) {
- Uri executable = new File(Platform.resolvedExecutable).uri;
- uri = executable.resolve(uri.path);
- } else {
- uri = Uri.base.resolveUri(uri);
- }
- }
- return uri;
-}
diff --git a/tests/compiler/dart2js/kernel/try_catch_test.dart b/tests/compiler/dart2js/kernel/try_catch_test.dart
deleted file mode 100644
index 77a1afd..0000000
--- a/tests/compiler/dart2js/kernel/try_catch_test.dart
+++ /dev/null
@@ -1,95 +0,0 @@
-// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'package:test/test.dart';
-
-import 'helper.dart' show check;
-
-main() {
- test('try catch', () {
- String code = '''
-main() {
- try {
- print('hi');
- } catch (e, s) {
- print(e);
- print(s);
- print('bye');
- }
-}''';
- return check(code);
- });
-
- test('try omit catch', () {
- String code = '''
-main() {
- try {
- print('hi');
- } on ArgumentError {
- print('howdy');
- }
-}''';
- return check(code);
- });
-
- test('try finally', () {
- String code = '''
-main() {
- try {
- print('hi');
- } finally {
- print('bye');
- }
-}''';
- return check(code);
- });
-
- test('try catch finally', () {
- String code = '''
-main() {
- try {
- print('hi');
- } catch(e) {
- print('howdy');
- } finally {
- print('bye');
- }
-}''';
- return check(code);
- });
-
- test('try multi catch', () {
- String code = '''
-main() {
- try {
- print('hi');
- } on String catch(e) {
- print('hola');
- } on int catch(e) {
- print('halo');
- } catch (e) {
- print('howdy');
- }
-}''';
- return check(code);
- });
-
- test('try multi-catch finally', () {
- String code = '''
-main() {
- try {
- print('hi');
- } on String catch(e) {
- print('hola');
- } on int catch(e) {
- print('halo');
- } catch (e) {
- print('howdy');
- } finally {
- print('bye');
- }
-}''';
- return check(code);
- });
-}
diff --git a/tests/compiler/dart2js/memory_compiler.dart b/tests/compiler/dart2js/memory_compiler.dart
index 88dc06c..3f92e4c 100644
--- a/tests/compiler/dart2js/memory_compiler.dart
+++ b/tests/compiler/dart2js/memory_compiler.dart
@@ -14,7 +14,6 @@
CompilerOutput,
Diagnostic,
PackagesDiscoveryProvider;
-import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/diagnostics/messages.dart' show Message;
import 'package:compiler/src/elements/entities.dart'
show LibraryEntity, MemberEntity;
@@ -140,10 +139,7 @@
Uri packageConfig,
PackagesDiscoveryProvider packagesDiscoveryProvider}) {
Uri libraryRoot = Uri.base.resolve('sdk/');
- Uri platformBinaries;
- if (!options.contains(Flags.useOldFrontend)) {
- platformBinaries = computePlatformBinariesLocation();
- }
+ Uri platformBinaries = computePlatformBinariesLocation();
if (packageRoot == null &&
packageConfig == null &&
diff --git a/tests/compiler/dart2js/model/constant_expression_evaluate_test.dart b/tests/compiler/dart2js/model/constant_expression_evaluate_test.dart
index 8fa15e2..e014671 100644
--- a/tests/compiler/dart2js/model/constant_expression_evaluate_test.dart
+++ b/tests/compiler/dart2js/model/constant_expression_evaluate_test.dart
@@ -11,7 +11,6 @@
import 'package:compiler/src/common.dart';
import 'package:compiler/src/common_elements.dart';
import 'package:compiler/src/compiler.dart';
-import 'package:compiler/src/compile_time_constants.dart';
import 'package:compiler/src/constants/constructors.dart';
import 'package:compiler/src/constants/evaluation.dart';
import 'package:compiler/src/constants/expressions.dart';
@@ -645,38 +644,14 @@
});
}
- const skipAstList = const [
- // The old front end reports errors through the compile time constant
- // evaluator which results in different constant expressions for errorneous
- // constants.
- 'errors',
- // Assert in initializer is not supported by the old frontend.
- 'assert',
- ];
- const skipKernelList = const [
- // TODO(johnniwinther): Investigate why some types of the constructed
- // objects don't match.
- 'redirect',
- ];
+ const skipKernelList = const [];
const skipStrongList = const [
- // TODO(johnniwinther): Investigate why some types of the constructed
- // objects don't match.
- 'redirect',
// TODO(johnniwinther): Investigate why different errors are reported in
// strong mode.
'errors',
];
- if (!skipAstList.contains(data.name) && !data.strongModeOnly) {
- print(
- '--test ast----------------------------------------------------------');
- await runTest(
- [Flags.useOldFrontend],
- (Compiler compiler, FieldEntity field) => new AstEvaluationEnvironment(
- compiler,
- constantRequired: field.isConst));
- }
if (!skipKernelList.contains(data.name) && !data.strongModeOnly) {
print(
'--test kernel-------------------------------------------------------');
diff --git a/tests/compiler/dart2js/rti/bound_check_test.dart b/tests/compiler/dart2js/rti/bound_check_test.dart
index 74cf201..10f1b35 100644
--- a/tests/compiler/dart2js/rti/bound_check_test.dart
+++ b/tests/compiler/dart2js/rti/bound_check_test.dart
@@ -4,7 +4,7 @@
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
-import '../kernel/compiler_helper.dart';
+import '../helpers/d8_helper.dart';
const String SOURCE1 = r'''
import 'package:expect/expect.dart';
diff --git a/tests/compiler/dart2js/rti/data/closure.dart b/tests/compiler/dart2js/rti/data/closure.dart
index 8b23eeb..df64b7e 100644
--- a/tests/compiler/dart2js/rti/data/closure.dart
+++ b/tests/compiler/dart2js/rti/data/closure.dart
@@ -13,7 +13,6 @@
f() {
// TODO(johnniwinther): Optimize local function type signature need.
return
- /*ast.*/
/*kernel.*/
/*strong.needsSignature*/
/*omit.needsSignature*/
diff --git a/tests/compiler/dart2js/rti/data/function_subtype_local5.dart b/tests/compiler/dart2js/rti/data/function_subtype_local5.dart
index b1cb012..6fb64c6 100644
--- a/tests/compiler/dart2js/rti/data/function_subtype_local5.dart
+++ b/tests/compiler/dart2js/rti/data/function_subtype_local5.dart
@@ -18,12 +18,10 @@
class C<T> {
void test(String nameOfT, bool expectedResult) {
// TODO(johnniwinther): Optimize local function type signature need.
- /*ast.*/
/*kernel.*/
/*strong.needsSignature*/
/*omit.needsSignature*/
int foo(bool a, [String b]) => null;
- /*ast.*/
/*kernel.*/
/*strong.needsSignature*/
/*omit.needsSignature*/
diff --git a/tests/compiler/dart2js/rti/data/generic_method_instantiate.dart b/tests/compiler/dart2js/rti/data/generic_method_instantiate.dart
index 0162882..2d0d2ce 100644
--- a/tests/compiler/dart2js/rti/data/generic_method_instantiate.dart
+++ b/tests/compiler/dart2js/rti/data/generic_method_instantiate.dart
@@ -8,7 +8,6 @@
/*class: B:deps=[method],explicit=[B<A>],needsArgs*/
class B<T> {}
-/*ast.element: method:*/
/*kernel.element: method:*/
/*strong.element: method:needsArgs*/
/*omit.element: method:needsArgs*/
diff --git a/tests/compiler/dart2js/rti/data/generic_method_is.dart b/tests/compiler/dart2js/rti/data/generic_method_is.dart
index a2cfa4a..6339de6 100644
--- a/tests/compiler/dart2js/rti/data/generic_method_is.dart
+++ b/tests/compiler/dart2js/rti/data/generic_method_is.dart
@@ -2,7 +2,6 @@
// 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.
-/*ast.element: method:direct,explicit=[method.T]*/
/*kernel.element: method:direct,explicit=[method.T]*/
/*strong.element: method:direct,explicit=[method.T],needsArgs*/
/*omit.element: method:direct,explicit=[method.T],needsArgs*/
diff --git a/tests/compiler/dart2js/rti/data/list_to_set.dart b/tests/compiler/dart2js/rti/data/list_to_set.dart
index 83762b3..427ecc9 100644
--- a/tests/compiler/dart2js/rti/data/list_to_set.dart
+++ b/tests/compiler/dart2js/rti/data/list_to_set.dart
@@ -2,12 +2,10 @@
// 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.
-/*ast.class: global#List:deps=[Class,EmptyIterable,Iterable,JSArray,ListIterable,SetMixin,SubListIterable],explicit=[List],implicit=[List.E],indirect,needsArgs*/
/*kernel.class: global#List:deps=[Class,EmptyIterable,Iterable,JSArray,ListIterable,SetMixin],explicit=[List],implicit=[List.E],indirect,needsArgs*/
/*strong.class: global#List:deps=[Class,EmptyIterable,Iterable,JSArray,ListIterable,SetMixin,makeListFixedLength],direct,explicit=[List,List.E,List<JSArray.E>,List<String>,List<makeListFixedLength.T>],implicit=[List.E],needsArgs*/
/*omit.class: global#List:deps=[Class,EmptyIterable,Iterable,JSArray,ListIterable,SetMixin],explicit=[List],implicit=[List.E],indirect,needsArgs*/
-/*ast.class: global#JSArray:deps=[List],explicit=[JSArray],implicit=[JSArray.E],indirect,needsArgs*/
/*kernel.class: global#JSArray:deps=[EmptyIterable,List,ListIterable,SetMixin,SubListIterable],explicit=[JSArray],implicit=[JSArray.E],indirect,needsArgs*/
/*strong.class: global#JSArray:deps=[ArrayIterator,EmptyIterable,List,ListIterable,SetMixin,SubListIterable],explicit=[Iterable<JSArray.E>,JSArray,JSArray.E,JSArray<ArrayIterator.E>,List<JSArray.E>],implicit=[JSArray.E],indirect,needsArgs*/
/*omit.class: global#JSArray:deps=[EmptyIterable,List,ListIterable,SetMixin,SubListIterable],explicit=[JSArray],implicit=[JSArray.E],indirect,needsArgs*/
diff --git a/tests/compiler/dart2js/rti/data/local_function_signatures.dart b/tests/compiler/dart2js/rti/data/local_function_signatures.dart
index 5759a26..b7c851c 100644
--- a/tests/compiler/dart2js/rti/data/local_function_signatures.dart
+++ b/tests/compiler/dart2js/rti/data/local_function_signatures.dart
@@ -6,7 +6,6 @@
class Class1 {
method1() {
- /*ast.*/
/*kernel.*/
/*strong.needsSignature*/
/*omit.needsSignature*/
diff --git a/tests/compiler/dart2js/rti/data/subtype_named_args.dart b/tests/compiler/dart2js/rti/data/subtype_named_args.dart
index d7014bf..452b820 100644
--- a/tests/compiler/dart2js/rti/data/subtype_named_args.dart
+++ b/tests/compiler/dart2js/rti/data/subtype_named_args.dart
@@ -6,28 +6,23 @@
import 'package:expect/expect.dart';
-/*ast.class: A:explicit=[dynamic Function({a:A,b:B,c:C,d:D}),dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>})]*/
-/*kernel.class: A:explicit=[dynamic Function({a:A,b:B,c:C,d:D}),dynamic Function({f1:dynamic Function({a:A,b:B,c:C,d:D}),f2:dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>}),f3:dynamic Function({v:dynamic,x:dynamic,y:dynamic,z:dynamic})}),dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>})]*/
+/*class: A:explicit=[dynamic Function({a:A,b:B,c:C,d:D}),dynamic Function({f1:dynamic Function({a:A,b:B,c:C,d:D}),f2:dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>}),f3:dynamic Function({v:dynamic,x:dynamic,y:dynamic,z:dynamic})}),dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>})]*/
class A {}
class A1 {}
class A2 {}
-/*ast.class: B:explicit=[dynamic Function({a:A,b:B,c:C,d:D}),dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>})]*/
-/*kernel.class: B:explicit=[dynamic Function({a:A,b:B,c:C,d:D}),dynamic Function({f1:dynamic Function({a:A,b:B,c:C,d:D}),f2:dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>}),f3:dynamic Function({v:dynamic,x:dynamic,y:dynamic,z:dynamic})}),dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>})]*/
+/*class: B:explicit=[dynamic Function({a:A,b:B,c:C,d:D}),dynamic Function({f1:dynamic Function({a:A,b:B,c:C,d:D}),f2:dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>}),f3:dynamic Function({v:dynamic,x:dynamic,y:dynamic,z:dynamic})}),dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>})]*/
class B implements A, A1, A2 {}
-/*ast.class: C:explicit=[dynamic Function({a:A,b:B,c:C,d:D}),dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>})]*/
-/*kernel.class: C:explicit=[dynamic Function({a:A,b:B,c:C,d:D}),dynamic Function({f1:dynamic Function({a:A,b:B,c:C,d:D}),f2:dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>}),f3:dynamic Function({v:dynamic,x:dynamic,y:dynamic,z:dynamic})}),dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>})]*/
+/*class: C:explicit=[dynamic Function({a:A,b:B,c:C,d:D}),dynamic Function({f1:dynamic Function({a:A,b:B,c:C,d:D}),f2:dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>}),f3:dynamic Function({v:dynamic,x:dynamic,y:dynamic,z:dynamic})}),dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>})]*/
class C implements B {}
-/*ast.class: D:explicit=[dynamic Function({a:A,b:B,c:C,d:D}),dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>})]*/
-/*kernel.class: D:explicit=[dynamic Function({a:A,b:B,c:C,d:D}),dynamic Function({f1:dynamic Function({a:A,b:B,c:C,d:D}),f2:dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>}),f3:dynamic Function({v:dynamic,x:dynamic,y:dynamic,z:dynamic})}),dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>})]*/
+/*class: D:explicit=[dynamic Function({a:A,b:B,c:C,d:D}),dynamic Function({f1:dynamic Function({a:A,b:B,c:C,d:D}),f2:dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>}),f3:dynamic Function({v:dynamic,x:dynamic,y:dynamic,z:dynamic})}),dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>})]*/
class D implements C {}
-/*ast.class: G:explicit=[dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>})]*/
-/*kernel.class: G:explicit=[dynamic Function({f1:dynamic Function({a:A,b:B,c:C,d:D}),f2:dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>}),f3:dynamic Function({v:dynamic,x:dynamic,y:dynamic,z:dynamic})}),dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>})]*/
+/*class: G:explicit=[dynamic Function({f1:dynamic Function({a:A,b:B,c:C,d:D}),f2:dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>}),f3:dynamic Function({v:dynamic,x:dynamic,y:dynamic,z:dynamic})}),dynamic Function({g:G<A,B,C,D>,l:List<List<B>>,m:Map<num,int>})]*/
class G<T, S, U, W> {}
typedef classesFunc({A a, B b, C c, D d});
diff --git a/tests/compiler/dart2js/rti/data/subtype_named_args1.dart b/tests/compiler/dart2js/rti/data/subtype_named_args1.dart
index 0312132..8d5cf9c 100644
--- a/tests/compiler/dart2js/rti/data/subtype_named_args1.dart
+++ b/tests/compiler/dart2js/rti/data/subtype_named_args1.dart
@@ -8,8 +8,7 @@
class A {}
-/*ast.class: B:explicit=[dynamic Function({a:B})]*/
-/*kernel.class: B:explicit=[dynamic Function({a:B}),dynamic Function({f:dynamic Function({a:B})})]*/
+/*class: B:explicit=[dynamic Function({a:B}),dynamic Function({f:dynamic Function({a:B})})]*/
class B implements A {}
/*class: C:explicit=[dynamic Function({c:C})]*/
diff --git a/tests/compiler/dart2js/rti/emission/closure_function.dart b/tests/compiler/dart2js/rti/emission/closure_function.dart
index 099dee0..9b11f64 100644
--- a/tests/compiler/dart2js/rti/emission/closure_function.dart
+++ b/tests/compiler/dart2js/rti/emission/closure_function.dart
@@ -9,7 +9,6 @@
main() {
test(
- /*ast.checks=[],functionType,instance*/
/*kernel.checks=[],functionType,instance*/
/*strong.checks=[],instance*/ () {});
test(null);
diff --git a/tests/compiler/dart2js/rti/emission/closure_signature_unneeded.dart b/tests/compiler/dart2js/rti/emission/closure_signature_unneeded.dart
index ac72186..6ffe4e3 100644
--- a/tests/compiler/dart2js/rti/emission/closure_signature_unneeded.dart
+++ b/tests/compiler/dart2js/rti/emission/closure_signature_unneeded.dart
@@ -11,7 +11,6 @@
// TODO(johnniwinther): The signature is not needed since the type isn't a
// potential subtype of the checked function types.
return
- /*ast.checks=[$signature],instance*/
/*kernel.checks=[$signature],instance*/
/*strong.checks=[],instance*/
(T t, String s) {};
diff --git a/tests/compiler/dart2js/rti/emission/list.dart b/tests/compiler/dart2js/rti/emission/list.dart
index 565ea00..5be9f09 100644
--- a/tests/compiler/dart2js/rti/emission/list.dart
+++ b/tests/compiler/dart2js/rti/emission/list.dart
@@ -4,7 +4,6 @@
import 'package:meta/dart2js.dart';
-/*ast.class: global#JSArray:checkedInstance,checks=[$isIterable],instance*/
/*kernel.class: global#JSArray:checkedInstance,checks=[$isIterable],instance*/
/*strong.class: global#JSArray:checkedInstance,checks=[$isIterable,$isList],instance*/
diff --git a/tests/compiler/dart2js/rti/emission/map_literal.dart b/tests/compiler/dart2js/rti/emission/map_literal.dart
index 4df5013..2dbeda8 100644
--- a/tests/compiler/dart2js/rti/emission/map_literal.dart
+++ b/tests/compiler/dart2js/rti/emission/map_literal.dart
@@ -2,14 +2,12 @@
// 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.
-/*ast.class: global#Map:instance*/
/*kernel.class: global#Map:instance*/
/*strong.class: global#Map:checkedInstance,checks=[],instance*/
/*class: global#LinkedHashMap:*/
/*class: global#JsLinkedHashMap:checks=[],instance*/
-/*ast.class: global#double:checks=[],instance,typeArgument*/
/*kernel.class: global#double:checks=[],instance,typeArgument*/
/*strong.class: global#double:checkedInstance,checks=[],instance,typeArgument*/
diff --git a/tests/compiler/dart2js/rti/rti_emission_test.dart b/tests/compiler/dart2js/rti/rti_emission_test.dart
index 5408325..3878ea1 100644
--- a/tests/compiler/dart2js/rti/rti_emission_test.dart
+++ b/tests/compiler/dart2js/rti/rti_emission_test.dart
@@ -8,14 +8,11 @@
import 'package:compiler/src/common.dart';
import 'package:compiler/src/compiler.dart';
import 'package:compiler/src/diagnostics/diagnostic_listener.dart';
-import 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/js_backend/runtime_types.dart';
import 'package:compiler/src/js_emitter/model.dart';
-import 'package:compiler/src/tree/nodes.dart' as ast;
import 'package:compiler/src/kernel/element_map.dart';
import 'package:compiler/src/kernel/kernel_backend_strategy.dart';
-import 'package:compiler/src/ssa/builder.dart' as ast;
import 'package:kernel/ast.dart' as ir;
import '../equivalence/id_equivalence.dart';
import '../equivalence/id_equivalence_helper.dart';
@@ -28,9 +25,7 @@
new Directory.fromUri(Platform.script.resolve('emission'));
await checkTests(
dataDir,
- computeAstRtiMemberEmission,
computeKernelRtiMemberEmission,
- computeClassDataFromAst: computeAstRtiClassEmission,
computeClassDataFromKernel: computeKernelRtiClassEmission,
args: args,
skipForStrong: [
@@ -57,24 +52,6 @@
static const String functionType = 'functionType';
}
-void computeAstRtiMemberEmission(
- Compiler compiler, MemberEntity _member, Map<Id, ActualData> actualMap,
- {bool verbose: false}) {
- MemberElement member = _member;
- ResolvedAst resolvedAst = member.resolvedAst;
- compiler.reporter.withCurrentElement(member.implementation, () {
- new RtiMemberEmissionAstComputer(
- compiler.reporter, actualMap, resolvedAst, compiler)
- .run();
- });
-}
-
-void computeAstRtiClassEmission(
- Compiler compiler, ClassEntity cls, Map<Id, ActualData> actualMap,
- {bool verbose: false}) {
- new RtiClassEmissionAstComputer(compiler, actualMap).computeClassValue(cls);
-}
-
abstract class ComputeValueMixin<T> {
Compiler get compiler;
ProgramLookup lookup;
@@ -121,51 +98,6 @@
}
}
-class RtiClassEmissionAstComputer extends DataRegistry
- with ComputeValueMixin<ast.Node> {
- final Compiler compiler;
- final Map<Id, ActualData> actualMap;
-
- RtiClassEmissionAstComputer(this.compiler, this.actualMap);
-
- DiagnosticReporter get reporter => compiler.reporter;
-
- void computeClassValue(covariant ClassElement cls) {
- Id id = new ClassId(cls.name);
- registerValue(cls.sourcePosition, id, getClassValue(cls), cls);
- }
-}
-
-class RtiMemberEmissionAstComputer extends AstDataExtractor
- with ComputeValueMixin<ast.Node> {
- final Compiler compiler;
-
- RtiMemberEmissionAstComputer(DiagnosticReporter reporter,
- Map<Id, ActualData> actualMap, ResolvedAst resolvedAst, this.compiler)
- : super(reporter, actualMap, resolvedAst);
-
- @override
- String computeElementValue(Id id, AstElement element) {
- if (element.isParameter) {
- return null;
- } else if (element.isLocal && element.isFunction) {
- LocalFunctionElement localFunction = element;
- return getMemberValue(localFunction.callMethod);
- } else {
- MemberElement member = element.declaration;
- return getMemberValue(member);
- }
- }
-
- @override
- String computeNodeValue(Id id, ast.Node node, [AstElement element]) {
- if (element != null && element.isLocal && element.isFunction) {
- return computeElementValue(id, element);
- }
- return null;
- }
-}
-
void computeKernelRtiMemberEmission(
Compiler compiler, MemberEntity member, Map<Id, ActualData> actualMap,
{bool verbose: false}) {
diff --git a/tests/compiler/dart2js/rti/rti_need_test_helper.dart b/tests/compiler/dart2js/rti/rti_need_test_helper.dart
index 567e519..d13dae2 100644
--- a/tests/compiler/dart2js/rti/rti_need_test_helper.dart
+++ b/tests/compiler/dart2js/rti/rti_need_test_helper.dart
@@ -13,12 +13,10 @@
import 'package:compiler/src/elements/entities.dart';
import 'package:compiler/src/elements/resolution_types.dart';
import 'package:compiler/src/elements/types.dart';
-import 'package:compiler/src/tree/nodes.dart' as ast;
import 'package:compiler/src/js_backend/runtime_types.dart';
import 'package:compiler/src/kernel/element_map.dart';
import 'package:compiler/src/kernel/kernel_backend_strategy.dart';
import 'package:compiler/src/kernel/kernel_strategy.dart';
-import 'package:compiler/src/ssa/builder.dart' as ast;
import 'package:compiler/src/universe/selector.dart';
import 'package:compiler/src/universe/world_builder.dart';
import 'package:kernel/ast.dart' as ir;
@@ -34,9 +32,7 @@
cacheRtiDataForTesting = true;
asyncTest(() async {
Directory dataDir = new Directory.fromUri(Platform.script.resolve('data'));
- await checkTests(
- dataDir, computeAstRtiMemberNeed, computeKernelRtiMemberNeed,
- computeClassDataFromAst: computeAstRtiClassNeed,
+ await checkTests(dataDir, computeKernelRtiMemberNeed,
computeClassDataFromKernel: computeKernelRtiClassNeed,
options: [],
skipForStrong: [
@@ -52,30 +48,6 @@
});
}
-/// Compute RTI need data for [_member] as a [MemberElement].
-///
-/// Fills [actualMap] with the data.
-void computeAstRtiMemberNeed(
- Compiler compiler, MemberEntity _member, Map<Id, ActualData> actualMap,
- {bool verbose: false}) {
- MemberElement member = _member;
- ResolvedAst resolvedAst = member.resolvedAst;
- compiler.reporter.withCurrentElement(member.implementation, () {
- new RtiMemberNeedAstComputer(
- compiler.reporter, actualMap, resolvedAst, compiler)
- .run();
- });
-}
-
-/// Compute RTI need data for [cls] from the old frontend.
-///
-/// Fills [actualMap] with the data.
-void computeAstRtiClassNeed(
- Compiler compiler, ClassEntity cls, Map<Id, ActualData> actualMap,
- {bool verbose: false}) {
- new RtiClassNeedAstComputer(compiler, actualMap).computeClassValue(cls);
-}
-
class Tags {
static const String needsTypeArguments = 'needsArgs';
static const String needsSignature = 'needsSignature';
@@ -259,70 +231,6 @@
}
}
-abstract class AstMixin implements ComputeValueMixin<ast.Node> {
- @override
- ClassEntity getFrontendClass(ClassEntity cls) {
- return cls;
- }
-
- @override
- MemberEntity getFrontendMember(MemberEntity member) {
- return member;
- }
-
- @override
- Local getFrontendClosure(MemberEntity member) {
- if (member is SynthesizedCallMethodElementX) return member.expression;
- return null;
- }
-}
-
-class RtiClassNeedAstComputer extends DataRegistry
- with ComputeValueMixin<ast.Node>, AstMixin {
- final Compiler compiler;
- final Map<Id, ActualData> actualMap;
-
- RtiClassNeedAstComputer(this.compiler, this.actualMap);
-
- DiagnosticReporter get reporter => compiler.reporter;
-
- void computeClassValue(covariant ClassElement cls) {
- Id id = new ClassId(cls.name);
- registerValue(cls.sourcePosition, id, getClassValue(cls), cls);
- }
-}
-
-/// AST visitor for computing inlining data for a member.
-class RtiMemberNeedAstComputer extends AstDataExtractor
- with ComputeValueMixin<ast.Node>, AstMixin {
- final Compiler compiler;
-
- RtiMemberNeedAstComputer(DiagnosticReporter reporter,
- Map<Id, ActualData> actualMap, ResolvedAst resolvedAst, this.compiler)
- : super(reporter, actualMap, resolvedAst);
-
- @override
- String computeElementValue(Id id, AstElement element) {
- if (element.isParameter) {
- return null;
- } else if (element.isLocal && element.isFunction) {
- LocalFunctionElement localFunction = element;
- return getMemberValue(localFunction.callMethod);
- } else {
- MemberElement member = element.declaration;
- return getMemberValue(member);
- }
- }
-
- @override
- String computeNodeValue(Id id, ast.Node node, [AstElement element]) {
- if (element != null && element.isLocal && element.isFunction) {
- return computeElementValue(id, element);
- }
- return null;
- }
-}
-
/// Compute RTI need data for [member] from the new frontend.
///
/// Fills [actualMap] with the data.
diff --git a/tests/compiler/dart2js/rti/show.dart b/tests/compiler/dart2js/rti/show.dart
index f4ab741..6c0ff7f 100644
--- a/tests/compiler/dart2js/rti/show.dart
+++ b/tests/compiler/dart2js/rti/show.dart
@@ -18,23 +18,16 @@
argParser.addFlag('emission');
ArgResults results = argParser.parse(args);
- ComputeMemberDataFunction computeAstData;
ComputeMemberDataFunction computeKernelData;
- ComputeClassDataFunction computeAstClassData;
ComputeClassDataFunction computeKernelClassData;
if (results['emission']) {
- computeAstData = computeAstRtiMemberEmission;
computeKernelData = computeKernelRtiMemberEmission;
- computeAstClassData = computeAstRtiClassEmission;
computeKernelClassData = computeKernelRtiClassEmission;
} else {
- computeAstData = computeAstRtiMemberNeed;
computeKernelData = computeKernelRtiMemberNeed;
- computeAstClassData = computeAstRtiClassNeed;
computeKernelClassData = computeKernelRtiClassNeed;
}
- await show(results, computeAstData, computeKernelData,
- computeAstClassData: computeAstClassData,
+ await show(results, computeKernelData,
computeKernelClassData: computeKernelClassData);
}
diff --git a/tests/compiler/dart2js/sourcemaps/d2js_validity_test.dart b/tests/compiler/dart2js/sourcemaps/d2js_validity_test.dart
index 53e0c75..f724936 100644
--- a/tests/compiler/dart2js/sourcemaps/d2js_validity_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/d2js_validity_test.dart
@@ -21,7 +21,6 @@
mainFile,
'-o${tmpDir.path}/out.js',
'--library-root=sdk',
- '--use-old-frontend'
]);
return result.then((CompilationResult result) {
CompilerImpl compiler = result.compiler;
diff --git a/tests/compiler/dart2js/sourcemaps/deferred_d2js_validity_test.dart b/tests/compiler/dart2js/sourcemaps/deferred_d2js_validity_test.dart
index ac03ca1..321719b 100644
--- a/tests/compiler/dart2js/sourcemaps/deferred_d2js_validity_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/deferred_d2js_validity_test.dart
@@ -20,7 +20,6 @@
file,
'-o${tmpDir.path}/out.js',
'--library-root=sdk',
- '--use-old-frontend'
]);
return result.then((CompilationResult result) {
CompilerImpl compiler = result.compiler;
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/null_instance_field.dart b/tests/compiler/dart2js/sourcemaps/stacktrace/null_instance_field.dart
index 8739e8f..a909569 100644
--- a/tests/compiler/dart2js/sourcemaps/stacktrace/null_instance_field.dart
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace/null_instance_field.dart
@@ -10,7 +10,7 @@
@NoInline()
test(c) {
- /*ast.2:test*/ c. /*kernel.2:test*/ field.method();
+ c. /*2:test*/ field.method();
}
class Class {
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/null_interceptor_field.dart b/tests/compiler/dart2js/sourcemaps/stacktrace/null_interceptor_field.dart
index 8f35b5f..011af16 100644
--- a/tests/compiler/dart2js/sourcemaps/stacktrace/null_interceptor_field.dart
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace/null_interceptor_field.dart
@@ -13,8 +13,7 @@
confuse([]).length;
confuse(new MyType()).length;
// TODO(johnniwinther): Intercepted access should point to 'length':
- /*ast.1:main*/ confuse(null)
- . /*kernel.1:main*/ length; // called through the interceptor
+ confuse(null). /*1:main*/ length; // called through the interceptor
}
@NoInline()
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_async.dart b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_async.dart
index b4ffec3..0ca8e55 100644
--- a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_async.dart
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_async.dart
@@ -10,6 +10,6 @@
}
@NoInline()
-test() async /*2:test*/ {
- /*3:test*/ throw '>ExceptionMarker<';
+test() async /*2:test*/ /*kernel.3:test*/ {
+ /*4:test*/ throw '>ExceptionMarker<';
}
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_awaited_async.dart b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_awaited_async.dart
index 424a063..cf570ba 100644
--- a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_awaited_async.dart
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_awaited_async.dart
@@ -10,12 +10,12 @@
}
@NoInline()
-test1() async /*2:test1*/ {
+test1() async /*3:test1*/ /*kernel.4:test1*/ {
// This call is on the stack when the error is thrown.
- await /*3:test1*/ test2();
+ await /*5:test1*/ test2();
}
@NoInline()
-test2() async /*4:test2*/ {
- /*5:test2*/ throw '>ExceptionMarker<';
+test2() async /*7:test2*/ /*kernel.8:test2*/ {
+ /*9:test2*/ throw '>ExceptionMarker<';
}
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_constructor_from_async.dart b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_constructor_from_async.dart
index 50035b4..a12eaa6 100644
--- a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_constructor_from_async.dart
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_constructor_from_async.dart
@@ -8,16 +8,16 @@
/*1:main*/ test();
}
-test() async /*ast.2:test*/ {
+test() async {
// TODO(johnniwinther): Investigate why kernel doesn't point to the body
// start brace.
// ignore: UNUSED_LOCAL_VARIABLE
- var /*kernel.2:test*/ c = new /*3:test*/ Class();
+ var /*2:test*/ /*3:test*/ c = new /*4:test*/ Class();
}
class Class {
@NoInline()
- /*4:Class*/ Class() {
- /*5:Class*/ throw '>ExceptionMarker<';
+ /*5:Class*/ Class() {
+ /*6:Class*/ throw '>ExceptionMarker<';
}
}
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_top_level_method_from_async.dart b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_top_level_method_from_async.dart
index 120b60c..eb5d5f0 100644
--- a/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_top_level_method_from_async.dart
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace/sync_throw_in_top_level_method_from_async.dart
@@ -9,11 +9,11 @@
}
@NoInline()
-test1() async /*2:test1*/ {
- /*3:test1*/ test2();
+test1() async /*2:test1*/ /*kernel.3:test1*/ {
+ /*9:test1*/ test2();
}
@NoInline()
test2() {
- /*4:test2*/ throw '>ExceptionMarker<';
+ /*10:test2*/ throw '>ExceptionMarker<';
}
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_async.dart b/tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_async.dart
index 7ca81d3..dba9a31 100644
--- a/tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_async.dart
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace/throw_in_async.dart
@@ -12,5 +12,5 @@
@NoInline()
test() async {
await null;
- /*1:test*/ throw '>ExceptionMarker<';
+ /*9:test*/ throw '>ExceptionMarker<';
}
diff --git a/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart b/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
index 1a815d9..d9ad5e6 100644
--- a/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/stacktrace_test.dart
@@ -8,7 +8,6 @@
import 'package:args/args.dart';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/compiler_new.dart';
-import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/dart2js.dart' as entry;
import 'package:sourcemap_testing/src/stacktrace_helper.dart';
@@ -46,16 +45,12 @@
});
}
-const String astMarker = 'ast.';
const String kernelMarker = 'kernel.';
Future testAnnotatedCode(String code,
{bool printJs: false, bool writeJs: false, bool verbose: false}) async {
- Test test = processTestCode(code, [astMarker, kernelMarker]);
+ Test test = processTestCode(code, [kernelMarker]);
print(test.code);
- print('---from ast---------------------------------------------------------');
- await runTest(test, astMarker,
- printJs: printJs, writeJs: writeJs, verbose: verbose);
print('---from kernel------------------------------------------------------');
await runTest(test, kernelMarker,
printJs: printJs, writeJs: writeJs, verbose: verbose);
@@ -79,12 +74,8 @@
'-o$output',
'--library-root=sdk',
'--packages=${Platform.packageConfig}',
- Flags.useNewSourceInfo,
input,
]..addAll(options);
- if (config == astMarker) {
- arguments.add(Flags.useOldFrontend);
- }
print("Compiling dart2js ${arguments.join(' ')}");
CompilationResult compilationResult = await entry.internalMain(arguments);
return compilationResult.isSuccess;
@@ -129,9 +120,6 @@
const LineException('_AsyncRun._scheduleImmediateJsOverride.internalCallback',
'async_patch.dart'),
const LineException('invokeClosure.<anonymous function>', 'js_helper.dart'),
- const LineException('_IsolateContext.eval', 'isolate_helper.dart'),
- const LineException('_callInIsolate', 'isolate_helper.dart'),
- const LineException('startRootIsolate', 'isolate_helper.dart'),
const LineException('invokeClosure', 'js_helper.dart'),
const LineException('convertDartClosureToJS', 'js_helper.dart'),
];
diff --git a/tests/compiler/dart2js/sourcemaps/stepping_test.dart b/tests/compiler/dart2js/sourcemaps/stepping_test.dart
index 4738bbc..c8610e0 100644
--- a/tests/compiler/dart2js/sourcemaps/stepping_test.dart
+++ b/tests/compiler/dart2js/sourcemaps/stepping_test.dart
@@ -44,7 +44,6 @@
});
}
-const String astMarker = 'ast.';
const String kernelMarker = 'kernel.';
Future testAnnotatedCode(String code,
@@ -53,9 +52,7 @@
new AnnotatedCode.fromText(code, commentStart, commentEnd);
print(annotatedCode.sourceCode);
Map<String, AnnotatedCode> split =
- splitByPrefixes(annotatedCode, [astMarker, kernelMarker]);
- print('---from ast---------------------------------------------------------');
- await runTest(split[astMarker], astMarker, debug: debug, verbose: verbose);
+ splitByPrefixes(annotatedCode, [kernelMarker]);
print('---from kernel------------------------------------------------------');
await runTest(split[kernelMarker], kernelMarker,
debug: debug, verbose: verbose);
@@ -75,10 +72,6 @@
inputFile,
Flags.disableInlining,
];
- if (config == astMarker) {
- arguments.add(Flags.useOldFrontend);
- arguments.add(Flags.useNewSourceInfo);
- }
CompilationResult compilationResult = await entry.internalMain(arguments);
Expect.isTrue(compilationResult.isSuccess);
List<String> scriptD8Command = [
diff --git a/tests/compiler/dart2js/sourcemaps/tools/source_mapping_tester.dart b/tests/compiler/dart2js/sourcemaps/tools/source_mapping_tester.dart
index 781b46b..4eaf294 100644
--- a/tests/compiler/dart2js/sourcemaps/tools/source_mapping_tester.dart
+++ b/tests/compiler/dart2js/sourcemaps/tools/source_mapping_tester.dart
@@ -131,14 +131,7 @@
}
const Map<String, List<String>> TEST_CONFIGURATIONS = const {
- 'ast': const [
- '--use-new-source-info',
- '--use-old-frontend',
- ],
'kernel': const [],
- 'old': const [
- '--use-old-frontend',
- ],
};
final Map<String, Uri> TEST_FILES = _computeTestFiles();
diff --git a/tests/compiler/dart2js/type_test_helper.dart b/tests/compiler/dart2js/type_test_helper.dart
index 9705244..36496c2 100644
--- a/tests/compiler/dart2js/type_test_helper.dart
+++ b/tests/compiler/dart2js/type_test_helper.dart
@@ -16,9 +16,9 @@
import 'package:compiler/src/elements/elements.dart'
show ClassElement, LibraryElement, TypedefElement;
import 'package:compiler/src/kernel/kernel_strategy.dart';
+import 'package:compiler/src/universe/world_builder.dart';
import 'package:compiler/src/world.dart' show ClosedWorld;
import 'memory_compiler.dart' as memory;
-import 'kernel/compiler_helper.dart' as dill;
DartType instantiate(Entity element, List<DartType> arguments) {
if (element is ClassElement) {
@@ -38,8 +38,7 @@
Resolution get resolution => compiler.resolution;
static Future<TypeEnvironment> create(String source,
- {bool useDillCompiler: false,
- bool expectNoErrors: false,
+ {bool expectNoErrors: false,
bool expectNoWarningsOrErrors: false,
bool stopAfterTypeInference: false,
String mainSource,
@@ -65,17 +64,20 @@
memory.DiagnosticCollector collector;
collector = new memory.DiagnosticCollector();
uri = Uri.parse('memory:main.dart');
- compiler = await dill.compileWithDill(
+ memory.CompilationResult result = await memory.runCompiler(
entryPoint: uri,
memorySourceFiles: {'main.dart': source},
- diagnosticHandler: collector,
options: stopAfterTypeInference
? ([Flags.disableTypeInference]..addAll(options))
: ([Flags.disableTypeInference, Flags.analyzeAll, Flags.analyzeOnly]
..addAll(options)),
- beforeRun: (Compiler compiler) {
+ diagnosticHandler: collector,
+ beforeRun: (compiler) {
+ ElementResolutionWorldBuilder.useInstantiationMap = true;
+ compiler.impactCacheDeleter.retainCachesForTesting = true;
compiler.stopAfterTypeInference = stopAfterTypeInference;
});
+ compiler = result.compiler;
if (expectNoErrors || expectNoWarningsOrErrors) {
var errors = collector.errors;
Expect.isTrue(errors.isEmpty, 'Unexpected errors: ${errors}');
diff --git a/tests/compiler/dart2js_extra/dart2js_extra.status b/tests/compiler/dart2js_extra/dart2js_extra.status
index 5dce5f5..f60ebac 100644
--- a/tests/compiler/dart2js_extra/dart2js_extra.status
+++ b/tests/compiler/dart2js_extra/dart2js_extra.status
@@ -43,7 +43,7 @@
[ $compiler == dart2js && $runtime == d8 && $fasta ]
deferred_fail_and_retry_test: RuntimeError # Uses XHR in dart:html
-deferred_fail_and_retry_worker_test: Fail # Uses XHR in dart:html
+deferred_with_csp_nonce_test: RuntimeError # Uses dart:html
unconditional_dartio_import_test: RuntimeError # Uses dart:io
[ $compiler == dart2js && $runtime == ff && $system == windows ]
@@ -52,9 +52,6 @@
[ $compiler == dart2js && $runtime == none ]
*: Fail, Pass # TODO(ahe): Triage these tests.
-[ $compiler == dart2js && $runtime == safari ]
-deferred_fail_and_retry_worker_test: Timeout # Issue 22106
-
[ $compiler == dart2js && $checked ]
variable_type_test/01: Fail, OK
variable_type_test/03: Fail, OK
@@ -77,7 +74,6 @@
[ $compiler == dart2js && $csp ]
deferred_custom_loader_test: SkipByDesign # Issue 25683
deferred_fail_and_retry_test: SkipByDesign # Uses eval to simulate failed loading.
-deferred_fail_and_retry_worker_test: SkipByDesign # Uses eval to simulate failed loading.
js_interop_optional_arg_test: RuntimeError # Issue 31082
js_interop_test: RuntimeError # Issue 31082
@@ -194,6 +190,9 @@
typevariable_typedef_test: Fail, OK # Tests expected output of Type.toString().
[ $compiler == dart2js && !$strong ]
+extract_type_arguments_1_test: RuntimeError # Uses function type variables
+extract_type_arguments_2_test: RuntimeError # Uses function type variables
+extract_type_arguments_3_test: RuntimeError # Uses function type variables
generic_method_dynamic_is_test: RuntimeError # Test against function type variables is only supported in strong mode.
generic_method_dynamic_type_test: SkipByDesign # Requires strong mode support for function type variables.
generic_method_static_is_test: RuntimeError # Test against function type variables is only supported in strong mode.
diff --git a/tests/compiler/dart2js_extra/deferred_fail_and_retry_worker_test.dart b/tests/compiler/dart2js_extra/deferred_fail_and_retry_worker_test.dart
deleted file mode 100644
index dffa739..0000000
--- a/tests/compiler/dart2js_extra/deferred_fail_and_retry_worker_test.dart
+++ /dev/null
@@ -1,60 +0,0 @@
-// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-// Test that when a deferred import from a worker fails to load, it is possible
-// to retry.
-
-import "deferred_fail_and_retry_lib.dart" deferred as lib;
-import "package:expect/expect.dart";
-import "package:async_helper/async_helper.dart";
-import "dart:isolate";
-import "dart:js" as js;
-
-void test(SendPort sendPort) {
- // Patch XMLHttpRequest to fail on first load.
- js.context.callMethod("eval", [
- """
- oldXMLHttpRequest = XMLHttpRequest;
- XMLHttpRequest = function() {
- XMLHttpRequest = oldXMLHttpRequest;
- var instance = new XMLHttpRequest();
- this.addEventListener = function(x, y, z) {
- instance.addEventListener(x, y, z);
- }
- this.send = function() {
- instance.send();
- }
- this.open = function(x, uri) {
- instance.open(x, "non_existing.js");
- }
- }
- """
- ]);
- lib.loadLibrary().then((_) {
- sendPort.send("Library should not have loaded");
- }, onError: (error) {
- sendPort.send("failed");
- lib.loadLibrary().then((_) {
- sendPort.send(lib.foo());
- }, onError: (error) {
- sendPort.send("Library should have loaded this time $error");
- });
- });
-}
-
-main() {
- ReceivePort receivePort = new ReceivePort();
- asyncStart();
- bool receivedFailed = false;
- receivePort.listen((message) {
- if (!receivedFailed) {
- Expect.equals("failed", message);
- receivedFailed = true;
- } else {
- Expect.equals("loaded", message);
- asyncEnd();
- }
- });
- Isolate.spawn(test, receivePort.sendPort);
-}
diff --git a/tests/compiler/dart2js_extra/deferred_with_csp_nonce_lib.dart b/tests/compiler/dart2js_extra/deferred_with_csp_nonce_lib.dart
new file mode 100644
index 0000000..48fbce6
--- /dev/null
+++ b/tests/compiler/dart2js_extra/deferred_with_csp_nonce_lib.dart
@@ -0,0 +1,7 @@
+// Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+foo() {
+ return "loaded";
+}
diff --git a/tests/compiler/dart2js_extra/deferred_with_csp_nonce_test.dart b/tests/compiler/dart2js_extra/deferred_with_csp_nonce_test.dart
new file mode 100644
index 0000000..90d6acb
--- /dev/null
+++ b/tests/compiler/dart2js_extra/deferred_with_csp_nonce_test.dart
@@ -0,0 +1,36 @@
+// Copyright (c) 2018, 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.
+
+// Test that code loaded via deferred imports uses the same nonce value as the
+// main page.
+
+import "deferred_with_csp_nonce_lib.dart" deferred as lib;
+import "package:expect/expect.dart";
+import "package:async_helper/async_helper.dart";
+import "dart:html";
+
+main() {
+ asyncStart();
+
+ var scripts = document
+ .querySelectorAll<ScriptElement>('script')
+ .where((s) => s.src.contains("generated_compilations"))
+ .toList();
+ Expect.equals(1, scripts.length);
+ Expect.equals('', scripts.first.nonce ?? '');
+ scripts.first.nonce = "an-example-nonce-string";
+
+ lib.loadLibrary().then((_) {
+ print(lib.foo());
+ var scripts = document
+ .querySelectorAll<ScriptElement>('script')
+ .where((s) => s.src.contains("generated_compilations"))
+ .toList();
+ Expect.equals(2, scripts.length);
+ for (var script in scripts) {
+ Expect.equals("an-example-nonce-string", script.nonce);
+ }
+ asyncEnd();
+ });
+}
diff --git a/tests/compiler/dart2js_extra/extract_type_arguments_1_test.dart b/tests/compiler/dart2js_extra/extract_type_arguments_1_test.dart
new file mode 100644
index 0000000..74d5081
--- /dev/null
+++ b/tests/compiler/dart2js_extra/extract_type_arguments_1_test.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2018, 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.
+// dart2jsOptions=--omit-implicit-checks
+
+import 'package:expect/expect.dart';
+import 'dart:_internal' show extractTypeArguments;
+
+class C<T> {}
+
+main() {
+ test(new C<int>(), int);
+ test(new C<String>(), String);
+}
+
+test(dynamic a, T) {
+ Expect.equals(T, extractTypeArguments<C>(a, <T>() => T));
+}
diff --git a/tests/compiler/dart2js_extra/extract_type_arguments_2_test.dart b/tests/compiler/dart2js_extra/extract_type_arguments_2_test.dart
new file mode 100644
index 0000000..bf8c2f9
--- /dev/null
+++ b/tests/compiler/dart2js_extra/extract_type_arguments_2_test.dart
@@ -0,0 +1,20 @@
+// Copyright (c) 2018, 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.
+// dart2jsOptions=--omit-implicit-checks
+
+import 'package:expect/expect.dart';
+import 'dart:_internal' show extractTypeArguments;
+
+class CC<A, B, C, D, E> {}
+
+class X {}
+
+main() {
+ test(new CC<X, X, X, X, int>(), int);
+ test(new CC<X, X, X, X, String>(), String);
+}
+
+test(dynamic a, T) {
+ Expect.equals(T, extractTypeArguments<CC>(a, <_1, _2, _3, _4, T>() => T));
+}
diff --git a/tests/compiler/dart2js_extra/extract_type_arguments_3_test.dart b/tests/compiler/dart2js_extra/extract_type_arguments_3_test.dart
new file mode 100644
index 0000000..10fa04a
--- /dev/null
+++ b/tests/compiler/dart2js_extra/extract_type_arguments_3_test.dart
@@ -0,0 +1,11 @@
+// Copyright (c) 2018, 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.
+// dart2jsOptions=--omit-implicit-checks
+
+import 'package:expect/expect.dart';
+import 'dart:_internal' show extractTypeArguments;
+
+main() {
+ Expect.equals(int, extractTypeArguments<List>('hello'.codeUnits, <T>() => T));
+}
diff --git a/tests/compiler/dart2js_native/compute_this_script_test.dart b/tests/compiler/dart2js_native/compute_this_script_test.dart
index e8316e8..2cdfb52 100644
--- a/tests/compiler/dart2js_native/compute_this_script_test.dart
+++ b/tests/compiler/dart2js_native/compute_this_script_test.dart
@@ -5,15 +5,9 @@
// Test of IsolateNatives.computeThisScript().
import 'dart:_isolate_helper';
-// The isolate helper library is not correctly set up if the dart:isolate
-// library hasn't been loaded.
-import 'dart:isolate';
main() {
- // Need to use the isolate-library so dart2js correctly initializes the
- // library.
- Capability cab = new Capability();
- String script = IsolateNatives.computeThisScript();
+ String script = computeThisScript();
// This is somewhat brittle and relies on an implementation detail
// of our test runner, but I can think of no other way to test this.
diff --git a/tests/compiler/dart2js_native/dart2js_native.status b/tests/compiler/dart2js_native/dart2js_native.status
index d3f454e..45d07d3 100644
--- a/tests/compiler/dart2js_native/dart2js_native.status
+++ b/tests/compiler/dart2js_native/dart2js_native.status
@@ -14,9 +14,6 @@
[ $browser ]
*: Skip
-[ $compiler == dart2js && $runtime == d8 && $system == windows && !$fasta ]
-compute_this_script_test: Skip # Issue 17458
-
[ $compiler == dart2js && $fasta ]
native_library_same_name_used_frog_test: CompileTimeError
subclassing_constructor_1_test: RuntimeError
@@ -24,8 +21,5 @@
subclassing_super_field_1_test: RuntimeError
subclassing_super_field_2_test: RuntimeError
-[ $compiler == dart2js && $fasta && $host_checked ]
-compute_this_script_test: Crash # 'file:*/pkg/compiler/lib/src/ssa/types.dart': Failed assertion: line 63 pos 12: '!result.isEmpty': is not true.
-
[ $compiler == dart2js && $minified ]
optimization_hints_test: RuntimeError, OK # Test relies on unminified names.
diff --git a/tests/compiler/dart2js_native/internal_library_test.dart b/tests/compiler/dart2js_native/internal_library_test.dart
index 0bf6c4f..7f81f6c 100644
--- a/tests/compiler/dart2js_native/internal_library_test.dart
+++ b/tests/compiler/dart2js_native/internal_library_test.dart
@@ -5,8 +5,8 @@
// Test that a private library can be accessed from libraries in this special
// test folder.
-import 'dart:_isolate_helper';
+import 'dart:_js_helper';
void main() {
- print(startRootIsolate);
+ print(loadDeferredLibrary);
}
diff --git a/tests/corelib/corelib.status b/tests/corelib/corelib.status
index 99a89af..443fca5 100644
--- a/tests/corelib/corelib.status
+++ b/tests/corelib/corelib.status
@@ -93,6 +93,9 @@
list_as_map_test: Pass, Slow # TODO(kasperl): Please triage.
string_trimlr_test/unicode63: RuntimeError # Uses Unicode 6.2.0 or earlier.
+[ $compiler == dart2js && $runtime != d8 ]
+main_test: RuntimeError
+
[ $compiler == dart2js && $runtime == drt ]
string_trimlr_test/unicode63: RuntimeError # Uses Unicode 6.2.0 or earlier.
diff --git a/tests/corelib_2/corelib_2.status b/tests/corelib_2/corelib_2.status
index 485d97c..87b316b 100644
--- a/tests/corelib_2/corelib_2.status
+++ b/tests/corelib_2/corelib_2.status
@@ -222,7 +222,6 @@
[ $compiler == dart2js && $fasta ]
int_from_environment_test: Pass # Issue 31762
int_parse_radix_test/none: Pass # Issue 31762
-map_entry_test: RuntimeError
[ $compiler == dart2js && $fasta && $host_checked && $strong ]
cast_test: RuntimeError
diff --git a/tests/corelib_2/growable_list_test.dart b/tests/corelib_2/growable_list_test.dart
index f6787ff..ebe04bc 100644
--- a/tests/corelib_2/growable_list_test.dart
+++ b/tests/corelib_2/growable_list_test.dart
@@ -37,7 +37,9 @@
// Avoid warnings because we don't actually implement Set.
noSuchMethod(i) => super.noSuchMethod(i);
Set<R> cast<R>() => throw "not used by test";
- Set<R> retype<R>() => throw "not used by test";
+
+ @Deprecated("Use cast instead.")
+ Set<R> retype<R>() => cast<R>();
}
class CallbackIterator implements Iterator<int> {
diff --git a/tests/html/html.status b/tests/html/html.status
index 632145d..972a95a 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -26,6 +26,8 @@
window_nosuchmethod_test: StaticWarning
[ $compiler == dart2js ]
+async_spawnuri_test: SkipByDesign
+async_test: SkipByDesign
custom/document_register_type_extensions_test/construction: Pass, Timeout # Roll 50 failure
custom/document_register_type_extensions_test/registration: Pass, Timeout # Roll 50 failure
custom/entered_left_view_test/shadow_dom: Pass, Timeout # Roll 50 failure
@@ -40,10 +42,12 @@
indexeddb_4_test: Pass, Timeout # Roll 50 failure
indexeddb_5_test: Pass, Timeout # Roll 50 failure
input_element_test/attributes: Fail # Issue 21555
+isolates_test: SkipByDesign
js_typed_interop_default_arg_test/default_value: MissingCompileTimeError # Issue #25759
js_typed_interop_side_cast_exp_test: Pass, RuntimeError # Roll 50 failure
mirrors_js_typed_interop_test: Pass, Slow
svgelement_test/PathElement: Pass, RuntimeError # Roll 50 failure
+worker_api_test: SkipByDesign
wrapping_collections_test: SkipByDesign # Testing an issue that is only relevant to Dartium
xhr_test/xhr: Pass, RuntimeError # Roll 50 failure
@@ -150,7 +154,6 @@
speechrecognition_test/supported: Fail # Safari Feature support statuses - All changes should be accompanied by platform support annotation changes.
touchevent_test/supported: Fail # Safari does not support TouchEvents
webgl_1_test: Pass, Fail # Issue 8219
-worker_api_test: Skip # Issue 13221
# The html tests were moved to lib_2/html, and there they should be made strong
# mode compliant. There's no sense in running the old versions here.
@@ -194,7 +197,6 @@
[ $compiler == dart2js && $runtime == d8 && $fasta ]
async_spawnuri_test: RuntimeError
-async_test: RuntimeError
audiobuffersourcenode_test: RuntimeError
audiocontext_test: RuntimeError
audioelement_test: RuntimeError
diff --git a/tests/isolate/isolate.status b/tests/isolate/isolate.status
index 753bf0c..d7fd1a0 100644
--- a/tests/isolate/isolate.status
+++ b/tests/isolate/isolate.status
@@ -6,26 +6,7 @@
browser/typed_data_message_test: StaticWarning
[ $compiler == dart2js ]
-browser/issue_12474_test: CompileTimeError # Issue 22529
-enum_const_test/02: RuntimeError # Issue 21817
-error_at_spawnuri_test: SkipByDesign # Test uses a ".dart" URI.
-error_exit_at_spawnuri_test: SkipByDesign # Test uses a ".dart" URI.
-exit_at_spawnuri_test: SkipByDesign # Test uses a ".dart" URI.
-function_send1_test: SkipByDesign # Test uses a ".dart" URI.
-issue_21398_parent_isolate1_test: SkipByDesign # Test uses a ".dart" URI.
-issue_21398_parent_isolate2_test: SkipByDesign # Test uses a ".dart" URI.
-issue_21398_parent_isolate_test: SkipByDesign # Test uses a ".dart" URI.
-issue_24243_parent_isolate_test: SkipByDesign # Test uses a ".dart" URI.
-kill_self_synchronously_test: SkipByDesign # Unsupported operation: Platform._resolvedExecutable
-message3_test/constInstance: RuntimeError # Issue 21817
-message3_test/constList: RuntimeError # Issue 21817
-message3_test/constList_identical: RuntimeError # Issue 21817
-message3_test/constMap: RuntimeError # Issue 21817
-non_fatal_exception_in_timer_callback_test: Skip # Issue 23876
-spawn_uri_exported_main_test: SkipByDesign # Test uses a ".dart" URI.
-spawn_uri_nested_vm_test: SkipByDesign # Test uses a ".dart" URI.
-spawn_uri_vm_test: SkipByDesign # Test uses a ".dart" URI.
-stacktrace_message_test: RuntimeError # Fails to send stacktrace object.
+*: SkipByDesign
[ $compiler == fasta ]
browser/compute_this_script_browser_test: CompileTimeError # TODO(ahe): Support dart:html in Fasta.
@@ -61,91 +42,6 @@
[ $compiler == dart2analyzer && $strong ]
*: Skip # Issue 28649
-[ $compiler == dart2js && $runtime == chrome ]
-function_send_test: Skip # Crashes Chrome 62: https://bugs.chromium.org/p/chromium/issues/detail?id=775506
-
-[ $compiler == dart2js && $runtime == chromeOnAndroid ]
-isolate_stress_test: Pass, Slow # TODO(kasperl): Please triage.
-mandel_isolate_test: Pass, Timeout # TODO(kasperl): Please triage.
-unresolved_ports_test: Pass, Timeout # Issue 15610
-
-[ $compiler == dart2js && $runtime == d8 && $fasta ]
-isolate_stress_test: RuntimeError
-
-[ $compiler == dart2js && $runtime != d8 ]
-error_at_spawn_test: Skip # Issue 23876
-error_exit_at_spawn_test: Skip # Issue 23876
-exit_at_spawn_test: Skip # Issue 23876
-message4_test: Skip # Issue 30247
-
-[ $compiler == dart2js && $runtime == jsshell ]
-pause_test: Fail, OK # non-zero timer not supported.
-timer_isolate_test: Fail, OK # Needs Timer to run.
-
-[ $compiler == dart2js && $runtime == safari ]
-cross_isolate_message_test: Skip # Issue 12627
-message_test: Skip # Issue 12627
-
-[ $compiler == dart2js && !$browser && $fast_startup ]
-isolate_current_test: Fail # please triage
-
-[ $compiler == dart2js && $fast_startup ]
-browser/compute_this_script_browser_test: Fail # mirrors not supported
-browser/typed_data_message_test: Fail # mirrors not supported
-count_test: Fail # mirrors not supported
-cross_isolate_message_test: Fail # mirrors not supported
-illegal_msg_function_test: Fail # mirrors not supported
-illegal_msg_mirror_test: Fail # mirrors not supported
-isolate_complex_messages_test: Fail # mirrors not supported
-mandel_isolate_test: Fail # mirrors not supported
-message2_test: Fail # mirrors not supported
-message_test: Fail # mirrors not supported
-mint_maker_test: Fail # mirrors not supported
-nested_spawn2_test: Fail # mirrors not supported
-nested_spawn_test: Fail # mirrors not supported
-raw_port_test: Fail # mirrors not supported
-remote_unittest_helper: Fail # mirrors not supported
-request_reply_test: Fail # mirrors not supported
-spawn_function_custom_class_test: Fail # mirrors not supported
-spawn_function_test: Fail # mirrors not supported
-stacktrace_message_test: Fail # mirrors not supported
-static_function_test: Fail # mirrors not supported
-unresolved_ports_test: Fail # mirrors not supported
-
-[ $compiler == dart2js && $fasta ]
-browser/compute_this_script_browser_test: RuntimeError # mirrors not supported
-browser/typed_data_message_test: RuntimeError # mirrors not supported
-compile_time_error_test/01: Crash
-count_test: RuntimeError # mirrors not supported
-cross_isolate_message_test: RuntimeError # mirrors not supported
-illegal_msg_function_test: RuntimeError # mirrors not supported
-illegal_msg_mirror_test: RuntimeError # mirrors not supported
-isolate_complex_messages_test: RuntimeError # mirrors not supported
-mandel_isolate_test: RuntimeError # mirrors not supported
-message2_test: RuntimeError # mirrors not supported
-message_test: RuntimeError # mirrors not supported
-mint_maker_test: RuntimeError # mirrors not supported
-nested_spawn2_test: RuntimeError # mirrors not supported
-nested_spawn_test: RuntimeError # mirrors not supported
-raw_port_test: RuntimeError # mirrors not supported
-remote_unittest_helper: RuntimeError # mirrors not supported
-request_reply_test: RuntimeError # mirrors not supported
-spawn_function_custom_class_test: RuntimeError # mirrors not supported
-spawn_function_test: RuntimeError # mirrors not supported
-stacktrace_message_test: RuntimeError # mirrors not supported
-static_function_test: RuntimeError # mirrors not supported
-unresolved_ports_test: RuntimeError # mirrors not supported
-
-[ $compiler == dart2js && $fasta && $host_checked ]
-deferred_in_isolate2_test: Crash
-
-[ $compiler == dart2js && $jscl ]
-browser/*: SkipByDesign # Browser specific tests
-spawn_uri_test: SkipByDesign # Loading another file is not supported in JS shell
-
-[ $compiler == dart2js && ($runtime == chrome || $runtime == chromeOnAndroid || $runtime == drt || $runtime == ff || $runtime == safari) ]
-isolate_stress_test: Pass, Slow # Issue 10697
-
[ $compiler == none && $runtime == vm && $system == fuchsia ]
*: Skip # Not yet triaged.
diff --git a/tests/language/language_dart2js.status b/tests/language/language_dart2js.status
index 15b1905..1f1f0d4 100644
--- a/tests/language/language_dart2js.status
+++ b/tests/language/language_dart2js.status
@@ -14,6 +14,7 @@
full_stacktrace2_test: Pass, RuntimeError # Issue 12698
full_stacktrace3_test: Pass, RuntimeError # Issue 12698
library_env_test/has_no_html_support: RuntimeError, OK
+main_test/03: MissingRuntimeError # dart:isolate not supported
vm/*: Skip # Issue 12699
[ $arch == ia32 && $compiler == dart2js && $runtime == d8 ]
@@ -132,9 +133,9 @@
const_init2_test/02: MissingCompileTimeError
deferred_constraints_constants_test/none: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
deferred_constraints_constants_test/reference_after_load: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
+deferred_constraints_type_annotation_test/type_annotation1: Fail # Missing dynamic type error
deferred_constraints_type_annotation_test/type_annotation_generic1: Fail # Missing dynamic type error
deferred_constraints_type_annotation_test/type_annotation_generic4: Fail # Missing dynamic type error
-deferred_constraints_type_annotation_test/type_annotation1: Fail # Missing dynamic type error
factory_redirection_test/08: Fail
factory_redirection_test/09: Fail
factory_redirection_test/10: Fail
diff --git a/tests/language_2/checked_method_error_order_test.dart b/tests/language_2/checked_method_error_order_test.dart
index 508a957..c5370cf 100644
--- a/tests/language_2/checked_method_error_order_test.dart
+++ b/tests/language_2/checked_method_error_order_test.dart
@@ -18,10 +18,13 @@
if (checkedMode) {
dynamic x = 'e';
dynamic y = 3;
- Expect.throws(
- () => new Bar().foo(i: x, a: y),
- (e) =>
- e is TypeError &&
- e.message.toString().contains("is not a subtype of type 'int'"));
+ Expect.throws(() => new Bar().foo(i: x, a: y), (e) {
+ if (e is TypeError) {
+ var m = e.message.toString();
+ return m.contains("is not a subtype of type 'int'") ||
+ m.contains("is not a subtype of expected type 'int'");
+ }
+ return false;
+ });
}
}
diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status
index 4b7d3be..66550b4 100644
--- a/tests/language_2/language_2_dart2js.status
+++ b/tests/language_2/language_2_dart2js.status
@@ -511,17 +511,11 @@
type_variable_scope_test/03: Crash # Internal Error: Unexpected type variable in static context.
[ $compiler == dart2js && !$checked ]
-async_covariant_type_test: RuntimeError # checked / strong mode test
-async_dcall_type_test: RuntimeError # checked / strong mode test
-asyncstar_covariant_type_test: RuntimeError # checked / strong mode test
-asyncstar_dcall_type_test: RuntimeError # checked / strong mode test
covariance_field_test/01: RuntimeError
covariance_field_test/02: RuntimeError
covariance_field_test/03: RuntimeError
covariance_field_test/04: RuntimeError
covariance_field_test/05: RuntimeError
-syncstar_covariant_type_test: RuntimeError # checked / strong mode test
-syncstar_dcall_type_test: RuntimeError # checked / strong mode test
[ $compiler == dart2js && !$checked && !$enable_asserts ]
assertion_test: RuntimeError, OK
@@ -701,7 +695,6 @@
local_function2_test/none: RuntimeError
local_function3_test/none: RuntimeError
local_function_test/none: RuntimeError
-main_test/03: RuntimeError
many_overridden_no_such_method_test: RuntimeError
method_override7_test/00: MissingCompileTimeError
method_override7_test/01: MissingCompileTimeError
@@ -883,7 +876,6 @@
checked_setter2_test: RuntimeError # Issue 31128
checked_setter_test: RuntimeError # Issue 31128
const_dynamic_type_literal_test/03: Pass # but it shouldn't until we fix issue 17207
-extract_type_arguments_test: Crash # Issue 31371
function_propagation_test: RuntimeError
generic_test/01: MissingCompileTimeError # front end does not validate `extends`
instantiate_tearoff_of_call_test: RuntimeError
@@ -1023,7 +1015,6 @@
external_test/20: MissingRuntimeError
external_test/21: CompileTimeError
external_test/24: CompileTimeError
-extract_type_arguments_test: RuntimeError # Issue 31371
f_bounded_quantification4_test: RuntimeError
f_bounded_quantification_test/01: MissingCompileTimeError
f_bounded_quantification_test/02: MissingCompileTimeError
@@ -1057,7 +1048,6 @@
function_subtype_setter0_test: RuntimeError
function_type_alias2_test: RuntimeError
function_type_alias4_test: RuntimeError
-generic_async_star_test: RuntimeError
generic_closure_test/01: RuntimeError
generic_closure_test/none: RuntimeError
generic_function_bounds_test: RuntimeError
@@ -1125,7 +1115,6 @@
local_function2_test/none: RuntimeError
local_function3_test/none: RuntimeError
local_function_test/none: RuntimeError
-main_test/03: RuntimeError
malbounded_instantiation_test/01: MissingCompileTimeError
malbounded_instantiation_test/02: MissingCompileTimeError
malbounded_instantiation_test/03: MissingCompileTimeError
@@ -1576,7 +1565,6 @@
external_test/20: MissingRuntimeError
external_test/21: CompileTimeError
external_test/24: CompileTimeError
-extract_type_arguments_test: RuntimeError # Issue 31371
f_bounded_quantification4_test: RuntimeError # Issue 12605
f_bounded_quantification_test/01: MissingCompileTimeError
f_bounded_quantification_test/02: MissingCompileTimeError
@@ -1610,7 +1598,6 @@
function_subtype_setter0_test: RuntimeError
function_type_alias2_test: RuntimeError
function_type_alias4_test: RuntimeError
-generic_async_star_test: RuntimeError
generic_function_bounds_test: RuntimeError
generic_function_dcall_test: RuntimeError
generic_function_type_as_type_argument_test/01: MissingCompileTimeError
@@ -1677,7 +1664,6 @@
local_function2_test/none: RuntimeError
local_function3_test/none: RuntimeError
local_function_test/none: RuntimeError
-main_test/03: RuntimeError
malbounded_instantiation_test/01: MissingCompileTimeError
malbounded_instantiation_test/02: MissingCompileTimeError
malbounded_instantiation_test/03: MissingCompileTimeError
diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status
index 6dc969f..6c07860 100644
--- a/tests/language_2/language_2_kernel.status
+++ b/tests/language_2/language_2_kernel.status
@@ -58,13 +58,13 @@
abstract_override_adds_optional_args_concrete_test: MissingCompileTimeError # Issue 32014.
additional_interface_adds_optional_args_concrete_subclass_test: MissingCompileTimeError # Issue 32014.
additional_interface_adds_optional_args_concrete_test: MissingCompileTimeError # Issue 32014.
-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
-async_return_types_test/nestedFuture: MissingCompileTimeError
-async_return_types_test/wrongReturnType: MissingCompileTimeError
-bad_override_test/01: MissingCompileTimeError
-bad_override_test/02: MissingCompileTimeError
+async_or_generator_return_type_stacktrace_test/01: MissingCompileTimeError # Issue 33068
+async_or_generator_return_type_stacktrace_test/02: MissingCompileTimeError # Issue 33068
+async_or_generator_return_type_stacktrace_test/03: MissingCompileTimeError # Issue 33068
+async_return_types_test/nestedFuture: MissingCompileTimeError # Issue 33068
+async_return_types_test/wrongReturnType: MissingCompileTimeError # Issue 33068
+bad_override_test/01: MissingCompileTimeError # Issue 32984
+bad_override_test/02: MissingCompileTimeError # Issue 32984
call_non_method_field_test/01: MissingCompileTimeError
call_non_method_field_test/02: MissingCompileTimeError
check_member_static_test/01: MissingCompileTimeError
@@ -83,10 +83,10 @@
constructor_redirect2_negative_test: MissingCompileTimeError
constructor_redirect_test/01: MissingCompileTimeError # Fasta bug: Initializer refers to this.
cyclic_constructor_test/01: MissingCompileTimeError # Fasta bug: Cyclic constructor redirection.
-cyclic_type_variable_test/01: MissingCompileTimeError
-cyclic_type_variable_test/02: MissingCompileTimeError
-cyclic_type_variable_test/03: MissingCompileTimeError
-cyclic_type_variable_test/04: MissingCompileTimeError
+cyclic_type_variable_test/01: MissingCompileTimeError # Issue 32989 (missing cycle check in bounds)
+cyclic_type_variable_test/02: MissingCompileTimeError # Issue 32989 (missing cycle check in bounds)
+cyclic_type_variable_test/03: MissingCompileTimeError # Issue 32989 (missing cycle check in bounds)
+cyclic_type_variable_test/04: MissingCompileTimeError # Issue 32989 (missing cycle check in bounds)
default_factory2_test/01: MissingCompileTimeError
default_factory_test/01: MissingCompileTimeError
deferred_inheritance_constraints_test/extends: MissingCompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 30273.
@@ -132,29 +132,29 @@
mixin_forwarding_constructor4_test/01: MissingCompileTimeError # KernelVM bug: Issue 15101
mixin_forwarding_constructor4_test/02: MissingCompileTimeError # KernelVM bug: Issue 15101
mixin_forwarding_constructor4_test/03: MissingCompileTimeError # KernelVM bug: Issue 15101
-mixin_invalid_bound2_test/02: MissingCompileTimeError
-mixin_invalid_bound2_test/03: MissingCompileTimeError
-mixin_invalid_bound2_test/04: MissingCompileTimeError
-mixin_invalid_bound2_test/05: MissingCompileTimeError
-mixin_invalid_bound2_test/06: MissingCompileTimeError
-mixin_invalid_bound2_test/07: MissingCompileTimeError
-mixin_invalid_bound2_test/08: MissingCompileTimeError
-mixin_invalid_bound2_test/09: MissingCompileTimeError
-mixin_invalid_bound2_test/10: MissingCompileTimeError
-mixin_invalid_bound2_test/11: MissingCompileTimeError
-mixin_invalid_bound2_test/12: MissingCompileTimeError
-mixin_invalid_bound2_test/13: MissingCompileTimeError
-mixin_invalid_bound2_test/14: MissingCompileTimeError
-mixin_invalid_bound2_test/15: MissingCompileTimeError
-mixin_invalid_bound_test/02: MissingCompileTimeError
-mixin_invalid_bound_test/03: MissingCompileTimeError
-mixin_invalid_bound_test/04: MissingCompileTimeError
-mixin_invalid_bound_test/05: MissingCompileTimeError
-mixin_invalid_bound_test/06: MissingCompileTimeError
-mixin_invalid_bound_test/07: MissingCompileTimeError
-mixin_invalid_bound_test/08: MissingCompileTimeError
-mixin_invalid_bound_test/09: MissingCompileTimeError
-mixin_invalid_bound_test/10: MissingCompileTimeError
+mixin_invalid_bound2_test/02: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound2_test/03: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound2_test/04: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound2_test/05: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound2_test/06: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound2_test/07: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound2_test/08: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound2_test/09: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound2_test/10: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound2_test/11: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound2_test/12: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound2_test/13: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound2_test/14: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound2_test/15: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound_test/02: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound_test/03: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound_test/04: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound_test/05: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound_test/06: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound_test/07: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound_test/08: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound_test/09: MissingCompileTimeError # Issue 33071 (missing bounds check)
+mixin_invalid_bound_test/10: MissingCompileTimeError # Issue 33071 (missing bounds check)
mixin_super_bound_test/01: MissingCompileTimeError
mixin_super_bound_test/02: MissingCompileTimeError
mixin_super_constructor_named_test/01: MissingCompileTimeError # KernelVM bug: Issue 15101
@@ -212,232 +212,232 @@
vm/regress_27201_test: CompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 30273.
void_type_callbacks_test/00: MissingCompileTimeError
void_type_callbacks_test/01: MissingCompileTimeError
-void_type_function_types_test/04: MissingCompileTimeError
-void_type_function_types_test/06: MissingCompileTimeError
-void_type_function_types_test/08: MissingCompileTimeError
-void_type_override_test/00: MissingCompileTimeError
-void_type_override_test/00b: MissingCompileTimeError
-void_type_override_test/00c: MissingCompileTimeError
-void_type_override_test/01: MissingCompileTimeError
-void_type_override_test/03: MissingCompileTimeError
-void_type_usage_test/call_argument: MissingCompileTimeError
-void_type_usage_test/call_cascade: MissingCompileTimeError
-void_type_usage_test/call_conditional: MissingCompileTimeError
-void_type_usage_test/call_do_while: MissingCompileTimeError
-void_type_usage_test/call_dynamic_init: MissingCompileTimeError
-void_type_usage_test/call_for_in: MissingCompileTimeError
-void_type_usage_test/call_is: MissingCompileTimeError
-void_type_usage_test/call_literal_list_init: MissingCompileTimeError
-void_type_usage_test/call_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/call_literal_map_key_init2: MissingCompileTimeError
-void_type_usage_test/call_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/call_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/call_null_dot: MissingCompileTimeError
-void_type_usage_test/call_null_equals2: MissingCompileTimeError
-void_type_usage_test/call_return: MissingCompileTimeError
-void_type_usage_test/call_throw: MissingCompileTimeError
-void_type_usage_test/call_toString: MissingCompileTimeError
-void_type_usage_test/call_void_init: MissingCompileTimeError
-void_type_usage_test/call_while: MissingCompileTimeError
-void_type_usage_test/conditional2_argument: MissingCompileTimeError
-void_type_usage_test/conditional2_conditional: MissingCompileTimeError
-void_type_usage_test/conditional2_dynamic_init: MissingCompileTimeError
-void_type_usage_test/conditional2_for: MissingCompileTimeError
-void_type_usage_test/conditional2_literal_list_init: MissingCompileTimeError
-void_type_usage_test/conditional2_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/conditional2_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/conditional2_null_equals2: MissingCompileTimeError
-void_type_usage_test/conditional2_parens: MissingCompileTimeError
-void_type_usage_test/conditional2_return: MissingCompileTimeError
-void_type_usage_test/conditional2_stmt: MissingCompileTimeError
-void_type_usage_test/conditional2_throw: MissingCompileTimeError
-void_type_usage_test/conditional2_void_init: MissingCompileTimeError
-void_type_usage_test/conditional2do_while: MissingCompileTimeError
-void_type_usage_test/conditional2for_in: MissingCompileTimeError
-void_type_usage_test/conditional2while: MissingCompileTimeError
-void_type_usage_test/conditional3_argument: MissingCompileTimeError
-void_type_usage_test/conditional3_conditional: MissingCompileTimeError
-void_type_usage_test/conditional3_dynamic_init: MissingCompileTimeError
-void_type_usage_test/conditional3_for: MissingCompileTimeError
-void_type_usage_test/conditional3_literal_list_init: MissingCompileTimeError
-void_type_usage_test/conditional3_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/conditional3_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/conditional3_null_equals2: MissingCompileTimeError
-void_type_usage_test/conditional3_parens: MissingCompileTimeError
-void_type_usage_test/conditional3_return: MissingCompileTimeError
-void_type_usage_test/conditional3_stmt: MissingCompileTimeError
-void_type_usage_test/conditional3_throw: MissingCompileTimeError
-void_type_usage_test/conditional3_void_init: MissingCompileTimeError
-void_type_usage_test/conditional_argument: MissingCompileTimeError
-void_type_usage_test/conditional_conditional: MissingCompileTimeError
-void_type_usage_test/conditional_do_while: MissingCompileTimeError
-void_type_usage_test/conditional_dynamic_init: MissingCompileTimeError
-void_type_usage_test/conditional_for: MissingCompileTimeError
-void_type_usage_test/conditional_for_in: MissingCompileTimeError
-void_type_usage_test/conditional_literal_list_init: MissingCompileTimeError
-void_type_usage_test/conditional_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/conditional_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/conditional_null_equals2: MissingCompileTimeError
-void_type_usage_test/conditional_parens: MissingCompileTimeError
-void_type_usage_test/conditional_return: MissingCompileTimeError
-void_type_usage_test/conditional_stmt: MissingCompileTimeError
-void_type_usage_test/conditional_throw: MissingCompileTimeError
-void_type_usage_test/conditional_void_init: MissingCompileTimeError
-void_type_usage_test/conditional_while: MissingCompileTimeError
-void_type_usage_test/final_local_argument: MissingCompileTimeError
-void_type_usage_test/final_local_cascade: MissingCompileTimeError
-void_type_usage_test/final_local_conditional: MissingCompileTimeError
-void_type_usage_test/final_local_do_while: MissingCompileTimeError
-void_type_usage_test/final_local_dynamic_init: MissingCompileTimeError
-void_type_usage_test/final_local_for_in: MissingCompileTimeError
-void_type_usage_test/final_local_is: MissingCompileTimeError
-void_type_usage_test/final_local_literal_list_init: MissingCompileTimeError
-void_type_usage_test/final_local_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/final_local_literal_map_key_init2: MissingCompileTimeError
-void_type_usage_test/final_local_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/final_local_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/final_local_null_dot: MissingCompileTimeError
-void_type_usage_test/final_local_null_equals2: MissingCompileTimeError
-void_type_usage_test/final_local_return: MissingCompileTimeError
-void_type_usage_test/final_local_throw: MissingCompileTimeError
-void_type_usage_test/final_local_toString: MissingCompileTimeError
-void_type_usage_test/final_local_void_init: MissingCompileTimeError
-void_type_usage_test/final_local_while: MissingCompileTimeError
-void_type_usage_test/global_argument: MissingCompileTimeError
-void_type_usage_test/global_cascade: MissingCompileTimeError
-void_type_usage_test/global_conditional: MissingCompileTimeError
-void_type_usage_test/global_do_while: MissingCompileTimeError
-void_type_usage_test/global_dynamic_init: MissingCompileTimeError
-void_type_usage_test/global_for_in: MissingCompileTimeError
-void_type_usage_test/global_is: MissingCompileTimeError
-void_type_usage_test/global_literal_list_init: MissingCompileTimeError
-void_type_usage_test/global_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/global_literal_map_key_init2: MissingCompileTimeError
-void_type_usage_test/global_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/global_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/global_null_dot: MissingCompileTimeError
-void_type_usage_test/global_null_equals2: MissingCompileTimeError
-void_type_usage_test/global_return: MissingCompileTimeError
-void_type_usage_test/global_throw: MissingCompileTimeError
-void_type_usage_test/global_toString: MissingCompileTimeError
-void_type_usage_test/global_void_init: MissingCompileTimeError
-void_type_usage_test/global_while: MissingCompileTimeError
-void_type_usage_test/instance2_argument: MissingCompileTimeError
-void_type_usage_test/instance2_cascade: MissingCompileTimeError
-void_type_usage_test/instance2_conditional: MissingCompileTimeError
-void_type_usage_test/instance2_do_while: MissingCompileTimeError
-void_type_usage_test/instance2_dynamic_init: MissingCompileTimeError
-void_type_usage_test/instance2_for_in: MissingCompileTimeError
-void_type_usage_test/instance2_for_in2: MissingCompileTimeError
-void_type_usage_test/instance2_is: MissingCompileTimeError
-void_type_usage_test/instance2_literal_list_init: MissingCompileTimeError
-void_type_usage_test/instance2_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/instance2_literal_map_key_init2: MissingCompileTimeError
-void_type_usage_test/instance2_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/instance2_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/instance2_null_dot: MissingCompileTimeError
-void_type_usage_test/instance2_null_equals2: MissingCompileTimeError
-void_type_usage_test/instance2_return: MissingCompileTimeError
-void_type_usage_test/instance2_throw: MissingCompileTimeError
-void_type_usage_test/instance2_toString: MissingCompileTimeError
-void_type_usage_test/instance2_void_init: MissingCompileTimeError
-void_type_usage_test/instance2_while: MissingCompileTimeError
-void_type_usage_test/instance3_argument: MissingCompileTimeError
-void_type_usage_test/instance3_cascade: MissingCompileTimeError
-void_type_usage_test/instance3_conditional: MissingCompileTimeError
-void_type_usage_test/instance3_do_while: MissingCompileTimeError
-void_type_usage_test/instance3_dynamic_init: MissingCompileTimeError
-void_type_usage_test/instance3_for_in: MissingCompileTimeError
-void_type_usage_test/instance3_for_in2: MissingCompileTimeError
-void_type_usage_test/instance3_is: MissingCompileTimeError
-void_type_usage_test/instance3_literal_list_init: MissingCompileTimeError
-void_type_usage_test/instance3_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/instance3_literal_map_key_init2: MissingCompileTimeError
-void_type_usage_test/instance3_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/instance3_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/instance3_null_dot: MissingCompileTimeError
-void_type_usage_test/instance3_null_equals2: MissingCompileTimeError
-void_type_usage_test/instance3_return: MissingCompileTimeError
-void_type_usage_test/instance3_throw: MissingCompileTimeError
-void_type_usage_test/instance3_toString: MissingCompileTimeError
-void_type_usage_test/instance3_void_init: MissingCompileTimeError
-void_type_usage_test/instance3_while: MissingCompileTimeError
-void_type_usage_test/instance_argument: MissingCompileTimeError
-void_type_usage_test/instance_cascade: MissingCompileTimeError
-void_type_usage_test/instance_conditional: MissingCompileTimeError
-void_type_usage_test/instance_do_while: MissingCompileTimeError
-void_type_usage_test/instance_dynamic_init: MissingCompileTimeError
-void_type_usage_test/instance_for_in: MissingCompileTimeError
-void_type_usage_test/instance_is: MissingCompileTimeError
-void_type_usage_test/instance_literal_list_init: MissingCompileTimeError
-void_type_usage_test/instance_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/instance_literal_map_key_init2: MissingCompileTimeError
-void_type_usage_test/instance_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/instance_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/instance_null_dot: MissingCompileTimeError
-void_type_usage_test/instance_null_equals2: MissingCompileTimeError
-void_type_usage_test/instance_return: MissingCompileTimeError
-void_type_usage_test/instance_throw: MissingCompileTimeError
-void_type_usage_test/instance_toString: MissingCompileTimeError
-void_type_usage_test/instance_void_init: MissingCompileTimeError
-void_type_usage_test/instance_while: MissingCompileTimeError
-void_type_usage_test/local_argument: MissingCompileTimeError
-void_type_usage_test/local_cascade: MissingCompileTimeError
-void_type_usage_test/local_conditional: MissingCompileTimeError
-void_type_usage_test/local_do_while: MissingCompileTimeError
-void_type_usage_test/local_dynamic_init: MissingCompileTimeError
-void_type_usage_test/local_for_in: MissingCompileTimeError
-void_type_usage_test/local_is: MissingCompileTimeError
-void_type_usage_test/local_literal_list_init: MissingCompileTimeError
-void_type_usage_test/local_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/local_literal_map_key_init2: MissingCompileTimeError
-void_type_usage_test/local_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/local_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/local_null_dot: MissingCompileTimeError
-void_type_usage_test/local_null_equals2: MissingCompileTimeError
-void_type_usage_test/local_return: MissingCompileTimeError
-void_type_usage_test/local_throw: MissingCompileTimeError
-void_type_usage_test/local_toString: MissingCompileTimeError
-void_type_usage_test/local_void_init: MissingCompileTimeError
-void_type_usage_test/local_while: MissingCompileTimeError
-void_type_usage_test/param_argument: MissingCompileTimeError
-void_type_usage_test/param_cascade: MissingCompileTimeError
-void_type_usage_test/param_conditional: MissingCompileTimeError
-void_type_usage_test/param_do_while: MissingCompileTimeError
-void_type_usage_test/param_dynamic_init: MissingCompileTimeError
-void_type_usage_test/param_for_in: MissingCompileTimeError
-void_type_usage_test/param_is: MissingCompileTimeError
-void_type_usage_test/param_literal_list_init: MissingCompileTimeError
-void_type_usage_test/param_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/param_literal_map_key_init2: MissingCompileTimeError
-void_type_usage_test/param_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/param_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/param_null_dot: MissingCompileTimeError
-void_type_usage_test/param_null_equals2: MissingCompileTimeError
-void_type_usage_test/param_return: MissingCompileTimeError
-void_type_usage_test/param_throw: MissingCompileTimeError
-void_type_usage_test/param_toString: MissingCompileTimeError
-void_type_usage_test/param_void_init: MissingCompileTimeError
-void_type_usage_test/param_while: MissingCompileTimeError
-void_type_usage_test/paren_argument: MissingCompileTimeError
-void_type_usage_test/paren_cascade: MissingCompileTimeError
-void_type_usage_test/paren_conditional: MissingCompileTimeError
-void_type_usage_test/paren_do_while: MissingCompileTimeError
-void_type_usage_test/paren_dynamic_init: MissingCompileTimeError
-void_type_usage_test/paren_for_in: MissingCompileTimeError
-void_type_usage_test/paren_is: MissingCompileTimeError
-void_type_usage_test/paren_literal_list_init: MissingCompileTimeError
-void_type_usage_test/paren_literal_map_key_init: MissingCompileTimeError
-void_type_usage_test/paren_literal_map_key_init2: MissingCompileTimeError
-void_type_usage_test/paren_literal_map_value_init: MissingCompileTimeError
-void_type_usage_test/paren_literal_map_value_init2: MissingCompileTimeError
-void_type_usage_test/paren_null_dot: MissingCompileTimeError
-void_type_usage_test/paren_null_equals2: MissingCompileTimeError
-void_type_usage_test/paren_return: MissingCompileTimeError
-void_type_usage_test/paren_throw: MissingCompileTimeError
-void_type_usage_test/paren_toString: MissingCompileTimeError
-void_type_usage_test/paren_void_init: MissingCompileTimeError
-void_type_usage_test/paren_while: MissingCompileTimeError
+void_type_function_types_test/04: MissingCompileTimeError # Issue 32804
+void_type_function_types_test/06: MissingCompileTimeError # Issue 32804
+void_type_function_types_test/08: MissingCompileTimeError # Issue 32804
+void_type_override_test/00: MissingCompileTimeError # Issue 32804
+void_type_override_test/00b: MissingCompileTimeError # Issue 32804
+void_type_override_test/00c: MissingCompileTimeError # Issue 32804
+void_type_override_test/01: MissingCompileTimeError # Issue 32804
+void_type_override_test/03: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_argument: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_cascade: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_conditional: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_do_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_dynamic_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_for_in: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_is: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_literal_list_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_literal_map_key_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_literal_map_key_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_literal_map_value_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_literal_map_value_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_null_dot: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_null_equals2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_return: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_throw: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_toString: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_void_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/call_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional2_argument: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional2_conditional: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional2_dynamic_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional2_for: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional2_literal_list_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional2_literal_map_value_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional2_literal_map_value_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional2_null_equals2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional2_parens: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional2_return: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional2_stmt: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional2_throw: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional2_void_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional2do_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional2for_in: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional2while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional3_argument: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional3_conditional: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional3_dynamic_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional3_for: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional3_literal_list_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional3_literal_map_value_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional3_literal_map_value_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional3_null_equals2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional3_parens: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional3_return: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional3_stmt: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional3_throw: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional3_void_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional_argument: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional_conditional: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional_do_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional_dynamic_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional_for: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional_for_in: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional_literal_list_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional_literal_map_value_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional_literal_map_value_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional_null_equals2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional_parens: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional_return: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional_stmt: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional_throw: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional_void_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/conditional_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_argument: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_cascade: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_conditional: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_do_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_dynamic_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_for_in: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_is: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_literal_list_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_literal_map_key_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_literal_map_key_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_literal_map_value_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_literal_map_value_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_null_dot: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_null_equals2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_return: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_throw: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_toString: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_void_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/final_local_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_argument: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_cascade: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_conditional: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_do_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_dynamic_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_for_in: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_is: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_literal_list_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_literal_map_key_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_literal_map_key_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_literal_map_value_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_literal_map_value_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_null_dot: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_null_equals2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_return: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_throw: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_toString: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_void_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/global_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_argument: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_cascade: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_conditional: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_do_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_dynamic_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_for_in: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_for_in2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_is: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_literal_list_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_literal_map_key_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_literal_map_key_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_literal_map_value_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_literal_map_value_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_null_dot: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_null_equals2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_return: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_throw: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_toString: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_void_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance2_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_argument: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_cascade: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_conditional: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_do_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_dynamic_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_for_in: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_for_in2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_is: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_literal_list_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_literal_map_key_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_literal_map_key_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_literal_map_value_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_literal_map_value_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_null_dot: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_null_equals2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_return: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_throw: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_toString: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_void_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance3_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_argument: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_cascade: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_conditional: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_do_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_dynamic_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_for_in: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_is: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_literal_list_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_literal_map_key_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_literal_map_key_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_literal_map_value_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_literal_map_value_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_null_dot: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_null_equals2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_return: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_throw: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_toString: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_void_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/instance_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_argument: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_cascade: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_conditional: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_do_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_dynamic_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_for_in: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_is: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_literal_list_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_literal_map_key_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_literal_map_key_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_literal_map_value_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_literal_map_value_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_null_dot: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_null_equals2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_return: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_throw: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_toString: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_void_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/local_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_argument: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_cascade: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_conditional: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_do_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_dynamic_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_for_in: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_is: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_literal_list_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_literal_map_key_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_literal_map_key_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_literal_map_value_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_literal_map_value_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_null_dot: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_null_equals2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_return: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_throw: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_toString: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_void_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/param_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_argument: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_cascade: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_conditional: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_do_while: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_dynamic_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_for_in: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_is: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_literal_list_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_literal_map_key_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_literal_map_key_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_literal_map_value_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_literal_map_value_init2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_null_dot: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_null_equals2: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_return: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_throw: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_toString: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_void_init: MissingCompileTimeError # Issue 32804
+void_type_usage_test/paren_while: MissingCompileTimeError # Issue 32804
[ $arch == simarm && $compiler == dartkp && $strong ]
await_test: RuntimeError
diff --git a/tests/language_2/language_2_vm.status b/tests/language_2/language_2_vm.status
index eb0dd41..fcd9492 100644
--- a/tests/language_2/language_2_vm.status
+++ b/tests/language_2/language_2_vm.status
@@ -1329,6 +1329,7 @@
unicode_bom_test: Fail # Issue 16067
vm/debug_break_enabled_vm_test/01: Crash, OK # Expected to hit breakpoint.
vm/regress_29145_test: Skip # Issue 29145
+vm/regress_33073_test: Skip # Issue 33073
[ $compiler == none && $runtime == vm && $system == fuchsia ]
async_await_test: RuntimeError
diff --git a/tests/language_2/vm/regress_33073_test.dart b/tests/language_2/vm/regress_33073_test.dart
new file mode 100644
index 0000000..18ea228
--- /dev/null
+++ b/tests/language_2/vm/regress_33073_test.dart
@@ -0,0 +1,18 @@
+// Copyright (c) 2018, 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.
+
+// Verify that the correct number of type arguments is observed in the
+// Invocation object for invocations that pass all-dynamic type arguments.
+
+import "package:expect/expect.dart";
+
+class C {
+ dynamic noSuchMethod(Invocation invoke) {
+ Expect.equals(1, invoke.typeArguments.length);
+ }
+}
+
+void main() {
+ ((new C()) as dynamic).foo<dynamic>();
+}
diff --git a/tests/language_2/vm/regress_protobuf_95_test.dart b/tests/language_2/vm/regress_protobuf_95_test.dart
new file mode 100644
index 0000000..623aba3
--- /dev/null
+++ b/tests/language_2/vm/regress_protobuf_95_test.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2018, 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.
+
+// Verify that compiler loads class id from the receiver and not from type
+// arguments when performing polymorphic inlining in the AOT mode.
+
+import "package:expect/expect.dart";
+
+abstract class Base {
+ Type rareMethod<T>();
+}
+
+class A extends Base {
+ Type rareMethod<T>() => A;
+}
+
+class B extends Base {
+ Type rareMethod<T>() => B;
+}
+
+Type trampoline<T>(Base v) => v.rareMethod<T>();
+
+void main() {
+ Expect.equals(A, trampoline(new A()));
+ Expect.equals(B, trampoline(new B()));
+}
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index 7a7c744..90f3795 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -176,6 +176,9 @@
[ $strong ]
*: SkipByDesign # tests/lib_2 has the strong mode versions of these tests.
+[ $arch == arm64 && $runtime == vm ]
+mirrors/immutable_collections_test: Pass, Slow # http://dartbug.com/33057
+
[ $arch == ia32 && $mode == debug && $system == windows ]
convert/streamed_conversion_json_utf8_decode_test: Skip # Verification OOM.
diff --git a/tests/lib_2/lib_2_analyzer.status b/tests/lib_2/lib_2_analyzer.status
index 8a7efd5..346f32d 100644
--- a/tests/lib_2/lib_2_analyzer.status
+++ b/tests/lib_2/lib_2_analyzer.status
@@ -30,7 +30,6 @@
mirrors/mirrors_nsm_mismatch_test: CompileTimeError, OK
mirrors/mirrors_nsm_test: CompileTimeError, OK
mirrors/mirrors_nsm_test/dart2js: CompileTimeError, OK
-mirrors/relation_subclass_test: CompileTimeError, OK
mirrors/repeated_private_anon_mixin_app_test: CompileTimeError, OK # Intentional library name conflict.
[ $compiler == dart2analyzer && !$strong ]
diff --git a/tests/lib_2/lib_2_dart2js.status b/tests/lib_2/lib_2_dart2js.status
index 6277cb5..092573e 100644
--- a/tests/lib_2/lib_2_dart2js.status
+++ b/tests/lib_2/lib_2_dart2js.status
@@ -8,6 +8,8 @@
convert/chunked_conversion_utf88_test: Slow, Pass
convert/utf85_test: Slow, Pass
developer/timeline_test: Skip # Not supported
+html/async_spawnuri_test: SkipByDesign
+html/async_test: SkipByDesign
html/custom/document_register_type_extensions_test/construction: Pass, Timeout # Roll 50 failure
html/custom/document_register_type_extensions_test/registration: Pass, Timeout # Roll 50 failure
html/custom/element_upgrade_failure_test: MissingCompileTimeError
@@ -19,32 +21,15 @@
html/indexeddb_3_test: Pass, Timeout # Roll 50 failure
html/indexeddb_4_test: Pass, Timeout # Roll 50 failure
html/indexeddb_5_test: Pass, Timeout # Roll 50 failure
+html/isolates_test: SkipByDesign
html/js_typed_interop_default_arg_test/default_value: MissingCompileTimeError # Issue #25759
html/js_typed_interop_side_cast_exp_test: Pass, RuntimeError # Roll 50 failure
html/mirrors_js_typed_interop_test: Pass, Slow
html/svgelement_test/PathElement: Pass, RuntimeError # Roll 50 failure
+html/worker_api_test: SkipByDesign
html/wrapping_collections_test: SkipByDesign # Testing an issue that is only relevant to Dartium
html/xhr_test: Pass, Slow
-isolate/browser/issue_12474_test: CompileTimeError # Issue 22529
-isolate/enum_const_test/02: RuntimeError # Issue 21817
-isolate/error_at_spawnuri_test: SkipByDesign # Test uses a ".dart" URI.
-isolate/error_exit_at_spawnuri_test: SkipByDesign # Test uses a ".dart" URI.
-isolate/exit_at_spawnuri_test: SkipByDesign # Test uses a ".dart" URI.
-isolate/function_send1_test: SkipByDesign # Test uses a ".dart" URI.
-isolate/issue_21398_parent_isolate1_test: SkipByDesign # Test uses a ".dart" URI.
-isolate/issue_21398_parent_isolate2_test: SkipByDesign # Test uses a ".dart" URI.
-isolate/issue_21398_parent_isolate_test: SkipByDesign # Test uses a ".dart" URI.
-isolate/issue_24243_parent_isolate_test: SkipByDesign # Test uses a ".dart" URI.
-isolate/kill_self_synchronously_test: SkipByDesign # Unsupported operation: Platform._resolvedExecutable
-isolate/message3_test/constInstance: RuntimeError # Issue 21817
-isolate/message3_test/constList: RuntimeError # Issue 21817
-isolate/message3_test/constList_identical: RuntimeError # Issue 21817
-isolate/message3_test/constMap: RuntimeError # Issue 21817
-isolate/non_fatal_exception_in_timer_callback_test: Skip # Issue 23876
-isolate/spawn_uri_exported_main_test: SkipByDesign # Test uses a ".dart" URI.
-isolate/spawn_uri_nested_vm_test: SkipByDesign # Test uses a ".dart" URI.
-isolate/spawn_uri_vm_test: SkipByDesign # Test uses a ".dart" URI.
-isolate/stacktrace_message_test: RuntimeError # Fails to send stacktrace object.
+isolate/*: SkipByDesign # No support for dart:isolate in dart4web (http://dartbug.com/30538)
math/double_pow_test: RuntimeError
math/low_test: RuntimeError
math/random_big_test: RuntimeError # Using bigint seeds for random.
@@ -83,8 +68,6 @@
html/fileapi_entry_test: Pass, RuntimeError
html/media_stream_test: RuntimeError # Please triage.
html/speechrecognition_test: RuntimeError # Please triage.
-isolate/function_send_test: Skip # Crashes Chrome 62: https://bugs.chromium.org/p/chromium/issues/detail?id=775506
-isolate/kill_self_synchronously_test: RuntimeError
[ $compiler == dart2js && $runtime == chrome && $csp ]
html/canvas_pixel_array_type_alias_test: RuntimeError
@@ -119,8 +102,6 @@
html/rtc_test: Fail # TODO(dart2js-team): Please triage this failure.
html/speechrecognition_test: Fail # TODO(dart2js-team): Please triage this failure.
html/xhr_test/json: Fail # TODO(dart2js-team): Please triage this failure.
-isolate/mandel_isolate_test: Pass, Timeout # TODO(kasperl): Please triage.
-isolate/unresolved_ports_test: Pass, Timeout # Issue 15610
typed_data/setRange_2_test: RuntimeError # TODO(dart2js-team): Please triage this failure.
typed_data/setRange_3_test: RuntimeError # TODO(dart2js-team): Please triage this failure.
@@ -252,7 +233,6 @@
html/js_extend_class_test: RuntimeError
html/js_function_getter_test: RuntimeError
html/js_function_getter_trust_types_test: RuntimeError
-html/js_function_getter_trust_types_test: CompileTimeError
html/js_identity_test: RuntimeError
html/js_interop_1_test: RuntimeError
html/js_interop_constructor_name_div_test: RuntimeError
@@ -351,22 +331,12 @@
html/xhr_cross_origin_test: RuntimeError
html/xhr_test: RuntimeError
html/xsltprocessor_test: RuntimeError
-isolate/browser/package_resolve_browser_hook2_test: RuntimeError
-isolate/browser/package_resolve_browser_hook_test: RuntimeError
-isolate/browser/package_resolve_browser_test: RuntimeError
-isolate/isolate_stress_test: RuntimeError
js/null_test: RuntimeError
js/prototype_access_test: RuntimeError
[ $compiler == dart2js && $runtime == d8 && $fasta && $minified ]
collection/list_test: RuntimeError
-[ $compiler == dart2js && $runtime != d8 ]
-isolate/error_at_spawn_test: Skip # Issue 23876
-isolate/error_exit_at_spawn_test: Skip # Issue 23876
-isolate/exit_at_spawn_test: Skip # Issue 23876
-isolate/message4_test: Skip # Issue 30247
-
[ $compiler == dart2js && $runtime != d8 && $runtime != jsshell ]
html/fontface_loaded_test: RuntimeError
html/html_mock_test: RuntimeError # Issue 31038
@@ -409,7 +379,6 @@
html/speechrecognition_test: RuntimeError # Please triage.
html/text_event_test: Fail # Issue 17893
html/webgl_1_test: Pass, Fail # Issue 8219
-isolate/kill_self_synchronously_test: RuntimeError
[ $compiler == dart2js && $runtime == ie11 ]
html/element_types_content_test: RuntimeError # Issue 29922
@@ -476,8 +445,6 @@
async/zone_create_periodic_timer_test: RuntimeError # Timer interface not supported: Issue 7728.
async/zone_create_timer2_test: RuntimeError # Timer interface not supported: Issue 7728.
async/zone_empty_description2_test: RuntimeError # Timer interface not supported: Issue 7728.
-isolate/pause_test: Fail, OK # non-zero timer not supported.
-isolate/timer_isolate_test: Fail, OK # Needs Timer to run.
[ $compiler == dart2js && $runtime != jsshell ]
async/timer_not_available_test: RuntimeError
@@ -496,8 +463,6 @@
html/fileapi_supported_throws_test: Skip # FileSystem not supported on Safari
html/js_mock_test: RuntimeError # Issue 32286
html/xhr_test: RuntimeError
-isolate/cross_isolate_message_test: Skip # Issue 12627
-isolate/message_test: Skip # Issue 12627
[ $compiler == dart2js && $system == linux ]
html/interactive_geolocation_test: Skip # Requires allowing geo location.
@@ -511,16 +476,12 @@
html/js_typed_interop_lazy_test/01: RuntimeError
html/notification_permission_test: Timeout, Pass # Issue 32002
html/private_extension_member_test: RuntimeError
-isolate/isolate_stress_test: Pass, Slow # Issue 10697
js/null_test: RuntimeError # Issue 30652
[ $compiler == dart2js && $browser && $csp ]
html/custom/element_upgrade_test: Fail # Issue 17298
html/custom/js_custom_test: Fail # Issue 14643
-[ $compiler == dart2js && !$browser && $fast_startup ]
-isolate/isolate_current_test: Fail # please triage
-
[ $compiler == dart2js && $checked ]
convert/utf85_test: Pass, Slow # Issue 12029.
html/js_function_getter_trust_types_test: Skip # --trust-type-annotations incompatible with --checked
@@ -528,6 +489,9 @@
[ $compiler == dart2js && $checked && $fasta ]
async/stream_listen_zone_test: RuntimeError
+[ $compiler == dart2js && !$checked ]
+async/async_await_sync_completer_test: RuntimeError
+
[ $compiler == dart2js && $csp && $fasta && $minified ]
collection/list_test: RuntimeError
@@ -704,25 +668,6 @@
html/custom/mirrors_2_test: Fail # mirrors not supported
html/custom/mirrors_test: Fail # mirrors not supported
html/mirrors_js_typed_interop_test: Fail # mirrors not supported
-isolate/browser/compute_this_script_browser_test: Fail # mirrors not supported
-isolate/browser/typed_data_message_test: Fail # mirrors not supported
-isolate/count_test: Fail # mirrors not supported
-isolate/cross_isolate_message_test: Fail # mirrors not supported
-isolate/illegal_msg_mirror_test: Fail # mirrors not supported
-isolate/mandel_isolate_test: Fail # mirrors not supported
-isolate/message2_test: Fail # mirrors not supported
-isolate/message_test: Fail # mirrors not supported
-isolate/mint_maker_test: Fail # mirrors not supported
-isolate/nested_spawn2_test: Fail # mirrors not supported
-isolate/nested_spawn_test: Fail # mirrors not supported
-isolate/raw_port_test: Fail # mirrors not supported
-isolate/remote_unittest_helper: Fail # mirrors not supported
-isolate/request_reply_test: Fail # mirrors not supported
-isolate/spawn_function_custom_class_test: Fail # mirrors not supported
-isolate/spawn_function_test: Fail # mirrors not supported
-isolate/stacktrace_message_test: Fail # mirrors not supported
-isolate/static_function_test: Fail # mirrors not supported
-isolate/unresolved_ports_test: Fail # mirrors not supported
mirrors/regress_16321_test/01: Pass # expects failure, but if fails for the wrong reason
[ $compiler == dart2js && $fast_startup && $fasta ]
@@ -740,26 +685,6 @@
html/indexeddb_5_test: RuntimeError
html/js_typed_interop_default_arg_test/explicit_argument: RuntimeError
html/js_typed_interop_test: RuntimeError
-isolate/browser/compute_this_script_browser_test: RuntimeError # mirrors not supported
-isolate/browser/typed_data_message_test: RuntimeError # mirrors not supported
-isolate/compile_time_error_test/01: Crash
-isolate/count_test: RuntimeError # mirrors not supported
-isolate/cross_isolate_message_test: RuntimeError # mirrors not supported
-isolate/illegal_msg_mirror_test: RuntimeError # mirrors not supported
-isolate/mandel_isolate_test: RuntimeError # mirrors not supported
-isolate/message2_test: RuntimeError # mirrors not supported
-isolate/message_test: RuntimeError # mirrors not supported
-isolate/mint_maker_test: RuntimeError # mirrors not supported
-isolate/nested_spawn2_test: RuntimeError # mirrors not supported
-isolate/nested_spawn_test: RuntimeError # mirrors not supported
-isolate/raw_port_test: RuntimeError # mirrors not supported
-isolate/remote_unittest_helper: RuntimeError # mirrors not supported
-isolate/request_reply_test: RuntimeError # mirrors not supported
-isolate/spawn_function_custom_class_test: RuntimeError # mirrors not supported
-isolate/spawn_function_test: RuntimeError # mirrors not supported
-isolate/stacktrace_message_test: RuntimeError # mirrors not supported
-isolate/static_function_test: RuntimeError # mirrors not supported
-isolate/unresolved_ports_test: RuntimeError # mirrors not supported
[ $compiler == dart2js && $fasta && $host_checked ]
async/stream_controller_async_test: Crash
@@ -775,8 +700,6 @@
html/js_typed_interop_default_arg_test/explicit_argument: CompileTimeError
html/js_typed_interop_side_cast_exp_test: Crash # 'file:*/pkg/compiler/lib/src/common_elements.dart': Failed assertion: line 405 pos 12: 'element.name == '=='': is not true.
html/js_typed_interop_test: CompileTimeError
-isolate/deferred_in_isolate2_test: Crash
-isolate/mint_maker_test: Crash
typed_data/typed_data_list_test: Crash
typed_data/typed_list_iterable_test: Crash
@@ -859,9 +782,6 @@
[ $compiler == dart2js && !$fasta ]
async/future_or_bad_type_test: MissingCompileTimeError
-[ $compiler == dart2js && $jscl ]
-isolate/spawn_uri_test: SkipByDesign # Loading another file is not supported in JS shell
-
[ $compiler == dart2js && $minified ]
html/canvas_pixel_array_type_alias_test/types2_runtimeTypeName: Fail, OK # Issue 12605
@@ -870,11 +790,6 @@
convert/streamed_conversion_json_utf8_decode_test: SkipSlow # Times out. Issue 22050
convert/streamed_conversion_json_utf8_encode_test: SkipSlow # Times out. Issue 22050
convert/streamed_conversion_utf8_decode_test: SkipSlow # Times out. Issue 22050
-isolate/kill_self_synchronously_test: RuntimeError
-
-[ $compiler == dart2js && ($runtime == d8 || $runtime == jsshell) ]
-isolate/browser/issue_12474_test: RuntimeError # packageRoot not implemented.
-isolate/large_byte_data_leak_test: RuntimeError
[ $compiler == dart2js && ($runtime == ff || $runtime == safari || $ie) ]
html/custom/attribute_changed_callback_test/unsupported_on_polyfill: Fail # Polyfill does not support
diff --git a/tests/lib_2/lib_2_dartdevc.status b/tests/lib_2/lib_2_dartdevc.status
index 4e43310..c9e3342 100644
--- a/tests/lib_2/lib_2_dartdevc.status
+++ b/tests/lib_2/lib_2_dartdevc.status
@@ -8,11 +8,9 @@
[ $compiler == dartdevk ]
async/slow_consumer_test: CompileTimeError
-convert/chunked_conversion1_test: RuntimeError
convert/chunked_conversion_utf82_test: RuntimeError
convert/chunked_conversion_utf86_test: RuntimeError
convert/chunked_conversion_utf87_test: RuntimeError
-convert/codec1_test: RuntimeError
convert/utf82_test: RuntimeError
html/debugger_test: CompileTimeError
diff --git a/tests/lib_2/lib_2_kernel.status b/tests/lib_2/lib_2_kernel.status
index e9c9f60..bf33435 100644
--- a/tests/lib_2/lib_2_kernel.status
+++ b/tests/lib_2/lib_2_kernel.status
@@ -50,13 +50,6 @@
[ $compiler == dartk && $mode == debug && $runtime == vm && $strong ]
isolate/isolate_complex_messages_test: Crash
-mirrors/library_exports_shown_test: Crash # 31916
-mirrors/library_imports_deferred_test: Crash # 31916
-mirrors/library_imports_hidden_test: Crash # 31916
-mirrors/library_imports_metadata_test: Crash # 31916
-mirrors/library_imports_prefixed_show_hide_test: Crash # 31916
-mirrors/library_imports_prefixed_test: Crash # 31916
-mirrors/library_imports_shown_test: Crash # 31916
mirrors/other_declarations_location_test: Crash # assertion error, TypeParameter not having position.
[ $compiler == dartk && $mode == debug && $strong ]
@@ -120,7 +113,6 @@
mirrors/generic_interface_test/none: RuntimeError
mirrors/generic_mixin_applications_test: RuntimeError
mirrors/generic_mixin_test: RuntimeError
-mirrors/generics_dynamic_test: RuntimeError
mirrors/hot_get_field_test: RuntimeError
mirrors/hot_set_field_test: RuntimeError
mirrors/intercepted_object_test: RuntimeError # Issue 31402 (Invocation arguments)
@@ -129,15 +121,15 @@
mirrors/invoke_private_wrong_library_test: RuntimeError
mirrors/library_declarations_test/none: RuntimeError # Issue 31402 (Invocation arguments)
mirrors/library_enumeration_deferred_loading_test: RuntimeError
-mirrors/library_exports_hidden_test: RuntimeError, Crash, CompileTimeError # Issue 31402 (Invocation arguments)
-mirrors/library_exports_shown_test: RuntimeError, CompileTimeError # Issue 31402 (Invocation arguments)
-mirrors/library_import_deferred_loading_test: RuntimeError # Deferred loading kernel issue 28335.
-mirrors/library_imports_deferred_test: RuntimeError, CompileTimeError # Issue 31402 (Invocation arguments)
-mirrors/library_imports_hidden_test: RuntimeError # Issue 31402 (Invocation arguments)
-mirrors/library_imports_metadata_test: RuntimeError # Issue 31402 (Invocation arguments)
-mirrors/library_imports_prefixed_show_hide_test: RuntimeError # Issue 31402 (Invocation arguments)
-mirrors/library_imports_prefixed_test: RuntimeError # Issue 31402 (Invocation arguments)
-mirrors/library_imports_shown_test: RuntimeError # Issue 31402 (Invocation arguments)
+mirrors/library_exports_hidden_test: RuntimeError # Issue 33098
+mirrors/library_exports_shown_test: RuntimeError # Issue 33098
+mirrors/library_import_deferred_loading_test: RuntimeError # Issue 33098
+mirrors/library_imports_deferred_test: RuntimeError # Issue 33098
+mirrors/library_imports_hidden_test: RuntimeError # Issue 33098
+mirrors/library_imports_metadata_test: RuntimeError # Issue 33098
+mirrors/library_imports_prefixed_show_hide_test: RuntimeError # Issue 33098
+mirrors/library_imports_prefixed_test: RuntimeError # Issue 33098
+mirrors/library_imports_shown_test: RuntimeError # Issue 33098
mirrors/library_metadata_test: RuntimeError
mirrors/load_library_test: RuntimeError
mirrors/metadata_allowed_values_test/16: Skip # Flaky, crashes.
@@ -181,7 +173,7 @@
mirrors/reflected_type_typevars_test: RuntimeError
mirrors/regress_26187_test: RuntimeError
mirrors/relation_assignable_test: RuntimeError
-mirrors/relation_subclass_test: CompileTimeError # Issue 31533
+mirrors/relation_subclass_test: RuntimeError
mirrors/relation_subtype_test: RuntimeError
mirrors/repeated_private_anon_mixin_app_test: RuntimeError
mirrors/static_members_easier_test: RuntimeError # Issue 31402 (Invocation arguments)
@@ -222,10 +214,6 @@
mirrors/constructors_test: RuntimeError
mirrors/deferred_constraints_constants_test/default_argument2: Pass
mirrors/fake_function_with_call_test: RuntimeError
-mirrors/generic_superclass_test/01: RuntimeError
-mirrors/generic_superclass_test/none: RuntimeError
-mirrors/hierarchy_invariants_test: RuntimeError
-mirrors/immutable_collections_test: RuntimeError
mirrors/instance_members_easier_test: RuntimeError
mirrors/instance_members_test: RuntimeError
mirrors/instance_members_unimplemented_interface_test: RuntimeError
@@ -234,7 +222,6 @@
mirrors/invoke_throws_test: RuntimeError
mirrors/metadata_const_map_test: Crash
mirrors/mixin_members_test: RuntimeError
-mirrors/null_test: RuntimeError
mirrors/operator_test: RuntimeError
mirrors/redirecting_factory_different_type_test/02: MissingCompileTimeError
mirrors/redirecting_factory_different_type_test/none: RuntimeError
@@ -315,7 +302,6 @@
mirrors/native_class_test: CompileTimeError
mirrors/redirecting_factory_different_type_test/01: MissingCompileTimeError
mirrors/redirecting_factory_different_type_test/02: MissingCompileTimeError
-mirrors/relation_subclass_test: CompileTimeError
[ $fasta && $strong ]
mirrors/top_level_accessors_test/01: MissingCompileTimeError
diff --git a/tests/lib_2/lib_2_vm.status b/tests/lib_2/lib_2_vm.status
index cd8570e..cd5c32c 100644
--- a/tests/lib_2/lib_2_vm.status
+++ b/tests/lib_2/lib_2_vm.status
@@ -2,6 +2,9 @@
# 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.
+[ $arch == arm64 && $runtime == vm ]
+mirrors/immutable_collections_test: Pass, Slow # http://dartbug.com/33057
+
[ $arch == ia32 && $mode == debug && $runtime == vm && $system == windows ]
convert/streamed_conversion_json_utf8_decode_test: Skip # Verification OOM.
diff --git a/tests/lib_2/mirrors/relation_subclass_test.dart b/tests/lib_2/mirrors/relation_subclass_test.dart
index 704605f..7be25c2 100644
--- a/tests/lib_2/mirrors/relation_subclass_test.dart
+++ b/tests/lib_2/mirrors/relation_subclass_test.dart
@@ -66,12 +66,12 @@
Expect.isFalse(Obj.isSubclassOf(Func));
// Function typedef.
- var NumPred = thisLibrary.declarations[#NumberPredicate];
- var IntPred = thisLibrary.declarations[#IntegerPredicate];
- var DubPred = thisLibrary.declarations[#DoublePredicate];
- var NumGen = thisLibrary.declarations[#NumberGenerator];
- var IntGen = thisLibrary.declarations[#IntegerGenerator];
- var DubGen = thisLibrary.declarations[#DoubleGenerator];
+ dynamic NumPred = thisLibrary.declarations[#NumberPredicate];
+ dynamic IntPred = thisLibrary.declarations[#IntegerPredicate];
+ dynamic DubPred = thisLibrary.declarations[#DoublePredicate];
+ dynamic NumGen = thisLibrary.declarations[#NumberGenerator];
+ dynamic IntGen = thisLibrary.declarations[#IntegerGenerator];
+ dynamic DubGen = thisLibrary.declarations[#DoubleGenerator];
isArgumentOrTypeError(e) => e is ArgumentError || e is TypeError;
Expect.throws(() => Func.isSubclassOf(NumPred), isArgumentOrTypeError);
diff --git a/tests/lib_2/mirrors/stringify.dart b/tests/lib_2/mirrors/stringify.dart
index 32cc653..b726832 100644
--- a/tests/lib_2/mirrors/stringify.dart
+++ b/tests/lib_2/mirrors/stringify.dart
@@ -117,7 +117,7 @@
stringifyDependencies(LibraryMirror l) {
n(s) => s is Symbol ? MirrorSystem.getName(s) : s;
- compareDep(a, b) {
+ int compareDep(a, b) {
if (a.targetLibrary == b.targetLibrary) {
if ((a.prefix != null) && (b.prefix != null)) {
return n(a.prefix).compareTo(n(b.prefix));
@@ -128,8 +128,8 @@
.compareTo(n(b.targetLibrary.simpleName));
}
- compareCom(a, b) => n(a.identifier).compareTo(n(b.identifier));
- compareFirst(a, b) => a[0].compareTo(b[0]);
+ int compareCom(a, b) => n(a.identifier).compareTo(n(b.identifier));
+ int compareFirst(a, b) => a[0].compareTo(b[0]);
sortBy(c, p) => new List.from(c)..sort(p);
var buffer = new StringBuffer();
diff --git a/tools/VERSION b/tools/VERSION
index cf7a0c4..b5da02e 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 0
PATCH 0
-PRERELEASE 54
+PRERELEASE 55
PRERELEASE_PATCH 0
diff --git a/tools/dom/src/AttributeMap.dart b/tools/dom/src/AttributeMap.dart
index 85aef19..a6e79f3 100644
--- a/tools/dom/src/AttributeMap.dart
+++ b/tools/dom/src/AttributeMap.dart
@@ -15,12 +15,10 @@
});
}
- Map<K, V> cast<K, V>() {
- Map<Object, Object> self = this;
- return self is Map<K, V> ? self : Map.castFrom<String, String, K, V>(this);
- }
+ Map<K, V> cast<K, V>() => Map.castFrom<String, String, K, V>(this);
- Map<K, V> retype<K, V>() => Map.castFrom<String, String, K, V>(this);
+ @Deprecated("Use cast instead.")
+ Map<K, V> retype<K, V>() => cast<K, V>();
bool containsValue(Object value) {
for (var v in this.values) {
@@ -182,12 +180,10 @@
});
}
- Map<K, V> cast<K, V>() {
- Map<Object, Object> self = this;
- return self is Map<K, V> ? self : Map.castFrom<String, String, K, V>(this);
- }
+ Map<K, V> cast<K, V>() => Map.castFrom<String, String, K, V>(this);
- Map<K, V> retype<K, V>() => Map.castFrom<String, String, K, V>(this);
+ @Deprecated("Use cast instead.")
+ Map<K, V> retype<K, V>() => cast<K, V>();
// TODO: Use lazy iterator when it is available on Map.
bool containsValue(Object value) => values.any((v) => v == value);