Version 2.0.0-dev.13.0
Merge commit 'f52cc1b382fb198e2f4b5f951b3243c6b0340ca8' into dev
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2db006c..e0d48cb 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -83,7 +83,9 @@
decompression routines.
* Added `IOOverrides` and `HttpOverrides` to aid in writing tests that wish to
mock varios `dart:io` objects.
- * Added `Stdin.hasTerminal`.
+ * Added `Stdin.hasTerminal`, which is true if stdin is attached to a terminal.
+ * Added `waitForEventSync`, which suspends execution until an asynchronous
+ event oocurs.
* `dart:isolate`
* Rename `IMMEDIATE` and `BEFORE_NEXT_EVENT` on `Isolate` to `immediate` and
@@ -109,6 +111,16 @@
### Tool Changes
+* Analyzer
+
+The analyzer will no longer issue a warning when a generic type parameter is
+used as the type in an instance check. For example:
+ ```dart
+ test<T>() {
+ print(3 is T); // No warning
+ }
+ ```
+
* Pub
* Git dependencies may now include a `path` parameter, indicating that the
diff --git a/DEPS b/DEPS
index 1c6c875..642a59a 100644
--- a/DEPS
+++ b/DEPS
@@ -91,7 +91,7 @@
"isolate_tag": "@1.1.0",
"jinja2_rev": "@2222b31554f03e62600cd7e383376a7c187967a1",
"json_rpc_2_tag": "@2.0.4",
- "linter_tag": "@0.1.40",
+ "linter_tag": "@0.1.41",
"logging_tag": "@0.11.3+1",
"markdown_tag": "@1.0.0",
"matcher_tag": "@0.12.1+4",
diff --git a/pkg/analysis_server/lib/src/computer/computer_closingLabels.dart b/pkg/analysis_server/lib/src/computer/computer_closingLabels.dart
index 71c5ff3..15fe295 100644
--- a/pkg/analysis_server/lib/src/computer/computer_closingLabels.dart
+++ b/pkg/analysis_server/lib/src/computer/computer_closingLabels.dart
@@ -7,9 +7,6 @@
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/src/generated/source.dart';
-// TODO(devoncarew): We should look into not creating any labels until there's
-// at least 2 levels of nesting.
-
/**
* A computer for [CompilationUnit] closing labels.
*/
@@ -17,6 +14,8 @@
final LineInfo _lineInfo;
final CompilationUnit _unit;
final List<ClosingLabel> _closingLabels = [];
+ final Set<ClosingLabel> hasNestingSet = new Set();
+ final Set<ClosingLabel> isSingleLineSet = new Set();
DartUnitClosingLabelsComputer(this._lineInfo, this._unit);
@@ -25,7 +24,20 @@
*/
List<ClosingLabel> compute() {
_unit.accept(new _DartUnitClosingLabelsComputerVisitor(this));
- return _closingLabels;
+
+ return _closingLabels.where((ClosingLabel label) {
+ // Filter labels that don't have some nesting.
+ // Filter labels that start and end on the same line.
+ return hasNestingSet.contains(label) && !isSingleLineSet.contains(label);
+ }).toList();
+ }
+
+ void setHasNesting(ClosingLabel label) {
+ hasNestingSet.add(label);
+ }
+
+ void setSingleLine(ClosingLabel label) {
+ isSingleLineSet.add(label);
}
}
@@ -37,24 +49,33 @@
final DartUnitClosingLabelsComputer computer;
int interpolatedStringsEntered = 0;
+ List<ClosingLabel> labelStack = [];
_DartUnitClosingLabelsComputerVisitor(this.computer);
@override
Object visitInstanceCreationExpression(InstanceCreationExpression node) {
+ ClosingLabel label;
+
if (node.argumentList != null) {
- var label = node.constructorName.type.name.name;
+ String labelText = node.constructorName.type.name.name;
if (node.constructorName.name != null) {
- label += ".${node.constructorName.name.name}";
+ labelText += ".${node.constructorName.name.name}";
}
// We override the node used for doing line calculations because otherwise
// constructors that split over multiple lines (but have parens on same
// line) would incorrectly get labels, because node.start on an instance
// creation expression starts at the start of the expression.
- _addLabel(node, label, checkLinesUsing: node.argumentList);
+ label = _addLabel(node, labelText, checkLinesUsing: node.argumentList);
}
- return super.visitInstanceCreationExpression(node);
+ if (label != null) _pushLabel(label);
+
+ try {
+ return super.visitInstanceCreationExpression(node);
+ } finally {
+ if (label != null) _popLabel();
+ }
}
@override
@@ -62,11 +83,19 @@
final NodeList<TypeAnnotation> args = node.typeArguments?.arguments;
final String typeName = args != null ? args[0]?.toString() : null;
+ ClosingLabel label;
+
if (typeName != null) {
- _addLabel(node, "<$typeName>[]");
+ label = _addLabel(node, "<$typeName>[]");
}
- return super.visitListLiteral(node);
+ if (label != null) _pushLabel(label);
+
+ try {
+ return super.visitListLiteral(node);
+ } finally {
+ if (label != null) _popLabel();
+ }
}
@override
@@ -79,10 +108,11 @@
}
}
- void _addLabel(AstNode node, String label, {AstNode checkLinesUsing}) {
+ ClosingLabel _addLabel(AstNode node, String label,
+ {AstNode checkLinesUsing}) {
// Never add labels if we're inside strings.
if (interpolatedStringsEntered > 0) {
- return;
+ return null;
}
checkLinesUsing = checkLinesUsing ?? node;
@@ -92,14 +122,32 @@
final LineInfo_Location end =
computer._lineInfo.getLocation(checkLinesUsing.end - 1);
- int spannedLines = end.lineNumber - start.lineNumber;
- if (spannedLines < 1) {
- return;
- }
-
final ClosingLabel closingLabel =
new ClosingLabel(node.offset, node.length, label);
+ int spannedLines = end.lineNumber - start.lineNumber;
+ if (spannedLines < 1) {
+ computer.setSingleLine(closingLabel);
+ }
+
+ ClosingLabel parent = _currentLabel;
+ if (parent != null) {
+ computer.setHasNesting(parent);
+ computer.setHasNesting(closingLabel);
+ }
+
computer._closingLabels.add(closingLabel);
+
+ return closingLabel;
+ }
+
+ void _pushLabel(ClosingLabel label) {
+ labelStack.add(label);
+ }
+
+ ClosingLabel get _currentLabel => labelStack.isEmpty ? null : labelStack.last;
+
+ void _popLabel() {
+ labelStack.removeLast();
}
}
diff --git a/pkg/analysis_server/lib/src/services/completion/dart/common_usage_sorter.dart b/pkg/analysis_server/lib/src/services/completion/dart/common_usage_sorter.dart
index a515bed..6f84fd8 100644
--- a/pkg/analysis_server/lib/src/services/completion/dart/common_usage_sorter.dart
+++ b/pkg/analysis_server/lib/src/services/completion/dart/common_usage_sorter.dart
@@ -16,6 +16,7 @@
import 'package:analyzer/dart/ast/visitor.dart';
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/dart/element/type.dart';
+import 'package:analyzer/src/dart/ast/ast.dart';
import 'package:analyzer_plugin/src/utilities/completion/completion_target.dart';
part 'common_usage_sorter.g.dart';
@@ -101,27 +102,44 @@
/**
* An [AstVisitor] used to determine the best defining type of a node.
*/
-class _BestTypeVisitor extends GeneralizingAstVisitor<DartType> {
+class _BestTypeVisitor extends UnifyingAstVisitor<DartType> {
/**
* The entity which the completed text will replace (or which will be
* displaced once the completed text is inserted). This may be an AstNode or
- * a Token, or it may be null if the cursor is after all tokens in the file.
+ * a Token, or it may be `null` if the cursor is after all tokens in the file.
* See field of the same name in [CompletionTarget].
*/
final Object entity;
_BestTypeVisitor(this.entity);
+ @override
DartType visitConstructorName(ConstructorName node) =>
node.period != null && node.name == entity ? node.type?.type : null;
+ @override
+ DartType visitNamedExpression(NamedExpression node) {
+ AstNode parent = node.parent;
+ if (parent is ArgumentListImpl) {
+ List<ParameterElement> params = parent.correspondingStaticParameters;
+ if (params != null) {
+ int index = parent.arguments.indexOf(node);
+ return params[index]?.type;
+ }
+ }
+ return super.visitNamedExpression(node);
+ }
+
+ @override
DartType visitNode(AstNode node) {
return null;
}
+ @override
DartType visitPrefixedIdentifier(PrefixedIdentifier node) =>
node.identifier == entity ? node.prefix?.bestType : null;
+ @override
DartType visitPropertyAccess(PropertyAccess node) =>
node.propertyName == entity ? node.realTarget?.bestType : null;
}
diff --git a/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart b/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart
index 8e1519e..a43d978 100644
--- a/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart
+++ b/pkg/analysis_server/lib/src/services/search/search_engine_internal.dart
@@ -113,14 +113,14 @@
@override
Future<List<SearchMatch>> searchTopLevelDeclarations(String pattern) async {
- List<SearchMatch> allDeclarations = [];
+ Set<Element> allElements = new Set<Element>();
RegExp regExp = new RegExp(pattern);
List<AnalysisDriver> drivers = _drivers.toList();
for (AnalysisDriver driver in drivers) {
List<Element> elements = await driver.search.topLevelElements(regExp);
- allDeclarations.addAll(elements.map(SearchMatchImpl.forElement));
+ allElements.addAll(elements);
}
- return allDeclarations;
+ return allElements.map(SearchMatchImpl.forElement).toList();
}
Future<List<SearchResult>> _searchDirectSubtypes(ClassElement type) async {
diff --git a/pkg/analysis_server/test/benchmarks_test.dart b/pkg/analysis_server/test/benchmarks_test.dart
index 5c6ecc1..4cd4a46 100644
--- a/pkg/analysis_server/test/benchmarks_test.dart
+++ b/pkg/analysis_server/test/benchmarks_test.dart
@@ -53,7 +53,7 @@
);
expect(r.exitCode, 0,
reason: 'exit: ${r.exitCode}\n${r.stdout}\n${r.stderr}');
- }, skip: true); // #31554
+ });
}
});
}
diff --git a/pkg/analysis_server/test/integration/analysis/analysis_options_test.dart b/pkg/analysis_server/test/integration/analysis/analysis_options_test.dart
index e437193..4420642 100644
--- a/pkg/analysis_server/test/integration/analysis/analysis_options_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/analysis_options_test.dart
@@ -12,6 +12,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(OptionsIntegrationTest);
+ defineReflectiveTests(OptionsIntegrationTest_PreviewDart2);
});
}
@@ -79,3 +80,9 @@
expect(error.location.startColumn, 7);
}
}
+
+@reflectiveTest
+class OptionsIntegrationTest_PreviewDart2 extends OptionsIntegrationTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/error_test.dart b/pkg/analysis_server/test/integration/analysis/error_test.dart
index 1c32caa..fe968d7 100644
--- a/pkg/analysis_server/test/integration/analysis/error_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/error_test.dart
@@ -12,6 +12,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(AnalysisErrorIntegrationTest);
+ defineReflectiveTests(AnalysisErrorIntegrationTest_PreviewDart2);
});
}
@@ -98,3 +99,23 @@
expect(errors, isEmpty);
}
}
+
+@reflectiveTest
+class AnalysisErrorIntegrationTest_PreviewDart2
+ extends AnalysisErrorIntegrationTest {
+ @override
+ bool get usePreviewDart2 => true;
+
+ @override
+ @failingTest
+ test_super_mixins_disabled() {
+ // Disabling super mixins is not supported in the new FE.
+ return super.test_super_mixins_disabled();
+ }
+
+ @override
+ test_super_mixins_enabled() {
+ // This does pass with the new FE.
+ return super.test_super_mixins_enabled();
+ }
+}
diff --git a/pkg/analysis_server/test/integration/analysis/get_errors_nonStandard_sdk.dart b/pkg/analysis_server/test/integration/analysis/get_errors_nonStandard_sdk.dart
index 289a332..0d18844 100644
--- a/pkg/analysis_server/test/integration/analysis/get_errors_nonStandard_sdk.dart
+++ b/pkg/analysis_server/test/integration/analysis/get_errors_nonStandard_sdk.dart
@@ -17,6 +17,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(AnalysisDomainGetErrorsTest);
+ defineReflectiveTests(AnalysisDomainGetErrorsTest_PreviewDart2);
});
}
@@ -97,3 +98,10 @@
expect(errors[0].code, 'unused_import');
}
}
+
+@reflectiveTest
+class AnalysisDomainGetErrorsTest_PreviewDart2
+ extends AnalysisDomainGetErrorsTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/get_errors_test.dart b/pkg/analysis_server/test/integration/analysis/get_errors_test.dart
index 2f39542..c8a518f 100644
--- a/pkg/analysis_server/test/integration/analysis/get_errors_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/get_errors_test.dart
@@ -12,6 +12,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(GetErrorsTest);
+ defineReflectiveTests(GetErrorsTest_PreviewDart2);
});
}
@@ -34,3 +35,9 @@
return analysisFinished.then((_) => finishTest());
}
}
+
+@reflectiveTest
+class GetErrorsTest_PreviewDart2 extends GetErrorsTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/get_hover_test.dart b/pkg/analysis_server/test/integration/analysis/get_hover_test.dart
index 55be6ca..352df8c 100644
--- a/pkg/analysis_server/test/integration/analysis/get_hover_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/get_hover_test.dart
@@ -14,6 +14,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(AnalysisGetHoverIntegrationTest);
+ defineReflectiveTests(AnalysisGetHoverIntegrationTest_PreviewDart2);
});
}
@@ -187,3 +188,17 @@
});
}
}
+
+@reflectiveTest
+class AnalysisGetHoverIntegrationTest_PreviewDart2
+ extends AnalysisGetHoverIntegrationTest {
+ @override
+ bool get usePreviewDart2 => true;
+
+ @override
+ @failingTest
+ test_getHover() {
+ // TODO(devoncarew): NoSuchMethodError: The getter 'canonicalName' was called on null.
+ return super.test_getHover();
+ }
+}
diff --git a/pkg/analysis_server/test/integration/analysis/get_imported_elements_test.dart b/pkg/analysis_server/test/integration/analysis/get_imported_elements_test.dart
index 7433df5..4823a1a 100644
--- a/pkg/analysis_server/test/integration/analysis/get_imported_elements_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/get_imported_elements_test.dart
@@ -15,6 +15,8 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(AnalysisGetImportedElementsIntegrationTest);
+ defineReflectiveTests(
+ AnalysisGetImportedElementsIntegrationTest_PreviewDart2);
});
}
@@ -138,3 +140,10 @@
}
}
}
+
+@reflectiveTest
+class AnalysisGetImportedElementsIntegrationTest_PreviewDart2
+ extends AnalysisGetImportedElementsIntegrationTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/get_library_dependencies_test.dart b/pkg/analysis_server/test/integration/analysis/get_library_dependencies_test.dart
index 51a7659..dda8e99 100644
--- a/pkg/analysis_server/test/integration/analysis/get_library_dependencies_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/get_library_dependencies_test.dart
@@ -11,6 +11,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(GetLibraryDependenciesTest);
+ defineReflectiveTests(GetLibraryDependenciesTest_PreviewDart2);
});
}
@@ -45,3 +46,10 @@
expect(map.keys, isEmpty);
}
}
+
+@reflectiveTest
+class GetLibraryDependenciesTest_PreviewDart2
+ extends GetLibraryDependenciesTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/get_navigation_test.dart b/pkg/analysis_server/test/integration/analysis/get_navigation_test.dart
index 9725e58..e9757fb 100644
--- a/pkg/analysis_server/test/integration/analysis/get_navigation_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/get_navigation_test.dart
@@ -12,6 +12,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(GetNavigationTest);
+ defineReflectiveTests(GetNavigationTest_PreviewDart2);
});
}
@@ -65,3 +66,13 @@
expect(result.targets, isEmpty);
}
}
+
+@reflectiveTest
+class GetNavigationTest_PreviewDart2 extends GetNavigationTest {
+ @override
+ bool get usePreviewDart2 => true;
+
+ @override
+ @failingTest
+ test_navigation() => super.test_navigation();
+}
diff --git a/pkg/analysis_server/test/integration/analysis/get_reachable_sources_test.dart b/pkg/analysis_server/test/integration/analysis/get_reachable_sources_test.dart
index 150c67f..532002c 100644
--- a/pkg/analysis_server/test/integration/analysis/get_reachable_sources_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/get_reachable_sources_test.dart
@@ -13,6 +13,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(GetReachableSourcesTest);
+ defineReflectiveTests(GetReachableSourcesTest_PreviewDart2);
});
}
@@ -47,3 +48,9 @@
expect(sources[url], contains('dart:core'));
}
}
+
+@reflectiveTest
+class GetReachableSourcesTest_PreviewDart2 extends GetReachableSourcesTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/highlights_test.dart b/pkg/analysis_server/test/integration/analysis/highlights_test.dart
index 64d3313..8091efa 100644
--- a/pkg/analysis_server/test/integration/analysis/highlights_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/highlights_test.dart
@@ -12,6 +12,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(AnalysisHighlightsTest);
+ defineReflectiveTests(AnalysisHighlightsTest_PreviewDart2);
});
}
@@ -144,3 +145,13 @@
});
}
}
+
+@reflectiveTest
+class AnalysisHighlightsTest_PreviewDart2 extends AnalysisHighlightsTest {
+ @override
+ bool get usePreviewDart2 => true;
+
+ @override
+ @failingTest
+ test_highlights() => super.test_highlights();
+}
diff --git a/pkg/analysis_server/test/integration/analysis/highlights_test2.dart b/pkg/analysis_server/test/integration/analysis/highlights_test2.dart
index 2e672288..7d7314b 100644
--- a/pkg/analysis_server/test/integration/analysis/highlights_test2.dart
+++ b/pkg/analysis_server/test/integration/analysis/highlights_test2.dart
@@ -14,6 +14,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(AnalysisHighlightsTest);
+ defineReflectiveTests(AnalysisHighlightsTest_PreviewDart2);
});
}
@@ -164,3 +165,9 @@
});
}
}
+
+@reflectiveTest
+class AnalysisHighlightsTest_PreviewDart2 extends AnalysisHighlightsTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/lint_test.dart b/pkg/analysis_server/test/integration/analysis/lint_test.dart
index 699b43b..803c4a1 100644
--- a/pkg/analysis_server/test/integration/analysis/lint_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/lint_test.dart
@@ -12,6 +12,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(LintIntegrationTest);
+ defineReflectiveTests(LintIntegrationTest_PreviewDart2);
});
}
@@ -81,3 +82,9 @@
expect(error.type, AnalysisErrorType.LINT);
}
}
+
+@reflectiveTest
+class LintIntegrationTest_PreviewDart2 extends LintIntegrationTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/navigation_test.dart b/pkg/analysis_server/test/integration/analysis/navigation_test.dart
index a514323..bad4f91 100644
--- a/pkg/analysis_server/test/integration/analysis/navigation_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/navigation_test.dart
@@ -12,6 +12,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(AnalysisNavigationTest);
+ defineReflectiveTests(AnalysisNavigationTest_PreviewDart2);
});
}
@@ -134,3 +135,13 @@
'TypeParameter field;', 'TypeParameter>', ElementKind.TYPE_PARAMETER);
}
}
+
+@reflectiveTest
+class AnalysisNavigationTest_PreviewDart2 extends AnalysisNavigationTest {
+ @override
+ bool get usePreviewDart2 => true;
+
+ @override
+ @failingTest
+ test_navigation() => super.test_navigation();
+}
diff --git a/pkg/analysis_server/test/integration/analysis/occurrences_test.dart b/pkg/analysis_server/test/integration/analysis/occurrences_test.dart
index 94c942c..78f8ca4 100644
--- a/pkg/analysis_server/test/integration/analysis/occurrences_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/occurrences_test.dart
@@ -12,6 +12,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(OccurrencesTest);
+ defineReflectiveTests(OccurrencesTest_PreviewDart2);
});
}
@@ -66,3 +67,9 @@
});
}
}
+
+@reflectiveTest
+class OccurrencesTest_PreviewDart2 extends OccurrencesTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/outline_test.dart b/pkg/analysis_server/test/integration/analysis/outline_test.dart
index bef8bd2..048ae85 100644
--- a/pkg/analysis_server/test/integration/analysis/outline_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/outline_test.dart
@@ -12,6 +12,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(OutlineTest);
+ defineReflectiveTests(OutlineTest_PreviewDart2);
});
}
@@ -82,3 +83,9 @@
});
}
}
+
+@reflectiveTest
+class OutlineTest_PreviewDart2 extends OutlineTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/overrides_test.dart b/pkg/analysis_server/test/integration/analysis/overrides_test.dart
index 32c238c..ca1bdbea 100644
--- a/pkg/analysis_server/test/integration/analysis/overrides_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/overrides_test.dart
@@ -11,6 +11,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(OverridesTest);
+ defineReflectiveTests(OverridesTest_PreviewDart2);
});
}
@@ -120,3 +121,9 @@
});
}
}
+
+@reflectiveTest
+class OverridesTest_PreviewDart2 extends OverridesTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/package_root_test.dart b/pkg/analysis_server/test/integration/analysis/package_root_test.dart
index d2e1c2c..8423906 100644
--- a/pkg/analysis_server/test/integration/analysis/package_root_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/package_root_test.dart
@@ -13,6 +13,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(SetAnalysisRootsTest);
+ defineReflectiveTests(SetAnalysisRootsTest_PreviewDart2);
});
}
@@ -77,3 +78,9 @@
});
}
}
+
+@reflectiveTest
+class SetAnalysisRootsTest_PreviewDart2 extends SetAnalysisRootsTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/reanalyze_concurrent_test.dart b/pkg/analysis_server/test/integration/analysis/reanalyze_concurrent_test.dart
index 11b7ceb..792e290 100644
--- a/pkg/analysis_server/test/integration/analysis/reanalyze_concurrent_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/reanalyze_concurrent_test.dart
@@ -17,6 +17,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(ReanalyzeTest);
+ defineReflectiveTests(ReanalyzeTest_PreviewDart2);
});
}
@@ -47,3 +48,9 @@
});
}
}
+
+@reflectiveTest
+class ReanalyzeTest_PreviewDart2 extends ReanalyzeTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/reanalyze_test.dart b/pkg/analysis_server/test/integration/analysis/reanalyze_test.dart
index 8740ef0..23693a7 100644
--- a/pkg/analysis_server/test/integration/analysis/reanalyze_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/reanalyze_test.dart
@@ -11,6 +11,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(ReanalyzeTest);
+ defineReflectiveTests(ReanalyzeTest_PreviewDart2);
});
}
@@ -38,3 +39,9 @@
});
}
}
+
+@reflectiveTest
+class ReanalyzeTest_PreviewDart2 extends ReanalyzeTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/set_analysis_roots_test.dart b/pkg/analysis_server/test/integration/analysis/set_analysis_roots_test.dart
index f6c1d61..80869a9 100644
--- a/pkg/analysis_server/test/integration/analysis/set_analysis_roots_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/set_analysis_roots_test.dart
@@ -10,6 +10,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(SetAnalysisRootsTest);
+ defineReflectiveTests(SetAnalysisRootsTest_PreviewDart2);
});
}
@@ -30,3 +31,9 @@
expect(currentAnalysisErrors[pathname], isEmpty);
}
}
+
+@reflectiveTest
+class SetAnalysisRootsTest_PreviewDart2 extends SetAnalysisRootsTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/set_general_subscriptions_test.dart b/pkg/analysis_server/test/integration/analysis/set_general_subscriptions_test.dart
index 9d49157..3ee248a 100644
--- a/pkg/analysis_server/test/integration/analysis/set_general_subscriptions_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/set_general_subscriptions_test.dart
@@ -11,6 +11,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(SetGeneralSubscriptionsTest);
+ defineReflectiveTests(SetGeneralSubscriptionsTest_PreviewDart2);
});
}
@@ -38,3 +39,10 @@
true);
}
}
+
+@reflectiveTest
+class SetGeneralSubscriptionsTest_PreviewDart2
+ extends SetGeneralSubscriptionsTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/set_priority_files_test.dart b/pkg/analysis_server/test/integration/analysis/set_priority_files_test.dart
index 10cb1a0..6a07229 100644
--- a/pkg/analysis_server/test/integration/analysis/set_priority_files_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/set_priority_files_test.dart
@@ -11,6 +11,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(SetPriorityFilesTest);
+ defineReflectiveTests(SetPriorityFilesTest_PreviewDart2);
});
}
@@ -28,3 +29,9 @@
expect(status.analysis.isAnalyzing, false);
}
}
+
+@reflectiveTest
+class SetPriorityFilesTest_PreviewDart2 extends SetPriorityFilesTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/set_subscriptions_test.dart b/pkg/analysis_server/test/integration/analysis/set_subscriptions_test.dart
index 9524b4d..1656f80 100644
--- a/pkg/analysis_server/test/integration/analysis/set_subscriptions_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/set_subscriptions_test.dart
@@ -10,6 +10,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(SetSubscriptionsTest);
+ defineReflectiveTests(SetSubscriptionsTest_PreviewDart2);
});
}
@@ -30,3 +31,9 @@
expect(currentAnalysisErrors[pathname], isEmpty);
}
}
+
+@reflectiveTest
+class SetSubscriptionsTest_PreviewDart2 extends SetSubscriptionsTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/update_content_list_test.dart b/pkg/analysis_server/test/integration/analysis/update_content_list_test.dart
index d44cce7..c42ee65 100644
--- a/pkg/analysis_server/test/integration/analysis/update_content_list_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/update_content_list_test.dart
@@ -11,6 +11,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(UpdateContentTest);
+ defineReflectiveTests(UpdateContentTest_PreviewDart2);
});
}
@@ -50,3 +51,16 @@
});
}
}
+
+@reflectiveTest
+class UpdateContentTest_PreviewDart2 extends UpdateContentTest {
+ @override
+ bool get usePreviewDart2 => true;
+
+ @override
+ @failingTest
+ test_updateContent_list() {
+ // TODO(devoncarew): Class '_CompileTimeError' not found in library 'dart:core'.
+ return super.test_updateContent_list();
+ }
+}
diff --git a/pkg/analysis_server/test/integration/analysis/update_content_test.dart b/pkg/analysis_server/test/integration/analysis/update_content_test.dart
index 0e307b3..ac2644b 100644
--- a/pkg/analysis_server/test/integration/analysis/update_content_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/update_content_test.dart
@@ -11,6 +11,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(UpdateContentTest);
+ defineReflectiveTests(UpdateContentTest_PreviewDart2);
});
}
@@ -105,3 +106,9 @@
expect(errors2[0].location.file, equals(pathname));
}
}
+
+@reflectiveTest
+class UpdateContentTest_PreviewDart2 extends UpdateContentTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/analysis/update_options_test.dart b/pkg/analysis_server/test/integration/analysis/update_options_test.dart
index 1172d78..f4d9610 100644
--- a/pkg/analysis_server/test/integration/analysis/update_options_test.dart
+++ b/pkg/analysis_server/test/integration/analysis/update_options_test.dart
@@ -11,6 +11,7 @@
main() {
defineReflectiveSuite(() {
defineReflectiveTests(UpdateOptionsTest);
+ defineReflectiveTests(UpdateOptionsTest_PreviewDart2);
});
}
@@ -45,3 +46,9 @@
expect(getErrors(pathname), hasLength(1));
}
}
+
+@reflectiveTest
+class UpdateOptionsTest_PreviewDart2 extends UpdateOptionsTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
diff --git a/pkg/analysis_server/test/integration/completion/get_suggestions_test.dart b/pkg/analysis_server/test/integration/completion/get_suggestions_test.dart
index f2b5bd3..b3f4e19 100644
--- a/pkg/analysis_server/test/integration/completion/get_suggestions_test.dart
+++ b/pkg/analysis_server/test/integration/completion/get_suggestions_test.dart
@@ -2,8 +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.
-import 'dart:async';
-
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
@@ -124,18 +122,4 @@
class GetSuggestionsTest_PreviewDart2 extends GetSuggestionsTest {
@override
bool get usePreviewDart2 => true;
-
- @override
- @failingTest
- Future test_getSuggestions() => super.test_getSuggestions();
-
- @override
- @failingTest
- Future test_getSuggestions_onlyOverlay() =>
- super.test_getSuggestions_onlyOverlay();
-
- @override
- @failingTest
- Future test_getSuggestions_onlyOverlay_noWait() =>
- super.test_getSuggestions_onlyOverlay_noWait();
}
diff --git a/pkg/analysis_server/test/integration/edit/get_postfix_completion_test.dart b/pkg/analysis_server/test/integration/edit/get_postfix_completion_test.dart
index 69acbdf..4a3e3e9 100644
--- a/pkg/analysis_server/test/integration/edit/get_postfix_completion_test.dart
+++ b/pkg/analysis_server/test/integration/edit/get_postfix_completion_test.dart
@@ -2,8 +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.
-import 'dart:async';
-
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
diff --git a/pkg/analysis_server/test/integration/edit/organize_directives_test.dart b/pkg/analysis_server/test/integration/edit/organize_directives_test.dart
index 429c143..cc94235 100644
--- a/pkg/analysis_server/test/integration/edit/organize_directives_test.dart
+++ b/pkg/analysis_server/test/integration/edit/organize_directives_test.dart
@@ -2,8 +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.
-import 'dart:async';
-
import 'package:analysis_server/protocol/protocol_generated.dart';
import 'package:analyzer_plugin/protocol/protocol_common.dart';
import 'package:test/test.dart';
diff --git a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
index 2430ec8..3cf0ef7 100644
--- a/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/arglist_contributor_test.dart
@@ -142,22 +142,6 @@
return new ArgListContributor();
}
- fail_test_Annotation_local_constructor_named_param_10() async {
- addTestSource('''
-class A { const A({int one, String two: 'defaultValue'}); }
-@A(two: '2' ^) main() { }''');
- await computeSuggestions();
- assertSuggestions([', one: ']);
- }
-
- fail_test_Annotation_local_constructor_named_param_9() async {
- addTestSource('''
-class A { const A({int one, String two: 'defaultValue'}); }
-@A(two: '2'^) main() { }''');
- await computeSuggestions();
- assertSuggestions([', one: ']);
- }
-
test_Annotation_imported_constructor_named_param() async {
addSource('/libA.dart', '''
library libA; class A { const A({int one, String two: 'defaultValue'}); }''');
@@ -176,6 +160,15 @@
namedArgumentsWithTypes: {'one': 'int', 'two': 'String'});
}
+ @failingTest
+ test_Annotation_local_constructor_named_param_10() async {
+ addTestSource('''
+class A { const A({int one, String two: 'defaultValue'}); }
+@A(two: '2' ^) main() { }''');
+ await computeSuggestions();
+ assertSuggestions([', one: ']);
+ }
+
test_Annotation_local_constructor_named_param_11() async {
addTestSource('''
class A { const A({int one, String two: 'defaultValue'}); }
@@ -240,6 +233,15 @@
assertSuggestions(['one: ,']);
}
+ @failingTest
+ test_Annotation_local_constructor_named_param_9() async {
+ addTestSource('''
+class A { const A({int one, String two: 'defaultValue'}); }
+@A(two: '2'^) main() { }''');
+ await computeSuggestions();
+ assertSuggestions([', one: ']);
+ }
+
test_Annotation_local_constructor_named_param_negative() async {
addTestSource('''
class A { const A(int one, int two, int three, {int four, String five:
@@ -344,31 +346,6 @@
defaultArgumentListTextRanges: null);
}
- test_ArgumentList_Flutter_InstanceCreationExpression_slivers() async {
- configureFlutterPkg({
- 'src/widgets/framework.dart': flutter_framework_code +
- '\nclass CustomScrollView extends Widget { CustomScrollView('
- '\n{List<Widget> slivers}){}}'
- });
-
- addTestSource('''
-import 'package:flutter/src/widgets/framework.dart';
-
-build() => new CustomScrollView(
- ^
- );
-''');
-
- await computeSuggestions();
-
- assertSuggest('slivers: <Widget>[],',
- csKind: CompletionSuggestionKind.NAMED_ARGUMENT,
- relevance: DART_RELEVANCE_NAMED_PARAMETER,
- defaultArgListString: null,
- selectionOffset: 18,
- defaultArgumentListTextRanges: null);
- }
-
test_ArgumentList_Flutter_InstanceCreationExpression_children_dynamic() async {
// Ensure we don't generate unneeded <dynamic> param if a future API doesn't
// type it's children.
@@ -419,6 +396,31 @@
defaultArgListString: null);
}
+ test_ArgumentList_Flutter_InstanceCreationExpression_slivers() async {
+ configureFlutterPkg({
+ 'src/widgets/framework.dart': flutter_framework_code +
+ '\nclass CustomScrollView extends Widget { CustomScrollView('
+ '\n{List<Widget> slivers}){}}'
+ });
+
+ addTestSource('''
+import 'package:flutter/src/widgets/framework.dart';
+
+build() => new CustomScrollView(
+ ^
+ );
+''');
+
+ await computeSuggestions();
+
+ assertSuggest('slivers: <Widget>[],',
+ csKind: CompletionSuggestionKind.NAMED_ARGUMENT,
+ relevance: DART_RELEVANCE_NAMED_PARAMETER,
+ defaultArgListString: null,
+ selectionOffset: 18,
+ defaultArgumentListTextRanges: null);
+ }
+
test_ArgumentList_Flutter_MethodExpression_children() async {
// Ensure we don't generate params for a method call
configureFlutterPkg({
diff --git a/pkg/analysis_server/test/services/completion/dart/common_usage_sorter_test.dart b/pkg/analysis_server/test/services/completion/dart/common_usage_sorter_test.dart
index 3aa6d41..b578713 100644
--- a/pkg/analysis_server/test/services/completion/dart/common_usage_sorter_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/common_usage_sorter_test.dart
@@ -48,8 +48,26 @@
assertNoResult('A');
}
+ test_namedArgument_enum() async {
+ addTestFile('''
+enum E {e1, e2}
+f({E e}) {}
+main() {
+ f(e: ^);
+}
+''');
+ await getSuggestionsWith(<String, List<String>>{});
+ expect(replacementOffset, equals(completionOffset));
+ expect(replacementLength, equals(0));
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'E');
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'E.e1',
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
+ assertHasResult(CompletionSuggestionKind.INVOCATION, 'E.e2',
+ relevance: DART_RELEVANCE_DEFAULT + DART_RELEVANCE_INCREMENT);
+ }
+
test_PrefixedIdentifier_field() async {
- // SimpleIdentifier PrefixedIdentifeir ExpressionStatement
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
addTestFile('class A {static int s1; static int s2; x() {A.^}}');
await getSuggestionsWith({
'.A': ['s2']
@@ -65,7 +83,7 @@
}
test_PrefixedIdentifier_field_inPart() async {
- // SimpleIdentifier PrefixedIdentifeir ExpressionStatement
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
addFile('/project/bin/myLib.dart',
'library L; part "$testFile"; class A {static int s2;}');
addTestFile('part of L; foo() {A.^}');
@@ -82,7 +100,7 @@
}
test_PrefixedIdentifier_getter() async {
- // SimpleIdentifier PrefixedIdentifeir ExpressionStatement
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
addTestFile('class A {int get g1 => 1; int get g2 => 2; x() {new A().^}}');
await getSuggestionsWith({
'.A': ['g2']
@@ -98,7 +116,7 @@
}
test_PrefixedIdentifier_setter() async {
- // SimpleIdentifier PrefixedIdentifeir ExpressionStatement
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
addTestFile('class A {set s1(v) {}; set s2(v) {}; x() {new A().^}}');
await getSuggestionsWith({
'.A': ['s2']
@@ -114,7 +132,7 @@
}
test_PrefixedIdentifier_static_method() async {
- // SimpleIdentifier PrefixedIdentifeir ExpressionStatement
+ // SimpleIdentifier PrefixedIdentifier ExpressionStatement
addTestFile('import "dart:async"; class A {x() {Future.^}}');
await getSuggestionsWith({
'dart.async.Future': ['value', 'wait']
diff --git a/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
index 3bac1ad..deff0db 100644
--- a/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/keyword_contributor_test.dart
@@ -279,35 +279,6 @@
return new KeywordContributor();
}
- fail_import_partial() async {
- addTestSource('imp^ import "package:foo/foo.dart"; import "bar.dart";');
- await computeSuggestions();
- // TODO(danrubel) should not suggest declaration keywords
- assertNotSuggested('class');
- }
-
- fail_import_partial4() async {
- addTestSource('^ imp import "package:foo/foo.dart";');
- await computeSuggestions();
- // TODO(danrubel) should not suggest declaration keywords
- assertNotSuggested('class');
- }
-
- fail_import_partial5() async {
- addTestSource('library libA; imp^ import "package:foo/foo.dart";');
- await computeSuggestions();
- // TODO(danrubel) should not suggest declaration keywords
- assertNotSuggested('class');
- }
-
- fail_import_partial6() async {
- addTestSource(
- 'library bar; import "zoo.dart"; imp^ import "package:foo/foo.dart";');
- await computeSuggestions();
- // TODO(danrubel) should not suggest declaration keywords
- assertNotSuggested('class');
- }
-
test_after_class() async {
addTestSource('class A {} ^');
await computeSuggestions();
diff --git a/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
index 8df73bd..da59376 100644
--- a/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/static_member_contributor_test.dart
@@ -22,18 +22,6 @@
return new StaticMemberContributor();
}
- fail_enumConst_deprecated() async {
- addTestSource('@deprecated enum E { one, two } main() {E.^}');
- await computeSuggestions();
- assertNotSuggested('E');
- // TODO(danrubel) Investigate why enum suggestion is not marked
- // as deprecated if enum ast element is deprecated
- assertSuggestEnumConst('one', isDeprecated: true);
- assertSuggestEnumConst('two', isDeprecated: true);
- assertNotSuggested('index');
- assertSuggestField('values', 'List<E>', isDeprecated: true);
- }
-
test_enumConst() async {
addTestSource('enum E { one, two } main() {E.^}');
await computeSuggestions();
@@ -96,6 +84,19 @@
assertSuggestField('values', 'List<E>');
}
+ @failingTest
+ test_enumConst_deprecated() async {
+ addTestSource('@deprecated enum E { one, two } main() {E.^}');
+ await computeSuggestions();
+ assertNotSuggested('E');
+ // TODO(danrubel) Investigate why enum suggestion is not marked
+ // as deprecated if enum ast element is deprecated
+ assertSuggestEnumConst('one', isDeprecated: true);
+ assertSuggestEnumConst('two', isDeprecated: true);
+ assertNotSuggested('index');
+ assertSuggestField('values', 'List<E>', isDeprecated: true);
+ }
+
test_keyword() async {
addTestSource('class C { static C get instance => null; } main() {C.in^}');
await computeSuggestions();
diff --git a/pkg/analysis_server/test/services/search/search_engine_test.dart b/pkg/analysis_server/test/services/search/search_engine_test.dart
index 6c3bb33..678806c 100644
--- a/pkg/analysis_server/test/services/search/search_engine_test.dart
+++ b/pkg/analysis_server/test/services/search/search_engine_test.dart
@@ -9,6 +9,7 @@
import 'package:analyzer/dart/element/element.dart';
import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/file_system/memory_file_system.dart';
+import 'package:analyzer/source/package_map_resolver.dart';
import 'package:analyzer/src/dart/analysis/driver.dart';
import 'package:analyzer/src/dart/analysis/file_state.dart';
import 'package:analyzer/src/generated/engine.dart';
@@ -23,12 +24,12 @@
main() {
defineReflectiveSuite(() {
- defineReflectiveTests(SearchEngineImpl2Test);
+ defineReflectiveTests(SearchEngineImplTest);
});
}
@reflectiveTest
-class SearchEngineImpl2Test {
+class SearchEngineImplTest {
final MemoryResourceProvider provider = new MemoryResourceProvider();
DartSdk sdk;
final ByteStore byteStore = new MemoryByteStore();
@@ -392,31 +393,81 @@
expect(
matches.where((match) => !match.libraryElement.isInSdk), hasLength(4));
- void assertHasElement(String name) {
- expect(
- matches,
- contains(predicate((SearchMatch m) =>
- m.kind == MatchKind.DECLARATION && m.element.name == name)));
+ void assertHasOneElement(String name) {
+ Iterable<SearchMatch> nameMatches = matches.where((SearchMatch m) =>
+ m.kind == MatchKind.DECLARATION && m.element.name == name);
+ expect(nameMatches, hasLength(1));
}
- assertHasElement('A');
- assertHasElement('a');
- assertHasElement('B');
- assertHasElement('b');
+ assertHasOneElement('A');
+ assertHasOneElement('a');
+ assertHasOneElement('B');
+ assertHasOneElement('b');
}
- AnalysisDriver _newDriver() => new AnalysisDriver(
- scheduler,
- logger,
- provider,
- byteStore,
- contentOverlay,
- null,
- new SourceFactory(
- [new DartUriResolver(sdk), new ResourceUriResolver(provider)],
- null,
- provider),
- new AnalysisOptionsImpl()..strongMode = true);
+ test_searchTopLevelDeclarations_dependentPackage() async {
+ var a = _p('/a/lib/a.dart');
+ provider.newFile(a, '''
+class A {}
+''');
+ var driver1 = _newDriver();
+ driver1.addFile(a);
+
+ // The package:b uses the class A from the package:a,
+ // so it sees the declaration the element A.
+ var b = _p('/b/lib/b.dart');
+ provider.newFile(b, '''
+import 'package:a/a.dart';
+class B extends A {}
+''');
+ var driver2 = _newDriver(
+ packageUriResolver: new PackageMapUriResolver(provider, {
+ 'a': [provider.getFile(a).parent]
+ }));
+ driver2.addFile(b);
+
+ while (scheduler.isAnalyzing) {
+ await new Future.delayed(new Duration(milliseconds: 1));
+ }
+
+ var searchEngine = new SearchEngineImpl([driver1, driver2]);
+ List<SearchMatch> matches =
+ await searchEngine.searchTopLevelDeclarations('.*');
+ // We get exactly two items: A and B.
+ // I.e. we get exactly one A.
+ expect(
+ matches.where((match) => !match.libraryElement.isInSdk), hasLength(2));
+
+ void assertHasOneElement(String name) {
+ Iterable<SearchMatch> nameMatches = matches.where((SearchMatch m) =>
+ m.kind == MatchKind.DECLARATION && m.element.name == name);
+ expect(nameMatches, hasLength(1));
+ }
+
+ assertHasOneElement('A');
+ assertHasOneElement('B');
+ }
+
+ AnalysisDriver _newDriver({UriResolver packageUriResolver}) {
+ var resolvers = <UriResolver>[
+ new DartUriResolver(sdk),
+ new ResourceUriResolver(provider)
+ ];
+ if (packageUriResolver != null) {
+ resolvers.add(packageUriResolver);
+ }
+ resolvers.add(new ResourceUriResolver(provider));
+
+ return new AnalysisDriver(
+ scheduler,
+ logger,
+ provider,
+ byteStore,
+ contentOverlay,
+ null,
+ new SourceFactory(resolvers, null, provider),
+ new AnalysisOptionsImpl()..strongMode = true);
+ }
String _p(String path) => provider.convertPath(path);
}
diff --git a/pkg/analysis_server/test/src/computer/closingLabels_computer_test.dart b/pkg/analysis_server/test/src/computer/closingLabels_computer_test.dart
index 533d072..aaf6879 100644
--- a/pkg/analysis_server/test/src/computer/closingLabels_computer_test.dart
+++ b/pkg/analysis_server/test/src/computer/closingLabels_computer_test.dart
@@ -30,13 +30,15 @@
test_adjacentLinesExcluded() async {
String content = """
void myMethod() {
- return /*1*/new Thing(1,
- 2)/*1:Thing*/;
+ return /*1*/new Wrapper(
+ /*2*/new Thing(1,
+ 2)/*2:Thing*/
+ )/*1:Wrapper*/;
}
""";
var labels = await _computeElements(content);
- _compareLabels(labels, content, expectedLabelCount: 1);
+ _compareLabels(labels, content, expectedLabelCount: 2);
}
/// When constructors span many like this, the node's start position is on the first line
@@ -74,13 +76,24 @@
_compareLabels(labels, content, expectedLabelCount: 0);
}
- test_constConstructor() async {
+ test_noLabelsForOneElement() async {
String content = """
-void myMethod() {
- return /*1*/const Class(
- 1,
- 2
- )/*1:Class*/;
+Widget build(BuildContext context) {
+ return new Row(
+ );
+}
+""";
+
+ var labels = await _computeElements(content);
+ _compareLabels(labels, content, expectedLabelCount: 0);
+ }
+
+ test_labelsShownForMultipleElements() async {
+ String content = """
+Widget build(BuildContext context) {
+ return /*1*/new Row(
+ child: new RaisedButton(),
+ )/*1:Row*/;
}
""";
@@ -88,18 +101,51 @@
_compareLabels(labels, content, expectedLabelCount: 1);
}
- test_constNamedConstructor() async {
+ test_labelsShownForMultipleElements_2() async {
String content = """
-void myMethod() {
- return /*1*/const Class.fromThing(
- 1,
- 2
- )/*1:Class.fromThing*/;
+Widget build(BuildContext context) {
+ return /*1*/new Row(
+ child: /*2*/new RaisedButton(
+ onPressed: increment,
+ )/*2:RaisedButton*/,
+ )/*1:Row*/;
}
""";
var labels = await _computeElements(content);
- _compareLabels(labels, content, expectedLabelCount: 1);
+ _compareLabels(labels, content, expectedLabelCount: 2);
+ }
+
+ test_constConstructor() async {
+ String content = """
+void myMethod() {
+ return /*1*/new Wrapper(
+ /*2*/const Class(
+ 1,
+ 2
+ )/*2:Class*/
+ )/*1:Wrapper*/;
+}
+""";
+
+ var labels = await _computeElements(content);
+ _compareLabels(labels, content, expectedLabelCount: 2);
+ }
+
+ test_constNamedConstructor() async {
+ String content = """
+void myMethod() {
+ return /*1*/new Wrapper(
+ /*2*/const Class.fromThing(
+ 1,
+ 2
+ )/*2:Class.fromThing*/
+ )/*1:Wrapper*/;
+}
+""";
+
+ var labels = await _computeElements(content);
+ _compareLabels(labels, content, expectedLabelCount: 2);
}
test_knownBadCode1() async {
@@ -134,15 +180,17 @@
test_listLiterals() async {
String content = """
void myMethod() {
- return Widget.createWidget(/*1*/<Widget>[
- 1,
- 2
- ]/*1:<Widget>[]*/);
+ return /*1*/new Wrapper(
+ Widget.createWidget(/*2*/<Widget>[
+ 1,
+ 2
+ ]/*2:<Widget>[]*/)
+ )/*1:Wrapper*/;
}
""";
var labels = await _computeElements(content);
- _compareLabels(labels, content, expectedLabelCount: 1);
+ _compareLabels(labels, content, expectedLabelCount: 2);
}
/// When a line contains the end of a label, we need to ensure we also include any
@@ -192,102 +240,116 @@
test_newConstructor() async {
String content = """
void myMethod() {
- return /*1*/new Class(
- 1,
- 2
- )/*1:Class*/;
+ return /*1*/new Wrapper(
+ /*2*/new Class(
+ 1,
+ 2
+ )/*2:Class*/
+ )/*1:Wrapper*/;
}
""";
var labels = await _computeElements(content);
- _compareLabels(labels, content, expectedLabelCount: 1);
+ _compareLabels(labels, content, expectedLabelCount: 2);
}
test_newNamedConstructor() async {
String content = """
void myMethod() {
- return /*1*/new Class.fromThing(
- 1,
- 2
- )/*1:Class.fromThing*/;
+ return /*1*/new Wrapper(
+ /*2*/new Class.fromThing(
+ 1,
+ 2
+ )/*2:Class.fromThing*/
+ )/*1:Wrapper*/;
}
""";
var labels = await _computeElements(content);
- _compareLabels(labels, content, expectedLabelCount: 1);
+ _compareLabels(labels, content, expectedLabelCount: 2);
}
test_NoLabelsFromInterpolatedStrings() async {
String content = """
void main(HighlightRegionType type, int offset, int length) {
- /*1*/new Fail(
- 'Not expected to find (offset=\$offset; length=\$length; type=\$type) in\\n'
- '\${regions.join('\\n')}')/*1:Fail*/;
+ /*1*/new Wrapper(
+ /*2*/new Fail(
+ 'Not expected to find (offset=\$offset; length=\$length; type=\$type) in\\n'
+ '\${regions.join('\\n')}')/*2:Fail*/
+ )/*1:Wrapper*/;
}
""";
var labels = await _computeElements(content);
- _compareLabels(labels, content, expectedLabelCount: 1);
+ _compareLabels(labels, content, expectedLabelCount: 2);
}
test_prefixedConstConstructor() async {
String content = """
import 'dart:async' as a;
void myMethod() {
- return /*1*/const a.Future(
- 1,
- 2
- )/*1:a.Future*/;
+ return /*1*/new Wrapper(
+ /*2*/const a.Future(
+ 1,
+ 2
+ )/*2:a.Future*/
+ )/*1:Wrapper*/;
}
""";
var labels = await _computeElements(content);
- _compareLabels(labels, content, expectedLabelCount: 1);
+ _compareLabels(labels, content, expectedLabelCount: 2);
}
test_prefixedConstNamedConstructor() async {
String content = """
import 'dart:async' as a;
void myMethod() {
- return /*1*/const a.Future.delayed(
- 1,
- 2
- )/*1:a.Future.delayed*/;
+ return /*1*/new Wrapper(
+ /*2*/const a.Future.delayed(
+ 1,
+ 2
+ )/*2:a.Future.delayed*/
+ )/*1:Wrapper*/;
}
""";
var labels = await _computeElements(content);
- _compareLabels(labels, content, expectedLabelCount: 1);
+ _compareLabels(labels, content, expectedLabelCount: 2);
}
test_prefixedNewConstructor() async {
String content = """
import 'dart:async' as a;
void myMethod() {
- return /*1*/new a.Future(
- 1,
- 2
- )/*1:a.Future*/;
+ return /*1*/new Wrapper(
+ /*2*/new a.Future(
+ 1,
+ 2
+ )/*2:a.Future*/
+ )/*1:Wrapper*/;
}
""";
var labels = await _computeElements(content);
- _compareLabels(labels, content, expectedLabelCount: 1);
+ _compareLabels(labels, content, expectedLabelCount: 2);
}
test_prefixedNewNamedConstructor() async {
String content = """
import 'dart:async' as a;
void myMethod() {
- return /*1*/new a.Future.delayed(
- 1,
- 2
- )/*1:a.Future.delayed*/;
+ return /*1*/new Wrapper(
+ /*2*/new a.Future.delayed(
+ 1,
+ 2
+ )/*2:a.Future.delayed*/
+ )/*1:Wrapper*/;
}
""";
var labels = await _computeElements(content);
- _compareLabels(labels, content, expectedLabelCount: 1);
+ _compareLabels(labels, content, expectedLabelCount: 2);
}
test_sameLineExcluded() async {
@@ -303,7 +365,7 @@
/// Compares provided closing labels with expected
/// labels extracted from the comments in the provided content.
- _compareLabels(List<ClosingLabel> labels, String content,
+ void _compareLabels(List<ClosingLabel> labels, String content,
{int expectedLabelCount}) {
// Require the test pass us the expected count to guard
// against expected annotations being mistyped and not
diff --git a/pkg/analyzer/lib/dart/element/element.dart b/pkg/analyzer/lib/dart/element/element.dart
index 555f10d..c618f14 100644
--- a/pkg/analyzer/lib/dart/element/element.dart
+++ b/pkg/analyzer/lib/dart/element/element.dart
@@ -665,6 +665,10 @@
*/
bool get isSynthetic;
+ /// Return `true` if this element has an annotation of the form
+ /// '@visibleForTesting'.
+ bool get isVisibleForTesting;
+
/**
* Return the kind of element that this is.
*/
@@ -873,6 +877,10 @@
*/
bool get isRequired;
+ /// Return `true` if this annotation marks the associated member as being
+ /// visible for testing.
+ bool get isVisibleForTesting;
+
/**
* Return a representation of the value of this annotation, forcing the value
* to be computed if it had not previously been computed, or `null` if the
diff --git a/pkg/analyzer/lib/error/error.dart b/pkg/analyzer/lib/error/error.dart
index af34a92..34148ff 100644
--- a/pkg/analyzer/lib/error/error.dart
+++ b/pkg/analyzer/lib/error/error.dart
@@ -261,6 +261,7 @@
HintCode.INVALID_METHOD_OVERRIDE_TYPE_PARAMETER_BOUND,
HintCode.INVALID_REQUIRED_PARAM,
HintCode.INVALID_USE_OF_PROTECTED_MEMBER,
+ HintCode.INVALID_USE_OF_VISIBLE_FOR_TESTING_MEMBER,
HintCode.IS_DOUBLE,
HintCode.IS_INT,
HintCode.IS_NOT_DOUBLE,
@@ -532,6 +533,7 @@
StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE,
StaticWarningCode.ASSIGNMENT_TO_CONST,
StaticWarningCode.ASSIGNMENT_TO_FINAL,
+ StaticWarningCode.ASSIGNMENT_TO_FINAL_LOCAL,
StaticWarningCode.ASSIGNMENT_TO_FINAL_NO_SETTER,
StaticWarningCode.ASSIGNMENT_TO_FUNCTION,
StaticWarningCode.ASSIGNMENT_TO_METHOD,
@@ -608,7 +610,6 @@
StaticWarningCode.STATIC_ACCESS_TO_INSTANCE_MEMBER,
StaticWarningCode.SWITCH_EXPRESSION_NOT_ASSIGNABLE,
StaticWarningCode.TYPE_ANNOTATION_DEFERRED_CLASS,
- StaticWarningCode.TYPE_ANNOTATION_GENERIC_FUNCTION_PARAMETER,
StaticWarningCode.TYPE_PARAMETER_REFERENCED_BY_STATIC,
StaticWarningCode.TYPE_TEST_WITH_NON_TYPE,
StaticWarningCode.TYPE_TEST_WITH_UNDEFINED_NAME,
@@ -666,7 +667,6 @@
StrongModeCode.TOP_LEVEL_INSTANCE_GETTER,
StrongModeCode.TOP_LEVEL_TYPE_ARGUMENTS,
StrongModeCode.TOP_LEVEL_UNSUPPORTED,
- StrongModeCode.UNSAFE_BLOCK_CLOSURE_INFERENCE,
TodoCode.TODO,
];
diff --git a/pkg/analyzer/lib/src/context/builder.dart b/pkg/analyzer/lib/src/context/builder.dart
index 4d06fb1..6bccdb7 100644
--- a/pkg/analyzer/lib/src/context/builder.dart
+++ b/pkg/analyzer/lib/src/context/builder.dart
@@ -32,6 +32,7 @@
import 'package:analyzer/src/services/lint.dart';
import 'package:analyzer/src/summary/summary_sdk.dart';
import 'package:analyzer/src/task/options.dart';
+import 'package:analyzer/src/util/sdk.dart';
import 'package:args/args.dart';
import 'package:front_end/src/api_prototype/byte_store.dart';
import 'package:front_end/src/base/performance_logger.dart';
@@ -171,6 +172,19 @@
getAnalysisOptions(path, contextRoot: contextRoot);
//_processAnalysisOptions(context, optionMap);
final sf = createSourceFactory(path, options);
+
+ // The folder with `vm_platform_strong.dill`, which has required patches.
+ Folder kernelPlatformFolder;
+ if (previewDart2) {
+ DartSdk sdk = sf.dartSdk;
+ if (sdk is FolderBasedDartSdk) {
+ var binariesPath = computePlatformBinariesPath(sdk.directory.path);
+ if (binariesPath != null) {
+ kernelPlatformFolder = resourceProvider.getFolder(binariesPath);
+ }
+ }
+ }
+
AnalysisDriver driver = new AnalysisDriver(
analysisDriverScheduler,
performanceLog,
@@ -180,7 +194,8 @@
contextRoot,
sf,
options,
- enableKernelDriver: previewDart2);
+ enableKernelDriver: previewDart2,
+ kernelPlatformFolder: kernelPlatformFolder);
// temporary plugin support:
if (onCreateAnalysisDriver != null) {
onCreateAnalysisDriver(driver, analysisDriverScheduler, performanceLog,
diff --git a/pkg/analyzer/lib/src/dart/analysis/kernel_context.dart b/pkg/analyzer/lib/src/dart/analysis/kernel_context.dart
index 47ebc2e..be948b9 100644
--- a/pkg/analyzer/lib/src/dart/analysis/kernel_context.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/kernel_context.dart
@@ -84,14 +84,16 @@
var uriTranslator = new UriTranslatorImpl(
new TargetLibrariesSpecification('none', dartLibraries), packages);
+ var errorListener = new KernelErrorListener();
var options = new ProcessedOptions(new CompilerOptions()
..target = new _AnalysisTarget(
new TargetFlags(strongMode: analysisOptions.strongMode))
..reportMessages = false
..logger = logger
..fileSystem = new _FileSystemAdaptor(fsState, pathContext)
- ..byteStore = byteStore);
- return new KernelDriver(options, uriTranslator,
+ ..byteStore = byteStore
+ ..onError = errorListener.onError);
+ return new KernelDriver(options, uriTranslator, errorListener,
metadataFactory: new AnalyzerMetadataFactory(),
sdkOutlineBytes: sdkOutlineBytes);
}
@@ -171,7 +173,7 @@
}
kernelResult.dependencies.forEach(addLibrary);
- addLibrary(kernelResult.library);
+ addLibrary(kernelResult.libraryResult.library);
if (DEBUG) {
print('----------- ${targetLibrary.uriStr}');
diff --git a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
index e7a18bb..5ac8673 100644
--- a/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
+++ b/pkg/analyzer/lib/src/dart/analysis/library_analyzer.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:async';
+import 'dart:collection';
import 'package:analyzer/context/declared_variables.dart';
import 'package:analyzer/dart/ast/ast.dart';
@@ -23,6 +24,7 @@
import 'package:analyzer/src/dart/element/type.dart';
import 'package:analyzer/src/error/codes.dart';
import 'package:analyzer/src/error/pending_error.dart';
+import 'package:analyzer/src/fasta/error_converter.dart';
import 'package:analyzer/src/fasta/resolution_applier.dart';
import 'package:analyzer/src/fasta/resolution_storer.dart' as kernel;
import 'package:analyzer/src/generated/declaration_resolver.dart';
@@ -196,7 +198,7 @@
// TODO(scheglov) Improve.
AnalyzerTarget analyzerTarget;
- await _kernelDriver.compileLibrary(
+ final kernelResult = await _kernelDriver.compileLibrary(
(fileSystem, bool includeComments, dillTarget, uriTranslator,
{metadataCollector}) =>
analyzerTarget ??= new AnalyzerTarget(fileSystem, dillTarget,
@@ -207,6 +209,18 @@
units.forEach((file, unit) {
_resolveFile2(file, unit, resolutions);
_computePendingMissingRequiredParameters(file, unit);
+
+ // Invalid part URIs can result in an element with a null source
+ if (unit.element.source != null) {
+ final errorListener = new FastaErrorReporter(
+ new ErrorReporter(_getErrorListener(file), unit.element.source));
+ final libraryKernelResult = kernelResult.results
+ .expand((r) => r.libraryResults)
+ .where((r) => r.library.importUri == unit.element.source.uri)
+ .firstWhere((_) => true, orElse: () => null);
+ libraryKernelResult?.errors?.forEach((kernelError) =>
+ errorListener.reportCompilationMessage(kernelError));
+ }
});
_computeConstants();
@@ -724,24 +738,33 @@
}
for (var member in declaration.members) {
if (member is ConstructorDeclaration) {
- var context = member.element as ElementImpl;
- var resolution = resolutions.next();
- var applier = _createResolutionApplier(context, resolution);
- member.initializers.accept(applier);
- member.parameters.accept(applier);
- member.body.accept(applier);
- applier.applyToAnnotations(member);
- applier.checkDone();
+ var context = member.element as ConstructorElementImpl;
+ ConstructorName redirectName = member.redirectedConstructor;
+ if (redirectName != null) {
+ var redirectedConstructor = context.redirectedConstructor;
+ redirectName.staticElement = redirectedConstructor;
+ ResolutionApplier.applyConstructorElement(
+ redirectedConstructor.returnType,
+ redirectedConstructor,
+ redirectName);
+ // TODO(scheglov) Add support for type parameterized redirects.
+ } else {
+ var resolution = resolutions.next();
+ var applier = _createResolutionApplier(context, resolution);
+ member.initializers.accept(applier);
+ member.parameters.accept(applier);
+ member.body.accept(applier);
+ applier.applyToAnnotations(member);
+ applier.checkDone();
+ }
} else if (member is FieldDeclaration) {
List<VariableDeclaration> fields = member.fields.variables;
- if (fields.length != 1) {
- // TODO(scheglov) Handle this case.
- throw new UnimplementedError('Multiple field');
- }
var context = fields[0].element as ElementImpl;
var resolution = resolutions.next();
var applier = _createResolutionApplier(context, resolution);
- fields[0].initializer?.accept(applier);
+ for (var field in fields.reversed) {
+ field.initializer?.accept(applier);
+ }
applier.applyToAnnotations(member);
applier.checkDone();
} else if (member is MethodDeclaration) {
@@ -772,14 +795,12 @@
// No bodies to resolve.
} else if (declaration is TopLevelVariableDeclaration) {
List<VariableDeclaration> variables = declaration.variables.variables;
- if (variables.length != 1) {
- // TODO(scheglov) Handle this case.
- throw new UnimplementedError('Multiple variables');
- }
var context = variables[0].element as ElementImpl;
var resolution = resolutions.next();
var applier = _createResolutionApplier(context, resolution);
- variables[0].initializer?.accept(applier);
+ for (var variable in variables.reversed) {
+ variable.initializer?.accept(applier);
+ }
applier.applyToAnnotations(declaration);
applier.checkDone();
} else {
@@ -999,10 +1020,11 @@
ElementImpl context;
List<Element> declaredElements = [];
- Map<kernel.TreeNode, Element> declarationToElement = {};
- Map<FunctionElementImpl, kernel.TreeNode> functionElementToDeclaration = {};
+ Map<kernel.TreeNode, Element> declarationToElement = new HashMap.identity();
+ Map<FunctionElementImpl, kernel.TreeNode> functionElementToDeclaration =
+ new HashMap.identity();
Map<ParameterElementImpl, kernel.VariableDeclaration>
- parameterElementToDeclaration = {};
+ parameterElementToDeclaration = new HashMap.identity();
ResolutionApplier applier;
@@ -1050,6 +1072,8 @@
element = resynthesizer
.getElementFromCanonicalName(referencedNode.canonicalName);
assert(element != null);
+ } else if (referencedNode is kernel.DynamicType) {
+ element = DynamicElementImpl.instance;
} else if (referencedNode is kernel.FunctionType) {
element = resynthesizer
.getElementFromCanonicalName(referencedNode.typedef.canonicalName);
@@ -1059,24 +1083,32 @@
referencedNode.classNode.canonicalName);
assert(element != null);
} else if (referencedNode is kernel.MemberGetterNode) {
- var memberElement = resynthesizer
- .getElementFromCanonicalName(referencedNode.member.canonicalName);
- assert(memberElement != null);
- if (memberElement is PropertyInducingElementImpl) {
- element = memberElement.getter;
- assert(element != null);
+ if (referencedNode.member == null) {
+ element = null;
} else {
- element = memberElement;
+ var memberElement = resynthesizer
+ .getElementFromCanonicalName(referencedNode.member.canonicalName);
+ assert(memberElement != null);
+ if (memberElement is PropertyInducingElementImpl) {
+ element = memberElement.getter;
+ assert(element != null);
+ } else {
+ element = memberElement;
+ }
}
} else if (referencedNode is kernel.MemberSetterNode) {
- var memberElement = resynthesizer
- .getElementFromCanonicalName(referencedNode.member.canonicalName);
- assert(memberElement != null);
- if (memberElement is PropertyInducingElementImpl) {
- element = memberElement.setter;
- assert(element != null);
+ if (referencedNode.member == null) {
+ element = null;
} else {
- element = memberElement;
+ var memberElement = resynthesizer
+ .getElementFromCanonicalName(referencedNode.member.canonicalName);
+ assert(memberElement != null);
+ if (memberElement is PropertyInducingElementImpl) {
+ element = memberElement.setter;
+ assert(element != null);
+ } else {
+ element = memberElement;
+ }
}
} else if (referencedNode is kernel.NullNode) {
element = null;
@@ -1091,13 +1123,13 @@
referencedElements.add(element);
}
- applier = new ResolutionApplier(
+ applier = new ValidatingResolutionApplier(
this,
declaredElements,
- resolution.declarationOffsets,
referencedElements,
- resolution.referenceOffsets,
resolution.kernelTypes,
+ resolution.declarationOffsets,
+ resolution.referenceOffsets,
resolution.typeOffsets);
}
@@ -1187,7 +1219,8 @@
return element.type;
} else if (kernelType is kernel.MemberInvocationDartType) {
kernel.Member member = kernelType.member;
- if (member != null) {
+ if (member is kernel.Procedure &&
+ member.kind == kernel.ProcedureKind.Method) {
ExecutableElementImpl element =
resynthesizer.getElementFromCanonicalName(member.canonicalName);
return resynthesizer.instantiateFunctionType(
@@ -1197,7 +1230,7 @@
member.function.functionType.withoutTypeParameters,
kernelType.type);
}
- return null;
+ return DynamicTypeImpl.instance;
} else if (kernelType is kernel.IndexAssignNullFunctionType) {
return null;
} else {
diff --git a/pkg/analyzer/lib/src/dart/element/element.dart b/pkg/analyzer/lib/src/dart/element/element.dart
index 5c534f9..0f26c2c 100644
--- a/pkg/analyzer/lib/src/dart/element/element.dart
+++ b/pkg/analyzer/lib/src/dart/element/element.dart
@@ -2874,6 +2874,10 @@
*/
static String _REQUIRED_VARIABLE_NAME = "required";
+ /// The name of the top-level variable used to mark a method as being
+ /// visible for testing.
+ static String _VISIBLE_FOR_TESTING_VARIABLE_NAME = "visibleForTesting";
+
/**
* The element representing the field, variable, or constructor being used as
* an annotation.
@@ -2988,6 +2992,12 @@
element.name == _REQUIRED_VARIABLE_NAME &&
element.library?.name == _META_LIB_NAME;
+ @override
+ bool get isVisibleForTesting =>
+ element is PropertyAccessorElement &&
+ element.name == _VISIBLE_FOR_TESTING_VARIABLE_NAME &&
+ element.library?.name == _META_LIB_NAME;
+
/**
* Get the library containing this annotation.
*/
@@ -3260,6 +3270,10 @@
}
@override
+ bool get isVisibleForTesting => metadata
+ .any((ElementAnnotation annotation) => annotation.isVisibleForTesting);
+
+ @override
LibraryElement get library =>
getAncestor((element) => element is LibraryElement);
@@ -7465,6 +7479,9 @@
bool get isSynthetic => true;
@override
+ bool get isVisibleForTesting => false;
+
+ @override
ElementKind get kind => ElementKind.ERROR;
@override
diff --git a/pkg/analyzer/lib/src/dart/element/handle.dart b/pkg/analyzer/lib/src/dart/element/handle.dart
index f26e94e..062b10f 100644
--- a/pkg/analyzer/lib/src/dart/element/handle.dart
+++ b/pkg/analyzer/lib/src/dart/element/handle.dart
@@ -378,6 +378,9 @@
bool get isSynthetic => actualElement.isSynthetic;
@override
+ bool get isVisibleForTesting => actualElement.isVisibleForTesting;
+
+ @override
LibraryElement get library =>
getAncestor((element) => element is LibraryElement);
diff --git a/pkg/analyzer/lib/src/dart/element/member.dart b/pkg/analyzer/lib/src/dart/element/member.dart
index ef78722..ac66f59 100644
--- a/pkg/analyzer/lib/src/dart/element/member.dart
+++ b/pkg/analyzer/lib/src/dart/element/member.dart
@@ -424,6 +424,9 @@
bool get isSynthetic => _baseElement.isSynthetic;
@override
+ bool get isVisibleForTesting => _baseElement.isVisibleForTesting;
+
+ @override
ElementKind get kind => _baseElement.kind;
@override
diff --git a/pkg/analyzer/lib/src/dart/error/hint_codes.dart b/pkg/analyzer/lib/src/dart/error/hint_codes.dart
index 63067a8..eb7771a 100644
--- a/pkg/analyzer/lib/src/dart/error/hint_codes.dart
+++ b/pkg/analyzer/lib/src/dart/error/hint_codes.dart
@@ -303,6 +303,16 @@
"The member '{0}' can only be used within instance members of subclasses "
"of '{1}'.");
+ /// This hint is generated anywhere where a member annotated with
+ /// `@visibleForTesting` is used outside the defining library, or a test.
+ ///
+ /// Parameters:
+ /// 0: the name of the member
+ /// 1: the name of the defining class
+ static const HintCode INVALID_USE_OF_VISIBLE_FOR_TESTING_MEMBER =
+ const HintCode('INVALID_USE_OF_VISIBLE_FOR_TESTING_MEMBER',
+ "The member '{0}' can only be used within '{1}' or a test.");
+
/**
* Hint for the `x is double` type checks.
*/
diff --git a/pkg/analyzer/lib/src/error/codes.dart b/pkg/analyzer/lib/src/error/codes.dart
index 346daf9..6241319 100644
--- a/pkg/analyzer/lib/src/error/codes.dart
+++ b/pkg/analyzer/lib/src/error/codes.dart
@@ -3325,6 +3325,17 @@
* a NoSuchMethodError to be thrown, because no setter is defined for it. The
* assignment will also give rise to a static warning for the same reason.
*/
+ static const StaticWarningCode ASSIGNMENT_TO_FINAL_LOCAL =
+ const StaticWarningCode(
+ 'ASSIGNMENT_TO_FINAL_LOCAL',
+ "'{0}', a final variable, can only be set once.",
+ "Try making '{0}' non-final.");
+
+ /**
+ * 5 Variables: Attempting to assign to a final variable elsewhere will cause
+ * a NoSuchMethodError to be thrown, because no setter is defined for it. The
+ * assignment will also give rise to a static warning for the same reason.
+ */
static const StaticWarningCode ASSIGNMENT_TO_FINAL_NO_SETTER =
const StaticWarningCode(
'ASSIGNMENT_TO_FINAL_NO_SETTER',
@@ -4523,19 +4534,6 @@
"changing the import to not be deferred.");
/**
- * Not yet spec'd.
- *
- * Parameters:
- * 0: the name of the generic function's type parameter that is being used in
- * an `is` expression
- */
- static const StaticWarningCode TYPE_ANNOTATION_GENERIC_FUNCTION_PARAMETER =
- const StaticWarningCode(
- 'TYPE_ANNOTATION_GENERIC_FUNCTION_PARAMETER',
- "The type parameter '{0}' can't be used in a type test.",
- "Try using a different type.");
-
- /**
* 12.31 Type Test: It is a static warning if <i>T</i> does not denote a type
* available in the current lexical scope.
*/
@@ -5038,12 +5036,6 @@
"The type of '{0}' can't be inferred because {1} expressions aren't supported.",
"Try adding an explicit type for '{0}'.");
- static const StrongModeCode UNSAFE_BLOCK_CLOSURE_INFERENCE = const StrongModeCode(
- ErrorType.STATIC_WARNING,
- 'UNSAFE_BLOCK_CLOSURE_INFERENCE',
- "Unsafe use of a block closure in a type-inferred variable outside a function body.",
- "Try adding a type annotation for '{0}'. See dartbug.com/26947.");
-
@override
final ErrorType type;
diff --git a/pkg/analyzer/lib/src/fasta/ast_builder.dart b/pkg/analyzer/lib/src/fasta/ast_builder.dart
index 463735d..6d25fab 100644
--- a/pkg/analyzer/lib/src/fasta/ast_builder.dart
+++ b/pkg/analyzer/lib/src/fasta/ast_builder.dart
@@ -171,6 +171,7 @@
leftParenthesis, expression, leftParenthesis?.endGroup));
}
+ @override
void handleStringPart(Token literalString) {
assert(identical(literalString.kind, STRING_TOKEN));
debugEvent("StringPart");
@@ -178,6 +179,13 @@
push(literalString);
}
+ @override
+ void handleInterpolationExpression(Token leftBracket, Token rightBracket) {
+ Expression expression = pop();
+ push(ast.interpolationExpression(leftBracket, expression, rightBracket));
+ }
+
+ @override
void endLiteralString(int interpolationCount, Token endToken) {
debugEvent("endLiteralString");
@@ -197,8 +205,8 @@
var part = parts[i];
if (part is Token) {
elements.add(ast.interpolationString(part, part.lexeme));
- } else if (part is Expression) {
- elements.add(ast.interpolationExpression(null, part, null));
+ } else if (part is InterpolationExpression) {
+ elements.add(part);
} else {
unhandled("${part.runtimeType}", "string interpolation",
first.charOffset, uri);
@@ -2027,8 +2035,7 @@
optional('set', getOrSet));
debugEvent("Method");
- FunctionBody body = pop();
- ConstructorName redirectedConstructor = null; // TODO(paulberry)
+ var bodyObject = pop();
List<ConstructorInitializer> initializers = pop() ?? const [];
Token separator = pop();
FormalParameterList parameters = pop();
@@ -2039,6 +2046,19 @@
List<Annotation> metadata = pop();
Comment comment = _findComment(metadata, beginToken);
+ ConstructorName redirectedConstructor;
+ FunctionBody body;
+ if (bodyObject is FunctionBody) {
+ body = bodyObject;
+ } else if (bodyObject is _RedirectingFactoryBody) {
+ separator = bodyObject.equalToken;
+ redirectedConstructor = bodyObject.constructorName;
+ body = ast.emptyFunctionBody(endToken);
+ } else {
+ unhandled("${bodyObject.runtimeType}", "bodyObject",
+ beginToken.charOffset, uri);
+ }
+
if (parameters == null && (getOrSet == null || optional('set', getOrSet))) {
Token previous = typeParameters?.endToken;
if (previous == null) {
diff --git a/pkg/analyzer/lib/src/fasta/error_converter.dart b/pkg/analyzer/lib/src/fasta/error_converter.dart
index f93c156..a4c0bec 100644
--- a/pkg/analyzer/lib/src/fasta/error_converter.dart
+++ b/pkg/analyzer/lib/src/fasta/error_converter.dart
@@ -5,6 +5,7 @@
import 'package:analyzer/analyzer.dart';
import 'package:analyzer/dart/ast/token.dart' show Token;
import 'package:analyzer/src/dart/error/syntactic_errors.dart';
+import 'package:front_end/src/api_prototype/compilation_message.dart';
import 'package:front_end/src/fasta/messages.dart' show Code, Message;
/// An error reporter that knows how to convert a Fasta error into an analyzer
@@ -17,12 +18,8 @@
/// [errorReporter].
FastaErrorReporter(this.errorReporter);
- /// Report an error based on the given [message] whose range is described by
- /// the given [offset] and [length].
- void reportMessage(Message message, int offset, int length) {
- Code code = message.code;
- Map<String, dynamic> arguments = message.arguments;
-
+ void reportByCode(String analyzerCode, int offset, int length,
+ Map<String, dynamic> arguments) {
String stringOrTokenLexeme() {
var text = arguments['string'];
if (text == null) {
@@ -34,7 +31,7 @@
return text;
}
- switch (code.analyzerCode) {
+ switch (analyzerCode) {
case "ABSTRACT_CLASS_MEMBER":
errorReporter?.reportErrorForOffset(
ParserErrorCode.ABSTRACT_CLASS_MEMBER, offset, length);
@@ -408,6 +405,12 @@
errorReporter?.reportErrorForOffset(
ParserErrorCode.PREFIX_AFTER_COMBINATOR, offset, length);
return;
+ case "REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR":
+ errorReporter?.reportErrorForOffset(
+ ParserErrorCode.REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR,
+ offset,
+ length);
+ return;
case "RETURN_IN_GENERATOR":
errorReporter?.reportErrorForOffset(
CompileTimeErrorCode.RETURN_IN_GENERATOR, offset, length);
@@ -502,4 +505,40 @@
// fall through
}
}
+
+ void reportCompilationMessage(CompilationMessage message) {
+ // TODO(mfairhurst) Disable this once the codes are already analyzer
+ // format (#31644)
+ final analyzerCode =
+ message.code.runes.fold<List<String>>(<String>[], (words, charcode) {
+ final char = new String.fromCharCode(charcode);
+ if (char.toUpperCase() == char) {
+ words.add(char);
+ } else {
+ words[words.length - 1] = words.last + char.toUpperCase();
+ }
+ return words;
+ }).join('_');
+
+ final code = errorCodeByUniqueName(analyzerCode);
+ if (code != null) {
+ errorReporter.reportError(new AnalysisError.forValues(
+ errorReporter.source,
+ message.span.start.offset,
+ message.span.length,
+ code,
+ message.message,
+ message.tip));
+ } else {
+ // TODO(mfairhurst) throw here, and fail all tests that trip this.
+ }
+ }
+
+ /// Report an error based on the given [message] whose range is described by
+ /// the given [offset] and [length].
+ void reportMessage(Message message, int offset, int length) {
+ Code code = message.code;
+
+ reportByCode(code.analyzerCode, offset, length, message.arguments);
+ }
}
diff --git a/pkg/analyzer/lib/src/fasta/resolution_applier.dart b/pkg/analyzer/lib/src/fasta/resolution_applier.dart
index 80281aa..1cf2182 100644
--- a/pkg/analyzer/lib/src/fasta/resolution_applier.dart
+++ b/pkg/analyzer/lib/src/fasta/resolution_applier.dart
@@ -19,21 +19,15 @@
/// Visitor that applies resolution data from the front end (obtained via
/// [ResolutionStorer]) to an analyzer AST.
class ResolutionApplier extends GeneralizingAstVisitor {
- /// Indicates whether debug messages should be printed.
- static const bool _debug = false;
-
final TypeContext _typeContext;
final List<Element> _declaredElements;
- final List<int> _declaredElementOffsets;
int _declaredElementIndex = 0;
final List<Element> _referencedElements;
- final List<int> _referencedElementOffsets;
int _referencedElementIndex = 0;
final List<kernel.DartType> _types;
- final List<int> _typeOffsets;
int _typeIndex = 0;
/// Indicates whether we are applying resolution to an annotation.
@@ -42,14 +36,8 @@
/// with corresponding getters.
bool _inAnnotation = false;
- ResolutionApplier(
- this._typeContext,
- this._declaredElements,
- this._declaredElementOffsets,
- this._referencedElements,
- this._referencedElementOffsets,
- this._types,
- this._typeOffsets);
+ ResolutionApplier(this._typeContext, this._declaredElements,
+ this._referencedElements, this._types);
/// Apply resolution to annotations of the given [node].
void applyToAnnotations(AnnotatedNode node) {
@@ -62,15 +50,15 @@
void checkDone() {
if (_declaredElementIndex != _declaredElements.length) {
throw new StateError('Some declarations were not consumed, starting at '
- 'offset ${_declaredElementOffsets[_declaredElementIndex]}');
+ '${_declaredElements[_declaredElementIndex]}');
}
if (_referencedElementIndex != _referencedElements.length) {
throw new StateError('Some references were not consumed, starting at '
- 'offset ${_referencedElementOffsets[_referencedElementIndex]}');
+ '${_referencedElements[_referencedElementIndex]}');
}
if (_typeIndex != _types.length) {
- throw new StateError('Some types were not consumed, starting at offset '
- '${_typeOffsets[_typeIndex]}');
+ throw new StateError(
+ 'Some types were not consumed, starting at ${_types[_typeIndex]}');
}
}
@@ -251,7 +239,7 @@
}
}
- _applyParameters(element.parameters, parameterList.parameters);
+ applyParameters(element.parameters, parameterList);
}
functionExpression.body?.accept(this);
@@ -269,7 +257,7 @@
if (element != null) {
node.element = element;
node.staticType = element.type;
- _applyParameters(element.parameters, parameterList.parameters);
+ applyParameters(element.parameters, parameterList);
}
// Apply resolution to default values.
@@ -314,33 +302,15 @@
DartType type = _getTypeFor(constructorName);
ConstructorElement element = _getReferenceFor(constructorName);
- ClassElement classElement = element?.enclosingElement;
node.staticElement = element;
node.staticType = type;
- Identifier typeIdentifier = constructorName.type.name;
- if (typeIdentifier is SimpleIdentifier) {
- applyToTypeAnnotation(type, constructorName.type);
- if (constructorName.name != null) {
- constructorName.name.staticElement = element;
- }
- } else if (typeIdentifier is PrefixedIdentifier) {
- // TODO(scheglov) Rewrite AST using knowledge about prefixes.
- // TODO(scheglov) Add support for `new prefix.Type()`.
- // TODO(scheglov) Add support for `new prefix.Type.name()`.
- assert(constructorName.name == null);
- constructorName.period = typeIdentifier.period;
- constructorName.name = typeIdentifier.identifier;
- SimpleIdentifier classNode = typeIdentifier.prefix;
- constructorName.type = astFactory.typeName(classNode, null);
- classNode.staticElement = classElement;
- classNode.staticType = type;
- constructorName.name.staticElement = element;
- }
+ applyConstructorElement(type, element, constructorName);
- node.argumentList?.accept(this);
- _associateArgumentsWithParameters(element?.parameters, node.argumentList);
+ ArgumentList argumentList = node.argumentList;
+ _associateArgumentsWithParameters(element?.parameters, argumentList);
+ _applyResolutionToArguments(argumentList);
}
@override
@@ -376,13 +346,18 @@
ArgumentList argumentList = node.argumentList;
- _getReferenceFor(node.methodName); // raw element
+ Element invokeElement = _getReferenceFor(node.methodName);
DartType invokeType = _getTypeFor(node.methodName);
DartType resultType = _getTypeFor(argumentList);
+ if (invokeElement is PropertyInducingElement) {
+ PropertyInducingElement property = invokeElement;
+ invokeElement = property.getter;
+ }
+
node.staticInvokeType = invokeType;
node.staticType = resultType;
- node.methodName.staticElement = invokeType.element;
+ node.methodName.staticElement = invokeElement;
node.methodName.staticType = invokeType;
if (invokeType is FunctionType) {
@@ -392,15 +367,7 @@
_associateArgumentsWithParameters(invokeType.parameters, argumentList);
}
- // Apply resolution to arguments.
- // Skip names of named arguments.
- for (var argument in argumentList.arguments) {
- if (argument is NamedExpression) {
- argument.expression.accept(this);
- } else {
- argument.accept(this);
- }
- }
+ _applyResolutionToArguments(argumentList);
}
@override
@@ -424,36 +391,8 @@
@override
void visitPrefixedIdentifier(PrefixedIdentifier node) {
- Element element =
- _getReferenceFor(node.identifier, nullIfDifferentOffset: true);
- if (element != null) {
- // If the element is for the identifier, then this is a static element.
- DartType type = _getTypeFor(node.identifier);
- if (element is PropertyAccessorElement) {
- assert(element.isStatic);
- node.identifier.staticElement = element;
- node.identifier.staticType = type;
- var enclosingElement = element.enclosingElement;
- if (enclosingElement is ClassElement) {
- node.prefix.staticElement = enclosingElement;
- node.prefix.staticType = enclosingElement.type;
- } else {
- // TODO(scheglov) Support for prefixed top-level variables?
- throw new UnimplementedError('(${element.runtimeType}) $element');
- }
- } else {
- // TODO(scheglov) Support for methods?
- throw new UnimplementedError('(${element.runtimeType}) $element');
- }
- } else {
- // If the element is not for the identifier, this is actually a property.
- // The element and type must be for the prefix.
- node.prefix.staticElement = _getReferenceFor(node.prefix);
- node.prefix.staticType = _getTypeFor(node.prefix);
- // The resolution for the identifier follows.
- node.identifier.staticElement = _getReferenceFor(node.identifier);
- node.identifier.staticType = _getTypeFor(node.identifier);
- }
+ node.prefix.accept(this);
+ node.identifier.accept(this);
node.staticType = node.identifier.staticType;
}
@@ -488,6 +427,20 @@
}
@override
+ void visitRedirectingConstructorInvocation(
+ RedirectingConstructorInvocation node) {
+ SimpleIdentifier constructorName = node.constructorName;
+
+ ConstructorElement element = _getReferenceFor(constructorName ?? node);
+ node.staticElement = element;
+ constructorName?.staticElement = element;
+
+ ArgumentList argumentList = node.argumentList;
+ _associateArgumentsWithParameters(element?.parameters, argumentList);
+ _applyResolutionToArguments(argumentList);
+ }
+
+ @override
void visitSimpleIdentifier(SimpleIdentifier node) {
node.staticElement = _getReferenceFor(node);
super.visitSimpleIdentifier(node);
@@ -564,10 +517,6 @@
if (node.parent is TopLevelVariableDeclaration) {
node.variables.accept(this);
} else {
- if (node.variables.length != 1) {
- // TODO(paulberry): handle this case
- throw new UnimplementedError('Multiple variables in one declaration');
- }
if (node.metadata.isNotEmpty) {
// TODO(paulberry): handle this case
throw new UnimplementedError('Metadata on a variable declaration list');
@@ -583,6 +532,17 @@
}
}
+ /// Apply resolution to arguments of the [argumentList].
+ void _applyResolutionToArguments(ArgumentList argumentList) {
+ for (var argument in argumentList.arguments) {
+ if (argument is NamedExpression) {
+ argument.expression.accept(this);
+ } else {
+ argument.accept(this);
+ }
+ }
+ }
+
/// Associate arguments of the [argumentList] with the [parameters].
void _associateArgumentsWithParameters(
List<ParameterElement> parameters, ArgumentList argumentList) {
@@ -630,46 +590,12 @@
/// Return the element associated with the declaration represented by the
/// given [node].
Element _getDeclarationFor(AstNode node) {
- int nodeOffset = node.offset;
- if (_debug) {
- print('Getting declaration element for $node at $nodeOffset');
- }
- if (_declaredElementIndex >= _declaredElements.length) {
- throw new StateError(
- 'No declaration information for $node at $nodeOffset');
- }
- int elementOffset = _declaredElementOffsets[_declaredElementIndex];
- if (nodeOffset != elementOffset) {
- throw new StateError(
- 'Expected element declaration for analyzer offset $nodeOffset; '
- 'got one for kernel offset $elementOffset');
- }
-
return _declaredElements[_declaredElementIndex++];
}
/// Return the element associated with the reference represented by the
/// given [entity].
- Element _getReferenceFor(SyntacticEntity entity,
- {bool nullIfDifferentOffset: false}) {
- int entityOffset = entity.offset;
- if (_debug) {
- print('Getting reference element for $entity at $entityOffset');
- }
- if (_referencedElementIndex >= _referencedElements.length) {
- throw new StateError(
- 'No reference information for $entity at $entityOffset');
- }
- int elementOffset = _referencedElementOffsets[_referencedElementIndex];
- if (entityOffset != elementOffset) {
- if (nullIfDifferentOffset) {
- return null;
- }
- throw new StateError(
- 'Expected element reference for analyzer offset $entityOffset; '
- 'got one for kernel offset $elementOffset');
- }
-
+ Element _getReferenceFor(SyntacticEntity entity) {
Element element = _referencedElements[_referencedElementIndex++];
if (_inAnnotation && element is PropertyInducingElement) {
return element.getter;
@@ -684,23 +610,99 @@
/// optional parameter (i.e. [Null]).
DartType _getTypeFor(SyntacticEntity entity, {bool synthetic: false}) {
assert(!synthetic || entity == null);
-
- var entityOffset = synthetic ? -1 : entity.offset;
- if (_debug) {
- print('Getting type for $entity at $entityOffset');
- }
- if (_typeIndex >= _types.length) {
- throw new StateError('No type information for $entity at $entityOffset');
- }
- if (entityOffset != _typeOffsets[_typeIndex]) {
- throw new StateError('Expected a type for $entity at $entityOffset; '
- 'got one for kernel offset ${_typeOffsets[_typeIndex]}');
- }
-
kernel.DartType kernelType = _types[_typeIndex++];
return _typeContext.translateType(kernelType);
}
+ /// Apply the [type] that is created by the [constructorName] and the
+ /// [constructorElement] it references.
+ static void applyConstructorElement(DartType type,
+ ConstructorElement constructorElement, ConstructorName constructorName) {
+ ClassElement classElement = constructorElement?.enclosingElement;
+
+ Identifier typeIdentifier = constructorName.type.name;
+ if (typeIdentifier is SimpleIdentifier) {
+ applyToTypeAnnotation(type, constructorName.type);
+ if (constructorName.name != null) {
+ constructorName.name.staticElement = constructorElement;
+ }
+ } else if (typeIdentifier is PrefixedIdentifier) {
+ // TODO(scheglov) Rewrite AST using knowledge about prefixes.
+ // TODO(scheglov) Add support for `new prefix.Type()`.
+ // TODO(scheglov) Add support for `new prefix.Type.name()`.
+ assert(constructorName.name == null);
+ constructorName.period = typeIdentifier.period;
+ constructorName.name = typeIdentifier.identifier;
+
+ SimpleIdentifier classNode = typeIdentifier.prefix;
+ classNode.staticElement = classElement;
+ classNode.staticType = type;
+
+ constructorName.type = astFactory.typeName(classNode, null);
+ constructorName.type.type = type;
+ constructorName.name.staticElement = constructorElement;
+ }
+ }
+
+ /// Apply the types of the [parameterElements] to the [parameterList] that
+ /// have an explicit type annotation.
+ static void applyParameters(List<ParameterElement> parameterElements,
+ FormalParameterList parameterList) {
+ List<FormalParameter> parameters = parameterList.parameters;
+
+ int length = parameterElements.length;
+ if (parameters.length != length) {
+ throw new StateError('Parameter counts do not match');
+ }
+ for (int i = 0; i < length; i++) {
+ ParameterElementImpl element = parameterElements[i];
+ FormalParameter parameter = parameters[i];
+
+ NormalFormalParameter normalParameter;
+ if (parameter is NormalFormalParameter) {
+ normalParameter = parameter;
+ } else if (parameter is DefaultFormalParameter) {
+ normalParameter = parameter.parameter;
+ }
+ assert(normalParameter != null);
+
+ if (normalParameter is SimpleFormalParameterImpl) {
+ normalParameter.element = element;
+ }
+
+ if (normalParameter.identifier != null) {
+ element.nameOffset = normalParameter.identifier.offset;
+ normalParameter.identifier.staticElement = element;
+ normalParameter.identifier.staticType = element.type;
+ }
+
+ // Apply the type or the return type, if a function typed parameter.
+ TypeAnnotation functionReturnType;
+ FormalParameterList functionParameterList;
+ if (normalParameter is SimpleFormalParameter) {
+ applyToTypeAnnotation(element.type, normalParameter.type);
+ } else if (normalParameter is FunctionTypedFormalParameter) {
+ functionReturnType = normalParameter.returnType;
+ functionParameterList = normalParameter.parameters;
+ } else if (normalParameter is FieldFormalParameter) {
+ if (normalParameter.parameters == null) {
+ applyToTypeAnnotation(element.type, normalParameter.type);
+ } else {
+ functionReturnType = normalParameter.type;
+ functionParameterList = normalParameter.parameters;
+ }
+ }
+
+ if (functionParameterList != null) {
+ FunctionType elementType = element.type;
+ if (functionReturnType != null) {
+ applyToTypeAnnotation(elementType.returnType, functionReturnType);
+ }
+ applyParameters(elementType.parameters, functionParameterList);
+ }
+ }
+ }
+
/// Apply the [type] to the [typeAnnotation] by setting the type of the
/// [typeAnnotation] to the [type] and recursively applying each of the type
/// arguments of the [type] to the corresponding type arguments of the
@@ -726,8 +728,7 @@
FunctionType functionType = type;
typeAnnotation.type = type;
applyToTypeAnnotation(functionType.returnType, typeAnnotation.returnType);
- _applyParameters(
- functionType.parameters, typeAnnotation.parameters.parameters);
+ applyParameters(functionType.parameters, typeAnnotation.parameters);
} else if (typeAnnotation is TypeNameImpl) {
typeAnnotation.type = type;
SimpleIdentifier name = nameForElement(typeAnnotation.name);
@@ -749,42 +750,6 @@
}
}
- /// Apply the types of the [parameterElements] to the [parameters] that have
- /// an explicit type annotation.
- static void _applyParameters(List<ParameterElement> parameterElements,
- List<FormalParameter> parameters) {
- int length = parameterElements.length;
- if (parameters.length != length) {
- throw new StateError('Parameter counts do not match');
- }
- for (int i = 0; i < length; i++) {
- ParameterElement element = parameterElements[i];
- FormalParameter parameter = parameters[i];
-
- NormalFormalParameter normalParameter;
- if (parameter is NormalFormalParameter) {
- normalParameter = parameter;
- } else if (parameter is DefaultFormalParameter) {
- normalParameter = parameter.parameter;
- }
-
- TypeAnnotation typeAnnotation = null;
- if (normalParameter is SimpleFormalParameter) {
- typeAnnotation = normalParameter.type;
- }
- if (typeAnnotation != null) {
- applyToTypeAnnotation(element.type, typeAnnotation);
- }
-
- if (normalParameter is SimpleFormalParameterImpl) {
- normalParameter.element = element;
- }
- if (normalParameter.identifier != null) {
- normalParameter.identifier.staticElement = element;
- }
- }
- }
-
/// Recursively apply each of the type arguments of the [type] to the
/// corresponding type arguments of the [typeArguments].
static void _applyTypeArgumentsToList(
@@ -832,3 +797,95 @@
/// Return the Analyzer [DartType] for the given [kernelType].
DartType translateType(kernel.DartType kernelType);
}
+
+/// Visitor that applies resolution data from the front end (obtained via
+/// [ResolutionStorer]) to an analyzer AST, and also checks file offsets to
+/// verify that the types are applied to the correct subexpressions.
+class ValidatingResolutionApplier extends ResolutionApplier {
+ /// Indicates whether debug messages should be printed.
+ static const bool _debug = false;
+
+ final List<int> _declaredElementOffsets;
+ final List<int> _referencedElementOffsets;
+ final List<int> _typeOffsets;
+
+ ValidatingResolutionApplier(
+ TypeContext typeContext,
+ List<Element> declaredElements,
+ List<Element> referencedElements,
+ List<kernel.DartType> types,
+ this._declaredElementOffsets,
+ this._referencedElementOffsets,
+ this._typeOffsets)
+ : super(typeContext, declaredElements, referencedElements, types);
+
+ @override
+ void checkDone() {
+ if (_declaredElementIndex != _declaredElements.length) {
+ throw new StateError('Some declarations were not consumed, starting at '
+ 'offset ${_declaredElementOffsets[_declaredElementIndex]}');
+ }
+ if (_referencedElementIndex != _referencedElements.length) {
+ throw new StateError('Some references were not consumed, starting at '
+ 'offset ${_referencedElementOffsets[_referencedElementIndex]}');
+ }
+ if (_typeIndex != _types.length) {
+ throw new StateError('Some types were not consumed, starting at offset '
+ '${_typeOffsets[_typeIndex]}');
+ }
+ }
+
+ @override
+ Element _getDeclarationFor(AstNode node) {
+ int nodeOffset = node.offset;
+ if (_debug) {
+ print('Getting declaration element for $node at $nodeOffset');
+ }
+ if (_declaredElementIndex >= _declaredElements.length) {
+ throw new StateError(
+ 'No declaration information for $node at $nodeOffset');
+ }
+ int elementOffset = _declaredElementOffsets[_declaredElementIndex];
+ if (nodeOffset != elementOffset) {
+ throw new StateError(
+ 'Expected element declaration for analyzer offset $nodeOffset; '
+ 'got one for kernel offset $elementOffset');
+ }
+ return super._getDeclarationFor(node);
+ }
+
+ @override
+ Element _getReferenceFor(SyntacticEntity entity) {
+ int entityOffset = entity.offset;
+ if (_debug) {
+ print('Getting reference element for $entity at $entityOffset');
+ }
+ if (_referencedElementIndex >= _referencedElements.length) {
+ throw new StateError(
+ 'No reference information for $entity at $entityOffset');
+ }
+ int elementOffset = _referencedElementOffsets[_referencedElementIndex];
+ if (entityOffset != elementOffset) {
+ throw new StateError(
+ 'Expected element reference for analyzer offset $entityOffset; '
+ 'got one for kernel offset $elementOffset');
+ }
+ return super._getReferenceFor(entity);
+ }
+
+ @override
+ DartType _getTypeFor(SyntacticEntity entity, {bool synthetic: false}) {
+ var entityOffset = synthetic ? -1 : entity.offset;
+ if (_debug) {
+ print('Getting type for $entity at $entityOffset');
+ }
+ if (_typeIndex >= _types.length) {
+ throw new StateError('No type information for $entity at $entityOffset');
+ }
+ if (entityOffset != _typeOffsets[_typeIndex]) {
+ throw new StateError('Expected a type for $entity at $entityOffset; '
+ 'got one for kernel offset ${_typeOffsets[_typeIndex]}');
+ }
+ return super._getTypeFor(entity);
+ }
+}
diff --git a/pkg/analyzer/lib/src/fasta/resolution_storer.dart b/pkg/analyzer/lib/src/fasta/resolution_storer.dart
index 665f407..8a59929 100644
--- a/pkg/analyzer/lib/src/fasta/resolution_storer.dart
+++ b/pkg/analyzer/lib/src/fasta/resolution_storer.dart
@@ -132,6 +132,8 @@
/// A reference to the getter represented by the [member].
/// The [member] might be either a getter itself, or a field.
class MemberGetterNode implements TreeNode {
+ /// The member representing the getter, or `null` if the getter could not be
+ /// resolved.
final Member member;
MemberGetterNode(this.member);
@@ -162,6 +164,8 @@
/// A reference to the setter represented by the [member].
/// The [member] might be either a setter itself, or a field.
class MemberSetterNode implements TreeNode {
+ /// The member representing the setter, or `null` if the setter could not be
+ /// resolved.
final Member member;
MemberSetterNode(this.member);
@@ -485,11 +489,23 @@
}
@override
- bool staticAssignEnter(
- Expression expression, Expression write, DartType typeContext) {
+ void redirectingInitializerEnter(RedirectingInitializer initializer) {
+ _recordReference(initializer.target, initializer.fileOffset);
+ }
+
+ @override
+ bool staticAssignEnter(Expression expression, int targetOffset,
+ Class targetClass, Expression write, DartType typeContext) {
+ // If the static target is explicit (and is a class), record it.
+ if (targetClass != null) {
+ _recordReference(targetClass, targetOffset);
+ _recordType(targetClass.rawType, targetOffset);
+ }
+
_deferReference(write.fileOffset);
_deferType(write.fileOffset);
- return super.staticAssignEnter(expression, write, typeContext);
+ return super.staticAssignEnter(
+ expression, targetOffset, targetClass, write, typeContext);
}
@override
@@ -508,6 +524,18 @@
}
@override
+ bool staticGetEnter(StaticGet expression, int targetOffset, Class targetClass,
+ DartType typeContext) {
+ // If the static target is explicit (and is a class), record it.
+ if (targetClass != null) {
+ _recordReference(targetClass, targetOffset);
+ _recordType(targetClass.rawType, targetOffset);
+ }
+ return super
+ .staticGetEnter(expression, targetOffset, targetClass, typeContext);
+ }
+
+ @override
void staticGetExit(StaticGet expression, DartType inferredType) {
_recordReference(
new MemberGetterNode(expression.target), expression.fileOffset);
diff --git a/pkg/analyzer/lib/src/generated/declaration_resolver.dart b/pkg/analyzer/lib/src/generated/declaration_resolver.dart
index ae1db7e..dc46ac2 100644
--- a/pkg/analyzer/lib/src/generated/declaration_resolver.dart
+++ b/pkg/analyzer/lib/src/generated/declaration_resolver.dart
@@ -291,6 +291,17 @@
}
@override
+ Object visitFormalParameterList(FormalParameterList node) {
+ if (_applyKernelTypes) {
+ ResolutionApplier.applyParameters(_walker._parameters, node);
+ _walker.consumeParameters();
+ return null;
+ } else {
+ return super.visitFormalParameterList(node);
+ }
+ }
+
+ @override
Object visitFunctionDeclaration(FunctionDeclaration node) {
SimpleIdentifier functionName = node.name;
Token property = node.propertyKeyword;
@@ -890,6 +901,10 @@
_functionIndex = _functions.length;
}
+ void consumeParameters() {
+ _parameterIndex = _parameters.length;
+ }
+
/**
* Returns the next non-synthetic child of [element] which is an accessor;
* throws an [IndexError] if there are no more.
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index e5b19aa..a0b598b 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -919,7 +919,6 @@
@override
Object visitIsExpression(IsExpression node) {
_checkForTypeAnnotationDeferredClass(node.type);
- _checkForTypeAnnotationGenericFunctionParameter(node.type);
return super.visitIsExpression(node);
}
@@ -2574,17 +2573,24 @@
_errorReporter.reportErrorForNode(
StaticWarningCode.ASSIGNMENT_TO_CONST, expression);
} else if (element.isFinal) {
- if (element is FieldElementImpl &&
- element.setter == null &&
- element.isSynthetic) {
- _errorReporter.reportErrorForNode(
- StaticWarningCode.ASSIGNMENT_TO_FINAL_NO_SETTER,
- highlightedNode,
- [element.name, element.enclosingElement.displayName]);
+ if (element is FieldElementImpl) {
+ if (element.setter == null && element.isSynthetic) {
+ _errorReporter.reportErrorForNode(
+ StaticWarningCode.ASSIGNMENT_TO_FINAL_NO_SETTER,
+ highlightedNode,
+ [element.name, element.enclosingElement.displayName]);
+ } else {
+ _errorReporter.reportErrorForNode(
+ StaticWarningCode.ASSIGNMENT_TO_FINAL,
+ highlightedNode,
+ [element.name]);
+ }
return;
}
- _errorReporter.reportErrorForNode(StaticWarningCode.ASSIGNMENT_TO_FINAL,
- highlightedNode, [element.name]);
+ _errorReporter.reportErrorForNode(
+ StaticWarningCode.ASSIGNMENT_TO_FINAL_LOCAL,
+ highlightedNode,
+ [element.name]);
}
} else if (element is FunctionElement) {
_errorReporter.reportErrorForNode(
@@ -5561,7 +5567,8 @@
void _checkForReferenceBeforeDeclaration(SimpleIdentifier node) {
if (!node.inDeclarationContext() &&
_hiddenElements != null &&
- _hiddenElements.contains(node.staticElement)) {
+ _hiddenElements.contains(node.staticElement) &&
+ node.parent is! CommentReference) {
_errorReporter.reportErrorForNode(
CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION,
node,
@@ -5759,28 +5766,6 @@
}
/**
- * Verify that the given type [name] is not a type parameter in a generic
- * method.
- *
- * See [StaticWarningCode.TYPE_ANNOTATION_GENERIC_FUNCTION_PARAMETER].
- */
- void _checkForTypeAnnotationGenericFunctionParameter(TypeAnnotation type) {
- if (type is TypeName) {
- Identifier name = type.name;
- if (name is SimpleIdentifier) {
- Element element = name.staticElement;
- if (element is TypeParameterElement &&
- element.enclosingElement is ExecutableElement) {
- _errorReporter.reportErrorForNode(
- StaticWarningCode.TYPE_ANNOTATION_GENERIC_FUNCTION_PARAMETER,
- name,
- [name.name]);
- }
- }
- }
- }
-
- /**
* Verify that the type arguments in the given [typeName] are all within
* their bounds.
*
diff --git a/pkg/analyzer/lib/src/generated/parser.dart b/pkg/analyzer/lib/src/generated/parser.dart
index 820bb38..f4c4590 100644
--- a/pkg/analyzer/lib/src/generated/parser.dart
+++ b/pkg/analyzer/lib/src/generated/parser.dart
@@ -6455,7 +6455,14 @@
Expression message;
if (_matches(TokenType.COMMA)) {
comma = getAndAdvance();
- message = parseExpression2();
+ if (_matches(TokenType.CLOSE_PAREN)) {
+ comma = null;
+ } else {
+ message = parseExpression2();
+ if (_matches(TokenType.COMMA)) {
+ getAndAdvance();
+ }
+ }
}
Token rightParen = _expect(TokenType.CLOSE_PAREN);
return astFactory.assertInitializer(
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index b524b43..770a02e 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -32,6 +32,7 @@
import 'package:analyzer/src/generated/testing/element_factory.dart';
import 'package:analyzer/src/generated/type_system.dart';
import 'package:analyzer/src/generated/utilities_dart.dart';
+import 'package:path/path.dart' as path;
export 'package:analyzer/src/dart/resolver/inheritance_manager.dart';
export 'package:analyzer/src/dart/resolver/scope.dart';
@@ -48,6 +49,8 @@
static String _TO_INT_METHOD_NAME = "toInt";
+ static final _testDir = '${path.separator}test${path.separator}';
+
/**
* The class containing the AST nodes being visited, or `null` if we are not in the scope of
* a class.
@@ -353,7 +356,7 @@
@override
Object visitSimpleIdentifier(SimpleIdentifier node) {
_checkForDeprecatedMemberUseAtIdentifier(node);
- _checkForInvalidProtectedMemberAccess(node);
+ _checkForInvalidAccess(node);
return super.visitSimpleIdentifier(node);
}
@@ -902,11 +905,17 @@
decl.name, [decl.name.toString()]);
}
- /**
- * Produces a hint if the given identifier is a protected closure, field or
- * getter/setter, method closure or invocation accessed outside a subclass.
- */
- void _checkForInvalidProtectedMemberAccess(SimpleIdentifier identifier) {
+ /// Produces a hint if [identifier] is accessed from an invalid location. In
+ /// particular:
+ ///
+ /// * if the given identifier is a protected closure, field or
+ /// getter/setter, method closure or invocation accessed outside a subclass,
+ /// or accessed outside the library wherein the identifier is declared, or
+ /// * if the given identifier is a closure, field, getter, setter, method
+ /// closure or invocation which is annotated with `visibleForTesting`, and
+ /// is accessed outside of the defining library, and the current library
+ /// does not have the word 'test' in its name.
+ void _checkForInvalidAccess(SimpleIdentifier identifier) {
if (identifier.inDeclarationContext()) {
return;
}
@@ -925,6 +934,21 @@
return false;
}
+ bool isVisibleForTesting(Element element) {
+ if (element == null) {
+ return false;
+ }
+ if (element.isVisibleForTesting) {
+ return true;
+ }
+ if (element is PropertyAccessorElement &&
+ element.enclosingElement is ClassElement &&
+ element.variable.isVisibleForTesting) {
+ return true;
+ }
+ return false;
+ }
+
bool inCommentReference(SimpleIdentifier identifier) =>
identifier.getAncestor((AstNode node) => node is CommentReference) !=
null;
@@ -932,21 +956,38 @@
bool inCurrentLibrary(Element element) =>
element.library == _currentLibrary;
+ bool inTestDirectory(LibraryElement library) =>
+ library.definingCompilationUnit.source.fullName.contains(_testDir);
+
Element element = identifier.bestElement;
- if (isProtected(element) &&
- !inCurrentLibrary(element) &&
- !inCommentReference(identifier)) {
+ if (isProtected(element)) {
+ if (inCurrentLibrary(element) || inCommentReference(identifier)) {
+ // The access is valid; even if [element] is also marked
+ // `visibleForTesting`, the "visibilities" are unioned.
+ return;
+ }
ClassElement definingClass = element.enclosingElement;
ClassDeclaration accessingClass =
identifier.getAncestor((AstNode node) => node is ClassDeclaration);
- if (accessingClass == null ||
- !_hasTypeOrSuperType(accessingClass.element, definingClass.type)) {
+ if (_hasTypeOrSuperType(accessingClass?.element, definingClass.type)) {
+ return;
+ } else {
_errorReporter.reportErrorForNode(
HintCode.INVALID_USE_OF_PROTECTED_MEMBER,
identifier,
[identifier.name.toString(), definingClass.name]);
}
}
+ if (isVisibleForTesting(element) &&
+ !inCurrentLibrary(element) &&
+ !inTestDirectory(_currentLibrary) &&
+ !inCommentReference(identifier)) {
+ Element definingClass = element.enclosingElement;
+ _errorReporter.reportErrorForNode(
+ HintCode.INVALID_USE_OF_VISIBLE_FOR_TESTING_MEMBER,
+ identifier,
+ [identifier.name.toString(), definingClass.name]);
+ }
}
/**
diff --git a/pkg/analyzer/lib/src/kernel/resynthesize.dart b/pkg/analyzer/lib/src/kernel/resynthesize.dart
index 0fec400..a3a6ee3 100644
--- a/pkg/analyzer/lib/src/kernel/resynthesize.dart
+++ b/pkg/analyzer/lib/src/kernel/resynthesize.dart
@@ -488,6 +488,7 @@
if (expr is kernel.StringLiteral) {
return AstTestFactory.string2(expr.value);
}
+
if (expr is kernel.StringConcatenation) {
List<InterpolationElement> elements = expr.expressions
.map(_build)
@@ -495,6 +496,7 @@
.toList(growable: false);
return AstTestFactory.string(elements);
}
+
if (expr is kernel.SymbolLiteral) {
List<String> components = expr.value.split('.').toList();
return AstTestFactory.symbolLiteral(components);
@@ -524,6 +526,20 @@
return AstTestFactory.mapLiteral(keyword, typeArguments, entries);
}
+ // Invalid annotations are represented as Let.
+ if (expr is kernel.Let) {
+ kernel.Let let = expr;
+ if (_isConstantExpressionErrorThrow(let.variable.initializer) ||
+ _isConstantExpressionErrorThrow(let.body)) {
+ throw const _CompilationErrorFound();
+ }
+ }
+
+ // Stop if there is an error.
+ if (_isConstantExpressionErrorThrow(expr)) {
+ throw const _CompilationErrorFound();
+ }
+
if (expr is kernel.StaticGet) {
return _buildIdentifier(expr.targetReference, isGet: true);
}
@@ -572,6 +588,10 @@
return AstTestFactory.binaryExpression(left, operator, right);
}
+ if (expr is kernel.AsExpression && expr.isTypeError) {
+ return _build(expr.operand);
+ }
+
if (expr is kernel.Let) {
var body = expr.body;
if (body is kernel.ConditionalExpression) {
@@ -595,25 +615,20 @@
}
if (expr is kernel.MethodInvocation) {
- kernel.Member member = expr.interfaceTarget;
- if (member is kernel.Procedure) {
- if (member.kind == kernel.ProcedureKind.Operator) {
- var left = _build(expr.receiver);
- String operatorName = expr.name.name;
- List<kernel.Expression> args = expr.arguments.positional;
- if (args.isEmpty) {
- if (operatorName == 'unary-') {
- return AstTestFactory.prefixExpression(TokenType.MINUS, left);
- }
- if (operatorName == '~') {
- return AstTestFactory.prefixExpression(TokenType.TILDE, left);
- }
- } else if (args.length == 1) {
- var operator = _toBinaryOperatorTokenType(operatorName);
- var right = _build(args.single);
- return AstTestFactory.binaryExpression(left, operator, right);
- }
+ var left = _build(expr.receiver);
+ String operatorName = expr.name.name;
+ List<kernel.Expression> args = expr.arguments.positional;
+ if (args.isEmpty) {
+ if (operatorName == 'unary-') {
+ return AstTestFactory.prefixExpression(TokenType.MINUS, left);
}
+ if (operatorName == '~') {
+ return AstTestFactory.prefixExpression(TokenType.TILDE, left);
+ }
+ } else if (args.length == 1) {
+ var operator = _toBinaryOperatorTokenType(operatorName);
+ var right = _build(args.single);
+ return AstTestFactory.binaryExpression(left, operator, right);
}
}
@@ -660,20 +675,6 @@
return identifier;
}
- // Invalid annotations are represented as Let.
- if (expr is kernel.Let) {
- kernel.Let let = expr;
- if (_isConstantExpressionErrorThrow(let.variable.initializer) ||
- _isConstantExpressionErrorThrow(let.body)) {
- throw const _CompilationErrorFound();
- }
- }
-
- // Stop if there is an error.
- if (_isConstantExpressionErrorThrow(expr)) {
- throw const _CompilationErrorFound();
- }
-
// TODO(scheglov): complete getExpression
throw new UnimplementedError('kernel: (${expr.runtimeType}) $expr');
}
diff --git a/pkg/analyzer/lib/src/task/options.dart b/pkg/analyzer/lib/src/task/options.dart
index 6d92337..b38c3ad 100644
--- a/pkg/analyzer/lib/src/task/options.dart
+++ b/pkg/analyzer/lib/src/task/options.dart
@@ -281,7 +281,7 @@
initialIncludeSpan ??= span;
String includeUri = span.text;
Source includedSource = sourceFactory.resolveUri(source, includeUri);
- if (!includedSource.exists()) {
+ if (includedSource == null || !includedSource.exists()) {
errors.add(new AnalysisError(
initialSource,
initialIncludeSpan.start.column + 1,
diff --git a/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_kernel_test.dart b/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_kernel_test.dart
index 193fcce..4f7a9c2 100644
--- a/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/checked_mode_compile_time_error_code_kernel_test.dart
@@ -17,6 +17,232 @@
extends CheckedModeCompileTimeErrorCodeTest_Driver {
@override
bool get enableKernelDriver => true;
+
+ @override
+ bool get previewDart2 => true;
+
+ @failingTest
+ @override
+ test_fieldFormalParameterAssignableToField_fieldType_unresolved_null() async {
+ // Expected 1 errors of type StaticWarningCode.UNDEFINED_CLASS, found 0
+ await super
+ .test_fieldFormalParameterAssignableToField_fieldType_unresolved_null();
+ }
+
+ @failingTest
+ @override
+ test_fieldFormalParameterAssignableToField_typedef() async {
+ // Expected 1 errors of type StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, found 0
+ await super.test_fieldFormalParameterAssignableToField_typedef();
+ }
+
+ @failingTest
+ @override
+ test_fieldFormalParameterNotAssignableToField() async {
+ // Expected 1 errors of type CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, found 0;
+ // 1 errors of type StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, found 0
+ await super.test_fieldFormalParameterNotAssignableToField();
+ }
+
+ @failingTest
+ @override
+ test_fieldFormalParameterNotAssignableToField_extends() async {
+ // Expected 1 errors of type CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, found 0
+ await super.test_fieldFormalParameterNotAssignableToField_extends();
+ }
+
+ @failingTest
+ @override
+ test_fieldFormalParameterNotAssignableToField_fieldType() async {
+ // Expected 1 errors of type CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, found 0;
+ // 1 errors of type StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, found 0
+ await super.test_fieldFormalParameterNotAssignableToField_fieldType();
+ }
+
+ @failingTest
+ @override
+ test_fieldFormalParameterNotAssignableToField_fieldType_unresolved() async {
+ // Expected 1 errors of type CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, found 0;
+ // 1 errors of type StaticWarningCode.UNDEFINED_CLASS, found 0
+ await super
+ .test_fieldFormalParameterNotAssignableToField_fieldType_unresolved();
+ }
+
+ @failingTest
+ @override
+ test_fieldFormalParameterNotAssignableToField_implements() async {
+ // Expected 1 errors of type CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, found 0
+ await super.test_fieldFormalParameterNotAssignableToField_implements();
+ }
+
+ @failingTest
+ @override
+ test_fieldFormalParameterNotAssignableToField_list() async {
+ // Expected 1 errors of type CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, found 0
+ await super.test_fieldFormalParameterNotAssignableToField_list();
+ }
+
+ @failingTest
+ @override
+ test_fieldFormalParameterNotAssignableToField_map_keyMismatch() async {
+ // Expected 1 errors of type CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, found 0
+ await super.test_fieldFormalParameterNotAssignableToField_map_keyMismatch();
+ }
+
+ @failingTest
+ @override
+ test_fieldFormalParameterNotAssignableToField_map_valueMismatch() async {
+ // Expected 1 errors of type CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, found 0
+ await super
+ .test_fieldFormalParameterNotAssignableToField_map_valueMismatch();
+ }
+
+ @failingTest
+ @override
+ test_fieldFormalParameterNotAssignableToField_optional() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t1 = "foo" in let ...
+ await super.test_fieldFormalParameterNotAssignableToField_optional();
+ }
+
+ @failingTest
+ @override
+ test_fieldFormalParameterNotAssignableToField_typedef() async {
+ // Expected 1 errors of type CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, found 0;
+ // 1 errors of type StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, found 0
+ await super.test_fieldFormalParameterNotAssignableToField_typedef();
+ }
+
+ @failingTest
+ @override
+ test_fieldInitializerNotAssignable() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t2 = "" in let ...
+ await super.test_fieldInitializerNotAssignable();
+ }
+
+ @failingTest
+ @override
+ test_fieldTypeMismatch() async {
+ // UnimplementedError: kernel: (AsExpression) x as{TypeError} dart.core::int
+ await super.test_fieldTypeMismatch();
+ }
+
+ @failingTest
+ @override
+ test_fieldTypeMismatch_generic() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t3 = #lib1::y in let ...
+ await super.test_fieldTypeMismatch_generic();
+ }
+
+ @failingTest
+ @override
+ test_fieldTypeMismatch_unresolved() async {
+ // UnimplementedError: kernel: (AsExpression) x as{TypeError} invalid-type
+ await super.test_fieldTypeMismatch_unresolved();
+ }
+
+ @failingTest
+ @override
+ test_fieldTypeOk_generic() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t4 = #lib2::y in let ...
+ await super.test_fieldTypeOk_generic();
+ }
+
+ @failingTest
+ @override
+ test_fieldTypeOk_unresolved_null() async {
+ // UnimplementedError: kernel: (AsExpression) x as{TypeError} invalid-type
+ await super.test_fieldTypeOk_unresolved_null();
+ }
+
+ @failingTest
+ @override
+ test_listElementTypeNotAssignable() async {
+ // Expected 1 errors of type CheckedModeCompileTimeErrorCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE, found 0;
+ // 1 errors of type StaticWarningCode.LIST_ELEMENT_TYPE_NOT_ASSIGNABLE, found 0
+ await super.test_listElementTypeNotAssignable();
+ }
+
+ @failingTest
+ @override
+ test_mapKeyTypeNotAssignable() async {
+ // Expected 1 errors of type CheckedModeCompileTimeErrorCode.MAP_KEY_TYPE_NOT_ASSIGNABLE, found 0;
+ // 1 errors of type StaticWarningCode.MAP_KEY_TYPE_NOT_ASSIGNABLE, found 0
+ await super.test_mapKeyTypeNotAssignable();
+ }
+
+ @failingTest
+ @override
+ test_mapValueTypeNotAssignable() async {
+ // Expected 1 errors of type CheckedModeCompileTimeErrorCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE, found 0;
+ // 1 errors of type StaticWarningCode.MAP_VALUE_TYPE_NOT_ASSIGNABLE, found 0
+ await super.test_mapValueTypeNotAssignable();
+ }
+
+ @failingTest
+ @override
+ test_parameterAssignable_undefined_null() async {
+ // Expected 1 errors of type StaticWarningCode.UNDEFINED_CLASS, found 0
+ await super.test_parameterAssignable_undefined_null();
+ }
+
+ @failingTest
+ @override
+ test_parameterNotAssignable() async {
+ // Expected 1 errors of type CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, found 0;
+ // 1 errors of type StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, found 0
+ await super.test_parameterNotAssignable();
+ }
+
+ @failingTest
+ @override
+ test_parameterNotAssignable_typeSubstitution() async {
+ // Expected 1 errors of type CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, found 0;
+ // 1 errors of type StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, found 0
+ await super.test_parameterNotAssignable_typeSubstitution();
+ }
+
+ @failingTest
+ @override
+ test_parameterNotAssignable_undefined() async {
+ // Expected 1 errors of type CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH, found 0;
+ // 1 errors of type StaticWarningCode.UNDEFINED_CLASS, found 0
+ await super.test_parameterNotAssignable_undefined();
+ }
+
+ @failingTest
+ @override
+ test_redirectingConstructor_paramTypeMismatch() async {
+ // Bad state: Expected element reference for analyzer offset 33; got one for kernel offset 36
+ await super.test_redirectingConstructor_paramTypeMismatch();
+ }
+
+ @failingTest
+ @override
+ test_superConstructor_paramTypeMismatch() async {
+ // UnimplementedError: kernel: (AsExpression) d as{TypeError} dart.core::double
+ await super.test_superConstructor_paramTypeMismatch();
+ }
+
+ @failingTest
+ @override
+ test_topLevelVarAssignable_undefined_null() async {
+ // Expected 1 errors of type StaticWarningCode.UNDEFINED_CLASS, found 0
+ await super.test_topLevelVarAssignable_undefined_null();
+ }
+
+ @failingTest
+ @override
+ test_topLevelVarNotAssignable() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t5 = "foo" in let ...
+ await super.test_topLevelVarNotAssignable();
+ }
+
+ @failingTest
+ @override
+ test_topLevelVarNotAssignable_undefined() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t6 = "foo" in let ...
+ await super.test_topLevelVarNotAssignable_undefined();
+ }
}
/// Tests marked with this annotation fail because of a Fasta problem.
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart
index 0b6dc66..dcd7eb6 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_kernel_test.dart
@@ -22,6 +22,86 @@
bool get enableKernelDriver => true;
@override
+ bool get previewDart2 => true;
+
+ @override
+ @failingTest
+ test_accessPrivateEnumField() async {
+ // 'package:analyzer/src/dart/analysis/library_analyzer.dart': Failed assertion: line 1082 pos 18: 'memberElement != null': is not true.
+ await super.test_accessPrivateEnumField();
+ }
+
+ @override
+ @failingTest
+ test_ambiguousExport() async {
+ // Expected 1 errors of type CompileTimeErrorCode.AMBIGUOUS_EXPORT, found 0
+ await super.test_ambiguousExport();
+ }
+
+ @override
+ @failingTest
+ test_annotationWithNotClass() async {
+ // Bad state: No reference information for property at 117
+ await super.test_annotationWithNotClass();
+ }
+
+ @override
+ @failingTest
+ test_annotationWithNotClass_prefixed() async {
+ // Bad state: No reference information for pref at 36
+ await super.test_annotationWithNotClass_prefixed();
+ }
+
+ @override
+ @failingTest
+ test_async_used_as_identifier_in_annotation() async {
+ // 'package:analyzer/src/dart/constant/utilities.dart': Failed assertion: line 184 pos 14: 'node.parent is PartOfDirective ||
+ await super.test_async_used_as_identifier_in_annotation();
+ }
+
+ @override
+ @failingTest
+ test_async_used_as_identifier_in_break_statement() async {
+ // Bad state: No type information for true at 21
+ await super.test_async_used_as_identifier_in_break_statement();
+ }
+
+ @override
+ @failingTest
+ test_async_used_as_identifier_in_continue_statement() async {
+ // Bad state: No reference information for async at 42
+ await super.test_async_used_as_identifier_in_continue_statement();
+ }
+
+ @override
+ @failingTest
+ test_async_used_as_identifier_in_prefix() async {
+ // 'package:analyzer/src/fasta/resolution_applier.dart': Failed assertion: line 632 pos 14: 'constructorName.name == null': is not true.
+ await super.test_async_used_as_identifier_in_prefix();
+ }
+
+ @override
+ @failingTest
+ test_async_used_as_identifier_in_statement_label() async {
+ // Bad state: Expected element reference for analyzer offset 14; got one for kernel offset 21
+ await super.test_async_used_as_identifier_in_statement_label();
+ }
+
+ @override
+ @failingTest
+ test_async_used_as_identifier_in_suffix() async {
+ // Bad state: Expected element reference for analyzer offset 46; got one for kernel offset 48
+ await super.test_async_used_as_identifier_in_suffix();
+ }
+
+ @override
+ @failingTest
+ test_async_used_as_identifier_in_switch_label() async {
+ // Bad state: No reference information for async at 31
+ await super.test_async_used_as_identifier_in_switch_label();
+ }
+
+ @override
@failingTest
// This test fails because the kernel driver element model produces a
// different element model result than the regular parser produces. Once these
@@ -33,12 +113,588 @@
@override
@failingTest
+ test_builtInIdentifierAsMixinName_classTypeAlias() async {
+ // Expected 1 errors of type CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME, found 0
+ await super.test_builtInIdentifierAsMixinName_classTypeAlias();
+ }
+
+ @override
+ @failingTest
+ test_builtInIdentifierAsPrefixName() async {
+ // Expected 1 errors of type CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_PREFIX_NAME, found 0
+ await super.test_builtInIdentifierAsPrefixName();
+ }
+
+ @override
+ @failingTest
+ test_builtInIdentifierAsType_formalParameter_field() async {
+ // Expected 1 errors of type CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE, found 0;
+ // 0 errors of type ParserErrorCode.EXTRANEOUS_MODIFIER, found 1 (23)
+ await super.test_builtInIdentifierAsType_formalParameter_field();
+ }
+
+ @override
+ @failingTest
+ test_builtInIdentifierAsType_formalParameter_simple() async {
+ // Expected 1 errors of type CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE, found 0;
+ // 0 errors of type ParserErrorCode.EXTRANEOUS_MODIFIER, found 1 (2)
+ await super.test_builtInIdentifierAsType_formalParameter_simple();
+ }
+
+ @override
+ @failingTest
+ test_builtInIdentifierAsType_variableDeclaration() async {
+ // Bad state: No reference information for typedef at 8
+ await super.test_builtInIdentifierAsType_variableDeclaration();
+ }
+
+ @override
+ @failingTest
+ test_builtInIdentifierAsTypedefName_functionTypeAlias() async {
+ // Expected 1 errors of type CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME, found 0
+ await super.test_builtInIdentifierAsTypedefName_functionTypeAlias();
+ }
+
+ @override
+ @failingTest
+ test_builtInIdentifierAsTypeName() async {
+ // Expected 1 errors of type CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME, found 0
+ await super.test_builtInIdentifierAsTypeName();
+ }
+
+ @override
+ @failingTest
+ test_builtInIdentifierAsTypeParameterName() async {
+ // Expected 1 errors of type CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME, found 0
+ await super.test_builtInIdentifierAsTypeParameterName();
+ }
+
+ @override
+ @failingTest
+ test_caseExpressionTypeImplementsEquals() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, found 0
+ await super.test_caseExpressionTypeImplementsEquals();
+ }
+
+ @override
+ @failingTest
+ test_conflictingConstructorNameAndMember_field() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_FIELD, found 0
+ await super.test_conflictingConstructorNameAndMember_field();
+ }
+
+ @override
+ @failingTest
+ test_conflictingConstructorNameAndMember_getter() async {
+ // Bad state: No type information for 42 at 25
+ await super.test_conflictingConstructorNameAndMember_getter();
+ }
+
+ @override
+ @failingTest
+ test_conflictingConstructorNameAndMember_method() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_CONSTRUCTOR_NAME_AND_METHOD, found 0
+ await super.test_conflictingConstructorNameAndMember_method();
+ }
+
+ @override
+ @failingTest
+ test_conflictingGetterAndMethod_field_method() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD, found 0
+ await super.test_conflictingGetterAndMethod_field_method();
+ }
+
+ @override
+ @failingTest
+ test_conflictingGetterAndMethod_getter_method() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_GETTER_AND_METHOD, found 0
+ await super.test_conflictingGetterAndMethod_getter_method();
+ }
+
+ @override
+ @failingTest
+ test_conflictingGetterAndMethod_method_field() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER, found 0
+ await super.test_conflictingGetterAndMethod_method_field();
+ }
+
+ @override
+ @failingTest
+ test_conflictingGetterAndMethod_method_getter() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_METHOD_AND_GETTER, found 0
+ await super.test_conflictingGetterAndMethod_method_getter();
+ }
+
+ @override
+ @failingTest
+ test_conflictingTypeVariableAndClass() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_CLASS, found 0
+ await super.test_conflictingTypeVariableAndClass();
+ }
+
+ @override
+ @failingTest
+ test_conflictingTypeVariableAndMember_field() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, found 0
+ await super.test_conflictingTypeVariableAndMember_field();
+ }
+
+ @override
+ @failingTest
+ test_conflictingTypeVariableAndMember_getter() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, found 0
+ await super.test_conflictingTypeVariableAndMember_getter();
+ }
+
+ @override
+ @failingTest
+ test_conflictingTypeVariableAndMember_method() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, found 0
+ await super.test_conflictingTypeVariableAndMember_method();
+ }
+
+ @override
+ @failingTest
+ test_conflictingTypeVariableAndMember_method_static() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, found 0
+ await super.test_conflictingTypeVariableAndMember_method_static();
+ }
+
+ @override
+ @failingTest
+ test_conflictingTypeVariableAndMember_setter() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONFLICTING_TYPE_VARIABLE_AND_MEMBER, found 0
+ await super.test_conflictingTypeVariableAndMember_setter();
+ }
+
+ @override
+ @failingTest
test_const_invalid_constructorFieldInitializer_fromLibrary() {
return super.test_const_invalid_constructorFieldInitializer_fromLibrary();
}
@override
@failingTest
+ test_constConstructorWithFieldInitializedByNonConst() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_FIELD_INITIALIZED_BY_NON_CONST, found 0;
+ // 1 errors of type CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, found 0
+ await super.test_constConstructorWithFieldInitializedByNonConst();
+ }
+
+ @override
+ @failingTest
+ test_constConstructorWithMixin() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN, found 0
+ await super.test_constConstructorWithMixin();
+ }
+
+ @override
+ @failingTest
+ test_constConstructorWithNonConstSuper_explicit() async {
+ // UnimplementedError: For ShadowInvalidInitializer
+ await super.test_constConstructorWithNonConstSuper_explicit();
+ }
+
+ @override
+ @failingTest
+ test_constConstructorWithNonConstSuper_implicit() async {
+ // UnimplementedError: For ShadowInvalidInitializer
+ await super.test_constConstructorWithNonConstSuper_implicit();
+ }
+
+ @override
+ @failingTest
+ test_constConstructorWithNonFinalField_mixin() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_MIXIN, found 0;
+ // 1 errors of type CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, found 0
+ await super.test_constConstructorWithNonFinalField_mixin();
+ }
+
+ @override
+ @failingTest
+ test_constConstructorWithNonFinalField_super() async {
+ // UnimplementedError: For ShadowInvalidInitializer
+ await super.test_constConstructorWithNonFinalField_super();
+ }
+
+ @override
+ @failingTest
+ test_constConstructorWithNonFinalField_this() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, found 0
+ await super.test_constConstructorWithNonFinalField_this();
+ }
+
+ @override
+ @failingTest
+ test_constDeferredClass() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_DEFERRED_CLASS, found 0;
+ // 0 errors of type HintCode.UNUSED_IMPORT, found 1 (21)
+ await super.test_constDeferredClass();
+ }
+
+ @override
+ @failingTest
+ test_constDeferredClass_namedConstructor() async {
+ // 'package:analyzer/src/fasta/resolution_applier.dart': Failed assertion: line 632 pos 14: 'constructorName.name == null': is not true.
+ await super.test_constDeferredClass_namedConstructor();
+ }
+
+ @override
+ @failingTest
+ test_constEval_newInstance_constConstructor() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, found 0
+ await super.test_constEval_newInstance_constConstructor();
+ }
+
+ @override
+ @failingTest
+ test_constEval_nonStaticField_inGenericClass() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, found 0
+ await super.test_constEval_nonStaticField_inGenericClass();
+ }
+
+ @override
+ @failingTest
+ test_constEval_propertyExtraction_targetNotConst() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, found 0
+ await super.test_constEval_propertyExtraction_targetNotConst();
+ }
+
+ @override
+ @failingTest
+ test_constEvalThrowsException_binaryMinus_null() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t2 = null in let ...
+ await super.test_constEvalThrowsException_binaryMinus_null();
+ }
+
+ @override
+ @failingTest
+ test_constEvalThrowsException_binaryPlus_null() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t3 = null in let ...
+ await super.test_constEvalThrowsException_binaryPlus_null();
+ }
+
+ @override
+ @failingTest
+ test_constEvalThrowsException_divisionByZero() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_EVAL_THROWS_IDBZE, found 0
+ await super.test_constEvalThrowsException_divisionByZero();
+ }
+
+ @override
+ @failingTest
+ test_constEvalThrowsException_finalAlreadySet_initializer() async {
+ // Bad state: No reference information for = at 41
+ await super.test_constEvalThrowsException_finalAlreadySet_initializer();
+ }
+
+ @override
+ @failingTest
+ test_constEvalThrowsException_finalAlreadySet_initializing_formal() async {
+ // UnimplementedError: For ShadowInvalidInitializer
+ await super
+ .test_constEvalThrowsException_finalAlreadySet_initializing_formal();
+ }
+
+ @override
+ @failingTest
+ test_constEvalThrowsException_unaryBitNot_null() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t4 = null in let ...
+ await super.test_constEvalThrowsException_unaryBitNot_null();
+ }
+
+ @override
+ @failingTest
+ test_constEvalThrowsException_unaryNegated_null() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t5 = null in let ...
+ await super.test_constEvalThrowsException_unaryNegated_null();
+ }
+
+ @override
+ @failingTest
+ test_constEvalThrowsException_unaryNot_null() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, found 0
+ await super.test_constEvalThrowsException_unaryNot_null();
+ }
+
+ @override
+ @failingTest
+ test_constEvalTypeBool_binary() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t6 = "" in let ...
+ await super.test_constEvalTypeBool_binary();
+ }
+
+ @override
+ @failingTest
+ test_constEvalTypeBool_binary_leftTrue() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t7 = 0 in let ...
+ await super.test_constEvalTypeBool_binary_leftTrue();
+ }
+
+ @override
+ @failingTest
+ test_constEvalTypeBoolNumString_equal() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING, found 0
+ await super.test_constEvalTypeBoolNumString_equal();
+ }
+
+ @override
+ @failingTest
+ test_constEvalTypeBoolNumString_notEqual() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_EVAL_TYPE_BOOL_NUM_STRING, found 0
+ await super.test_constEvalTypeBoolNumString_notEqual();
+ }
+
+ @override
+ @failingTest
+ test_constEvalTypeInt_binary() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t8 = "" in let ...
+ await super.test_constEvalTypeInt_binary();
+ }
+
+ @override
+ @failingTest
+ test_constEvalTypeNum_binary() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t9 = "" in let ...
+ await super.test_constEvalTypeNum_binary();
+ }
+
+ @override
+ @failingTest
+ test_constFormalParameter_fieldFormalParameter() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_FORMAL_PARAMETER, found 0;
+ // 0 errors of type ParserErrorCode.EXTRANEOUS_MODIFIER, found 1 (23)
+ await super.test_constFormalParameter_fieldFormalParameter();
+ }
+
+ @override
+ @failingTest
+ test_constFormalParameter_simpleFormalParameter() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_FORMAL_PARAMETER, found 0;
+ // 0 errors of type ParserErrorCode.EXTRANEOUS_MODIFIER, found 1 (2)
+ await super.test_constFormalParameter_simpleFormalParameter();
+ }
+
+ @override
+ @failingTest
+ test_constInitializedWithNonConstValue() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, found 0
+ await super.test_constInitializedWithNonConstValue();
+ }
+
+ @override
+ @failingTest
+ test_constInitializedWithNonConstValue_finalField() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE, found 0
+ await super.test_constInitializedWithNonConstValue_finalField();
+ }
+
+ @override
+ @failingTest
+ test_constInitializedWithNonConstValue_missingConstInListLiteral() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, found 0
+ await super
+ .test_constInitializedWithNonConstValue_missingConstInListLiteral();
+ }
+
+ @override
+ @failingTest
+ test_constInitializedWithNonConstValue_missingConstInMapLiteral() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, found 0
+ await super
+ .test_constInitializedWithNonConstValue_missingConstInMapLiteral();
+ }
+
+ @override
+ @failingTest
+ test_constInitializedWithNonConstValueFromDeferredClass() async {
+ // Bad state: Expected element reference for analyzer offset 58; got one for kernel offset 60
+ await super.test_constInitializedWithNonConstValueFromDeferredClass();
+ }
+
+ @override
+ @failingTest
+ test_constInitializedWithNonConstValueFromDeferredClass_nested() async {
+ // Bad state: Expected element reference for analyzer offset 58; got one for kernel offset 60
+ await super
+ .test_constInitializedWithNonConstValueFromDeferredClass_nested();
+ }
+
+ @override
+ @failingTest
+ test_constInstanceField() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_INSTANCE_FIELD, found 0
+ await super.test_constInstanceField();
+ }
+
+ @override
+ @failingTest
+ test_constMapKeyTypeImplementsEquals_direct() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, found 0
+ await super.test_constMapKeyTypeImplementsEquals_direct();
+ }
+
+ @override
+ @failingTest
+ test_constMapKeyTypeImplementsEquals_dynamic() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, found 0
+ await super.test_constMapKeyTypeImplementsEquals_dynamic();
+ }
+
+ @override
+ @failingTest
+ test_constMapKeyTypeImplementsEquals_factory() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, found 0
+ await super.test_constMapKeyTypeImplementsEquals_factory();
+ }
+
+ @override
+ @failingTest
+ test_constMapKeyTypeImplementsEquals_super() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_MAP_KEY_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, found 0
+ await super.test_constMapKeyTypeImplementsEquals_super();
+ }
+
+ @override
+ @failingTest
+ test_constWithInvalidTypeParameters() async {
+ // Bad state: Found 0 argument types for 1 type arguments
+ await super.test_constWithInvalidTypeParameters();
+ }
+
+ @override
+ @failingTest
+ test_constWithInvalidTypeParameters_tooFew() async {
+ // Bad state: Found 2 argument types for 1 type arguments
+ await super.test_constWithInvalidTypeParameters_tooFew();
+ }
+
+ @override
+ @failingTest
+ test_constWithInvalidTypeParameters_tooMany() async {
+ // Bad state: Found 1 argument types for 2 type arguments
+ await super.test_constWithInvalidTypeParameters_tooMany();
+ }
+
+ @override
+ @failingTest
+ test_constWithNonConst() async {
+ // Bad state: No type information for T at 52
+ await super.test_constWithNonConst();
+ }
+
+ @override
+ @failingTest
+ test_constWithNonConst_with() async {
+ // Bad state: No type information for C at 72
+ await super.test_constWithNonConst_with();
+ }
+
+ @override
+ @failingTest
+ test_constWithNonConstantArgument_annotation() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT, found 0
+ await super.test_constWithNonConstantArgument_annotation();
+ }
+
+ @override
+ @failingTest
+ test_constWithNonConstantArgument_instanceCreation() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_WITH_NON_CONSTANT_ARGUMENT, found 0;
+ // 1 errors of type CompileTimeErrorCode.INVALID_CONSTANT, found 0
+ await super.test_constWithNonConstantArgument_instanceCreation();
+ }
+
+ @override
+ @failingTest
+ test_constWithNonType() async {
+ // Bad state: No type information for A at 28
+ await super.test_constWithNonType();
+ }
+
+ @override
+ @failingTest
+ test_constWithNonType_fromLibrary() async {
+ // Bad state: No type information for lib.A at 45
+ await super.test_constWithNonType_fromLibrary();
+ }
+
+ @override
+ @failingTest
+ test_constWithUndefinedConstructor() async {
+ // Bad state: No type information for A.noSuchConstructor at 46
+ await super.test_constWithUndefinedConstructor();
+ }
+
+ @override
+ @failingTest
+ test_constWithUndefinedConstructorDefault() async {
+ // Bad state: No type information for A at 51
+ await super.test_constWithUndefinedConstructorDefault();
+ }
+
+ @override
+ @failingTest
+ test_defaultValueInFunctionTypeAlias_new_named() async {
+ // Bad state: (GenericTypeAliasImpl) typedef F = int Function({Map<String, String> m : const {}})
+ await super.test_defaultValueInFunctionTypeAlias_new_named();
+ }
+
+ @override
+ @failingTest
+ test_defaultValueInFunctionTypeAlias_new_positional() async {
+ // Bad state: (GenericTypeAliasImpl) typedef F = int Function([Map<String, String> m = const {}])
+ await super.test_defaultValueInFunctionTypeAlias_new_positional();
+ }
+
+ @override
+ @failingTest
+ test_defaultValueInFunctionTypeAlias_old_named() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS, found 0;
+ // 0 errors of type ParserErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE, found 1 (13)
+ await super.test_defaultValueInFunctionTypeAlias_old_named();
+ }
+
+ @override
+ @failingTest
+ test_defaultValueInFunctionTypeAlias_old_positional() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS, found 0;
+ // 0 errors of type ParserErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE, found 1 (13)
+ await super.test_defaultValueInFunctionTypeAlias_old_positional();
+ }
+
+ @override
+ @failingTest
+ test_defaultValueInFunctionTypedParameter_named() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER, found 0;
+ // 0 errors of type ParserErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE, found 1 (6)
+ await super.test_defaultValueInFunctionTypedParameter_named();
+ }
+
+ @override
+ @failingTest
+ test_defaultValueInFunctionTypedParameter_optional() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPED_PARAMETER, found 0;
+ // 0 errors of type ParserErrorCode.DEFAULT_VALUE_IN_FUNCTION_TYPE, found 1 (7)
+ await super.test_defaultValueInFunctionTypedParameter_optional();
+ }
+
+ @override
+ @failingTest
+ test_defaultValueInRedirectingFactoryConstructor() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DEFAULT_VALUE_IN_REDIRECTING_FACTORY_CONSTRUCTOR, found 0
+ await super.test_defaultValueInRedirectingFactoryConstructor();
+ }
+
+ @override
+ @failingTest
+ test_deferredImportWithInvalidUri() async {
+ // Bad state: No reference information for p at 49
+ await super.test_deferredImportWithInvalidUri();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/30857')
test_duplicateConstructorName_named() async {
return super.test_duplicateConstructorName_named();
@@ -60,6 +716,13 @@
@override
@failingTest
+ test_duplicateDefinition_catch() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION, found 0
+ await super.test_duplicateDefinition_catch();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/30857')
test_duplicateDefinition_classMembers_fields() async {
return super.test_duplicateDefinition_classMembers_fields();
@@ -88,6 +751,138 @@
@override
@failingTest
+ test_duplicateDefinition_locals_inCase() async {
+ // Bad state: No type information for a at 58
+ await super.test_duplicateDefinition_locals_inCase();
+ }
+
+ @override
+ @failingTest
+ test_duplicateDefinition_locals_inFunctionBlock() async {
+ // Bad state: No declaration information for m(a) {} at 24
+ await super.test_duplicateDefinition_locals_inFunctionBlock();
+ }
+
+ @override
+ @failingTest
+ test_duplicateDefinition_locals_inIf() async {
+ // Bad state: No type information for a at 49
+ await super.test_duplicateDefinition_locals_inIf();
+ }
+
+ @override
+ @failingTest
+ test_duplicateDefinition_locals_inMethodBlock() async {
+ // Bad state: No type information for a at 37
+ await super.test_duplicateDefinition_locals_inMethodBlock();
+ }
+
+ @override
+ @failingTest
+ test_duplicateDefinition_parameters_inConstructor() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION, found 0
+ await super.test_duplicateDefinition_parameters_inConstructor();
+ }
+
+ @override
+ @failingTest
+ test_duplicateDefinition_parameters_inFunctionTypeAlias() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION, found 0
+ await super.test_duplicateDefinition_parameters_inFunctionTypeAlias();
+ }
+
+ @override
+ @failingTest
+ test_duplicateDefinition_parameters_inLocalFunction() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION, found 0
+ await super.test_duplicateDefinition_parameters_inLocalFunction();
+ }
+
+ @override
+ @failingTest
+ test_duplicateDefinition_parameters_inMethod() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION, found 0
+ await super.test_duplicateDefinition_parameters_inMethod();
+ }
+
+ @override
+ @failingTest
+ test_duplicateDefinition_parameters_inTopLevelFunction() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION, found 0
+ await super.test_duplicateDefinition_parameters_inTopLevelFunction();
+ }
+
+ @override
+ @failingTest
+ test_duplicateDefinition_typeParameters() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION, found 0
+ await super.test_duplicateDefinition_typeParameters();
+ }
+
+ @override
+ @failingTest
+ test_duplicateDefinitionInheritance_instanceGetter_staticGetter() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE, found 0
+ await super
+ .test_duplicateDefinitionInheritance_instanceGetter_staticGetter();
+ }
+
+ @override
+ @failingTest
+ test_duplicateDefinitionInheritance_instanceGetterAbstract_staticGetter() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE, found 0
+ await super
+ .test_duplicateDefinitionInheritance_instanceGetterAbstract_staticGetter();
+ }
+
+ @override
+ @failingTest
+ test_duplicateDefinitionInheritance_instanceMethod_staticMethod() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE, found 0
+ await super
+ .test_duplicateDefinitionInheritance_instanceMethod_staticMethod();
+ }
+
+ @override
+ @failingTest
+ test_duplicateDefinitionInheritance_instanceMethodAbstract_staticMethod() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE, found 0
+ await super
+ .test_duplicateDefinitionInheritance_instanceMethodAbstract_staticMethod();
+ }
+
+ @override
+ @failingTest
+ test_duplicateDefinitionInheritance_instanceSetter_staticSetter() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE, found 0
+ await super
+ .test_duplicateDefinitionInheritance_instanceSetter_staticSetter();
+ }
+
+ @override
+ @failingTest
+ test_duplicateDefinitionInheritance_instanceSetterAbstract_staticSetter() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION_INHERITANCE, found 0
+ await super
+ .test_duplicateDefinitionInheritance_instanceSetterAbstract_staticSetter();
+ }
+
+ @override
+ @failingTest
+ test_duplicateNamedArgument() async {
+ // Bad state: No type information for 1 at 29
+ await super.test_duplicateNamedArgument();
+ }
+
+ @override
+ @failingTest
+ test_exportInternalLibrary() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXPORT_INTERNAL_LIBRARY, found 0
+ await super.test_exportInternalLibrary();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/30960')
test_exportOfNonLibrary() async {
return super.test_exportOfNonLibrary();
@@ -95,6 +890,224 @@
@override
@failingTest
+ test_extendsDeferredClass() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXTENDS_DEFERRED_CLASS, found 0;
+ // 0 errors of type HintCode.UNUSED_IMPORT, found 1 (21)
+ await super.test_extendsDeferredClass();
+ }
+
+ @override
+ @failingTest
+ test_extendsDeferredClass_classTypeAlias() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXTENDS_DEFERRED_CLASS, found 0;
+ // 0 errors of type HintCode.UNUSED_IMPORT, found 1 (21)
+ await super.test_extendsDeferredClass_classTypeAlias();
+ }
+
+ @override
+ @failingTest
+ test_extendsDisallowedClass_class_bool() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, found 0;
+ // 1 errors of type CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT, found 0
+ await super.test_extendsDisallowedClass_class_bool();
+ }
+
+ @override
+ @failingTest
+ test_extendsDisallowedClass_class_double() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, found 0
+ await super.test_extendsDisallowedClass_class_double();
+ }
+
+ @override
+ @failingTest
+ test_extendsDisallowedClass_class_int() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, found 0;
+ // 1 errors of type CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT, found 0
+ await super.test_extendsDisallowedClass_class_int();
+ }
+
+ @override
+ @failingTest
+ test_extendsDisallowedClass_class_Null() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, found 0;
+ // 1 errors of type CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT, found 0
+ await super.test_extendsDisallowedClass_class_Null();
+ }
+
+ @override
+ @failingTest
+ test_extendsDisallowedClass_class_num() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, found 0
+ await super.test_extendsDisallowedClass_class_num();
+ }
+
+ @override
+ @failingTest
+ test_extendsDisallowedClass_class_String() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, found 0;
+ // 1 errors of type CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT, found 0
+ await super.test_extendsDisallowedClass_class_String();
+ }
+
+ @override
+ @failingTest
+ test_extendsDisallowedClass_classTypeAlias_bool() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, found 0
+ await super.test_extendsDisallowedClass_classTypeAlias_bool();
+ }
+
+ @override
+ @failingTest
+ test_extendsDisallowedClass_classTypeAlias_double() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, found 0
+ await super.test_extendsDisallowedClass_classTypeAlias_double();
+ }
+
+ @override
+ @failingTest
+ test_extendsDisallowedClass_classTypeAlias_int() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, found 0
+ await super.test_extendsDisallowedClass_classTypeAlias_int();
+ }
+
+ @override
+ @failingTest
+ test_extendsDisallowedClass_classTypeAlias_Null() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, found 0
+ await super.test_extendsDisallowedClass_classTypeAlias_Null();
+ }
+
+ @override
+ @failingTest
+ test_extendsDisallowedClass_classTypeAlias_num() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, found 0
+ await super.test_extendsDisallowedClass_classTypeAlias_num();
+ }
+
+ @override
+ @failingTest
+ test_extendsDisallowedClass_classTypeAlias_String() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXTENDS_DISALLOWED_CLASS, found 0
+ await super.test_extendsDisallowedClass_classTypeAlias_String();
+ }
+
+ @override
+ @failingTest
+ test_extendsEnum() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXTENDS_ENUM, found 0
+ await super.test_extendsEnum();
+ }
+
+ @override
+ @failingTest
+ test_extendsNonClass_class() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXTENDS_NON_CLASS, found 0
+ await super.test_extendsNonClass_class();
+ }
+
+ @override
+ @failingTest
+ test_extendsNonClass_dynamic() async {
+ // Expected 1 errors of type CompileTimeErrorCode.EXTENDS_NON_CLASS, found 0
+ await super.test_extendsNonClass_dynamic();
+ }
+
+ @override
+ @failingTest
+ test_extraPositionalArguments_const() async {
+ // Bad state: No type information for A at 42
+ await super.test_extraPositionalArguments_const();
+ }
+
+ @override
+ @failingTest
+ test_extraPositionalArguments_const_super() async {
+ // Bad state: No type information for 0 at 65
+ await super.test_extraPositionalArguments_const_super();
+ }
+
+ @override
+ @failingTest
+ test_extraPositionalArgumentsCouldBeNamed_const() async {
+ // Bad state: No type information for A at 49
+ await super.test_extraPositionalArgumentsCouldBeNamed_const();
+ }
+
+ @override
+ @failingTest
+ test_extraPositionalArgumentsCouldBeNamed_const_super() async {
+ // Bad state: No type information for 0 at 72
+ await super.test_extraPositionalArgumentsCouldBeNamed_const_super();
+ }
+
+ @override
+ @failingTest
+ test_fieldFormalParameter_assignedInInitializer() async {
+ // Bad state: No reference information for = at 35
+ await super.test_fieldFormalParameter_assignedInInitializer();
+ }
+
+ @override
+ @failingTest
+ test_fieldInitializedByMultipleInitializers() async {
+ // Bad state: No reference information for = at 36
+ await super.test_fieldInitializedByMultipleInitializers();
+ }
+
+ @override
+ @failingTest
+ test_fieldInitializedByMultipleInitializers_multipleInits() async {
+ // Bad state: No reference information for = at 36
+ await super.test_fieldInitializedByMultipleInitializers_multipleInits();
+ }
+
+ @override
+ @failingTest
+ test_fieldInitializedByMultipleInitializers_multipleNames() async {
+ // Bad state: Expected element reference for analyzer offset 45; got one for kernel offset 52
+ await super.test_fieldInitializedByMultipleInitializers_multipleNames();
+ }
+
+ @override
+ @failingTest
+ test_fieldInitializedInParameterAndInitializer() async {
+ // Bad state: No reference information for = at 35
+ await super.test_fieldInitializedInParameterAndInitializer();
+ }
+
+ @override
+ @failingTest
+ test_fieldInitializerFactoryConstructor() async {
+ // Expected 1 errors of type CompileTimeErrorCode.FIELD_INITIALIZER_FACTORY_CONSTRUCTOR, found 0
+ await super.test_fieldInitializerFactoryConstructor();
+ }
+
+ @override
+ @failingTest
+ test_fieldInitializerOutsideConstructor() async {
+ // Expected 1 errors of type ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, found 0;
+ // 1 errors of type CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, found 0
+ await super.test_fieldInitializerOutsideConstructor();
+ }
+
+ @override
+ @failingTest
+ test_fieldInitializerOutsideConstructor_defaultParameter() async {
+ // Expected 1 errors of type CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, found 0
+ await super.test_fieldInitializerOutsideConstructor_defaultParameter();
+ }
+
+ @override
+ @failingTest
+ test_fieldInitializerOutsideConstructor_inFunctionTypeParameter() async {
+ // Expected 1 errors of type CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, found 0
+ await super
+ .test_fieldInitializerOutsideConstructor_inFunctionTypeParameter();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/30982')
test_fieldInitializerRedirectingConstructor_afterRedirection() async {
return super.test_fieldInitializerRedirectingConstructor_afterRedirection();
@@ -117,6 +1130,73 @@
@override
@failingTest
+ test_finalInitializedMultipleTimes_initializers() async {
+ // Bad state: No reference information for = at 38
+ await super.test_finalInitializedMultipleTimes_initializers();
+ }
+
+ @override
+ @failingTest
+ test_finalInitializedMultipleTimes_initializingFormal_initializer() async {
+ // Bad state: No reference information for = at 37
+ await super
+ .test_finalInitializedMultipleTimes_initializingFormal_initializer();
+ }
+
+ @override
+ @failingTest
+ test_finalInitializedMultipleTimes_initializingFormals() async {
+ // Expected 1 errors of type CompileTimeErrorCode.DUPLICATE_DEFINITION, found 0;
+ // 1 errors of type CompileTimeErrorCode.FINAL_INITIALIZED_MULTIPLE_TIMES, found 0
+ await super.test_finalInitializedMultipleTimes_initializingFormals();
+ }
+
+ @override
+ @failingTest
+ test_finalNotInitialized_instanceField_const_static() async {
+ // Bad state: Some types were not consumed, starting at offset 26
+ await super.test_finalNotInitialized_instanceField_const_static();
+ }
+
+ @override
+ @failingTest
+ test_finalNotInitialized_library_const() async {
+ // Bad state: Some types were not consumed, starting at offset 7
+ await super.test_finalNotInitialized_library_const();
+ }
+
+ @override
+ @failingTest
+ test_finalNotInitialized_local_const() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_NOT_INITIALIZED, found 0
+ await super.test_finalNotInitialized_local_const();
+ }
+
+ @override
+ @failingTest
+ test_fromEnvironment_bool_badArgs() async {
+ // Expected 2 errors of type CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, found 0;
+ // 2 errors of type StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, found 0
+ await super.test_fromEnvironment_bool_badArgs();
+ }
+
+ @override
+ @failingTest
+ test_fromEnvironment_bool_badDefault_whenDefined() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, found 0;
+ // 1 errors of type StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, found 0
+ await super.test_fromEnvironment_bool_badDefault_whenDefined();
+ }
+
+ @override
+ @failingTest
+ test_genericFunctionTypedParameter() async {
+ // Expected 1 errors of type CompileTimeErrorCode.GENERIC_FUNCTION_TYPED_PARAM_UNSUPPORTED, found 0
+ await super.test_genericFunctionTypedParameter();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/30857')
test_getterAndMethodWithSameName() async {
return super.test_getterAndMethodWithSameName();
@@ -124,6 +1204,241 @@
@override
@failingTest
+ test_implementsDeferredClass() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_DEFERRED_CLASS, found 0;
+ // 0 errors of type HintCode.UNUSED_IMPORT, found 1 (21)
+ await super.test_implementsDeferredClass();
+ }
+
+ @override
+ @failingTest
+ test_implementsDeferredClass_classTypeAlias() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_DEFERRED_CLASS, found 0;
+ // 0 errors of type HintCode.UNUSED_IMPORT, found 1 (21)
+ await super.test_implementsDeferredClass_classTypeAlias();
+ }
+
+ @override
+ @failingTest
+ test_implementsDisallowedClass_class_bool() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, found 0
+ await super.test_implementsDisallowedClass_class_bool();
+ }
+
+ @override
+ @failingTest
+ test_implementsDisallowedClass_class_double() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, found 0
+ await super.test_implementsDisallowedClass_class_double();
+ }
+
+ @override
+ @failingTest
+ test_implementsDisallowedClass_class_int() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, found 0
+ await super.test_implementsDisallowedClass_class_int();
+ }
+
+ @override
+ @failingTest
+ test_implementsDisallowedClass_class_Null() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, found 0
+ await super.test_implementsDisallowedClass_class_Null();
+ }
+
+ @override
+ @failingTest
+ test_implementsDisallowedClass_class_num() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, found 0
+ await super.test_implementsDisallowedClass_class_num();
+ }
+
+ @override
+ @failingTest
+ test_implementsDisallowedClass_class_String() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, found 0
+ await super.test_implementsDisallowedClass_class_String();
+ }
+
+ @override
+ @failingTest
+ test_implementsDisallowedClass_class_String_num() async {
+ // Expected 2 errors of type CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, found 0
+ await super.test_implementsDisallowedClass_class_String_num();
+ }
+
+ @override
+ @failingTest
+ test_implementsDisallowedClass_classTypeAlias_bool() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, found 0
+ await super.test_implementsDisallowedClass_classTypeAlias_bool();
+ }
+
+ @override
+ @failingTest
+ test_implementsDisallowedClass_classTypeAlias_double() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, found 0
+ await super.test_implementsDisallowedClass_classTypeAlias_double();
+ }
+
+ @override
+ @failingTest
+ test_implementsDisallowedClass_classTypeAlias_int() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, found 0
+ await super.test_implementsDisallowedClass_classTypeAlias_int();
+ }
+
+ @override
+ @failingTest
+ test_implementsDisallowedClass_classTypeAlias_Null() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, found 0
+ await super.test_implementsDisallowedClass_classTypeAlias_Null();
+ }
+
+ @override
+ @failingTest
+ test_implementsDisallowedClass_classTypeAlias_num() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, found 0
+ await super.test_implementsDisallowedClass_classTypeAlias_num();
+ }
+
+ @override
+ @failingTest
+ test_implementsDisallowedClass_classTypeAlias_String() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, found 0
+ await super.test_implementsDisallowedClass_classTypeAlias_String();
+ }
+
+ @override
+ @failingTest
+ test_implementsDisallowedClass_classTypeAlias_String_num() async {
+ // Expected 2 errors of type CompileTimeErrorCode.IMPLEMENTS_DISALLOWED_CLASS, found 0
+ await super.test_implementsDisallowedClass_classTypeAlias_String_num();
+ }
+
+ @override
+ @failingTest
+ test_implementsDynamic() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_implementsDynamic();
+ }
+
+ @override
+ @failingTest
+ test_implementsEnum() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_implementsEnum();
+ }
+
+ @override
+ @failingTest
+ test_implementsNonClass_class() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_implementsNonClass_class();
+ }
+
+ @override
+ @failingTest
+ test_implementsNonClass_typeAlias() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_implementsNonClass_typeAlias();
+ }
+
+ @override
+ @failingTest
+ test_implementsRepeated() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_REPEATED, found 0
+ await super.test_implementsRepeated();
+ }
+
+ @override
+ @failingTest
+ test_implementsRepeated_3times() async {
+ // Expected 3 errors of type CompileTimeErrorCode.IMPLEMENTS_REPEATED, found 0
+ await super.test_implementsRepeated_3times();
+ }
+
+ @override
+ @failingTest
+ test_implementsSuperClass() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS, found 0
+ await super.test_implementsSuperClass();
+ }
+
+ @override
+ @failingTest
+ test_implementsSuperClass_Object() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS, found 0
+ await super.test_implementsSuperClass_Object();
+ }
+
+ @override
+ @failingTest
+ test_implementsSuperClass_Object_typeAlias() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS, found 0
+ await super.test_implementsSuperClass_Object_typeAlias();
+ }
+
+ @override
+ @failingTest
+ test_implementsSuperClass_typeAlias() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLEMENTS_SUPER_CLASS, found 0
+ await super.test_implementsSuperClass_typeAlias();
+ }
+
+ @override
+ @failingTest
+ test_implicitThisReferenceInInitializer_field() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER, found 0
+ await super.test_implicitThisReferenceInInitializer_field();
+ }
+
+ @override
+ @failingTest
+ test_implicitThisReferenceInInitializer_field2() async {
+ // Bad state: No reference information for x at 37
+ await super.test_implicitThisReferenceInInitializer_field2();
+ }
+
+ @override
+ @failingTest
+ test_implicitThisReferenceInInitializer_invocation() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER, found 0
+ await super.test_implicitThisReferenceInInitializer_invocation();
+ }
+
+ @override
+ @failingTest
+ test_implicitThisReferenceInInitializer_invocationInStatic() async {
+ // Bad state: No reference information for m at 27
+ await super.test_implicitThisReferenceInInitializer_invocationInStatic();
+ }
+
+ @override
+ @failingTest
+ test_implicitThisReferenceInInitializer_redirectingConstructorInvocation() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER, found 0
+ await super
+ .test_implicitThisReferenceInInitializer_redirectingConstructorInvocation();
+ }
+
+ @override
+ @failingTest
+ test_implicitThisReferenceInInitializer_superConstructorInvocation() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPLICIT_THIS_REFERENCE_IN_INITIALIZER, found 0
+ await super
+ .test_implicitThisReferenceInInitializer_superConstructorInvocation();
+ }
+
+ @override
+ @failingTest
+ test_importInternalLibrary() async {
+ // Expected 1 errors of type CompileTimeErrorCode.IMPORT_INTERNAL_LIBRARY, found 0
+ await super.test_importInternalLibrary();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/30959')
test_importOfNonLibrary() async {
return super.test_importOfNonLibrary();
@@ -131,6 +1446,154 @@
@override
@failingTest
+ test_inconsistentCaseExpressionTypes() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES, found 0
+ await super.test_inconsistentCaseExpressionTypes();
+ }
+
+ @override
+ @failingTest
+ test_inconsistentCaseExpressionTypes_dynamic() async {
+ // Expected 2 errors of type CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES, found 0
+ await super.test_inconsistentCaseExpressionTypes_dynamic();
+ }
+
+ @override
+ @failingTest
+ test_inconsistentCaseExpressionTypes_repeated() async {
+ // Expected 2 errors of type CompileTimeErrorCode.INCONSISTENT_CASE_EXPRESSION_TYPES, found 0
+ await super.test_inconsistentCaseExpressionTypes_repeated();
+ }
+
+ @override
+ @failingTest
+ test_initializerForNonExistent_const() async {
+ // Bad state: No reference information for = at 26
+ await super.test_initializerForNonExistent_const();
+ }
+
+ @override
+ @failingTest
+ test_initializerForNonExistent_initializer() async {
+ // Bad state: No reference information for = at 20
+ await super.test_initializerForNonExistent_initializer();
+ }
+
+ @override
+ @failingTest
+ test_initializerForStaticField() async {
+ // Bad state: No reference information for = at 36
+ await super.test_initializerForStaticField();
+ }
+
+ @override
+ @failingTest
+ test_initializingFormalForNonExistentField() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD, found 0
+ await super.test_initializingFormalForNonExistentField();
+ }
+
+ @override
+ @failingTest
+ test_initializingFormalForNonExistentField_notInEnclosingClass() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD, found 0
+ await super
+ .test_initializingFormalForNonExistentField_notInEnclosingClass();
+ }
+
+ @override
+ @failingTest
+ test_initializingFormalForNonExistentField_optional() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD, found 0
+ await super.test_initializingFormalForNonExistentField_optional();
+ }
+
+ @override
+ @failingTest
+ test_initializingFormalForNonExistentField_synthetic() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_NON_EXISTENT_FIELD, found 0
+ await super.test_initializingFormalForNonExistentField_synthetic();
+ }
+
+ @override
+ @failingTest
+ test_initializingFormalForStaticField() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INITIALIZING_FORMAL_FOR_STATIC_FIELD, found 0
+ await super.test_initializingFormalForStaticField();
+ }
+
+ @override
+ @failingTest
+ test_instanceMemberAccessFromFactory_named() async {
+ // Bad state: Expected element reference for analyzer offset 51; got one for kernel offset 71
+ await super.test_instanceMemberAccessFromFactory_named();
+ }
+
+ @override
+ @failingTest
+ test_instanceMemberAccessFromFactory_unnamed() async {
+ // Bad state: Expected element reference for analyzer offset 48; got one for kernel offset 68
+ await super.test_instanceMemberAccessFromFactory_unnamed();
+ }
+
+ @override
+ @failingTest
+ test_instanceMemberAccessFromStatic_field() async {
+ // Bad state: No reference information for f at 40
+ await super.test_instanceMemberAccessFromStatic_field();
+ }
+
+ @override
+ @failingTest
+ test_instanceMemberAccessFromStatic_getter() async {
+ // Bad state: No reference information for g at 48
+ await super.test_instanceMemberAccessFromStatic_getter();
+ }
+
+ @override
+ @failingTest
+ test_instanceMemberAccessFromStatic_method() async {
+ // Bad state: No reference information for m at 40
+ await super.test_instanceMemberAccessFromStatic_method();
+ }
+
+ @override
+ @failingTest
+ test_instantiateEnum_const() async {
+ // Bad state: No type information for E at 49
+ await super.test_instantiateEnum_const();
+ }
+
+ @override
+ @failingTest
+ test_instantiateEnum_new() async {
+ // Bad state: No type information for E at 47
+ await super.test_instantiateEnum_new();
+ }
+
+ @override
+ @failingTest
+ test_invalidAnnotation_getter() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INVALID_ANNOTATION, found 0
+ await super.test_invalidAnnotation_getter();
+ }
+
+ @override
+ @failingTest
+ test_invalidAnnotation_importWithPrefix_getter() async {
+ // Bad state: No reference information for V at 27
+ await super.test_invalidAnnotation_importWithPrefix_getter();
+ }
+
+ @override
+ @failingTest
+ test_invalidAnnotation_importWithPrefix_notConstantVariable() async {
+ // Bad state: No reference information for V at 27
+ await super.test_invalidAnnotation_importWithPrefix_notConstantVariable();
+ }
+
+ @override
+ @failingTest
test_invalidAnnotation_importWithPrefix_notVariableOrConstructorInvocation() {
return super
.test_invalidAnnotation_importWithPrefix_notVariableOrConstructorInvocation();
@@ -138,18 +1601,39 @@
@override
@failingTest
+ test_invalidAnnotation_notConstantVariable() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INVALID_ANNOTATION, found 0
+ await super.test_invalidAnnotation_notConstantVariable();
+ }
+
+ @override
+ @failingTest
test_invalidAnnotation_notVariableOrConstructorInvocation() {
return super.test_invalidAnnotation_notVariableOrConstructorInvocation();
}
@override
@failingTest
+ test_invalidAnnotation_staticMethodReference() async {
+ // Bad state: Expected element reference for analyzer offset 31; got one for kernel offset 30
+ await super.test_invalidAnnotation_staticMethodReference();
+ }
+
+ @override
+ @failingTest
test_invalidAnnotation_unresolved_identifier() {
return super.test_invalidAnnotation_unresolved_identifier();
}
@override
@failingTest
+ test_invalidAnnotation_unresolved_invocation() async {
+ // Bad state: No reference information for Unresolved at 1
+ await super.test_invalidAnnotation_unresolved_invocation();
+ }
+
+ @override
+ @failingTest
test_invalidAnnotation_unresolved_prefixedIdentifier() {
return super.test_invalidAnnotation_unresolved_prefixedIdentifier();
}
@@ -162,6 +1646,27 @@
@override
@failingTest
+ test_invalidAnnotationFromDeferredLibrary() async {
+ // Bad state: No reference information for v at 51
+ await super.test_invalidAnnotationFromDeferredLibrary();
+ }
+
+ @override
+ @failingTest
+ test_invalidAnnotationFromDeferredLibrary_constructor() async {
+ // Bad state: No reference information for C at 51
+ await super.test_invalidAnnotationFromDeferredLibrary_constructor();
+ }
+
+ @override
+ @failingTest
+ test_invalidAnnotationFromDeferredLibrary_namedConstructor() async {
+ // Bad state: No reference information for C at 51
+ await super.test_invalidAnnotationFromDeferredLibrary_namedConstructor();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/31001')
test_invalidConstructorName_notEnclosingClassName_defined() async {
return super.test_invalidConstructorName_notEnclosingClassName_defined();
@@ -190,6 +1695,183 @@
@override
@failingTest
+ test_invalidModifierOnConstructor_async() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR, found 0
+ await super.test_invalidModifierOnConstructor_async();
+ }
+
+ @override
+ @failingTest
+ test_invalidModifierOnConstructor_asyncStar() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR, found 0
+ await super.test_invalidModifierOnConstructor_asyncStar();
+ }
+
+ @override
+ @failingTest
+ test_invalidModifierOnConstructor_syncStar() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INVALID_MODIFIER_ON_CONSTRUCTOR, found 0
+ await super.test_invalidModifierOnConstructor_syncStar();
+ }
+
+ @override
+ @failingTest
+ test_invalidModifierOnSetter_member_async() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_invalidModifierOnSetter_member_async();
+ }
+
+ @override
+ @failingTest
+ test_invalidModifierOnSetter_member_asyncStar() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_invalidModifierOnSetter_member_asyncStar();
+ }
+
+ @override
+ @failingTest
+ test_invalidModifierOnSetter_member_syncStar() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_invalidModifierOnSetter_member_syncStar();
+ }
+
+ @override
+ @failingTest
+ test_invalidModifierOnSetter_topLevel_async() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_invalidModifierOnSetter_topLevel_async();
+ }
+
+ @override
+ @failingTest
+ test_invalidModifierOnSetter_topLevel_asyncStar() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_invalidModifierOnSetter_topLevel_asyncStar();
+ }
+
+ @override
+ @failingTest
+ test_invalidModifierOnSetter_topLevel_syncStar() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_invalidModifierOnSetter_topLevel_syncStar();
+ }
+
+ @override
+ @failingTest
+ test_invalidReferenceToThis_factoryConstructor() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS, found 0
+ await super.test_invalidReferenceToThis_factoryConstructor();
+ }
+
+ @override
+ @failingTest
+ test_invalidReferenceToThis_instanceVariableInitializer_inConstructor() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS, found 0
+ await super
+ .test_invalidReferenceToThis_instanceVariableInitializer_inConstructor();
+ }
+
+ @override
+ @failingTest
+ test_invalidReferenceToThis_instanceVariableInitializer_inDeclaration() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS, found 0
+ await super
+ .test_invalidReferenceToThis_instanceVariableInitializer_inDeclaration();
+ }
+
+ @override
+ @failingTest
+ test_invalidReferenceToThis_staticMethod() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS, found 0
+ await super.test_invalidReferenceToThis_staticMethod();
+ }
+
+ @override
+ @failingTest
+ test_invalidReferenceToThis_staticVariableInitializer() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS, found 0
+ await super.test_invalidReferenceToThis_staticVariableInitializer();
+ }
+
+ @override
+ @failingTest
+ test_invalidReferenceToThis_superInitializer() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS, found 0
+ await super.test_invalidReferenceToThis_superInitializer();
+ }
+
+ @override
+ @failingTest
+ test_invalidReferenceToThis_topLevelFunction() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS, found 0
+ await super.test_invalidReferenceToThis_topLevelFunction();
+ }
+
+ @override
+ @failingTest
+ test_invalidReferenceToThis_variableInitializer() async {
+ // Expected 1 errors of type CompileTimeErrorCode.INVALID_REFERENCE_TO_THIS, found 0
+ await super.test_invalidReferenceToThis_variableInitializer();
+ }
+
+ @override
+ @failingTest
+ test_isInConstInstanceCreation_restored() async {
+ // Expected 1 errors of type CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_isInConstInstanceCreation_restored();
+ }
+
+ @override
+ @failingTest
+ test_isInInstanceVariableInitializer_restored() async {
+ // Bad state: No reference information for _foo at 89
+ await super.test_isInInstanceVariableInitializer_restored();
+ }
+
+ @override
+ @failingTest
+ test_labelInOuterScope() async {
+ // Bad state: No reference information for l at 32
+ await super.test_labelInOuterScope();
+ }
+
+ @override
+ @failingTest
+ test_labelUndefined_break() async {
+ // Bad state: No reference information for x at 8
+ await super.test_labelUndefined_break();
+ }
+
+ @override
+ @failingTest
+ test_labelUndefined_continue() async {
+ // Bad state: No reference information for x at 8
+ await super.test_labelUndefined_continue();
+ }
+
+ @override
+ @failingTest
+ test_length_of_erroneous_constant() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t15 = 1 in let ...
+ await super.test_length_of_erroneous_constant();
+ }
+
+ @override
+ @failingTest
+ test_memberWithClassName_field() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MEMBER_WITH_CLASS_NAME, found 0
+ await super.test_memberWithClassName_field();
+ }
+
+ @override
+ @failingTest
+ test_memberWithClassName_field2() async {
+ // UnimplementedError: Multiple field
+ await super.test_memberWithClassName_field2();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/30981')
test_memberWithClassName_getter() async {
return super.test_memberWithClassName_getter();
@@ -204,6 +1886,197 @@
@override
@failingTest
+ test_mixinDeclaresConstructor_classDeclaration() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR, found 0
+ await super.test_mixinDeclaresConstructor_classDeclaration();
+ }
+
+ @override
+ @failingTest
+ test_mixinDeclaresConstructor_typeAlias() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR, found 0
+ await super.test_mixinDeclaresConstructor_typeAlias();
+ }
+
+ @override
+ @failingTest
+ test_mixinDeferredClass() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_DEFERRED_CLASS, found 0;
+ // 0 errors of type HintCode.UNUSED_IMPORT, found 1 (21)
+ await super.test_mixinDeferredClass();
+ }
+
+ @override
+ @failingTest
+ test_mixinDeferredClass_classTypeAlias() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_DEFERRED_CLASS, found 0;
+ // 0 errors of type HintCode.UNUSED_IMPORT, found 1 (21)
+ await super.test_mixinDeferredClass_classTypeAlias();
+ }
+
+ @override
+ @failingTest
+ test_mixinHasNoConstructors_mixinApp() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS, found 0
+ await super.test_mixinHasNoConstructors_mixinApp();
+ }
+
+ @override
+ @failingTest
+ test_mixinHasNoConstructors_mixinClass() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS, found 0
+ await super.test_mixinHasNoConstructors_mixinClass();
+ }
+
+ @override
+ @failingTest
+ test_mixinHasNoConstructors_mixinClass_explicitSuperCall() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS, found 0
+ await super.test_mixinHasNoConstructors_mixinClass_explicitSuperCall();
+ }
+
+ @override
+ @failingTest
+ test_mixinHasNoConstructors_mixinClass_implicitSuperCall() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS, found 0
+ await super.test_mixinHasNoConstructors_mixinClass_implicitSuperCall();
+ }
+
+ @override
+ @failingTest
+ test_mixinHasNoConstructors_mixinClass_namedSuperCall() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_HAS_NO_CONSTRUCTORS, found 0
+ await super.test_mixinHasNoConstructors_mixinClass_namedSuperCall();
+ }
+
+ @override
+ @failingTest
+ test_mixinInheritsFromNotObject_classDeclaration_extends() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, found 0
+ await super.test_mixinInheritsFromNotObject_classDeclaration_extends();
+ }
+
+ @override
+ @failingTest
+ test_mixinInheritsFromNotObject_classDeclaration_with() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, found 0
+ await super.test_mixinInheritsFromNotObject_classDeclaration_with();
+ }
+
+ @override
+ @failingTest
+ test_mixinInheritsFromNotObject_typeAlias_extends() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, found 0
+ await super.test_mixinInheritsFromNotObject_typeAlias_extends();
+ }
+
+ @override
+ @failingTest
+ test_mixinInheritsFromNotObject_typeAlias_with() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_INHERITS_FROM_NOT_OBJECT, found 0
+ await super.test_mixinInheritsFromNotObject_typeAlias_with();
+ }
+
+ @override
+ @failingTest
+ test_mixinOfDisallowedClass_class_bool() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS, found 0
+ await super.test_mixinOfDisallowedClass_class_bool();
+ }
+
+ @override
+ @failingTest
+ test_mixinOfDisallowedClass_class_double() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS, found 0
+ await super.test_mixinOfDisallowedClass_class_double();
+ }
+
+ @override
+ @failingTest
+ test_mixinOfDisallowedClass_class_int() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS, found 0
+ await super.test_mixinOfDisallowedClass_class_int();
+ }
+
+ @override
+ @failingTest
+ test_mixinOfDisallowedClass_class_Null() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS, found 0
+ await super.test_mixinOfDisallowedClass_class_Null();
+ }
+
+ @override
+ @failingTest
+ test_mixinOfDisallowedClass_class_num() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS, found 0
+ await super.test_mixinOfDisallowedClass_class_num();
+ }
+
+ @override
+ @failingTest
+ test_mixinOfDisallowedClass_class_String() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS, found 0
+ await super.test_mixinOfDisallowedClass_class_String();
+ }
+
+ @override
+ @failingTest
+ test_mixinOfDisallowedClass_classTypeAlias_bool() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS, found 0
+ await super.test_mixinOfDisallowedClass_classTypeAlias_bool();
+ }
+
+ @override
+ @failingTest
+ test_mixinOfDisallowedClass_classTypeAlias_double() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS, found 0
+ await super.test_mixinOfDisallowedClass_classTypeAlias_double();
+ }
+
+ @override
+ @failingTest
+ test_mixinOfDisallowedClass_classTypeAlias_int() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS, found 0
+ await super.test_mixinOfDisallowedClass_classTypeAlias_int();
+ }
+
+ @override
+ @failingTest
+ test_mixinOfDisallowedClass_classTypeAlias_Null() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS, found 0
+ await super.test_mixinOfDisallowedClass_classTypeAlias_Null();
+ }
+
+ @override
+ @failingTest
+ test_mixinOfDisallowedClass_classTypeAlias_num() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS, found 0
+ await super.test_mixinOfDisallowedClass_classTypeAlias_num();
+ }
+
+ @override
+ @failingTest
+ test_mixinOfDisallowedClass_classTypeAlias_String() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_OF_DISALLOWED_CLASS, found 0
+ await super.test_mixinOfDisallowedClass_classTypeAlias_String();
+ }
+
+ @override
+ @failingTest
+ test_mixinOfEnum() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_mixinOfEnum();
+ }
+
+ @override
+ @failingTest
+ test_mixinOfNonClass_class() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_mixinOfNonClass_class();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/31005')
test_mixinOfNonClass_typeAlias() async {
return super.test_mixinOfNonClass_typeAlias();
@@ -211,6 +2084,27 @@
@override
@failingTest
+ test_mixinReferencesSuper() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_REFERENCES_SUPER, found 0
+ await super.test_mixinReferencesSuper();
+ }
+
+ @override
+ @failingTest
+ test_mixinWithNonClassSuperclass_class() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS, found 0
+ await super.test_mixinWithNonClassSuperclass_class();
+ }
+
+ @override
+ @failingTest
+ test_mixinWithNonClassSuperclass_typeAlias() async {
+ // Expected 1 errors of type CompileTimeErrorCode.MIXIN_WITH_NON_CLASS_SUPERCLASS, found 0
+ await super.test_mixinWithNonClassSuperclass_typeAlias();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/30982')
test_multipleRedirectingConstructorInvocations() async {
return super.test_multipleRedirectingConstructorInvocations();
@@ -225,12 +2119,369 @@
@override
@failingTest
+ test_nativeClauseInNonSDKCode() async {
+ // Expected 1 errors of type ParserErrorCode.NATIVE_CLAUSE_IN_NON_SDK_CODE, found 0
+ await super.test_nativeClauseInNonSDKCode();
+ }
+
+ @override
+ @failingTest
+ test_nativeFunctionBodyInNonSDKCode_function() async {
+ // Expected 1 errors of type ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE, found 0
+ await super.test_nativeFunctionBodyInNonSDKCode_function();
+ }
+
+ @override
+ @failingTest
+ test_nativeFunctionBodyInNonSDKCode_method() async {
+ // Expected 1 errors of type ParserErrorCode.NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE, found 0
+ await super.test_nativeFunctionBodyInNonSDKCode_method();
+ }
+
+ @override
+ @failingTest
test_noAnnotationConstructorArguments() {
return super.test_noAnnotationConstructorArguments();
}
@override
@failingTest
+ test_noDefaultSuperConstructorExplicit() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT, found 0
+ await super.test_noDefaultSuperConstructorExplicit();
+ }
+
+ @override
+ @failingTest
+ test_noDefaultSuperConstructorExplicit_MixinAppWithDirectSuperCall() async {
+ // Expected 1 errors of type CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT, found 0
+ await super
+ .test_noDefaultSuperConstructorExplicit_MixinAppWithDirectSuperCall();
+ }
+
+ @override
+ @failingTest
+ test_noDefaultSuperConstructorExplicit_mixinAppWithNamedParam() async {
+ // Expected 1 errors of type CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT, found 0
+ await super.test_noDefaultSuperConstructorExplicit_mixinAppWithNamedParam();
+ }
+
+ @override
+ @failingTest
+ test_noDefaultSuperConstructorExplicit_MixinAppWithNamedSuperCall() async {
+ // Expected 1 errors of type CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER, found 0
+ await super
+ .test_noDefaultSuperConstructorExplicit_MixinAppWithNamedSuperCall();
+ }
+
+ @override
+ @failingTest
+ test_noDefaultSuperConstructorExplicit_mixinAppWithOptionalParam() async {
+ // Expected 1 errors of type CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT, found 0
+ await super
+ .test_noDefaultSuperConstructorExplicit_mixinAppWithOptionalParam();
+ }
+
+ @override
+ @failingTest
+ test_noDefaultSuperConstructorExplicit_MixinWithDirectSuperCall() async {
+ // Expected 1 errors of type CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT, found 0
+ await super
+ .test_noDefaultSuperConstructorExplicit_MixinWithDirectSuperCall();
+ }
+
+ @override
+ @failingTest
+ test_noDefaultSuperConstructorExplicit_mixinWithNamedParam() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT, found 0
+ await super.test_noDefaultSuperConstructorExplicit_mixinWithNamedParam();
+ }
+
+ @override
+ @failingTest
+ test_noDefaultSuperConstructorExplicit_MixinWithNamedSuperCall() async {
+ // Expected 1 errors of type CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER, found 0
+ await super
+ .test_noDefaultSuperConstructorExplicit_MixinWithNamedSuperCall();
+ }
+
+ @override
+ @failingTest
+ test_noDefaultSuperConstructorExplicit_mixinWithOptionalParam() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_EXPLICIT, found 0
+ await super.test_noDefaultSuperConstructorExplicit_mixinWithOptionalParam();
+ }
+
+ @override
+ @failingTest
+ test_noDefaultSuperConstructorImplicit_mixinAppWithNamedParam() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT, found 0
+ await super.test_noDefaultSuperConstructorImplicit_mixinAppWithNamedParam();
+ }
+
+ @override
+ @failingTest
+ test_noDefaultSuperConstructorImplicit_mixinAppWithOptionalParam() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT, found 0
+ await super
+ .test_noDefaultSuperConstructorImplicit_mixinAppWithOptionalParam();
+ }
+
+ @override
+ @failingTest
+ test_noDefaultSuperConstructorImplicit_mixinWithNamedParam() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT, found 0
+ await super.test_noDefaultSuperConstructorImplicit_mixinWithNamedParam();
+ }
+
+ @override
+ @failingTest
+ test_noDefaultSuperConstructorImplicit_mixinWithOptionalParam() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT, found 0
+ await super.test_noDefaultSuperConstructorImplicit_mixinWithOptionalParam();
+ }
+
+ @override
+ @failingTest
+ test_noDefaultSuperConstructorImplicit_superHasParameters() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT, found 0
+ await super.test_noDefaultSuperConstructorImplicit_superHasParameters();
+ }
+
+ @override
+ @failingTest
+ test_noDefaultSuperConstructorImplicit_superOnlyNamed() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NO_DEFAULT_SUPER_CONSTRUCTOR_IMPLICIT, found 0
+ await super.test_noDefaultSuperConstructorImplicit_superOnlyNamed();
+ }
+
+ @override
+ @failingTest
+ test_nonConstantAnnotationConstructor_named() async {
+ // Bad state: No reference information for A at 30
+ await super.test_nonConstantAnnotationConstructor_named();
+ }
+
+ @override
+ @failingTest
+ test_nonConstantAnnotationConstructor_unnamed() async {
+ // Bad state: No reference information for A at 22
+ await super.test_nonConstantAnnotationConstructor_unnamed();
+ }
+
+ @override
+ @failingTest
+ test_nonConstantDefaultValue_function_named() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE, found 0
+ await super.test_nonConstantDefaultValue_function_named();
+ }
+
+ @override
+ @failingTest
+ test_nonConstantDefaultValue_function_positional() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE, found 0
+ await super.test_nonConstantDefaultValue_function_positional();
+ }
+
+ @override
+ @failingTest
+ test_nonConstantDefaultValue_inConstructor_named() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE, found 0
+ await super.test_nonConstantDefaultValue_inConstructor_named();
+ }
+
+ @override
+ @failingTest
+ test_nonConstantDefaultValue_inConstructor_positional() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE, found 0
+ await super.test_nonConstantDefaultValue_inConstructor_positional();
+ }
+
+ @override
+ @failingTest
+ test_nonConstantDefaultValue_method_named() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE, found 0
+ await super.test_nonConstantDefaultValue_method_named();
+ }
+
+ @override
+ @failingTest
+ test_nonConstantDefaultValue_method_positional() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_CONSTANT_DEFAULT_VALUE, found 0
+ await super.test_nonConstantDefaultValue_method_positional();
+ }
+
+ @override
+ @failingTest
+ test_nonConstantDefaultValueFromDeferredLibrary() async {
+ // Bad state: Expected element reference for analyzer offset 55; got one for kernel offset 57
+ await super.test_nonConstantDefaultValueFromDeferredLibrary();
+ }
+
+ @override
+ @failingTest
+ test_nonConstantDefaultValueFromDeferredLibrary_nested() async {
+ // Bad state: Expected element reference for analyzer offset 55; got one for kernel offset 57
+ await super.test_nonConstantDefaultValueFromDeferredLibrary_nested();
+ }
+
+ @override
+ @failingTest
+ test_nonConstCaseExpression() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_CONSTANT_CASE_EXPRESSION, found 0
+ await super.test_nonConstCaseExpression();
+ }
+
+ @override
+ @failingTest
+ test_nonConstCaseExpressionFromDeferredLibrary() async {
+ // Bad state: Expected element reference for analyzer offset 87; got one for kernel offset 89
+ await super.test_nonConstCaseExpressionFromDeferredLibrary();
+ }
+
+ @override
+ @failingTest
+ test_nonConstCaseExpressionFromDeferredLibrary_nested() async {
+ // Bad state: Expected element reference for analyzer offset 87; got one for kernel offset 89
+ await super.test_nonConstCaseExpressionFromDeferredLibrary_nested();
+ }
+
+ @override
+ @failingTest
+ test_nonConstListElement() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_CONSTANT_LIST_ELEMENT, found 0
+ await super.test_nonConstListElement();
+ }
+
+ @override
+ @failingTest
+ test_nonConstListElementFromDeferredLibrary() async {
+ // Bad state: Expected element reference for analyzer offset 70; got one for kernel offset 72
+ await super.test_nonConstListElementFromDeferredLibrary();
+ }
+
+ @override
+ @failingTest
+ test_nonConstListElementFromDeferredLibrary_nested() async {
+ // Bad state: Expected element reference for analyzer offset 70; got one for kernel offset 72
+ await super.test_nonConstListElementFromDeferredLibrary_nested();
+ }
+
+ @override
+ @failingTest
+ test_nonConstMapAsExpressionStatement_begin() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_nonConstMapAsExpressionStatement_begin();
+ }
+
+ @override
+ @failingTest
+ test_nonConstMapAsExpressionStatement_only() async {
+ // Bad state: No reference information for at 13
+ await super.test_nonConstMapAsExpressionStatement_only();
+ }
+
+ @override
+ @failingTest
+ test_nonConstMapKey() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_CONSTANT_MAP_KEY, found 0
+ await super.test_nonConstMapKey();
+ }
+
+ @override
+ @failingTest
+ test_nonConstMapKeyFromDeferredLibrary() async {
+ // Bad state: Expected element reference for analyzer offset 70; got one for kernel offset 72
+ await super.test_nonConstMapKeyFromDeferredLibrary();
+ }
+
+ @override
+ @failingTest
+ test_nonConstMapKeyFromDeferredLibrary_nested() async {
+ // Bad state: Expected element reference for analyzer offset 70; got one for kernel offset 72
+ await super.test_nonConstMapKeyFromDeferredLibrary_nested();
+ }
+
+ @override
+ @failingTest
+ test_nonConstMapValue() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_CONSTANT_MAP_VALUE, found 0
+ await super.test_nonConstMapValue();
+ }
+
+ @override
+ @failingTest
+ test_nonConstMapValueFromDeferredLibrary() async {
+ // Bad state: Expected element reference for analyzer offset 76; got one for kernel offset 78
+ await super.test_nonConstMapValueFromDeferredLibrary();
+ }
+
+ @override
+ @failingTest
+ test_nonConstMapValueFromDeferredLibrary_nested() async {
+ // Bad state: Expected element reference for analyzer offset 76; got one for kernel offset 78
+ await super.test_nonConstMapValueFromDeferredLibrary_nested();
+ }
+
+ @override
+ @failingTest
+ test_nonConstValueInInitializer_assert_condition() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER, found 0
+ await super.test_nonConstValueInInitializer_assert_condition();
+ }
+
+ @override
+ @failingTest
+ test_nonConstValueInInitializer_assert_message() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER, found 0
+ await super.test_nonConstValueInInitializer_assert_message();
+ }
+
+ @override
+ @failingTest
+ test_nonConstValueInInitializer_binary_notBool_left() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t17 = p in let ...
+ await super.test_nonConstValueInInitializer_binary_notBool_left();
+ }
+
+ @override
+ @failingTest
+ test_nonConstValueInInitializer_binary_notBool_right() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t18 = p in let ...
+ await super.test_nonConstValueInInitializer_binary_notBool_right();
+ }
+
+ @override
+ @failingTest
+ test_nonConstValueInInitializer_binary_notInt() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t19 = p in let ...
+ await super.test_nonConstValueInInitializer_binary_notInt();
+ }
+
+ @override
+ @failingTest
+ test_nonConstValueInInitializer_binary_notNum() async {
+ // UnimplementedError: kernel: (AsExpression) 5.{dart.core::num::+}(let ...
+ await super.test_nonConstValueInInitializer_binary_notNum();
+ }
+
+ @override
+ @failingTest
+ test_nonConstValueInInitializer_field() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER, found 0
+ await super.test_nonConstValueInInitializer_field();
+ }
+
+ @override
+ @failingTest
+ test_nonConstValueInInitializer_instanceCreation() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER, found 0;
+ // 1 errors of type CompileTimeErrorCode.CONST_EVAL_THROWS_EXCEPTION, found 0
+ await super.test_nonConstValueInInitializer_instanceCreation();
+ }
+
+ @override
+ @failingTest
test_nonConstValueInInitializer_instanceCreation_inDifferentFile() {
return super
.test_nonConstValueInInitializer_instanceCreation_inDifferentFile();
@@ -238,6 +2489,148 @@
@override
@failingTest
+ test_nonConstValueInInitializer_redirecting() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER, found 0
+ await super.test_nonConstValueInInitializer_redirecting();
+ }
+
+ @override
+ @failingTest
+ test_nonConstValueInInitializer_super() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_CONSTANT_VALUE_IN_INITIALIZER, found 0
+ await super.test_nonConstValueInInitializer_super();
+ }
+
+ @override
+ @failingTest
+ test_nonConstValueInInitializerFromDeferredLibrary_field() async {
+ // Bad state: Expected element reference for analyzer offset 91; got one for kernel offset 93
+ await super.test_nonConstValueInInitializerFromDeferredLibrary_field();
+ }
+
+ @override
+ @failingTest
+ test_nonConstValueInInitializerFromDeferredLibrary_field_nested() async {
+ // Bad state: Expected element reference for analyzer offset 91; got one for kernel offset 93
+ await super
+ .test_nonConstValueInInitializerFromDeferredLibrary_field_nested();
+ }
+
+ @override
+ @failingTest
+ test_nonConstValueInInitializerFromDeferredLibrary_redirecting() async {
+ // Bad state: Expected element reference for analyzer offset 103; got one for kernel offset 105
+ await super
+ .test_nonConstValueInInitializerFromDeferredLibrary_redirecting();
+ }
+
+ @override
+ @failingTest
+ test_nonConstValueInInitializerFromDeferredLibrary_super() async {
+ // Bad state: Expected element reference for analyzer offset 114; got one for kernel offset 116
+ await super.test_nonConstValueInInitializerFromDeferredLibrary_super();
+ }
+
+ @override
+ @failingTest
+ test_nonGenerativeConstructor_explicit() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR, found 0
+ await super.test_nonGenerativeConstructor_explicit();
+ }
+
+ @override
+ @failingTest
+ test_nonGenerativeConstructor_implicit() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR, found 0
+ await super.test_nonGenerativeConstructor_implicit();
+ }
+
+ @override
+ @failingTest
+ test_nonGenerativeConstructor_implicit2() async {
+ // Expected 1 errors of type CompileTimeErrorCode.NON_GENERATIVE_CONSTRUCTOR, found 0
+ await super.test_nonGenerativeConstructor_implicit2();
+ }
+
+ @override
+ @failingTest
+ test_notEnoughRequiredArguments_const() async {
+ // Bad state: No type information for A at 47
+ await super.test_notEnoughRequiredArguments_const();
+ }
+
+ @override
+ @failingTest
+ test_notEnoughRequiredArguments_const_super() async {
+ // UnimplementedError: For ShadowInvalidInitializer
+ await super.test_notEnoughRequiredArguments_const_super();
+ }
+
+ @override
+ @failingTest
+ test_optionalParameterInOperator_named() async {
+ // Expected 1 errors of type CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR, found 0
+ await super.test_optionalParameterInOperator_named();
+ }
+
+ @override
+ @failingTest
+ test_optionalParameterInOperator_positional() async {
+ // Expected 1 errors of type CompileTimeErrorCode.OPTIONAL_PARAMETER_IN_OPERATOR, found 0
+ await super.test_optionalParameterInOperator_positional();
+ }
+
+ @override
+ @failingTest
+ test_prefix_assignment_compound_in_method() async {
+ // Bad state: No reference information for p at 46
+ await super.test_prefix_assignment_compound_in_method();
+ }
+
+ @override
+ @failingTest
+ test_prefix_assignment_compound_not_in_method() async {
+ // Bad state: No reference information for p at 32
+ await super.test_prefix_assignment_compound_not_in_method();
+ }
+
+ @override
+ @failingTest
+ test_prefix_assignment_in_method() async {
+ // Bad state: No reference information for p at 46
+ await super.test_prefix_assignment_in_method();
+ }
+
+ @override
+ @failingTest
+ test_prefix_assignment_not_in_method() async {
+ // Bad state: No reference information for p at 32
+ await super.test_prefix_assignment_not_in_method();
+ }
+
+ @override
+ @failingTest
+ test_prefix_conditionalPropertyAccess_call() async {
+ // Bad state: Expected element reference for analyzer offset 32; got one for kernel offset 35
+ await super.test_prefix_conditionalPropertyAccess_call();
+ }
+
+ @override
+ @failingTest
+ test_prefix_conditionalPropertyAccess_call_loadLibrary() async {
+ // Bad state: No reference information for p at 41
+ await super.test_prefix_conditionalPropertyAccess_call_loadLibrary();
+ }
+
+ @override
+ @failingTest
+ test_prefix_conditionalPropertyAccess_get() async {
+ // Bad state: Expected element reference for analyzer offset 39; got one for kernel offset 42
+ await super.test_prefix_conditionalPropertyAccess_get();
+ }
+
+ @override
+ @failingTest
@potentialAnalyzerProblem
test_prefix_conditionalPropertyAccess_get_loadLibrary() async {
return super.test_prefix_conditionalPropertyAccess_get_loadLibrary();
@@ -245,6 +2638,34 @@
@override
@failingTest
+ test_prefix_conditionalPropertyAccess_set() async {
+ // Bad state: Expected element reference for analyzer offset 32; got one for kernel offset 35
+ await super.test_prefix_conditionalPropertyAccess_set();
+ }
+
+ @override
+ @failingTest
+ test_prefix_conditionalPropertyAccess_set_loadLibrary() async {
+ // Bad state: No reference information for p at 41
+ await super.test_prefix_conditionalPropertyAccess_set_loadLibrary();
+ }
+
+ @override
+ @failingTest
+ test_prefix_unqualified_invocation_in_method() async {
+ // Bad state: No reference information for p at 46
+ await super.test_prefix_unqualified_invocation_in_method();
+ }
+
+ @override
+ @failingTest
+ test_prefix_unqualified_invocation_not_in_method() async {
+ // Bad state: No reference information for p at 32
+ await super.test_prefix_unqualified_invocation_not_in_method();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/30857')
test_prefixCollidesWithTopLevelMembers_functionTypeAlias() async {
return super.test_prefixCollidesWithTopLevelMembers_functionTypeAlias();
@@ -273,6 +2694,212 @@
@override
@failingTest
+ test_prefixNotFollowedByDot() async {
+ // Bad state: No reference information for p at 39
+ await super.test_prefixNotFollowedByDot();
+ }
+
+ @override
+ @failingTest
+ test_prefixNotFollowedByDot_compoundAssignment() async {
+ // Bad state: No reference information for p at 32
+ await super.test_prefixNotFollowedByDot_compoundAssignment();
+ }
+
+ @override
+ @failingTest
+ test_prefixNotFollowedByDot_conditionalMethodInvocation() async {
+ // Bad state: Expected element reference for analyzer offset 32; got one for kernel offset 35
+ await super.test_prefixNotFollowedByDot_conditionalMethodInvocation();
+ }
+
+ @override
+ @failingTest
+ test_privateCollisionInClassTypeAlias_mixinAndMixin() async {
+ // Expected 1 errors of type CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION, found 0
+ await super.test_privateCollisionInClassTypeAlias_mixinAndMixin();
+ }
+
+ @override
+ @failingTest
+ test_privateCollisionInClassTypeAlias_mixinAndMixin_indirect() async {
+ // Expected 1 errors of type CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION, found 0
+ await super.test_privateCollisionInClassTypeAlias_mixinAndMixin_indirect();
+ }
+
+ @override
+ @failingTest
+ test_privateCollisionInClassTypeAlias_superclassAndMixin() async {
+ // Expected 1 errors of type CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION, found 0
+ await super.test_privateCollisionInClassTypeAlias_superclassAndMixin();
+ }
+
+ @override
+ @failingTest
+ test_privateCollisionInClassTypeAlias_superclassAndMixin_same() async {
+ // Expected 1 errors of type CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION, found 0
+ await super.test_privateCollisionInClassTypeAlias_superclassAndMixin_same();
+ }
+
+ @override
+ @failingTest
+ test_privateCollisionInMixinApplication_mixinAndMixin() async {
+ // Expected 1 errors of type CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION, found 0
+ await super.test_privateCollisionInMixinApplication_mixinAndMixin();
+ }
+
+ @override
+ @failingTest
+ test_privateCollisionInMixinApplication_mixinAndMixin_indirect() async {
+ // Expected 1 errors of type CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION, found 0
+ await super
+ .test_privateCollisionInMixinApplication_mixinAndMixin_indirect();
+ }
+
+ @override
+ @failingTest
+ test_privateCollisionInMixinApplication_superclassAndMixin() async {
+ // Expected 1 errors of type CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION, found 0
+ await super.test_privateCollisionInMixinApplication_superclassAndMixin();
+ }
+
+ @override
+ @failingTest
+ test_privateCollisionInMixinApplication_superclassAndMixin_same() async {
+ // Expected 1 errors of type CompileTimeErrorCode.PRIVATE_COLLISION_IN_MIXIN_APPLICATION, found 0
+ await super
+ .test_privateCollisionInMixinApplication_superclassAndMixin_same();
+ }
+
+ @override
+ @failingTest
+ test_privateOptionalParameter() async {
+ // Expected 1 errors of type CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER, found 0
+ await super.test_privateOptionalParameter();
+ }
+
+ @override
+ @failingTest
+ test_privateOptionalParameter_fieldFormal() async {
+ // Expected 1 errors of type CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER, found 0
+ await super.test_privateOptionalParameter_fieldFormal();
+ }
+
+ @override
+ @failingTest
+ test_privateOptionalParameter_withDefaultValue() async {
+ // Expected 1 errors of type CompileTimeErrorCode.PRIVATE_OPTIONAL_PARAMETER, found 0
+ await super.test_privateOptionalParameter_withDefaultValue();
+ }
+
+ @override
+ @failingTest
+ test_recursiveCompileTimeConstant() async {
+ // Expected 1 errors of type CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT, found 0
+ await super.test_recursiveCompileTimeConstant();
+ }
+
+ @override
+ @failingTest
+ test_recursiveCompileTimeConstant_cycle() async {
+ // UnimplementedError: kernel: (ShadowMethodInvocation) #lib4::y.+(1)
+ await super.test_recursiveCompileTimeConstant_cycle();
+ }
+
+ @override
+ @failingTest
+ test_recursiveCompileTimeConstant_initializer_after_toplevel_var() async {
+ // Expected 1 errors of type CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT, found 0
+ await super
+ .test_recursiveCompileTimeConstant_initializer_after_toplevel_var();
+ }
+
+ @override
+ @failingTest
+ test_recursiveCompileTimeConstant_singleVariable() async {
+ // Expected 1 errors of type CompileTimeErrorCode.RECURSIVE_COMPILE_TIME_CONSTANT, found 0
+ await super.test_recursiveCompileTimeConstant_singleVariable();
+ }
+
+ @override
+ @failingTest
+ test_recursiveConstructorRedirect() async {
+ // Expected 2 errors of type CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT, found 0
+ await super.test_recursiveConstructorRedirect();
+ }
+
+ @override
+ @failingTest
+ test_recursiveConstructorRedirect_directSelfReference() async {
+ // Expected 1 errors of type CompileTimeErrorCode.RECURSIVE_CONSTRUCTOR_REDIRECT, found 0
+ await super.test_recursiveConstructorRedirect_directSelfReference();
+ }
+
+ @override
+ @failingTest
+ test_recursiveFactoryRedirect() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_recursiveFactoryRedirect();
+ }
+
+ @override
+ @failingTest
+ test_recursiveFactoryRedirect_directSelfReference() async {
+ // Expected 1 errors of type CompileTimeErrorCode.RECURSIVE_FACTORY_REDIRECT, found 0
+ await super.test_recursiveFactoryRedirect_directSelfReference();
+ }
+
+ @override
+ @failingTest
+ test_recursiveFactoryRedirect_diverging() async {
+ // Bad state: Attempting to apply a non-parameterized type (TypeParameterTypeImpl) to type arguments
+ await super.test_recursiveFactoryRedirect_diverging();
+ }
+
+ @override
+ @failingTest
+ test_recursiveFactoryRedirect_generic() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_recursiveFactoryRedirect_generic();
+ }
+
+ @override
+ @failingTest
+ test_recursiveFactoryRedirect_named() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_recursiveFactoryRedirect_named();
+ }
+
+ @override
+ @failingTest
+ test_recursiveFactoryRedirect_outsideCycle() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_recursiveFactoryRedirect_outsideCycle();
+ }
+
+ @override
+ @failingTest
+ test_recursiveInterfaceInheritance_extends() async {
+ // Expected 2 errors of type CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE, found 0
+ await super.test_recursiveInterfaceInheritance_extends();
+ }
+
+ @override
+ @failingTest
+ test_recursiveInterfaceInheritance_extends_implements() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_recursiveInterfaceInheritance_extends_implements();
+ }
+
+ @override
+ @failingTest
+ test_recursiveInterfaceInheritance_implements() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_recursiveInterfaceInheritance_implements();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/31007')
test_recursiveInterfaceInheritance_mixin() async {
return super.test_recursiveInterfaceInheritance_mixin();
@@ -280,6 +2907,65 @@
@override
@failingTest
+ test_recursiveInterfaceInheritance_mixin_superclass() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_recursiveInterfaceInheritance_mixin_superclass();
+ }
+
+ @override
+ @failingTest
+ test_recursiveInterfaceInheritance_tail() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_recursiveInterfaceInheritance_tail();
+ }
+
+ @override
+ @failingTest
+ test_recursiveInterfaceInheritance_tail2() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_recursiveInterfaceInheritance_tail2();
+ }
+
+ @override
+ @failingTest
+ test_recursiveInterfaceInheritance_tail3() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_recursiveInterfaceInheritance_tail3();
+ }
+
+ @override
+ @failingTest
+ test_recursiveInterfaceInheritanceBaseCaseExtends() async {
+ // Expected 1 errors of type CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS, found 0
+ await super.test_recursiveInterfaceInheritanceBaseCaseExtends();
+ }
+
+ @override
+ @failingTest
+ test_recursiveInterfaceInheritanceBaseCaseExtends_abstract() async {
+ // Expected 1 errors of type CompileTimeErrorCode.RECURSIVE_INTERFACE_INHERITANCE_BASE_CASE_EXTENDS, found 0;
+ // 1 errors of type StaticWarningCode.CONCRETE_CLASS_WITH_ABSTRACT_MEMBER, found 0;
+ // 1 errors of type StaticWarningCode.NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE, found 0
+ await super.test_recursiveInterfaceInheritanceBaseCaseExtends_abstract();
+ }
+
+ @override
+ @failingTest
+ test_recursiveInterfaceInheritanceBaseCaseImplements() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_recursiveInterfaceInheritanceBaseCaseImplements();
+ }
+
+ @override
+ @failingTest
+ test_recursiveInterfaceInheritanceBaseCaseImplements_typeAlias() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super
+ .test_recursiveInterfaceInheritanceBaseCaseImplements_typeAlias();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/31007')
test_recursiveInterfaceInheritanceBaseCaseWith() async {
return super.test_recursiveInterfaceInheritanceBaseCaseWith();
@@ -287,6 +2973,202 @@
@override
@failingTest
+ test_redirectGenerativeToMissingConstructor() async {
+ // Bad state: No reference information for noSuchConstructor at 23
+ await super.test_redirectGenerativeToMissingConstructor();
+ }
+
+ @override
+ @failingTest
+ test_redirectGenerativeToNonGenerativeConstructor() async {
+ // Bad state: No reference information for x at 23
+ await super.test_redirectGenerativeToNonGenerativeConstructor();
+ }
+
+ @override
+ @failingTest
+ test_redirectToMissingConstructor_named() async {
+ // NoSuchMethodError: The getter 'returnType' was called on null.
+ await super.test_redirectToMissingConstructor_named();
+ }
+
+ @override
+ @failingTest
+ test_redirectToMissingConstructor_unnamed() async {
+ // NoSuchMethodError: The getter 'returnType' was called on null.
+ await super.test_redirectToMissingConstructor_unnamed();
+ }
+
+ @override
+ @failingTest
+ test_redirectToNonClass_notAType() async {
+ // NoSuchMethodError: The getter 'returnType' was called on null.
+ await super.test_redirectToNonClass_notAType();
+ }
+
+ @override
+ @failingTest
+ test_redirectToNonClass_undefinedIdentifier() async {
+ // NoSuchMethodError: The getter 'returnType' was called on null.
+ await super.test_redirectToNonClass_undefinedIdentifier();
+ }
+
+ @override
+ @failingTest
+ test_redirectToNonConstConstructor() async {
+ // Expected 1 errors of type CompileTimeErrorCode.REDIRECT_TO_NON_CONST_CONSTRUCTOR, found 0
+ await super.test_redirectToNonConstConstructor();
+ }
+
+ @override
+ @failingTest
+ test_referencedBeforeDeclaration_hideInBlock_function() async {
+ // Bad state: No declaration information for v() {} at 34
+ await super.test_referencedBeforeDeclaration_hideInBlock_function();
+ }
+
+ @override
+ @failingTest
+ test_referencedBeforeDeclaration_hideInBlock_local() async {
+ // Bad state: No type information for v at 38
+ await super.test_referencedBeforeDeclaration_hideInBlock_local();
+ }
+
+ @override
+ @failingTest
+ test_referencedBeforeDeclaration_hideInBlock_subBlock() async {
+ // Bad state: No type information for v at 48
+ await super.test_referencedBeforeDeclaration_hideInBlock_subBlock();
+ }
+
+ @override
+ @failingTest
+ test_referencedBeforeDeclaration_inInitializer_closure() async {
+ // Bad state: No type information for v at 15
+ await super.test_referencedBeforeDeclaration_inInitializer_closure();
+ }
+
+ @override
+ @failingTest
+ test_referencedBeforeDeclaration_inInitializer_directly() async {
+ // Bad state: No type information for v at 15
+ await super.test_referencedBeforeDeclaration_inInitializer_directly();
+ }
+
+ @override
+ @failingTest
+ test_referencedBeforeDeclaration_type_localFunction() async {
+ // Bad state: No declaration information for int String(int x) => x + 1; at 40
+ await super.test_referencedBeforeDeclaration_type_localFunction();
+ }
+
+ @override
+ @failingTest
+ test_referencedBeforeDeclaration_type_localVariable() async {
+ // Bad state: No type information for String at 44
+ await super.test_referencedBeforeDeclaration_type_localVariable();
+ }
+
+ @override
+ @failingTest
+ test_rethrowOutsideCatch() async {
+ // Bad state: No type information for rethrow at 8
+ await super.test_rethrowOutsideCatch();
+ }
+
+ @override
+ @failingTest
+ test_returnInGenerativeConstructor() async {
+ // Bad state: No type information for 0 at 25
+ await super.test_returnInGenerativeConstructor();
+ }
+
+ @override
+ @failingTest
+ test_returnInGenerativeConstructor_expressionFunctionBody() async {
+ // Bad state: No type information for null at 19
+ await super.test_returnInGenerativeConstructor_expressionFunctionBody();
+ }
+
+ @override
+ @failingTest
+ test_returnInGenerator_asyncStar() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_returnInGenerator_asyncStar();
+ }
+
+ @override
+ @failingTest
+ test_returnInGenerator_syncStar() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_returnInGenerator_syncStar();
+ }
+
+ @override
+ @failingTest
+ test_sharedDeferredPrefix() async {
+ // Bad state: Expected element reference for analyzer offset 86; got one for kernel offset 90
+ await super.test_sharedDeferredPrefix();
+ }
+
+ @override
+ @failingTest
+ test_superInInvalidContext_binaryExpression() async {
+ // Expected 1 errors of type CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, found 0
+ await super.test_superInInvalidContext_binaryExpression();
+ }
+
+ @override
+ @failingTest
+ test_superInInvalidContext_constructorFieldInitializer() async {
+ // Expected 1 errors of type CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, found 0
+ await super.test_superInInvalidContext_constructorFieldInitializer();
+ }
+
+ @override
+ @failingTest
+ test_superInInvalidContext_factoryConstructor() async {
+ // Bad state: No reference information for m at 67
+ await super.test_superInInvalidContext_factoryConstructor();
+ }
+
+ @override
+ @failingTest
+ test_superInInvalidContext_instanceVariableInitializer() async {
+ // Expected 1 errors of type CompileTimeErrorCode.SUPER_IN_INVALID_CONTEXT, found 0
+ await super.test_superInInvalidContext_instanceVariableInitializer();
+ }
+
+ @override
+ @failingTest
+ test_superInInvalidContext_staticMethod() async {
+ // Bad state: No reference information for m at 76
+ await super.test_superInInvalidContext_staticMethod();
+ }
+
+ @override
+ @failingTest
+ test_superInInvalidContext_staticVariableInitializer() async {
+ // Bad state: No reference information for a at 75
+ await super.test_superInInvalidContext_staticVariableInitializer();
+ }
+
+ @override
+ @failingTest
+ test_superInInvalidContext_topLevelFunction() async {
+ // Bad state: No reference information for f at 14
+ await super.test_superInInvalidContext_topLevelFunction();
+ }
+
+ @override
+ @failingTest
+ test_superInInvalidContext_topLevelVariableInitializer() async {
+ // Bad state: No reference information for y at 14
+ await super.test_superInInvalidContext_topLevelVariableInitializer();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/30982')
test_superInRedirectingConstructor_redirectionSuper() async {
return super.test_superInRedirectingConstructor_redirectionSuper();
@@ -301,6 +3183,21 @@
@override
@failingTest
+ test_symbol_constructor_badArgs() async {
+ // Bad state: No type information for Symbol at 69
+ await super.test_symbol_constructor_badArgs();
+ }
+
+ @override
+ @failingTest
+ test_test_fieldInitializerOutsideConstructor_topLevelFunction() async {
+ // Expected 1 errors of type ParserErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, found 0;
+ // 1 errors of type CompileTimeErrorCode.FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, found 0
+ await super.test_test_fieldInitializerOutsideConstructor_topLevelFunction();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/31007')
test_typeAliasCannotReferenceItself_11987() async {
return super.test_typeAliasCannotReferenceItself_11987();
@@ -308,6 +3205,14 @@
@override
@failingTest
+ test_typeAliasCannotReferenceItself_functionTypedParameter_returnType() async {
+ // Expected 1 errors of type CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, found 0
+ await super
+ .test_typeAliasCannotReferenceItself_functionTypedParameter_returnType();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/31007')
test_typeAliasCannotReferenceItself_generic() async {
return super.test_typeAliasCannotReferenceItself_generic();
@@ -344,6 +3249,20 @@
@override
@failingTest
+ test_typeAliasCannotReferenceItself_returnType() async {
+ // Expected 1 errors of type CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, found 0
+ await super.test_typeAliasCannotReferenceItself_returnType();
+ }
+
+ @override
+ @failingTest
+ test_typeAliasCannotReferenceItself_returnType_indirect() async {
+ // Expected 2 errors of type CompileTimeErrorCode.TYPE_ALIAS_CANNOT_REFERENCE_ITSELF, found 0
+ await super.test_typeAliasCannotReferenceItself_returnType_indirect();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/31007')
test_typeAliasCannotReferenceItself_typeVariableBounds() async {
return super.test_typeAliasCannotReferenceItself_typeVariableBounds();
@@ -351,6 +3270,90 @@
@override
@failingTest
+ test_typeArgumentNotMatchingBounds_const() async {
+ // Expected 1 errors of type CompileTimeErrorCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_typeArgumentNotMatchingBounds_const();
+ }
+
+ @override
+ @failingTest
+ test_undefinedClass_const() async {
+ // Bad state: No type information for A at 21
+ await super.test_undefinedClass_const();
+ }
+
+ @override
+ @failingTest
+ test_undefinedConstructorInInitializer_explicit_named() async {
+ // Expected 1 errors of type CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER, found 0
+ await super.test_undefinedConstructorInInitializer_explicit_named();
+ }
+
+ @override
+ @failingTest
+ test_undefinedConstructorInInitializer_explicit_unnamed() async {
+ // Expected 1 errors of type CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT, found 0
+ await super.test_undefinedConstructorInInitializer_explicit_unnamed();
+ }
+
+ @override
+ @failingTest
+ test_undefinedConstructorInInitializer_implicit() async {
+ // Expected 1 errors of type CompileTimeErrorCode.UNDEFINED_CONSTRUCTOR_IN_INITIALIZER_DEFAULT, found 0
+ await super.test_undefinedConstructorInInitializer_implicit();
+ }
+
+ @override
+ @failingTest
+ test_undefinedNamedParameter() async {
+ // Bad state: No type information for A at 42
+ await super.test_undefinedNamedParameter();
+ }
+
+ @override
+ @failingTest
+ test_uriDoesNotExist_export() async {
+ // Expected 1 errors of type CompileTimeErrorCode.URI_DOES_NOT_EXIST, found 0
+ await super.test_uriDoesNotExist_export();
+ }
+
+ @override
+ @failingTest
+ test_uriDoesNotExist_import() async {
+ // Expected 1 errors of type CompileTimeErrorCode.URI_DOES_NOT_EXIST, found 0
+ await super.test_uriDoesNotExist_import();
+ }
+
+ @override
+ @failingTest
+ test_uriDoesNotExist_import_appears_after_deleting_target() async {
+ // Expected 1 errors of type CompileTimeErrorCode.URI_DOES_NOT_EXIST, found 0
+ await super.test_uriDoesNotExist_import_appears_after_deleting_target();
+ }
+
+ @override
+ @failingTest
+ test_uriDoesNotExist_import_disappears_when_fixed() async {
+ // Expected 1 errors of type CompileTimeErrorCode.URI_DOES_NOT_EXIST, found 0
+ await super.test_uriDoesNotExist_import_disappears_when_fixed();
+ }
+
+ @override
+ @failingTest
+ test_uriDoesNotExist_part() async {
+ // Expected 1 errors of type CompileTimeErrorCode.URI_DOES_NOT_EXIST, found 0
+ await super.test_uriDoesNotExist_part();
+ }
+
+ @override
+ @failingTest
+ test_uriWithInterpolation_constant() async {
+ // Expected 1 errors of type StaticWarningCode.UNDEFINED_IDENTIFIER, found 0
+ await super.test_uriWithInterpolation_constant();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/30984')
test_uriWithInterpolation_nonConstant() async {
return super.test_uriWithInterpolation_nonConstant();
@@ -358,6 +3361,27 @@
@override
@failingTest
+ test_wrongNumberOfParametersForOperator1() async {
+ // Expected 1 errors of type CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR, found 0
+ await super.test_wrongNumberOfParametersForOperator1();
+ }
+
+ @override
+ @failingTest
+ test_wrongNumberOfParametersForOperator_minus() async {
+ // Expected 1 errors of type CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR_MINUS, found 0
+ await super.test_wrongNumberOfParametersForOperator_minus();
+ }
+
+ @override
+ @failingTest
+ test_wrongNumberOfParametersForOperator_tilde() async {
+ // Expected 1 errors of type CompileTimeErrorCode.WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR, found 0
+ await super.test_wrongNumberOfParametersForOperator_tilde();
+ }
+
+ @override
+ @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/31096')
test_wrongNumberOfParametersForSetter_function_named() async {
return super.test_wrongNumberOfParametersForSetter_function_named();
@@ -411,6 +3435,12 @@
test_wrongNumberOfParametersForSetter_method_tooMany() async {
return super.test_wrongNumberOfParametersForSetter_method_tooMany();
}
+
+ @override
+ test_yieldInNonGenerator_async() async {
+ // Test passes, even though if fails in the superclass
+ await super.test_yieldInNonGenerator_async();
+ }
}
/// Tests marked with this annotation fail because of a Fasta problem.
diff --git a/pkg/analyzer/test/generated/compile_time_error_code_test.dart b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
index fea5b07..7dc9b41 100644
--- a/pkg/analyzer/test/generated/compile_time_error_code_test.dart
+++ b/pkg/analyzer/test/generated/compile_time_error_code_test.dart
@@ -98,169 +98,6 @@
AnalysisOptions get defaultAnalysisOptions =>
new AnalysisOptionsImpl()..strongMode = true;
- fail_awaitInWrongContext_sync() async {
- // This test requires better error recovery than we currently have. In
- // particular, we need to be able to distinguish between an await expression
- // in the wrong context, and the use of 'await' as an identifier.
- Source source = addSource(r'''
-f(x) {
- return await x;
-}''');
- await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT]);
- verify([source]);
- }
-
- fail_awaitInWrongContext_syncStar() async {
- // This test requires better error recovery than we currently have. In
- // particular, we need to be able to distinguish between an await expression
- // in the wrong context, and the use of 'await' as an identifier.
- Source source = addSource(r'''
-f(x) sync* {
- yield await x;
-}''');
- await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT]);
- verify([source]);
- }
-
- fail_constEvalThrowsException() async {
- Source source = addSource(r'''
-class C {
- const C();
-}
-f() { return const C(); }''');
- await computeAnalysisResult(source);
- assertErrors(
- source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION]);
- verify([source]);
- }
-
- fail_invalidIdentifierInAsync_async() async {
- // TODO(brianwilkerson) Report this error.
- Source source = addSource(r'''
-class A {
- m() async {
- int async;
- }
-}''');
- await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
- verify([source]);
- }
-
- fail_invalidIdentifierInAsync_await() async {
- // TODO(brianwilkerson) Report this error.
- Source source = addSource(r'''
-class A {
- m() async {
- int await;
- }
-}''');
- await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
- verify([source]);
- }
-
- fail_invalidIdentifierInAsync_yield() async {
- // TODO(brianwilkerson) Report this error.
- Source source = addSource(r'''
-class A {
- m() async {
- int yield;
- }
-}''');
- await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
- verify([source]);
- }
-
- fail_mixinDeclaresConstructor() async {
- Source source = addSource(r'''
-class A {
- A() {}
-}
-class B extends Object mixin A {}''');
- await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
- verify([source]);
- }
-
- fail_mixinOfNonClass() async {
- // TODO(brianwilkerson) Compare with MIXIN_WITH_NON_CLASS_SUPERCLASS.
- Source source = addSource(r'''
-var A;
-class B extends Object mixin A {}''');
- await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]);
- verify([source]);
- }
-
- fail_objectCannotExtendAnotherClass() async {
- Source source = addSource(r'''
-''');
- await computeAnalysisResult(source);
- assertErrors(
- source, [CompileTimeErrorCode.OBJECT_CANNOT_EXTEND_ANOTHER_CLASS]);
- verify([source]);
- }
-
- fail_superInitializerInObject() async {
- Source source = addSource(r'''
-''');
- await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.SUPER_INITIALIZER_IN_OBJECT]);
- verify([source]);
- }
-
- fail_yieldEachInNonGenerator_async() async {
- // TODO(brianwilkerson) We are currently parsing the yield statement as a
- // binary expression.
- Source source = addSource(r'''
-f() async {
- yield* 0;
-}''');
- await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR]);
- verify([source]);
- }
-
- fail_yieldEachInNonGenerator_sync() async {
- // TODO(brianwilkerson) We are currently parsing the yield statement as a
- // binary expression.
- Source source = addSource(r'''
-f() {
- yield* 0;
-}''');
- await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.YIELD_IN_NON_GENERATOR]);
- verify([source]);
- }
-
- fail_yieldInNonGenerator_async() async {
- // TODO(brianwilkerson) We are currently trying to parse the yield statement
- // as a binary expression.
- Source source = addSource(r'''
-f() async {
- yield 0;
-}''');
- await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.YIELD_IN_NON_GENERATOR]);
- verify([source]);
- }
-
- fail_yieldInNonGenerator_sync() async {
- // TODO(brianwilkerson) We are currently trying to parse the yield statement
- // as a binary expression.
- Source source = addSource(r'''
-f() {
- yield 0;
-}''');
- await computeAnalysisResult(source);
- assertErrors(source, [CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR]);
- verify([source]);
- }
-
test_accessPrivateEnumField() async {
Source source = addSource(r'''
enum E { ONE }
@@ -659,6 +496,34 @@
verify([source]);
}
+ @failingTest
+ test_awaitInWrongContext_sync() async {
+ // This test requires better error recovery than we currently have. In
+ // particular, we need to be able to distinguish between an await expression
+ // in the wrong context, and the use of 'await' as an identifier.
+ Source source = addSource(r'''
+f(x) {
+ return await x;
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT]);
+ verify([source]);
+ }
+
+ @failingTest
+ test_awaitInWrongContext_syncStar() async {
+ // This test requires better error recovery than we currently have. In
+ // particular, we need to be able to distinguish between an await expression
+ // in the wrong context, and the use of 'await' as an identifier.
+ Source source = addSource(r'''
+f(x) sync* {
+ yield await x;
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [CompileTimeErrorCode.AWAIT_IN_WRONG_CONTEXT]);
+ verify([source]);
+ }
+
test_bug_23176() async {
Source source = addSource('''
class A {
@@ -1191,6 +1056,19 @@
verify([source]);
}
+ @failingTest
+ test_constEvalThrowsException() async {
+ Source source = addSource(r'''
+class C {
+ const C();
+}
+f() { return const C(); }''');
+ await computeAnalysisResult(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.CONST_CONSTRUCTOR_THROWS_EXCEPTION]);
+ verify([source]);
+ }
+
test_constEvalThrowsException_binaryMinus_null() async {
await _check_constEvalThrowsException_binary_null("null - 5", false);
await _check_constEvalThrowsException_binary_null("5 - null", true);
@@ -3440,6 +3318,48 @@
// no verify() call, "B" is not resolved
}
+ @failingTest
+ test_invalidIdentifierInAsync_async() async {
+ // TODO(brianwilkerson) Report this error.
+ Source source = addSource(r'''
+class A {
+ m() async {
+ int async;
+ }
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
+ verify([source]);
+ }
+
+ @failingTest
+ test_invalidIdentifierInAsync_await() async {
+ // TODO(brianwilkerson) Report this error.
+ Source source = addSource(r'''
+class A {
+ m() async {
+ int await;
+ }
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
+ verify([source]);
+ }
+
+ @failingTest
+ test_invalidIdentifierInAsync_yield() async {
+ // TODO(brianwilkerson) Report this error.
+ Source source = addSource(r'''
+class A {
+ m() async {
+ int yield;
+ }
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [CompileTimeErrorCode.INVALID_IDENTIFIER_IN_ASYNC]);
+ verify([source]);
+ }
+
test_invalidModifierOnConstructor_async() async {
Source source = addSource(r'''
class A {
@@ -3760,6 +3680,18 @@
verify([source]);
}
+ @failingTest
+ test_mixinDeclaresConstructor() async {
+ Source source = addSource(r'''
+class A {
+ A() {}
+}
+class B extends Object mixin A {}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [CompileTimeErrorCode.MIXIN_DECLARES_CONSTRUCTOR]);
+ verify([source]);
+ }
+
test_mixinDeclaresConstructor_classDeclaration() async {
Source source = addSource(r'''
class A {
@@ -4043,6 +3975,17 @@
verify([source]);
}
+ @failingTest
+ test_mixinOfNonClass() async {
+ // TODO(brianwilkerson) Compare with MIXIN_WITH_NON_CLASS_SUPERCLASS.
+ Source source = addSource(r'''
+var A;
+class B extends Object mixin A {}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [CompileTimeErrorCode.MIXIN_OF_NON_CLASS]);
+ verify([source]);
+ }
+
test_mixinOfNonClass_class() async {
Source source = addSource(r'''
int A;
@@ -5019,6 +4962,16 @@
verify([source]);
}
+ @failingTest
+ test_objectCannotExtendAnotherClass() async {
+ Source source = addSource(r'''
+''');
+ await computeAnalysisResult(source);
+ assertErrors(
+ source, [CompileTimeErrorCode.OBJECT_CANNOT_EXTEND_ANOTHER_CLASS]);
+ verify([source]);
+ }
+
test_optionalParameterInOperator_named() async {
Source source = addSource(r'''
class A {
@@ -5958,6 +5911,17 @@
assertErrors(source, [CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION]);
}
+ test_referencedBeforeDeclaration_hideInBlock_comment() async {
+ Source source = addSource(r'''
+main() {
+ /// [v] is a variable.
+ var v = 2;
+}
+print(x) {}''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ }
+
test_rethrowOutsideCatch() async {
Source source = addSource(r'''
f() {
@@ -6121,6 +6085,15 @@
// no verify(), 'super.y' is not resolved
}
+ @failingTest
+ test_superInitializerInObject() async {
+ Source source = addSource(r'''
+''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [CompileTimeErrorCode.SUPER_INITIALIZER_IN_OBJECT]);
+ verify([source]);
+ }
+
test_superInRedirectingConstructor_redirectionSuper() async {
Source source = addSource(r'''
class A {}
@@ -6615,6 +6588,58 @@
verify([source]);
}
+ @failingTest
+ test_yieldEachInNonGenerator_async() async {
+ // TODO(brianwilkerson) We are currently parsing the yield statement as a
+ // binary expression.
+ Source source = addSource(r'''
+f() async {
+ yield* 0;
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR]);
+ verify([source]);
+ }
+
+ @failingTest
+ test_yieldEachInNonGenerator_sync() async {
+ // TODO(brianwilkerson) We are currently parsing the yield statement as a
+ // binary expression.
+ Source source = addSource(r'''
+f() {
+ yield* 0;
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [CompileTimeErrorCode.YIELD_IN_NON_GENERATOR]);
+ verify([source]);
+ }
+
+ @failingTest
+ test_yieldInNonGenerator_async() async {
+ // TODO(brianwilkerson) We are currently trying to parse the yield statement
+ // as a binary expression.
+ Source source = addSource(r'''
+f() async {
+ yield 0;
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [CompileTimeErrorCode.YIELD_IN_NON_GENERATOR]);
+ verify([source]);
+ }
+
+ @failingTest
+ test_yieldInNonGenerator_sync() async {
+ // TODO(brianwilkerson) We are currently trying to parse the yield statement
+ // as a binary expression.
+ Source source = addSource(r'''
+f() {
+ yield 0;
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [CompileTimeErrorCode.YIELD_EACH_IN_NON_GENERATOR]);
+ verify([source]);
+ }
+
Future<Null> _check_constEvalThrowsException_binary_null(
String expr, bool resolved) async {
Source source = addSource("const C = $expr;");
diff --git a/pkg/analyzer/test/generated/error_suppression_kernel_test.dart b/pkg/analyzer/test/generated/error_suppression_kernel_test.dart
index 7babab5..87134ae 100644
--- a/pkg/analyzer/test/generated/error_suppression_kernel_test.dart
+++ b/pkg/analyzer/test/generated/error_suppression_kernel_test.dart
@@ -16,4 +16,122 @@
class ErrorSuppressionTest_Kernel extends ErrorSuppressionTest_Driver {
@override
bool get enableKernelDriver => true;
+
+ @override
+ bool get previewDart2 => true;
+
+ @override
+ @failingTest
+ test_error_code_mismatch() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0;
+ // 1 errors of type CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, found 0
+ await super.test_error_code_mismatch();
+ }
+
+ @override
+ @failingTest
+ test_ignore_first() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, found 0
+ await super.test_ignore_first();
+ }
+
+ @override
+ @failingTest
+ test_ignore_first_trailing() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, found 0
+ await super.test_ignore_first_trailing();
+ }
+
+ @override
+ @failingTest
+ test_ignore_for_file() async {
+ // Expected 1 errors of type CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, found 0
+ await super.test_ignore_for_file();
+ }
+
+ @override
+ @failingTest
+ test_ignore_second() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0
+ await super.test_ignore_second();
+ }
+
+ @override
+ @failingTest
+ test_ignore_second_trailing() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0
+ await super.test_ignore_second_trailing();
+ }
+
+ @override
+ @failingTest
+ test_invalid_error_code() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0;
+ // 1 errors of type CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, found 0
+ await super.test_invalid_error_code();
+ }
+
+ @override
+ @failingTest
+ test_missing_error_codes() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t1 = #lib1::x in let ...
+ await super.test_missing_error_codes();
+ }
+
+ @override
+ @failingTest
+ test_missing_metadata_suffix() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0
+ await super.test_missing_metadata_suffix();
+ }
+
+ @override
+ @failingTest
+ test_multiple_comments() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0
+ await super.test_multiple_comments();
+ }
+
+ @override
+ @failingTest
+ test_multiple_ignores() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t2 = #lib2::x in let ...
+ await super.test_multiple_ignores();
+ }
+
+ @override
+ @failingTest
+ test_multiple_ignores_traling() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t3 = #lib3::x in let ...
+ await super.test_multiple_ignores_traling();
+ }
+
+ @override
+ @failingTest
+ test_multiple_ignores_whitespace_variant_1() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t4 = #lib4::x in let ...
+ await super.test_multiple_ignores_whitespace_variant_1();
+ }
+
+ @override
+ @failingTest
+ test_multiple_ignores_whitespace_variant_2() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t5 = #lib5::x in let ...
+ await super.test_multiple_ignores_whitespace_variant_2();
+ }
+
+ @override
+ @failingTest
+ test_multiple_ignores_whitespace_variant_3() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t6 = #lib6::x in let ...
+ await super.test_multiple_ignores_whitespace_variant_3();
+ }
+
+ @override
+ @failingTest
+ test_no_ignores() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0;
+ // 1 errors of type CompileTimeErrorCode.CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, found 0
+ await super.test_no_ignores();
+ }
}
diff --git a/pkg/analyzer/test/generated/hint_code_kernel_test.dart b/pkg/analyzer/test/generated/hint_code_kernel_test.dart
index aaf7f2e..7bbdb16 100644
--- a/pkg/analyzer/test/generated/hint_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/hint_code_kernel_test.dart
@@ -18,17 +18,185 @@
bool get enableKernelDriver => true;
@override
+ bool get previewDart2 => true;
+
+ @failingTest
+ @override
+ test_abstractSuperMemberReference_getter() async {
+ // Expected 1 errors of type HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE, found 0
+ return super.test_abstractSuperMemberReference_getter();
+ }
+
+ @failingTest
+ @override
+ test_abstractSuperMemberReference_method_invocation() async {
+ // Expected 1 errors of type HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE, found 0
+ return super.test_abstractSuperMemberReference_method_invocation();
+ }
+
+ @failingTest
+ @override
+ test_abstractSuperMemberReference_method_reference() async {
+ // Expected 1 errors of type HintCode.ABSTRACT_SUPER_MEMBER_REFERENCE, found 0
+ return super.test_abstractSuperMemberReference_method_reference();
+ }
+
+ @failingTest
+ @override
+ test_argumentTypeNotAssignable_functionType() async {
+ // Expected 1 errors of type HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, found 0
+ return super.test_argumentTypeNotAssignable_functionType();
+ }
+
+ @failingTest
+ @override
+ test_argumentTypeNotAssignable_type() async {
+ // Expected 1 errors of type HintCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, found 0
+ return super.test_argumentTypeNotAssignable_type();
+ }
+
+ @failingTest
+ @override
+ test_deadCode_deadBlock_else() async {
+ // Expected 1 errors of type HintCode.DEAD_CODE, found 0
+ return super.test_deadCode_deadBlock_else();
+ }
+
+ @failingTest
+ @override
+ test_deadCode_deadBlock_else_nested() async {
+ // Expected 1 errors of type HintCode.DEAD_CODE, found 0
+ return super.test_deadCode_deadBlock_else_nested();
+ }
+
+ @failingTest
+ @override
+ test_deadCode_deadBlock_if() async {
+ // Expected 1 errors of type HintCode.DEAD_CODE, found 0
+ return super.test_deadCode_deadBlock_if();
+ }
+
+ @failingTest
+ @override
+ test_deadCode_deadBlock_if_nested() async {
+ // Expected 1 errors of type HintCode.DEAD_CODE, found 0
+ return super.test_deadCode_deadBlock_if_nested();
+ }
+
+ @failingTest
+ @override
+ test_deadCode_deadFinalStatementInCase() async {
+ // Expected 1 errors of type StaticWarningCode.CASE_BLOCK_NOT_TERMINATED, found 0
+ return super.test_deadCode_deadFinalStatementInCase();
+ }
+
+ @failingTest
+ @override
+ test_deprecatedAnnotationUse_Deprecated() async {
+ // Expected 1 errors of type HintCode.DEPRECATED_MEMBER_USE, found 0
+ return super.test_deprecatedAnnotationUse_Deprecated();
+ }
+
+ @override
@failingTest
test_deprecatedAnnotationUse_named() async {
return super.test_deprecatedAnnotationUse_named();
}
- @override
@failingTest
+ @override
test_deprecatedAnnotationUse_positional() async {
return super.test_deprecatedAnnotationUse_positional();
}
+ @failingTest
+ @override
+ test_deprecatedFunction_class() async {
+ // Expected 1 errors of type HintCode.DEPRECATED_FUNCTION_CLASS_DECLARATION, found 0
+ return super.test_deprecatedFunction_class();
+ }
+
+ @failingTest
+ @override
+ test_deprecatedFunction_extends() async {
+ // Expected 1 errors of type HintCode.DEPRECATED_EXTENDS_FUNCTION, found 0;
+ // 1 errors of type StaticWarningCode.FUNCTION_WITHOUT_CALL, found 0
+ return super.test_deprecatedFunction_extends();
+ }
+
+ @failingTest
+ @override
+ test_deprecatedFunction_extends2() async {
+ // Expected 1 errors of type HintCode.DEPRECATED_FUNCTION_CLASS_DECLARATION, found 0;
+ // 1 errors of type HintCode.DEPRECATED_EXTENDS_FUNCTION, found 0
+ return super.test_deprecatedFunction_extends2();
+ }
+
+ @failingTest
+ @override
+ test_deprecatedFunction_mixin() async {
+ // Expected 1 errors of type HintCode.DEPRECATED_MIXIN_FUNCTION, found 0;
+ // 1 errors of type StaticWarningCode.FUNCTION_WITHOUT_CALL, found 0
+ return super.test_deprecatedFunction_mixin();
+ }
+
+ @failingTest
+ @override
+ test_deprecatedFunction_mixin2() async {
+ // Expected 1 errors of type HintCode.DEPRECATED_FUNCTION_CLASS_DECLARATION, found 0;
+ // 1 errors of type HintCode.DEPRECATED_MIXIN_FUNCTION, found 0
+ return super.test_deprecatedFunction_mixin2();
+ }
+
+ @failingTest
+ @override
+ test_divisionOptimization_propagatedType() async {
+ // Expected 1 errors of type HintCode.DIVISION_OPTIMIZATION, found 0
+ return super.test_divisionOptimization_propagatedType();
+ }
+
+ @failingTest
+ @override
+ test_duplicateImport3() async {
+ // Expected 0 errors of type HintCode.UNUSED_IMPORT, found 2 (18, 57)
+ return super.test_duplicateImport3();
+ }
+
+ @failingTest
+ @override
+ test_importDeferredLibraryWithLoadFunction() async {
+ // ad state: Expected element reference for analyzer offset 60; got one for kernel offset 65
+ return super.test_importDeferredLibraryWithLoadFunction();
+ }
+
+ @failingTest
+ @override
+ test_invalidAssignment_instanceVariable() async {
+ // Expected 1 errors of type HintCode.INVALID_ASSIGNMENT, found 0
+ return super.test_invalidAssignment_instanceVariable();
+ }
+
+ @failingTest
+ @override
+ test_invalidAssignment_localVariable() async {
+ // Expected 1 errors of type HintCode.INVALID_ASSIGNMENT, found 0
+ return super.test_invalidAssignment_localVariable();
+ }
+
+ @failingTest
+ @override
+ test_invalidAssignment_staticVariable() async {
+ // Expected 1 errors of type HintCode.INVALID_ASSIGNMENT, found 0
+ return super.test_invalidAssignment_staticVariable();
+ }
+
+ @failingTest
+ @override
+ test_invalidAssignment_variableDeclaration() async {
+ // UnimplementedError: Multiple field
+ return super.test_invalidAssignment_variableDeclaration();
+ }
+
@override
@failingTest
test_invalidRequiredParam_on_named_parameter_with_default() async {
@@ -60,6 +228,69 @@
return super.test_invalidRequiredParam_valid();
}
+ @failingTest
+ @override
+ test_js_lib_OK() async {
+ // Bad state: Expected element reference for analyzer offset 51; got one for kernel offset 1
+ return super.test_js_lib_OK();
+ }
+
+ @failingTest
+ @override
+ test_missingJsLibAnnotation_class() async {
+ // Expected 1 errors of type HintCode.MISSING_JS_LIB_ANNOTATION, found 0;
+ // 0 errors of type HintCode.UNUSED_IMPORT, found 1 (21)
+ return super.test_missingJsLibAnnotation_class();
+ }
+
+ @failingTest
+ @override
+ test_missingJsLibAnnotation_externalField() async {
+ // Expected 1 errors of type ParserErrorCode.EXTERNAL_FIELD, found 0;
+ // 1 errors of type HintCode.MISSING_JS_LIB_ANNOTATION, found 0;
+ // 0 errors of type ParserErrorCode.EXTRANEOUS_MODIFIER, found 1 (36);
+ // 0 errors of type HintCode.UNUSED_IMPORT, found 1 (7)
+ return super.test_missingJsLibAnnotation_externalField();
+ }
+
+ @failingTest
+ @override
+ test_missingJsLibAnnotation_function() async {
+ // Expected 1 errors of type HintCode.MISSING_JS_LIB_ANNOTATION, found 0;
+ // 0 errors of type HintCode.UNUSED_IMPORT, found 1 (21)
+ return super.test_missingJsLibAnnotation_function();
+ }
+
+ @failingTest
+ @override
+ test_missingJsLibAnnotation_method() async {
+ // Expected 1 errors of type HintCode.MISSING_JS_LIB_ANNOTATION, found 0;
+ // 0 errors of type HintCode.UNUSED_IMPORT, found 1 (21)
+ return super.test_missingJsLibAnnotation_method();
+ }
+
+ @failingTest
+ @override
+ test_missingJsLibAnnotation_variable() async {
+ // Expected 1 errors of type HintCode.MISSING_JS_LIB_ANNOTATION, found 0;
+ // 0 errors of type HintCode.UNUSED_IMPORT, found 1 (7)
+ return super.test_missingJsLibAnnotation_variable();
+ }
+
+ @failingTest
+ @override
+ test_mustCallSuper() async {
+ // Expected 1 errors of type HintCode.MUST_CALL_SUPER, found 0
+ return super.test_mustCallSuper();
+ }
+
+ @failingTest
+ @override
+ test_mustCallSuper_indirect() async {
+ // Expected 1 errors of type HintCode.MUST_CALL_SUPER, found 0
+ return super.test_mustCallSuper_indirect();
+ }
+
@override
@failingTest
test_required_constructor_param() async {
@@ -119,4 +350,133 @@
test_required_typedef_function_param() async {
return super.test_required_typedef_function_param();
}
+
+ @failingTest
+ @override
+ test_strongMode_downCastCompositeHint() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_DOWN_CAST_COMPOSITE, found 0
+ return super.test_strongMode_downCastCompositeHint();
+ }
+
+ @failingTest
+ @override
+ test_strongMode_downCastCompositeWarn() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_DOWN_CAST_COMPOSITE, found 0
+ return super.test_strongMode_downCastCompositeWarn();
+ }
+
+ @failingTest
+ @override
+ test_undefinedGetter() async {
+ // Expected 1 errors of type HintCode.UNDEFINED_GETTER, found 0
+ return super.test_undefinedGetter();
+ }
+
+ @failingTest
+ @override
+ test_undefinedMethod() async {
+ // Expected 1 errors of type HintCode.UNDEFINED_METHOD, found 0
+ return super.test_undefinedMethod();
+ }
+
+ @failingTest
+ @override
+ test_undefinedMethod_assignmentExpression() async {
+ // Expected 1 errors of type HintCode.UNDEFINED_METHOD, found 0
+ return super.test_undefinedMethod_assignmentExpression();
+ }
+
+ @failingTest
+ @override
+ test_undefinedOperator_binaryExpression() async {
+ // Expected 1 errors of type HintCode.UNDEFINED_OPERATOR, found 0
+ return super.test_undefinedOperator_binaryExpression();
+ }
+
+ @failingTest
+ @override
+ test_undefinedOperator_indexBoth() async {
+ // Expected 1 errors of type HintCode.UNDEFINED_OPERATOR, found 0
+ return super.test_undefinedOperator_indexBoth();
+ }
+
+ @failingTest
+ @override
+ test_undefinedOperator_indexGetter() async {
+ // Expected 1 errors of type HintCode.UNDEFINED_OPERATOR, found 0
+ return super.test_undefinedOperator_indexGetter();
+ }
+
+ @failingTest
+ @override
+ test_undefinedOperator_indexSetter() async {
+ // Expected 1 errors of type HintCode.UNDEFINED_OPERATOR, found 0
+ return super.test_undefinedOperator_indexSetter();
+ }
+
+ @failingTest
+ @override
+ test_undefinedOperator_postfixExpression() async {
+ // Expected 1 errors of type HintCode.UNDEFINED_OPERATOR, found 0
+ return super.test_undefinedOperator_postfixExpression();
+ }
+
+ @failingTest
+ @override
+ test_undefinedOperator_prefixExpression() async {
+ // Expected 1 errors of type HintCode.UNDEFINED_OPERATOR, found 0
+ return super.test_undefinedOperator_prefixExpression();
+ }
+
+ @failingTest
+ @override
+ test_undefinedSetter() async {
+ // Expected 1 errors of type HintCode.UNDEFINED_SETTER, found 0
+ return super.test_undefinedSetter();
+ }
+
+ @failingTest
+ @override
+ test_unusedImport_as() async {
+ // Failed to resolve 2 nodes:
+ // one (/test.dart : 53)
+ // one (/test.dart : 58)
+ return super.test_unusedImport_as();
+ }
+
+ @failingTest
+ @override
+ test_unusedImport_inComment_libraryDirective() async {
+ // Expected 0 errors of type HintCode.UNUSED_IMPORT, found 1 (42)
+ return super.test_unusedImport_inComment_libraryDirective();
+ }
+
+ @failingTest
+ @override
+ test_unusedShownName() async {
+ // Expected 1 errors of type HintCode.UNUSED_SHOWN_NAME, found 0
+ return super.test_unusedShownName();
+ }
+
+ @failingTest
+ @override
+ test_unusedShownName_as() async {
+ // Expected 1 errors of type HintCode.UNUSED_SHOWN_NAME, found 0;
+ // 0 errors of type HintCode.UNUSED_IMPORT, found 1 (18)
+ return super.test_unusedShownName_as();
+ }
+
+ @failingTest
+ @override
+ test_unusedShownName_duplicates() async {
+ // Expected 2 errors of type HintCode.UNUSED_SHOWN_NAME, found 0
+ return super.test_unusedShownName_duplicates();
+ }
+
+ @failingTest
+ @override
+ test_unusedShownName_topLevelVariable() async {
+ // Expected 1 errors of type HintCode.UNUSED_SHOWN_NAME, found 0
+ return super.test_unusedShownName_topLevelVariable();
+ }
}
diff --git a/pkg/analyzer/test/generated/hint_code_test.dart b/pkg/analyzer/test/generated/hint_code_test.dart
index 5f063e9..9a12693 100644
--- a/pkg/analyzer/test/generated/hint_code_test.dart
+++ b/pkg/analyzer/test/generated/hint_code_test.dart
@@ -38,10 +38,7 @@
const _MustCallSuper mustCallSuper = const _MustCallSuper();
const _Protected protected = const _Protected();
const Required required = const Required();
-class Required {
- final String reason;
- const Required([this.reason]);
-}
+const _VisibleForTesting visibleForTesting = const _VisibleForTesting();
class Immutable {
final String reason;
@@ -62,9 +59,12 @@
class _Protected {
const _Protected();
}
-class _Required {
+class Required {
final String reason;
- const _Required([this.reason]);
+ const Required([this.reason]);
+}
+class _VisibleForTesting {
+ const _VisibleForTesting();
}
'''
],
@@ -1923,6 +1923,141 @@
verify([source]);
}
+ test_invalidUseOfVisibleForTestingMember_method() async {
+ Source source = addNamedSource('/lib1.dart', r'''
+import 'package:meta/meta.dart';
+class A {
+ @visibleForTesting
+ void a(){ }
+}
+''');
+ Source source2 = addNamedSource('/lib2.dart', r'''
+import 'lib1.dart';
+
+class B {
+ void b() => new A().a();
+}
+''');
+ await computeAnalysisResult(source);
+ await computeAnalysisResult(source2);
+ assertErrors(source2, [HintCode.INVALID_USE_OF_VISIBLE_FOR_TESTING_MEMBER]);
+ verify([source, source2]);
+ }
+
+ test_invalidUseOfVisibleForTestingMember_method_OK() async {
+ Source source = addNamedSource('/lib1.dart', r'''
+import 'package:meta/meta.dart';
+class A {
+ @visibleForTesting
+ void a(){ }
+}
+''');
+ Source source2 = addNamedSource('/test/test1.dart', r'''
+import '../lib1.dart';
+
+class B {
+ void b() => new A().a();
+}
+''');
+ await computeAnalysisResult(source);
+ await computeAnalysisResult(source2);
+ assertNoErrors(source2);
+ verify([source, source2]);
+ }
+
+ test_invalidUseProtectedAndForTesting_method_OK() async {
+ Source source = addNamedSource('/lib1.dart', r'''
+import 'package:meta/meta.dart';
+class A {
+ @protected
+ @visibleForTesting
+ void a(){ }
+}
+''');
+ Source source2 = addNamedSource('/lib2.dart', r'''
+import 'lib1.dart';
+
+class B extends A {
+ void b() => new A().a();
+}
+''');
+ await computeAnalysisResult(source);
+ await computeAnalysisResult(source2);
+ assertNoErrors(source2);
+ verify([source, source2]);
+ }
+
+ test_invalidUseOfVisibleForTestingMember_propertyAccess() async {
+ Source source = addNamedSource('/lib1.dart', r'''
+import 'package:meta/meta.dart';
+class A {
+ @visibleForTesting
+ int get a => 7;
+
+ @visibleForTesting
+ set b(_) => 7;
+}
+''');
+ Source source2 = addNamedSource('/lib2.dart', r'''
+import 'lib1.dart';
+
+void main() {
+ new A().a;
+ new A().b = 6;
+}
+''');
+ await computeAnalysisResult(source);
+ await computeAnalysisResult(source2);
+ assertErrors(source2, [
+ HintCode.INVALID_USE_OF_VISIBLE_FOR_TESTING_MEMBER,
+ HintCode.INVALID_USE_OF_VISIBLE_FOR_TESTING_MEMBER
+ ]);
+ verify([source, source2]);
+ }
+
+ test_invalidUseOfVisibleForTestingMember_constructor() async {
+ Source source = addNamedSource('/lib1.dart', r'''
+import 'package:meta/meta.dart';
+class A {
+ int _x;
+
+ @visibleForTesting
+ A.forTesting(this._x);
+}
+''');
+ Source source2 = addNamedSource('/lib2.dart', r'''
+import 'lib1.dart';
+
+void main() {
+ new A.forTesting(0);
+}
+''');
+ await computeAnalysisResult(source);
+ await computeAnalysisResult(source2);
+ assertErrors(source2, [HintCode.INVALID_USE_OF_VISIBLE_FOR_TESTING_MEMBER]);
+ verify([source, source2]);
+ }
+
+ test_invalidUseOfVisibleForTestingMember_topLevelFunction() async {
+ Source source = addNamedSource('/lib1.dart', r'''
+import 'package:meta/meta.dart';
+
+@visibleForTesting
+int fn0() => 1;
+''');
+ Source source2 = addNamedSource('/lib2.dart', r'''
+import 'lib1.dart';
+
+void main() {
+ fn0();
+}
+''');
+ await computeAnalysisResult(source);
+ await computeAnalysisResult(source2);
+ assertErrors(source2, [HintCode.INVALID_USE_OF_VISIBLE_FOR_TESTING_MEMBER]);
+ verify([source, source2]);
+ }
+
test_isDouble() async {
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
options.dart2jsHint = true;
diff --git a/pkg/analyzer/test/generated/invalid_code_kernel_test.dart b/pkg/analyzer/test/generated/invalid_code_kernel_test.dart
index 750740e..cacac44 100644
--- a/pkg/analyzer/test/generated/invalid_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/invalid_code_kernel_test.dart
@@ -20,6 +20,9 @@
@override
bool get enableNewAnalysisDriver => true;
+ @override
+ bool get previewDart2 => true;
+
@failingTest
@override
test_constructorAndMethodNameCollision() async {
diff --git a/pkg/analyzer/test/generated/non_error_resolver_kernel_test.dart b/pkg/analyzer/test/generated/non_error_resolver_kernel_test.dart
index c10d1c1..6b1c577 100644
--- a/pkg/analyzer/test/generated/non_error_resolver_kernel_test.dart
+++ b/pkg/analyzer/test/generated/non_error_resolver_kernel_test.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.
-import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'non_error_resolver_driver_test.dart';
@@ -32,14 +31,7 @@
@override
@failingTest
- @potentialAnalyzerProblem
- test_abstractSuperMemberReference_superHasNoSuchMethod() async {
- return super.test_abstractSuperMemberReference_superHasNoSuchMethod();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/31625')
test_ambiguousImport_showCombinator() async {
return super.test_ambiguousImport_showCombinator();
}
@@ -53,77 +45,70 @@
@override
@failingTest
- @potentialAnalyzerProblem
- test_async_flattened() async {
- return super.test_async_flattened();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/31604')
test_commentReference_beforeConstructor() async {
return super.test_commentReference_beforeConstructor();
}
@override
@failingTest
- @potentialAnalyzerProblem
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/31604')
test_commentReference_beforeEnum() async {
return super.test_commentReference_beforeEnum();
}
@override
@failingTest
- @potentialAnalyzerProblem
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/31604')
test_commentReference_beforeFunction_blockBody() async {
return super.test_commentReference_beforeFunction_blockBody();
}
@override
@failingTest
- @potentialAnalyzerProblem
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/31604')
test_commentReference_beforeFunction_expressionBody() async {
return super.test_commentReference_beforeFunction_expressionBody();
}
@override
@failingTest
- @potentialAnalyzerProblem
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/31604')
test_commentReference_beforeFunctionTypeAlias() async {
return super.test_commentReference_beforeFunctionTypeAlias();
}
@override
@failingTest
- @potentialAnalyzerProblem
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/31604')
test_commentReference_beforeGenericTypeAlias() async {
return super.test_commentReference_beforeGenericTypeAlias();
}
@override
@failingTest
- @potentialAnalyzerProblem
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/31604')
test_commentReference_beforeGetter() async {
return super.test_commentReference_beforeGetter();
}
@override
@failingTest
- @potentialAnalyzerProblem
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/31604')
test_commentReference_beforeMethod() async {
return super.test_commentReference_beforeMethod();
}
@override
@failingTest
- @potentialAnalyzerProblem
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/31604')
test_commentReference_class() async {
return super.test_commentReference_class();
}
@override
@failingTest
- @potentialAnalyzerProblem
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/31604')
test_commentReference_setter() async {
return super.test_commentReference_setter();
}
@@ -131,27 +116,6 @@
@override
@failingTest
@potentialAnalyzerProblem
- test_const_constructor_with_named_generic_parameter() async {
- return super.test_const_constructor_with_named_generic_parameter();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_const_dynamic() async {
- return super.test_const_dynamic();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_constConstructorWithNonConstSuper_redirectingFactory() async {
- return super.test_constConstructorWithNonConstSuper_redirectingFactory();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
test_constConstructorWithNonConstSuper_unresolved() async {
return super.test_constConstructorWithNonConstSuper_unresolved();
}
@@ -179,20 +143,6 @@
@override
@failingTest
- @potentialAnalyzerProblem
- test_constEval_propertyExtraction_methodStatic_targetType() async {
- return super.test_constEval_propertyExtraction_methodStatic_targetType();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_constRedirectSkipsSupertype() async {
- return super.test_constRedirectSkipsSupertype();
- }
-
- @override
- @failingTest
@FastaProblem('https://github.com/dart-lang/sdk/issues/28434')
test_constructorDeclaration_scope_signature() async {
return super.test_constructorDeclaration_scope_signature();
@@ -201,41 +151,6 @@
@override
@failingTest
@potentialAnalyzerProblem
- test_dynamicIdentifier() async {
- return super.test_dynamicIdentifier();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_fieldFormalParameter_functionTyped_named() async {
- return super.test_fieldFormalParameter_functionTyped_named();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_fieldFormalParameter_genericFunctionTyped() async {
- return super.test_fieldFormalParameter_genericFunctionTyped();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_fieldFormalParameter_genericFunctionTyped_named() async {
- return super.test_fieldFormalParameter_genericFunctionTyped_named();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_finalNotInitialized_functionTypedFieldFormal() async {
- return super.test_finalNotInitialized_functionTypedFieldFormal();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
test_finalNotInitialized_hasNativeClause_hasConstructor() async {
return super.test_finalNotInitialized_hasNativeClause_hasConstructor();
}
@@ -328,7 +243,7 @@
@override
@failingTest
- @potentialAnalyzerProblem
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/31641')
test_invalidAnnotation_constantVariable_field() async {
return super.test_invalidAnnotation_constantVariable_field();
}
@@ -367,31 +282,6 @@
@override
@failingTest
@potentialAnalyzerProblem
- test_invocationOfNonFunction_dynamic() async {
- // TODO(scheglov) This test fails only in checked mode.
- fail('This test fails only in checked mode');
- return super.test_invocationOfNonFunction_dynamic();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_invocationOfNonFunction_functionTypeTypeParameter() async {
- return super.test_invocationOfNonFunction_functionTypeTypeParameter();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_invocationOfNonFunction_getter() async {
- // TODO(scheglov) This test fails only in checked mode.
- fail('This test fails only in checked mode');
- return super.test_invocationOfNonFunction_getter();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
test_loadLibraryDefined() async {
return super.test_loadLibraryDefined();
}
@@ -419,14 +309,14 @@
@override
@failingTest
- @potentialAnalyzerProblem
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/31628')
test_nonConstCaseExpression_constField() async {
return super.test_nonConstCaseExpression_constField();
}
@override
@failingTest
- @potentialAnalyzerProblem
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/31627')
test_nonConstMapKey_constField() async {
return super.test_nonConstMapKey_constField();
}
@@ -434,27 +324,6 @@
@override
@failingTest
@potentialAnalyzerProblem
- test_nonConstValueInInitializer_binary_dynamic() async {
- return super.test_nonConstValueInInitializer_binary_dynamic();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_nonConstValueInInitializer_redirecting() async {
- return super.test_nonConstValueInInitializer_redirecting();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_null_callMethod() async {
- return super.test_null_callMethod();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
test_prefixCollidesWithTopLevelMembers() async {
return super.test_prefixCollidesWithTopLevelMembers();
}
@@ -462,41 +331,6 @@
@override
@failingTest
@potentialAnalyzerProblem
- test_recursiveConstructorRedirect() async {
- return super.test_recursiveConstructorRedirect();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_recursiveFactoryRedirect() async {
- return super.test_recursiveFactoryRedirect();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_redirectToInvalidFunctionType() async {
- return super.test_redirectToInvalidFunctionType();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_redirectToNonConstConstructor() async {
- return super.test_redirectToNonConstConstructor();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_referencedBeforeDeclaration_cascade() async {
- return super.test_referencedBeforeDeclaration_cascade();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
test_returnOfInvalidType_typeParameter_18468() async {
return super.test_returnOfInvalidType_typeParameter_18468();
}
@@ -518,13 +352,6 @@
@override
@failingTest
@potentialAnalyzerProblem
- test_staticAccessToInstanceMember_method() async {
- return super.test_staticAccessToInstanceMember_method();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
test_typeType_class_prefixed() async {
return super.test_typeType_class_prefixed();
}
@@ -539,20 +366,6 @@
@override
@failingTest
@potentialAnalyzerProblem
- test_undefinedConstructorInInitializer_redirecting() async {
- return super.test_undefinedConstructorInInitializer_redirecting();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_undefinedGetter_static_conditionalAccess() async {
- return super.test_undefinedGetter_static_conditionalAccess();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
test_undefinedIdentifier_synthetic_whenExpression() async {
return super.test_undefinedIdentifier_synthetic_whenExpression();
}
@@ -584,11 +397,4 @@
test_undefinedSetter_importWithPrefix() async {
return super.test_undefinedSetter_importWithPrefix();
}
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_undefinedSetter_static_conditionalAccess() async {
- return super.test_undefinedSetter_static_conditionalAccess();
- }
}
diff --git a/pkg/analyzer/test/generated/non_hint_code_kernel_test.dart b/pkg/analyzer/test/generated/non_hint_code_kernel_test.dart
index 31f2266..9f45d2e 100644
--- a/pkg/analyzer/test/generated/non_hint_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/non_hint_code_kernel_test.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:analyzer/src/dart/error/hint_codes.dart';
+import 'package:analyzer/src/generated/source.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'non_hint_code_driver_test.dart';
@@ -20,4 +22,87 @@
class NonHintCodeTest_Kernel extends NonHintCodeTest_Driver {
@override
bool get enableKernelDriver => true;
+
+ @override
+ bool get previewDart2 => true;
+
+ @failingTest
+ @override
+ @potentialAnalyzerProblem
+ test_deadCode_deadBlock_if_debugConst_propertyAccessor() async {
+ // Appears to be an issue with resolution of import prefixes.
+ await super.test_deadCode_deadBlock_if_debugConst_propertyAccessor();
+ }
+
+ @failingTest
+ @override
+ @potentialAnalyzerProblem
+ test_deprecatedMemberUse_inDeprecatedLibrary() async {
+ // LibraryAnalyzer is not applying resolution data to annotations on
+ // directives.
+ await super.test_deprecatedMemberUse_inDeprecatedLibrary();
+ }
+
+ @failingTest
+ @override
+ @potentialAnalyzerProblem
+ test_duplicateImport_as() async {
+ // Expected 0 errors of type HintCode.UNUSED_IMPORT, found 1 (38)
+ // Appears to be an issue with resolution of import prefixes.
+ await super.test_duplicateImport_as();
+ }
+
+ @failingTest
+ @override
+ @potentialAnalyzerProblem
+ test_importDeferredLibraryWithLoadFunction() async {
+ // Appears to be an issue with resolution of import prefixes.
+ await super.test_importDeferredLibraryWithLoadFunction();
+ }
+
+ @override
+ test_unnecessaryCast_generics() async {
+ // dartbug.com/18953
+ // Overridden because type inference now produces more information and there
+ // should now be a hint, where there wasn't one before.
+ Source source = addSource(r'''
+import 'dart:async';
+Future<int> f() => new Future.value(0);
+void g(bool c) {
+ (c ? f(): new Future.value(0) as Future<int>).then((int value) {});
+}''');
+ await computeAnalysisResult(source);
+ assertErrors(source, [HintCode.UNNECESSARY_CAST]);
+ verify([source]);
+ }
+
+ @failingTest
+ @override
+ @potentialAnalyzerProblem
+ test_unusedImport_as_equalPrefixes() async {
+ await super.test_unusedImport_as_equalPrefixes();
+ }
+
+ @failingTest
+ @override
+ @potentialAnalyzerProblem
+ test_unusedImport_metadata() async {
+ await super.test_unusedImport_metadata();
+ }
+
+ @failingTest
+ @override
+ @potentialAnalyzerProblem
+ test_unusedImport_prefix_topLevelFunction() async {
+ // Appears to be an issue with resolution of import prefixes.
+ await super.test_unusedImport_prefix_topLevelFunction();
+ }
+
+ @failingTest
+ @override
+ @potentialAnalyzerProblem
+ test_unusedImport_prefix_topLevelFunction2() async {
+ // Appears to be an issue with resolution of import prefixes.
+ await super.test_unusedImport_prefix_topLevelFunction2();
+ }
}
diff --git a/pkg/analyzer/test/generated/non_hint_code_test.dart b/pkg/analyzer/test/generated/non_hint_code_test.dart
index 40cc6b2..677da10 100644
--- a/pkg/analyzer/test/generated/non_hint_code_test.dart
+++ b/pkg/analyzer/test/generated/non_hint_code_test.dart
@@ -461,6 +461,23 @@
verify([source]);
}
+ test_missingReturn_alwaysThrows() async {
+ Source source = addSource(r'''
+import 'package:meta/meta.dart';
+
+@alwaysThrows
+void a() {
+ throw 'msg';
+}
+
+int f() {
+ a();
+}''');
+ await computeAnalysisResult(source);
+ assertNoErrors(source);
+ verify([source]);
+ }
+
test_missingReturn_emptyFunctionBody() async {
Source source = addSource(r'''
abstract class A {
@@ -492,23 +509,6 @@
verify([source]);
}
- test_missingReturn_alwaysThrows() async {
- Source source = addSource(r'''
-import 'package:meta/meta.dart';
-
-@alwaysThrows
-void a() {
- throw 'msg';
-}
-
-int f() {
- a();
-}''');
- await computeAnalysisResult(source);
- assertNoErrors(source);
- verify([source]);
- }
-
test_nullAwareInCondition_for_noCondition() async {
Source source = addSource(r'''
m(x) {
diff --git a/pkg/analyzer/test/generated/parser_fasta_test.dart b/pkg/analyzer/test/generated/parser_fasta_test.dart
index 929c31b..1bc90f2 100644
--- a/pkg/analyzer/test/generated/parser_fasta_test.dart
+++ b/pkg/analyzer/test/generated/parser_fasta_test.dart
@@ -1447,14 +1447,6 @@
@override
@failingTest
- void test_positionalParameterOutsideGroup() {
- // TODO(brianwilkerson) Wrong errors:
- // Expected 1 errors of type ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP, found 0
- super.test_positionalParameterOutsideGroup();
- }
-
- @override
- @failingTest
void test_redirectingConstructorWithBody_named() {
// TODO(brianwilkerson) Wrong errors:
// Expected 1 errors of type ParserErrorCode.REDIRECTING_CONSTRUCTOR_WITH_BODY, found 0
@@ -1471,22 +1463,6 @@
@override
@failingTest
- void test_redirectionInNonFactoryConstructor() {
- // TODO(brianwilkerson) Does not recover.
- // type '_RedirectingFactoryBody' is not a subtype of type 'FunctionBody' of 'body' where
- // _RedirectingFactoryBody is from package:analyzer/src/fasta/ast_builder.dart
- // FunctionBody is from package:analyzer/dart/ast/ast.dart
- //
- // package:analyzer/src/fasta/ast_builder.dart 1613:25 AstBuilder.endMethod
- // test/generated/parser_fasta_listener.dart 926:14 ForwardingTestListener.endMethod
- // package:front_end/src/fasta/parser/parser.dart 2433:14 Parser.parseMethod
- // package:front_end/src/fasta/parser/parser.dart 2323:11 Parser.parseMember
- // test/generated/parser_fasta_test.dart 3766:39 ParserProxy._run
- super.test_redirectionInNonFactoryConstructor();
- }
-
- @override
- @failingTest
void test_setterInFunction_block() {
// TODO(brianwilkerson) Wrong errors:
// Expected 1 errors of type ParserErrorCode.SETTER_IN_FUNCTION, found 0
@@ -2707,13 +2683,6 @@
@override
@failingTest
- void test_incompleteField_var() {
- // TODO(brianwilkerson) reportUnrecoverableErrorWithToken
- super.test_incompleteField_var();
- }
-
- @override
- @failingTest
void test_incompleteForEach() {
// TODO(brianwilkerson) reportUnrecoverableErrorWithToken
super.test_incompleteForEach();
@@ -2742,13 +2711,6 @@
@override
@failingTest
- void test_incompleteTypeParameters() {
- // TODO(brianwilkerson) reportUnrecoverableErrorWithToken
- super.test_incompleteTypeParameters();
- }
-
- @override
- @failingTest
void test_isExpression_noType() {
// TODO(brianwilkerson) reportUnrecoverableErrorWithToken
super.test_isExpression_noType();
diff --git a/pkg/analyzer/test/generated/parser_test.dart b/pkg/analyzer/test/generated/parser_test.dart
index aec9b4c..62153fb 100644
--- a/pkg/analyzer/test/generated/parser_test.dart
+++ b/pkg/analyzer/test/generated/parser_test.dart
@@ -4461,11 +4461,15 @@
createParser('(a, b = 0)');
FormalParameterList list = parser.parseFormalParameterList();
expectNotNullIfNoErrors(list);
- listener.assertErrors([
- expectedError(ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP, 4, 1)
- ]);
+ listener.assertErrors(usingFastaParser
+ ? [expectedError(ParserErrorCode.NAMED_PARAMETER_OUTSIDE_GROUP, 6, 1)]
+ : [
+ expectedError(
+ ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP, 4, 1)
+ ]);
expect(list.parameters[0].kind, ParameterKind.REQUIRED);
- expect(list.parameters[1].kind, ParameterKind.POSITIONAL);
+ expect(list.parameters[1].kind,
+ usingFastaParser ? ParameterKind.NAMED : ParameterKind.POSITIONAL);
}
void test_redirectingConstructorWithBody_named() {
@@ -7233,7 +7237,9 @@
expect(
interpolation.elements[1], new isInstanceOf<InterpolationExpression>());
InterpolationExpression element1 = interpolation.elements[1];
+ expect(element1.leftBracket.lexeme, '\$');
expect(element1.expression, new isInstanceOf<SimpleIdentifier>());
+ expect(element1.rightBracket, isNull);
expect(interpolation.elements[2], new isInstanceOf<InterpolationString>());
InterpolationString element2 = interpolation.elements[2];
expect(element2.value, '');
@@ -7252,6 +7258,10 @@
expect(elements[2] is InterpolationString, isTrue);
expect(elements[3] is InterpolationExpression, isTrue);
expect(elements[4] is InterpolationString, isTrue);
+ expect((elements[1] as InterpolationExpression).leftBracket.lexeme, '\${');
+ expect((elements[1] as InterpolationExpression).rightBracket.lexeme, '}');
+ expect((elements[3] as InterpolationExpression).leftBracket.lexeme, '\$');
+ expect((elements[3] as InterpolationExpression).rightBracket, isNull);
}
void test_parseStringLiteral_multiline_encodedSpace() {
@@ -10308,6 +10318,34 @@
expect(field.name.isSynthetic, isTrue);
}
+ void test_incompleteField_type() {
+ CompilationUnit unit = parseCompilationUnit(r'''
+class C {
+ A
+}''', codes: [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.EXPECTED_TOKEN
+ ]);
+ NodeList<CompilationUnitMember> declarations = unit.declarations;
+ expect(declarations, hasLength(1));
+ CompilationUnitMember unitMember = declarations[0];
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is ClassDeclaration, ClassDeclaration, unitMember);
+ NodeList<ClassMember> members = (unitMember as ClassDeclaration).members;
+ expect(members, hasLength(1));
+ ClassMember classMember = members[0];
+ EngineTestCase.assertInstanceOf(
+ (obj) => obj is FieldDeclaration, FieldDeclaration, classMember);
+ VariableDeclarationList fieldList =
+ (classMember as FieldDeclaration).fields;
+ TypeName type = fieldList.type;
+ expect(type.name.name, 'A');
+ NodeList<VariableDeclaration> fields = fieldList.variables;
+ expect(fields, hasLength(1));
+ VariableDeclaration field = fields[0];
+ expect(field.name.isSynthetic, isTrue);
+ }
+
void test_incompleteField_var() {
CompilationUnit unit = parseCompilationUnit(r'''
class C {
@@ -10433,7 +10471,24 @@
void test_incompleteTypeParameters() {
CompilationUnit unit = parseCompilationUnit(r'''
class C<K {
-}''', codes: [ParserErrorCode.EXPECTED_TOKEN]);
+}''', errors: [expectedError(ParserErrorCode.EXPECTED_TOKEN, 10, 1)]);
+ // one class
+ List<CompilationUnitMember> declarations = unit.declarations;
+ expect(declarations, hasLength(1));
+ ClassDeclaration classDecl = declarations[0] as ClassDeclaration;
+ // validate the type parameters
+ TypeParameterList typeParameters = classDecl.typeParameters;
+ expect(typeParameters.typeParameters, hasLength(1));
+ // synthetic '>'
+ Token token = typeParameters.endToken;
+ expect(token.type, TokenType.GT);
+ expect(token.isSynthetic, isTrue);
+ }
+
+ void test_incompleteTypeParameters2() {
+ CompilationUnit unit = parseCompilationUnit(r'''
+class C<K extends L<T> {
+}''', errors: [expectedError(ParserErrorCode.EXPECTED_TOKEN, 23, 1)]);
// one class
List<CompilationUnitMember> declarations = unit.declarations;
expect(declarations, hasLength(1));
@@ -10452,6 +10507,38 @@
codes: [ParserErrorCode.MISSING_STAR_AFTER_SYNC]);
}
+ void test_invalidTypeParameters() {
+ CompilationUnit unit = parseCompilationUnit(r'''
+class C {
+ G<int double> g;
+}''',
+ errors: usingFastaParser
+ ? [
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 18, 6),
+ expectedError(ParserErrorCode.EXTRANEOUS_MODIFIER, 18, 6)
+ ]
+ : [
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 18, 6),
+ expectedError(ParserErrorCode.EXPECTED_TOKEN, 18, 6),
+ expectedError(ParserErrorCode.EXPECTED_CLASS_MEMBER, 24, 1),
+ expectedError(ParserErrorCode.UNEXPECTED_TOKEN, 24, 1),
+ expectedError(
+ ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE, 26, 1)
+ ]);
+ // one class
+ List<CompilationUnitMember> declarations = unit.declarations;
+ expect(declarations, hasLength(1));
+ ClassDeclaration classDecl = declarations[0] as ClassDeclaration;
+ // validate members
+ if (usingFastaParser) {
+ expect(classDecl.members, hasLength(1));
+ FieldDeclaration fields = classDecl.members.first;
+ expect(fields.fields.variables, hasLength(1));
+ VariableDeclaration field = fields.fields.variables.first;
+ expect(field.name.name, 'g');
+ }
+ }
+
void test_isExpression_noType() {
CompilationUnit unit = parseCompilationUnit(
"class Bar<T extends Foo> {m(x){if (x is ) return;if (x is !)}}",
@@ -10781,6 +10868,25 @@
expect(expression, new isInstanceOf<SimpleIdentifier>());
}
+ void test_propertyAccess_missing_LHS_RHS() {
+ Expression result = parseExpression(".", codes: [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.MISSING_IDENTIFIER
+ ]);
+ if (usingFastaParser) {
+ PrefixedIdentifier expression = result;
+ expect(expression.prefix.isSynthetic, isTrue);
+ expect(expression.period.lexeme, '.');
+ expect(expression.identifier.isSynthetic, isTrue);
+ } else {
+ PropertyAccess expression = result;
+ SimpleIdentifier target = expression.target;
+ expect(target.isSynthetic, isTrue);
+ expect(expression.operator.lexeme, '.');
+ expect(expression.propertyName.isSynthetic, isTrue);
+ }
+ }
+
void test_relationalExpression_missing_LHS() {
IsExpression expression =
parseExpression("is y", codes: [ParserErrorCode.MISSING_IDENTIFIER]);
diff --git a/pkg/analyzer/test/generated/resolver_kernel_test.dart b/pkg/analyzer/test/generated/resolver_kernel_test.dart
index 1a87a9c..9d1b053 100644
--- a/pkg/analyzer/test/generated/resolver_kernel_test.dart
+++ b/pkg/analyzer/test/generated/resolver_kernel_test.dart
@@ -17,10 +17,398 @@
class StrictModeTest_Kernel extends StrictModeTest_Driver {
@override
bool get enableKernelDriver => true;
+
+ @override
+ bool get previewDart2 => true;
+
+ @override
+ @failingTest
+ test_assert_is() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_OPERATOR, found 0
+ await super.test_assert_is();
+ }
+
+ @override
+ @failingTest
+ test_conditional_isNot() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_OPERATOR, found 0
+ await super.test_conditional_isNot();
+ }
+
+ @override
+ @failingTest
+ test_conditional_or_is() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_OPERATOR, found 0
+ await super.test_conditional_or_is();
+ }
+
+ @override
+ @failingTest
+ test_forEach() async {
+ // 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart': Failed assertion: line 441 pos 16: 'identical(combiner.arguments.positional[0], rhs)': is not true.
+ await super.test_forEach();
+ }
+
+ @override
+ @failingTest
+ test_if_isNot() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_OPERATOR, found 0
+ await super.test_if_isNot();
+ }
+
+ @override
+ @failingTest
+ test_if_isNot_abrupt() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_OPERATOR, found 0
+ await super.test_if_isNot_abrupt();
+ }
+
+ @override
+ @failingTest
+ test_if_or_is() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_OPERATOR, found 0
+ await super.test_if_or_is();
+ }
+
+ @override
+ @failingTest
+ test_localVar() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_OPERATOR, found 0
+ await super.test_localVar();
+ }
}
@reflectiveTest
class TypePropagationTest_Kernel extends TypePropagationTest_Driver {
@override
bool get enableKernelDriver => true;
+
+ @override
+ bool get previewDart2 => true;
+
+ @override
+ @failingTest
+ test_as() async {
+ // Expected: same instance as InterfaceTypeImpl:<A>
+ await super.test_as();
+ }
+
+ @override
+ @failingTest
+ test_assert() async {
+ // Expected: same instance as InterfaceTypeImpl:<A>
+ await super.test_assert();
+ }
+
+ @override
+ @failingTest
+ test_assignment() async {
+ // Expected: InterfaceTypeImpl:<int>
+ await super.test_assignment();
+ }
+
+ @override
+ @failingTest
+ test_assignment_afterInitializer() async {
+ // Expected: InterfaceTypeImpl:<double>
+ await super.test_assignment_afterInitializer();
+ }
+
+ @override
+ @failingTest
+ test_assignment_throwExpression() async {
+ // Bad state: Expected element reference for analyzer offset 25; got one for kernel offset 21
+ await super.test_assignment_throwExpression();
+ }
+
+ @override
+ @failingTest
+ test_CanvasElement_getContext() async {
+ // NoSuchMethodError: The getter 'name' was called on null.
+ await super.test_CanvasElement_getContext();
+ }
+
+ @override
+ @failingTest
+ test_forEach() async {
+ // Expected: InterfaceTypeImpl:<String>
+ await super.test_forEach();
+ }
+
+ @override
+ @failingTest
+ test_forEach_async() async {
+ // Expected: InterfaceTypeImpl:<String>
+ await super.test_forEach_async();
+ }
+
+ @override
+ @failingTest
+ test_forEach_async_inheritedStream() async {
+ // Expected: InterfaceTypeImpl:<List<String>>
+ await super.test_forEach_async_inheritedStream();
+ }
+
+ @override
+ @failingTest
+ test_functionExpression_asInvocationArgument() async {
+ // Expected: InterfaceTypeImpl:<int>
+ await super.test_functionExpression_asInvocationArgument();
+ }
+
+ @override
+ @failingTest
+ test_functionExpression_asInvocationArgument_fromInferredInvocation() async {
+ // Expected: InterfaceTypeImpl:<int>
+ await super
+ .test_functionExpression_asInvocationArgument_fromInferredInvocation();
+ }
+
+ @override
+ @failingTest
+ test_functionExpression_asInvocationArgument_functionExpressionInvocation() async {
+ // Bad state: Expected a type for v at 43; got one for kernel offset 32
+ await super
+ .test_functionExpression_asInvocationArgument_functionExpressionInvocation();
+ }
+
+ @override
+ @failingTest
+ test_functionExpression_asInvocationArgument_notSubtypeOfStaticType() async {
+ // Expected 1 errors of type StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, found 0
+ await super
+ .test_functionExpression_asInvocationArgument_notSubtypeOfStaticType();
+ }
+
+ @override
+ @failingTest
+ test_functionExpression_asInvocationArgument_replaceIfMoreSpecific() async {
+ // Expected: InterfaceTypeImpl:<String>
+ await super
+ .test_functionExpression_asInvocationArgument_replaceIfMoreSpecific();
+ }
+
+ @override
+ @failingTest
+ test_Future_then() async {
+ // Expected: InterfaceTypeImpl:<int>
+ await super.test_Future_then();
+ }
+
+ @override
+ @failingTest
+ test_initializer() async {
+ // Expected: DynamicTypeImpl:<dynamic>
+ await super.test_initializer();
+ }
+
+ @override
+ @failingTest
+ test_initializer_dereference() async {
+ // Expected: InterfaceTypeImpl:<String>
+ await super.test_initializer_dereference();
+ }
+
+ @override
+ @failingTest
+ test_invocation_target_prefixed() async {
+ // Bad state: Expected element reference for analyzer offset 43; got one for kernel offset 50
+ await super.test_invocation_target_prefixed();
+ }
+
+ @override
+ @failingTest
+ test_is_conditional() async {
+ // Expected: same instance as InterfaceTypeImpl:<A>
+ await super.test_is_conditional();
+ }
+
+ @override
+ @failingTest
+ test_is_if() async {
+ // type 'ParenthesizedExpressionImpl' is not a subtype of type 'IsExpression' of 'isExpression' where
+ await super.test_is_if();
+ }
+
+ @override
+ @failingTest
+ test_is_if_logicalAnd() async {
+ // Expected: same instance as InterfaceTypeImpl:<A>
+ await super.test_is_if_logicalAnd();
+ }
+
+ @override
+ @failingTest
+ test_is_postConditional() async {
+ // Expected: same instance as InterfaceTypeImpl:<A>
+ await super.test_is_postConditional();
+ }
+
+ @override
+ @failingTest
+ test_is_postIf() async {
+ // Expected: same instance as InterfaceTypeImpl:<A>
+ await super.test_is_postIf();
+ }
+
+ @override
+ @failingTest
+ test_is_while() async {
+ // Expected: same instance as InterfaceTypeImpl:<A>
+ await super.test_is_while();
+ }
+
+ @override
+ @failingTest
+ test_isNot_conditional() async {
+ // Expected: same instance as InterfaceTypeImpl:<A>
+ await super.test_isNot_conditional();
+ }
+
+ @override
+ @failingTest
+ test_isNot_if() async {
+ // Expected: same instance as InterfaceTypeImpl:<A>
+ await super.test_isNot_if();
+ }
+
+ @override
+ @failingTest
+ test_isNot_if_logicalOr() async {
+ // Expected: same instance as InterfaceTypeImpl:<A>
+ await super.test_isNot_if_logicalOr();
+ }
+
+ @override
+ @failingTest
+ test_isNot_postConditional() async {
+ // Expected: same instance as InterfaceTypeImpl:<A>
+ await super.test_isNot_postConditional();
+ }
+
+ @override
+ @failingTest
+ test_isNot_postIf() async {
+ // Expected: same instance as InterfaceTypeImpl:<A>
+ await super.test_isNot_postIf();
+ }
+
+ @override
+ @failingTest
+ test_listLiteral_same() async {
+ // NoSuchMethodError: The getter 'element' was called on null.
+ await super.test_listLiteral_same();
+ }
+
+ @override
+ @failingTest
+ test_mapLiteral_different() async {
+ // NoSuchMethodError: The getter 'element' was called on null.
+ await super.test_mapLiteral_different();
+ }
+
+ @override
+ @failingTest
+ test_mapLiteral_same() async {
+ // NoSuchMethodError: The getter 'element' was called on null.
+ await super.test_mapLiteral_same();
+ }
+
+ @override
+ @failingTest
+ test_mergePropagatedTypes_afterIfThen_different() async {
+ // Expected: InterfaceTypeImpl:<String>
+ await super.test_mergePropagatedTypes_afterIfThen_different();
+ }
+
+ @override
+ @failingTest
+ test_mergePropagatedTypes_afterIfThen_same() async {
+ // Expected: InterfaceTypeImpl:<int>
+ await super.test_mergePropagatedTypes_afterIfThen_same();
+ }
+
+ @override
+ @failingTest
+ test_mergePropagatedTypes_afterIfThenElse_same() async {
+ // Expected: InterfaceTypeImpl:<int>
+ await super.test_mergePropagatedTypes_afterIfThenElse_same();
+ }
+
+ @override
+ @failingTest
+ test_mergePropagatedTypesAtJoinPoint_4() async {
+ // Expected: InterfaceTypeImpl:<int>
+ await super.test_mergePropagatedTypesAtJoinPoint_4();
+ }
+
+ @override
+ @failingTest
+ test_objectAccessInference_disabled_for_library_prefix() async {
+ // Bad state: Expected element reference for analyzer offset 43; got one for kernel offset 50
+ await super.test_objectAccessInference_disabled_for_library_prefix();
+ }
+
+ @override
+ @failingTest
+ test_objectAccessInference_enabled_for_cascades() async {
+ // Expected: DynamicTypeImpl:<dynamic>
+ await super.test_objectAccessInference_enabled_for_cascades();
+ }
+
+ @override
+ @failingTest
+ test_objectMethodInference_disabled_for_library_prefix() async {
+ // Bad state: Expected element reference for analyzer offset 43; got one for kernel offset 50
+ await super.test_objectMethodInference_disabled_for_library_prefix();
+ }
+
+ @override
+ @failingTest
+ test_objectMethodInference_enabled_for_cascades() async {
+ // Expected: DynamicTypeImpl:<dynamic>
+ await super.test_objectMethodInference_enabled_for_cascades();
+ }
+
+ @override
+ @failingTest
+ test_objectMethodOnDynamicExpression_doubleEquals() async {
+ // Expected: InterfaceTypeImpl:<bool>
+ await super.test_objectMethodOnDynamicExpression_doubleEquals();
+ }
+
+ @override
+ @failingTest
+ test_objectMethodOnDynamicExpression_hashCode() async {
+ // Expected: InterfaceTypeImpl:<int>
+ await super.test_objectMethodOnDynamicExpression_hashCode();
+ }
+
+ @override
+ @failingTest
+ test_objectMethodOnDynamicExpression_runtimeType() async {
+ // Expected: InterfaceTypeImpl:<Type>
+ await super.test_objectMethodOnDynamicExpression_runtimeType();
+ }
+
+ @override
+ @failingTest
+ test_objectMethodOnDynamicExpression_toString() async {
+ // Expected: InterfaceTypeImpl:<String>
+ await super.test_objectMethodOnDynamicExpression_toString();
+ }
+
+ @override
+ @failingTest
+ test_propagatedReturnType_localFunction() async {
+ // Expected: DynamicTypeImpl:<dynamic>
+ await super.test_propagatedReturnType_localFunction();
+ }
+
+ @override
+ @failingTest
+ test_query() async {
+ // NoSuchMethodError: The getter 'name' was called on null.
+ await super.test_query();
+ }
}
diff --git a/pkg/analyzer/test/generated/resolver_test_case.dart b/pkg/analyzer/test/generated/resolver_test_case.dart
index 139df0c..49548e5 100644
--- a/pkg/analyzer/test/generated/resolver_test_case.dart
+++ b/pkg/analyzer/test/generated/resolver_test_case.dart
@@ -667,7 +667,9 @@
options ??= defaultAnalysisOptions;
if (enableNewAnalysisDriver) {
if (previewDart2) {
- (options as AnalysisOptionsImpl).useFastaParser = true;
+ (options as AnalysisOptionsImpl)
+ ..strongMode = true
+ ..useFastaParser = true;
}
DartSdk sdk = new MockSdk(resourceProvider: resourceProvider)
..context.analysisOptions = options;
diff --git a/pkg/analyzer/test/generated/static_type_analyzer_kernel_test.dart b/pkg/analyzer/test/generated/static_type_analyzer_kernel_test.dart
index 08a3bc0..5d997c0 100644
--- a/pkg/analyzer/test/generated/static_type_analyzer_kernel_test.dart
+++ b/pkg/analyzer/test/generated/static_type_analyzer_kernel_test.dart
@@ -16,4 +16,42 @@
class StaticTypeAnalyzer2Test_Kernel extends StaticTypeAnalyzer2Test_Driver {
@override
bool get enableKernelDriver => true;
+
+ @override
+ bool get previewDart2 => true;
+
+ @override
+ @failingTest
+ test_FunctionExpressionInvocation_block() async {
+ // Bad state: No reference information for (() {return 1;})() at 21
+ await super.test_FunctionExpressionInvocation_block();
+ }
+
+ @override
+ @failingTest
+ test_FunctionExpressionInvocation_curried() async {
+ // Bad state: No reference information for f()() at 53
+ await super.test_FunctionExpressionInvocation_curried();
+ }
+
+ @override
+ @failingTest
+ test_FunctionExpressionInvocation_expression() async {
+ // Bad state: No reference information for (() => 1)() at 21
+ await super.test_FunctionExpressionInvocation_expression();
+ }
+
+ @override
+ @failingTest
+ test_MethodInvocation_nameType_parameter_propagatedType() async {
+ // Expected: DynamicTypeImpl:<dynamic>
+ await super.test_MethodInvocation_nameType_parameter_propagatedType();
+ }
+
+ @override
+ @failingTest
+ test_staticMethods_classTypeParameters_genericMethod() async {
+ // Expected: '(dynamic) → void'
+ await super.test_staticMethods_classTypeParameters_genericMethod();
+ }
}
diff --git a/pkg/analyzer/test/generated/static_type_warning_code_kernel_test.dart b/pkg/analyzer/test/generated/static_type_warning_code_kernel_test.dart
index 61cafa2..7260957 100644
--- a/pkg/analyzer/test/generated/static_type_warning_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/static_type_warning_code_kernel_test.dart
@@ -23,6 +23,1308 @@
extends StaticTypeWarningCodeTest_Driver {
@override
bool get enableKernelDriver => true;
+
+ @override
+ bool get previewDart2 => true;
+
+ @override
+ @failingTest
+ test_ambiguousImport_function() async {
+ // Bad state: No reference information for f at 53
+ await super.test_ambiguousImport_function();
+ }
+
+ @override
+ @failingTest
+ test_assert_message_suppresses_type_promotion() async {
+ // Bad state: No reference information for () {x = new C(); return 'msg';}() at 89
+ await super.test_assert_message_suppresses_type_promotion();
+ }
+
+ @override
+ @failingTest
+ test_await_flattened() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0
+ await super.test_await_flattened();
+ }
+
+ @override
+ @failingTest
+ test_await_simple() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0
+ await super.test_await_simple();
+ }
+
+ @override
+ @failingTest
+ test_awaitForIn_declaredVariableWrongType() async {
+ // Expected 1 errors of type StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, found 0
+ await super.test_awaitForIn_declaredVariableWrongType();
+ }
+
+ @override
+ @failingTest
+ test_awaitForIn_existingVariableWrongType() async {
+ // Expected 1 errors of type StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, found 0
+ await super.test_awaitForIn_existingVariableWrongType();
+ }
+
+ @override
+ @failingTest
+ test_awaitForIn_notStream() async {
+ // Expected 1 errors of type StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE, found 0
+ await super.test_awaitForIn_notStream();
+ }
+
+ @override
+ @failingTest
+ test_bug21912() async {
+ // Expected 2 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0
+ await super.test_bug21912();
+ }
+
+ @override
+ @failingTest
+ test_expectedOneListTypeArgument() async {
+ // Bad state: Found 1 argument types for 2 type arguments
+ await super.test_expectedOneListTypeArgument();
+ }
+
+ @override
+ @failingTest
+ test_expectedTwoMapTypeArguments_one() async {
+ // Bad state: Found 2 argument types for 1 type arguments
+ await super.test_expectedTwoMapTypeArguments_one();
+ }
+
+ @override
+ @failingTest
+ test_expectedTwoMapTypeArguments_three() async {
+ // Bad state: Found 2 argument types for 3 type arguments
+ await super.test_expectedTwoMapTypeArguments_three();
+ }
+
+ @override
+ @failingTest
+ test_forIn_declaredVariableWrongType() async {
+ // Expected 1 errors of type StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, found 0
+ await super.test_forIn_declaredVariableWrongType();
+ }
+
+ @override
+ @failingTest
+ test_forIn_existingVariableWrongType() async {
+ // Expected 1 errors of type StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, found 0
+ await super.test_forIn_existingVariableWrongType();
+ }
+
+ @override
+ @failingTest
+ test_forIn_notIterable() async {
+ // Expected 1 errors of type StaticTypeWarningCode.FOR_IN_OF_INVALID_TYPE, found 0
+ await super.test_forIn_notIterable();
+ }
+
+ @override
+ @failingTest
+ test_forIn_typeBoundBad() async {
+ // Expected 1 errors of type StaticTypeWarningCode.FOR_IN_OF_INVALID_ELEMENT_TYPE, found 0
+ await super.test_forIn_typeBoundBad();
+ }
+
+ @override
+ @failingTest
+ test_illegalAsyncGeneratorReturnType_function_nonStream() async {
+ // Expected 1 errors of type StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE, found 0
+ await super.test_illegalAsyncGeneratorReturnType_function_nonStream();
+ }
+
+ @override
+ @failingTest
+ test_illegalAsyncGeneratorReturnType_function_subtypeOfStream() async {
+ // Expected 1 errors of type StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE, found 0
+ await super.test_illegalAsyncGeneratorReturnType_function_subtypeOfStream();
+ }
+
+ @override
+ @failingTest
+ test_illegalAsyncGeneratorReturnType_method_nonStream() async {
+ // Expected 1 errors of type StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE, found 0
+ await super.test_illegalAsyncGeneratorReturnType_method_nonStream();
+ }
+
+ @override
+ @failingTest
+ test_illegalAsyncGeneratorReturnType_method_subtypeOfStream() async {
+ // Expected 1 errors of type StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE, found 0
+ await super.test_illegalAsyncGeneratorReturnType_method_subtypeOfStream();
+ }
+
+ @override
+ @failingTest
+ test_illegalAsyncReturnType_function_nonFuture() async {
+ // Expected 1 errors of type StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE, found 0
+ await super.test_illegalAsyncReturnType_function_nonFuture();
+ }
+
+ @override
+ @failingTest
+ test_illegalAsyncReturnType_function_subtypeOfFuture() async {
+ // Expected 1 errors of type StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE, found 0
+ await super.test_illegalAsyncReturnType_function_subtypeOfFuture();
+ }
+
+ @override
+ @failingTest
+ test_illegalAsyncReturnType_method_nonFuture() async {
+ // Expected 1 errors of type StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE, found 0
+ await super.test_illegalAsyncReturnType_method_nonFuture();
+ }
+
+ @override
+ @failingTest
+ test_illegalAsyncReturnType_method_subtypeOfFuture() async {
+ // Expected 1 errors of type StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE, found 0
+ await super.test_illegalAsyncReturnType_method_subtypeOfFuture();
+ }
+
+ @override
+ @failingTest
+ test_illegalSyncGeneratorReturnType_function_nonIterator() async {
+ // Expected 1 errors of type StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE, found 0
+ await super.test_illegalSyncGeneratorReturnType_function_nonIterator();
+ }
+
+ @override
+ @failingTest
+ test_illegalSyncGeneratorReturnType_function_subclassOfIterator() async {
+ // Expected 1 errors of type StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE, found 0
+ await super
+ .test_illegalSyncGeneratorReturnType_function_subclassOfIterator();
+ }
+
+ @override
+ @failingTest
+ test_illegalSyncGeneratorReturnType_method_nonIterator() async {
+ // Expected 1 errors of type StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE, found 0
+ await super.test_illegalSyncGeneratorReturnType_method_nonIterator();
+ }
+
+ @override
+ @failingTest
+ test_illegalSyncGeneratorReturnType_method_subclassOfIterator() async {
+ // Expected 1 errors of type StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE, found 0
+ await super.test_illegalSyncGeneratorReturnType_method_subclassOfIterator();
+ }
+
+ @override
+ @failingTest
+ test_inconsistentMethodInheritance_paramCount() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE, found 0
+ await super.test_inconsistentMethodInheritance_paramCount();
+ }
+
+ @override
+ @failingTest
+ test_inconsistentMethodInheritance_paramType() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE, found 0
+ await super.test_inconsistentMethodInheritance_paramType();
+ }
+
+ @override
+ @failingTest
+ test_inconsistentMethodInheritance_returnType() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INCONSISTENT_METHOD_INHERITANCE, found 0
+ await super.test_inconsistentMethodInheritance_returnType();
+ }
+
+ @override
+ @failingTest
+ test_instanceAccessToStaticMember_method_invocation() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, found 0
+ await super.test_instanceAccessToStaticMember_method_invocation();
+ }
+
+ @override
+ @failingTest
+ test_instanceAccessToStaticMember_method_reference() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, found 0
+ await super.test_instanceAccessToStaticMember_method_reference();
+ }
+
+ @override
+ @failingTest
+ test_instanceAccessToStaticMember_propertyAccess_field() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, found 0
+ await super.test_instanceAccessToStaticMember_propertyAccess_field();
+ }
+
+ @override
+ @failingTest
+ test_instanceAccessToStaticMember_propertyAccess_getter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, found 0
+ await super.test_instanceAccessToStaticMember_propertyAccess_getter();
+ }
+
+ @override
+ @failingTest
+ test_instanceAccessToStaticMember_propertyAccess_setter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INSTANCE_ACCESS_TO_STATIC_MEMBER, found 0
+ await super.test_instanceAccessToStaticMember_propertyAccess_setter();
+ }
+
+ @override
+ @failingTest
+ test_invalidAssignment_compoundAssignment() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0
+ await super.test_invalidAssignment_compoundAssignment();
+ }
+
+ @override
+ @failingTest
+ test_invalidAssignment_defaultValue_named() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t1 = 0 in let ...
+ await super.test_invalidAssignment_defaultValue_named();
+ }
+
+ @override
+ @failingTest
+ test_invalidAssignment_defaultValue_optional() async {
+ // UnimplementedError: kernel: (Let) let final dynamic #t2 = 0 in let ...
+ await super.test_invalidAssignment_defaultValue_optional();
+ }
+
+ @override
+ @failingTest
+ test_invalidAssignment_dynamic() async {
+ // Bad state: No reference information for dynamic at 11
+ await super.test_invalidAssignment_dynamic();
+ }
+
+ @override
+ @failingTest
+ test_invalidAssignment_functionExpressionInvocation() async {
+ // Bad state: No reference information for (() => 5)() at 22
+ await super.test_invalidAssignment_functionExpressionInvocation();
+ }
+
+ @override
+ @failingTest
+ test_invalidAssignment_ifNullAssignment() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0
+ await super.test_invalidAssignment_ifNullAssignment();
+ }
+
+ @override
+ @failingTest
+ test_invalidAssignment_instanceVariable() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0
+ await super.test_invalidAssignment_instanceVariable();
+ }
+
+ @override
+ @failingTest
+ test_invalidAssignment_localVariable() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0
+ await super.test_invalidAssignment_localVariable();
+ }
+
+ @override
+ @failingTest
+ test_invalidAssignment_regressionInIssue18468Fix() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0
+ await super.test_invalidAssignment_regressionInIssue18468Fix();
+ }
+
+ @override
+ @failingTest
+ test_invalidAssignment_staticVariable() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0
+ await super.test_invalidAssignment_staticVariable();
+ }
+
+ @override
+ @failingTest
+ test_invalidAssignment_topLevelVariableDeclaration() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0
+ await super.test_invalidAssignment_topLevelVariableDeclaration();
+ }
+
+ @override
+ @failingTest
+ test_invalidAssignment_typeParameter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0
+ await super.test_invalidAssignment_typeParameter();
+ }
+
+ @override
+ @failingTest
+ test_invalidAssignment_variableDeclaration() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVALID_ASSIGNMENT, found 0
+ await super.test_invalidAssignment_variableDeclaration();
+ }
+
+ @override
+ @failingTest
+ test_invocationOfNonFunction_class() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, found 0
+ await super.test_invocationOfNonFunction_class();
+ }
+
+ @override
+ @failingTest
+ test_invocationOfNonFunction_localGenericFunction() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, found 0
+ await super.test_invocationOfNonFunction_localGenericFunction();
+ }
+
+ @override
+ @failingTest
+ test_invocationOfNonFunction_localObject() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, found 0
+ await super.test_invocationOfNonFunction_localObject();
+ }
+
+ @override
+ @failingTest
+ test_invocationOfNonFunction_localVariable() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, found 0
+ await super.test_invocationOfNonFunction_localVariable();
+ }
+
+ @override
+ @failingTest
+ test_invocationOfNonFunction_ordinaryInvocation() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, found 0
+ await super.test_invocationOfNonFunction_ordinaryInvocation();
+ }
+
+ @override
+ @failingTest
+ test_invocationOfNonFunction_staticInvocation() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, found 0
+ await super.test_invocationOfNonFunction_staticInvocation();
+ }
+
+ @override
+ @failingTest
+ test_invocationOfNonFunction_superExpression() async {
+ // Expected 1 errors of type StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, found 0
+ await super.test_invocationOfNonFunction_superExpression();
+ }
+
+ @override
+ @failingTest
+ test_invocationOfNonFunctionExpression_literal() async {
+ // Bad state: Expected a type for 5 at 10; got one for kernel offset 9
+ await super.test_invocationOfNonFunctionExpression_literal();
+ }
+
+ @override
+ @failingTest
+ test_nonBoolCondition_conditional() async {
+ // Expected 1 errors of type StaticTypeWarningCode.NON_BOOL_CONDITION, found 0
+ await super.test_nonBoolCondition_conditional();
+ }
+
+ @override
+ @failingTest
+ test_nonBoolCondition_do() async {
+ // Expected 1 errors of type StaticTypeWarningCode.NON_BOOL_CONDITION, found 0
+ await super.test_nonBoolCondition_do();
+ }
+
+ @override
+ @failingTest
+ test_nonBoolCondition_for() async {
+ // Expected 1 errors of type StaticTypeWarningCode.NON_BOOL_CONDITION, found 0
+ await super.test_nonBoolCondition_for();
+ }
+
+ @override
+ @failingTest
+ test_nonBoolCondition_if() async {
+ // Expected 1 errors of type StaticTypeWarningCode.NON_BOOL_CONDITION, found 0
+ await super.test_nonBoolCondition_if();
+ }
+
+ @override
+ @failingTest
+ test_nonBoolCondition_while() async {
+ // Expected 1 errors of type StaticTypeWarningCode.NON_BOOL_CONDITION, found 0
+ await super.test_nonBoolCondition_while();
+ }
+
+ @override
+ @failingTest
+ test_nonBoolExpression_functionType() async {
+ // Expected 1 errors of type StaticTypeWarningCode.NON_BOOL_EXPRESSION, found 0
+ await super.test_nonBoolExpression_functionType();
+ }
+
+ @override
+ @failingTest
+ test_nonBoolExpression_interfaceType() async {
+ // Expected 1 errors of type StaticTypeWarningCode.NON_BOOL_EXPRESSION, found 0
+ await super.test_nonBoolExpression_interfaceType();
+ }
+
+ @override
+ @failingTest
+ test_nonBoolNegationExpression() async {
+ // Expected 1 errors of type StaticTypeWarningCode.NON_BOOL_NEGATION_EXPRESSION, found 0
+ await super.test_nonBoolNegationExpression();
+ }
+
+ @override
+ @failingTest
+ test_nonBoolOperand_and_left() async {
+ // Expected 1 errors of type StaticTypeWarningCode.NON_BOOL_OPERAND, found 0
+ await super.test_nonBoolOperand_and_left();
+ }
+
+ @override
+ @failingTest
+ test_nonBoolOperand_and_right() async {
+ // Expected 1 errors of type StaticTypeWarningCode.NON_BOOL_OPERAND, found 0
+ await super.test_nonBoolOperand_and_right();
+ }
+
+ @override
+ @failingTest
+ test_nonBoolOperand_or_left() async {
+ // Expected 1 errors of type StaticTypeWarningCode.NON_BOOL_OPERAND, found 0
+ await super.test_nonBoolOperand_or_left();
+ }
+
+ @override
+ @failingTest
+ test_nonBoolOperand_or_right() async {
+ // Expected 1 errors of type StaticTypeWarningCode.NON_BOOL_OPERAND, found 0
+ await super.test_nonBoolOperand_or_right();
+ }
+
+ @override
+ @failingTest
+ test_nonTypeAsTypeArgument_notAType() async {
+ // Expected 1 errors of type StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, found 0
+ await super.test_nonTypeAsTypeArgument_notAType();
+ }
+
+ @override
+ @failingTest
+ test_nonTypeAsTypeArgument_undefinedIdentifier() async {
+ // Expected 1 errors of type StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, found 0
+ await super.test_nonTypeAsTypeArgument_undefinedIdentifier();
+ }
+
+ @override
+ @failingTest
+ test_returnOfInvalidType_async_future_int_mismatches_future_string() async {
+ // Expected 1 errors of type StaticTypeWarningCode.RETURN_OF_INVALID_TYPE, found 0
+ await super
+ .test_returnOfInvalidType_async_future_int_mismatches_future_string();
+ }
+
+ @override
+ @failingTest
+ test_returnOfInvalidType_async_future_int_mismatches_int() async {
+ // Expected 1 errors of type StaticTypeWarningCode.RETURN_OF_INVALID_TYPE, found 0;
+ // 1 errors of type StaticTypeWarningCode.ILLEGAL_ASYNC_RETURN_TYPE, found 0
+ await super.test_returnOfInvalidType_async_future_int_mismatches_int();
+ }
+
+ @override
+ @failingTest
+ test_returnOfInvalidType_expressionFunctionBody_function() async {
+ // Expected 1 errors of type StaticTypeWarningCode.RETURN_OF_INVALID_TYPE, found 0
+ await super.test_returnOfInvalidType_expressionFunctionBody_function();
+ }
+
+ @override
+ @failingTest
+ test_returnOfInvalidType_expressionFunctionBody_getter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.RETURN_OF_INVALID_TYPE, found 0
+ await super.test_returnOfInvalidType_expressionFunctionBody_getter();
+ }
+
+ @override
+ @failingTest
+ test_returnOfInvalidType_expressionFunctionBody_localFunction() async {
+ // Expected 1 errors of type StaticTypeWarningCode.RETURN_OF_INVALID_TYPE, found 0
+ await super.test_returnOfInvalidType_expressionFunctionBody_localFunction();
+ }
+
+ @override
+ @failingTest
+ test_returnOfInvalidType_expressionFunctionBody_method() async {
+ // Expected 1 errors of type StaticTypeWarningCode.RETURN_OF_INVALID_TYPE, found 0
+ await super.test_returnOfInvalidType_expressionFunctionBody_method();
+ }
+
+ @override
+ @failingTest
+ test_returnOfInvalidType_function() async {
+ // Expected 1 errors of type StaticTypeWarningCode.RETURN_OF_INVALID_TYPE, found 0
+ await super.test_returnOfInvalidType_function();
+ }
+
+ @override
+ @failingTest
+ test_returnOfInvalidType_getter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.RETURN_OF_INVALID_TYPE, found 0
+ await super.test_returnOfInvalidType_getter();
+ }
+
+ @override
+ @failingTest
+ test_returnOfInvalidType_localFunction() async {
+ // Expected 1 errors of type StaticTypeWarningCode.RETURN_OF_INVALID_TYPE, found 0
+ await super.test_returnOfInvalidType_localFunction();
+ }
+
+ @override
+ @failingTest
+ test_returnOfInvalidType_method() async {
+ // Expected 1 errors of type StaticTypeWarningCode.RETURN_OF_INVALID_TYPE, found 0
+ await super.test_returnOfInvalidType_method();
+ }
+
+ @override
+ @failingTest
+ test_returnOfInvalidType_void() async {
+ // Expected 1 errors of type StaticTypeWarningCode.RETURN_OF_INVALID_TYPE, found 0
+ await super.test_returnOfInvalidType_void();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_classTypeAlias() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_typeArgumentNotMatchingBounds_classTypeAlias();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_extends() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_typeArgumentNotMatchingBounds_extends();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_extends_regressionInIssue18468Fix() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super
+ .test_typeArgumentNotMatchingBounds_extends_regressionInIssue18468Fix();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_fieldFormalParameter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_typeArgumentNotMatchingBounds_fieldFormalParameter();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_functionReturnType() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_typeArgumentNotMatchingBounds_functionReturnType();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_functionTypeAlias() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_typeArgumentNotMatchingBounds_functionTypeAlias();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_functionTypedFormalParameter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super
+ .test_typeArgumentNotMatchingBounds_functionTypedFormalParameter();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_implements() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_typeArgumentNotMatchingBounds_implements();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_is() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_typeArgumentNotMatchingBounds_is();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_methodInvocation_localFunction() async {
+ // 'package:analyzer/src/fasta/resolution_applier.dart': Failed assertion: line 236 pos 18: 'typeParameter.bound == null': is not true.
+ await super
+ .test_typeArgumentNotMatchingBounds_methodInvocation_localFunction();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_methodInvocation_method() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_typeArgumentNotMatchingBounds_methodInvocation_method();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_methodInvocation_topLevelFunction() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super
+ .test_typeArgumentNotMatchingBounds_methodInvocation_topLevelFunction();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_methodReturnType() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_typeArgumentNotMatchingBounds_methodReturnType();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_new() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_typeArgumentNotMatchingBounds_new();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_new_superTypeOfUpperBound() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_typeArgumentNotMatchingBounds_new_superTypeOfUpperBound();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_parameter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_typeArgumentNotMatchingBounds_parameter();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_redirectingConstructor() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0;
+ // 1 errors of type StaticWarningCode.REDIRECT_TO_INVALID_RETURN_TYPE, found 0
+ await super.test_typeArgumentNotMatchingBounds_redirectingConstructor();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_typeArgumentList() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_typeArgumentNotMatchingBounds_typeArgumentList();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_typeParameter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_typeArgumentNotMatchingBounds_typeParameter();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_variableDeclaration() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_typeArgumentNotMatchingBounds_variableDeclaration();
+ }
+
+ @override
+ @failingTest
+ test_typeArgumentNotMatchingBounds_with() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS, found 0
+ await super.test_typeArgumentNotMatchingBounds_with();
+ }
+
+ @override
+ @failingTest
+ test_typeParameterSupertypeOfItsBound() async {
+ // Expected 1 errors of type StaticTypeWarningCode.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND, found 0
+ await super.test_typeParameterSupertypeOfItsBound();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_booleanAnd_useInRight_accessedInClosureRight_mutated() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super
+ .test_typePromotion_booleanAnd_useInRight_accessedInClosureRight_mutated();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_booleanAnd_useInRight_mutatedInLeft() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_typePromotion_booleanAnd_useInRight_mutatedInLeft();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_booleanAnd_useInRight_mutatedInRight() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_typePromotion_booleanAnd_useInRight_mutatedInRight();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_conditional_useInThen_accessedInClosure_hasAssignment_after() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super
+ .test_typePromotion_conditional_useInThen_accessedInClosure_hasAssignment_after();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_conditional_useInThen_accessedInClosure_hasAssignment_before() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super
+ .test_typePromotion_conditional_useInThen_accessedInClosure_hasAssignment_before();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_conditional_useInThen_hasAssignment() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_typePromotion_conditional_useInThen_hasAssignment();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_if_accessedInClosure_hasAssignment() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_typePromotion_if_accessedInClosure_hasAssignment();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_if_and_right_hasAssignment() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_typePromotion_if_and_right_hasAssignment();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_if_extends_notMoreSpecific_dynamic() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_typePromotion_if_extends_notMoreSpecific_dynamic();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_if_extends_notMoreSpecific_notMoreSpecificTypeArg() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super
+ .test_typePromotion_if_extends_notMoreSpecific_notMoreSpecificTypeArg();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_if_hasAssignment_after() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_typePromotion_if_hasAssignment_after();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_if_hasAssignment_before() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_typePromotion_if_hasAssignment_before();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_if_hasAssignment_inClosure_anonymous_after() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_typePromotion_if_hasAssignment_inClosure_anonymous_after();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_if_hasAssignment_inClosure_anonymous_before() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super
+ .test_typePromotion_if_hasAssignment_inClosure_anonymous_before();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_if_hasAssignment_inClosure_function_after() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_typePromotion_if_hasAssignment_inClosure_function_after();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_if_hasAssignment_inClosure_function_before() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_typePromotion_if_hasAssignment_inClosure_function_before();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_if_implements_notMoreSpecific_dynamic() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_typePromotion_if_implements_notMoreSpecific_dynamic();
+ }
+
+ @override
+ @failingTest
+ test_typePromotion_if_with_notMoreSpecific_dynamic() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_typePromotion_if_with_notMoreSpecific_dynamic();
+ }
+
+ @override
+ @failingTest
+ test_undefinedFunction() async {
+ // Bad state: No reference information for g at 13
+ await super.test_undefinedFunction();
+ }
+
+ @override
+ @failingTest
+ test_undefinedFunction_inCatch() async {
+ // Bad state: No reference information for g at 39
+ await super.test_undefinedFunction_inCatch();
+ }
+
+ @override
+ @failingTest
+ test_undefinedFunction_inImportedLib() async {
+ // Bad state: No reference information for f at 40
+ await super.test_undefinedFunction_inImportedLib();
+ }
+
+ @override
+ @failingTest
+ test_undefinedGetter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_undefinedGetter();
+ }
+
+ @override
+ @failingTest
+ test_undefinedGetter_generic_function_call() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_undefinedGetter_generic_function_call();
+ }
+
+ @override
+ @failingTest
+ test_undefinedGetter_object_call() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_undefinedGetter_object_call();
+ }
+
+ @override
+ @failingTest
+ test_undefinedGetter_proxy_annotation_fakeProxy() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_undefinedGetter_proxy_annotation_fakeProxy();
+ }
+
+ @override
+ @failingTest
+ test_undefinedGetter_static() async {
+ // Bad state: No reference information for A at 19
+ await super.test_undefinedGetter_static();
+ }
+
+ @override
+ @failingTest
+ test_undefinedGetter_typeLiteral_cascadeTarget() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_undefinedGetter_typeLiteral_cascadeTarget();
+ }
+
+ @override
+ @failingTest
+ test_undefinedGetter_typeLiteral_conditionalAccess() async {
+ // Bad state: No reference information for A at 18
+ await super.test_undefinedGetter_typeLiteral_conditionalAccess();
+ }
+
+ @override
+ @failingTest
+ test_undefinedGetter_void() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_GETTER, found 0
+ await super.test_undefinedGetter_void();
+ }
+
+ @override
+ @failingTest
+ test_undefinedGetter_wrongNumberOfTypeArguments_tooLittle() async {
+ // AnalysisException: Element mismatch in /test.dart at main(A<dynamic, dynamic> a) → dynamic
+ await super.test_undefinedGetter_wrongNumberOfTypeArguments_tooLittle();
+ }
+
+ @override
+ @failingTest
+ test_undefinedGetter_wrongNumberOfTypeArguments_tooMany() async {
+ // AnalysisException: Element mismatch in /test.dart at main(A<dynamic> a) → dynamic
+ await super.test_undefinedGetter_wrongNumberOfTypeArguments_tooMany();
+ }
+
+ @override
+ @failingTest
+ test_undefinedGetter_wrongOfTypeArgument() async {
+ // Expected 1 errors of type StaticTypeWarningCode.NON_TYPE_AS_TYPE_ARGUMENT, found 0
+ await super.test_undefinedGetter_wrongOfTypeArgument();
+ }
+
+ @override
+ @failingTest
+ test_undefinedMethod() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_METHOD, found 0
+ await super.test_undefinedMethod();
+ }
+
+ @override
+ @failingTest
+ test_undefinedMethod_assignmentExpression() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_METHOD, found 0
+ await super.test_undefinedMethod_assignmentExpression();
+ }
+
+ @override
+ @failingTest
+ test_undefinedMethod_generic_function_call() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_METHOD, found 0
+ await super.test_undefinedMethod_generic_function_call();
+ }
+
+ @override
+ @failingTest
+ test_undefinedMethod_ignoreTypePropagation() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_METHOD, found 0
+ await super.test_undefinedMethod_ignoreTypePropagation();
+ }
+
+ @override
+ @failingTest
+ test_undefinedMethod_leastUpperBoundWithNull() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_METHOD, found 0
+ await super.test_undefinedMethod_leastUpperBoundWithNull();
+ }
+
+ @override
+ @failingTest
+ test_undefinedMethod_object_call() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_METHOD, found 0
+ await super.test_undefinedMethod_object_call();
+ }
+
+ @override
+ @failingTest
+ test_undefinedMethod_ofNull() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_METHOD, found 0
+ await super.test_undefinedMethod_ofNull();
+ }
+
+ @override
+ @failingTest
+ test_undefinedMethod_private() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_METHOD, found 0
+ await super.test_undefinedMethod_private();
+ }
+
+ @override
+ @failingTest
+ test_undefinedMethod_proxy_annotation_fakeProxy() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_METHOD, found 0
+ await super.test_undefinedMethod_proxy_annotation_fakeProxy();
+ }
+
+ @override
+ @failingTest
+ test_undefinedMethod_typeLiteral_cascadeTarget() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_METHOD, found 0
+ await super.test_undefinedMethod_typeLiteral_cascadeTarget();
+ }
+
+ @override
+ @failingTest
+ test_undefinedMethod_typeLiteral_conditionalAccess() async {
+ // Bad state: No reference information for A at 18
+ await super.test_undefinedMethod_typeLiteral_conditionalAccess();
+ }
+
+ @override
+ @failingTest
+ test_undefinedMethodWithConstructor() async {
+ // Bad state: No reference information for C at 35
+ await super.test_undefinedMethodWithConstructor();
+ }
+
+ @override
+ @failingTest
+ test_undefinedOperator_indexBoth() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_OPERATOR, found 0
+ await super.test_undefinedOperator_indexBoth();
+ }
+
+ @override
+ @failingTest
+ test_undefinedOperator_indexGetter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_OPERATOR, found 0
+ await super.test_undefinedOperator_indexGetter();
+ }
+
+ @override
+ @failingTest
+ test_undefinedOperator_indexSetter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_OPERATOR, found 0
+ await super.test_undefinedOperator_indexSetter();
+ }
+
+ @override
+ @failingTest
+ test_undefinedOperator_plus() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_OPERATOR, found 0
+ await super.test_undefinedOperator_plus();
+ }
+
+ @override
+ @failingTest
+ test_undefinedOperator_postfixExpression() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_OPERATOR, found 0
+ await super.test_undefinedOperator_postfixExpression();
+ }
+
+ @override
+ @failingTest
+ test_undefinedOperator_prefixExpression() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_OPERATOR, found 0
+ await super.test_undefinedOperator_prefixExpression();
+ }
+
+ @override
+ @failingTest
+ test_undefinedSetter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_SETTER, found 0
+ await super.test_undefinedSetter();
+ }
+
+ @override
+ @failingTest
+ test_undefinedSetter_static() async {
+ // Bad state: No reference information for A at 17
+ await super.test_undefinedSetter_static();
+ }
+
+ @override
+ @failingTest
+ test_undefinedSetter_typeLiteral_cascadeTarget() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_SETTER, found 0
+ await super.test_undefinedSetter_typeLiteral_cascadeTarget();
+ }
+
+ @override
+ @failingTest
+ test_undefinedSetter_void() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_SETTER, found 0
+ await super.test_undefinedSetter_void();
+ }
+
+ @override
+ @failingTest
+ test_undefinedSuperGetter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_SUPER_GETTER, found 0
+ await super.test_undefinedSuperGetter();
+ }
+
+ @override
+ @failingTest
+ test_undefinedSuperMethod() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_SUPER_METHOD, found 0
+ await super.test_undefinedSuperMethod();
+ }
+
+ @override
+ @failingTest
+ test_undefinedSuperOperator_binaryExpression() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR, found 0
+ await super.test_undefinedSuperOperator_binaryExpression();
+ }
+
+ @override
+ @failingTest
+ test_undefinedSuperOperator_indexBoth() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR, found 0
+ await super.test_undefinedSuperOperator_indexBoth();
+ }
+
+ @override
+ @failingTest
+ test_undefinedSuperOperator_indexGetter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR, found 0
+ await super.test_undefinedSuperOperator_indexGetter();
+ }
+
+ @override
+ @failingTest
+ test_undefinedSuperOperator_indexSetter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_SUPER_OPERATOR, found 0
+ await super.test_undefinedSuperOperator_indexSetter();
+ }
+
+ @override
+ @failingTest
+ test_undefinedSuperSetter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_SUPER_SETTER, found 0
+ await super.test_undefinedSuperSetter();
+ }
+
+ @override
+ @failingTest
+ test_unqualifiedReferenceToNonLocalStaticMember_getter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER, found 0
+ await super.test_unqualifiedReferenceToNonLocalStaticMember_getter();
+ }
+
+ @override
+ @failingTest
+ test_unqualifiedReferenceToNonLocalStaticMember_getter_invokeTarget() async {
+ // Bad state: No reference information for foo at 72
+ await super
+ .test_unqualifiedReferenceToNonLocalStaticMember_getter_invokeTarget();
+ }
+
+ @override
+ @failingTest
+ test_unqualifiedReferenceToNonLocalStaticMember_method() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER, found 0
+ await super.test_unqualifiedReferenceToNonLocalStaticMember_method();
+ }
+
+ @override
+ @failingTest
+ test_unqualifiedReferenceToNonLocalStaticMember_setter() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNQUALIFIED_REFERENCE_TO_NON_LOCAL_STATIC_MEMBER, found 0
+ await super.test_unqualifiedReferenceToNonLocalStaticMember_setter();
+ }
+
+ @override
+ @failingTest
+ test_wrongNumberOfTypeArguments_classAlias() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_wrongNumberOfTypeArguments_classAlias();
+ }
+
+ @override
+ @failingTest
+ test_wrongNumberOfTypeArguments_tooFew() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_wrongNumberOfTypeArguments_tooFew();
+ }
+
+ @override
+ @failingTest
+ test_wrongNumberOfTypeArguments_tooMany() async {
+ // AnalysisException: Element mismatch in /test.dart at /test.dart
+ await super.test_wrongNumberOfTypeArguments_tooMany();
+ }
+
+ @override
+ @failingTest
+ test_wrongNumberOfTypeArguments_typeTest_tooFew() async {
+ // Bad state: Found 2 argument types for 1 type arguments
+ await super.test_wrongNumberOfTypeArguments_typeTest_tooFew();
+ }
+
+ @override
+ @failingTest
+ test_wrongNumberOfTypeArguments_typeTest_tooMany() async {
+ // Bad state: Found 1 argument types for 2 type arguments
+ await super.test_wrongNumberOfTypeArguments_typeTest_tooMany();
+ }
+
+ @override
+ @failingTest
+ test_yield_async_to_basic_type() async {
+ // Expected 1 errors of type StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, found 0;
+ // 1 errors of type StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE, found 0
+ await super.test_yield_async_to_basic_type();
+ }
+
+ @override
+ @failingTest
+ test_yield_async_to_iterable() async {
+ // Expected 1 errors of type StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, found 0;
+ // 1 errors of type StaticTypeWarningCode.ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE, found 0
+ await super.test_yield_async_to_iterable();
+ }
+
+ @override
+ @failingTest
+ test_yield_async_to_mistyped_stream() async {
+ // Expected 1 errors of type StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, found 0
+ await super.test_yield_async_to_mistyped_stream();
+ }
+
+ @override
+ @failingTest
+ test_yield_each_async_non_stream() async {
+ // Expected 1 errors of type StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, found 0
+ await super.test_yield_each_async_non_stream();
+ }
+
+ @override
+ @failingTest
+ test_yield_each_async_to_mistyped_stream() async {
+ // Expected 1 errors of type StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, found 0
+ await super.test_yield_each_async_to_mistyped_stream();
+ }
+
+ @override
+ @failingTest
+ test_yield_each_sync_non_iterable() async {
+ // Expected 1 errors of type StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, found 0
+ await super.test_yield_each_sync_non_iterable();
+ }
+
+ @override
+ @failingTest
+ test_yield_each_sync_to_mistyped_iterable() async {
+ // Expected 1 errors of type StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, found 0
+ await super.test_yield_each_sync_to_mistyped_iterable();
+ }
+
+ @override
+ @failingTest
+ test_yield_sync_to_basic_type() async {
+ // Expected 1 errors of type StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, found 0;
+ // 1 errors of type StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE, found 0
+ await super.test_yield_sync_to_basic_type();
+ }
+
+ @override
+ @failingTest
+ test_yield_sync_to_mistyped_iterable() async {
+ // Expected 1 errors of type StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, found 0
+ await super.test_yield_sync_to_mistyped_iterable();
+ }
+
+ @override
+ @failingTest
+ test_yield_sync_to_stream() async {
+ // Expected 1 errors of type StaticTypeWarningCode.YIELD_OF_INVALID_TYPE, found 0;
+ // 1 errors of type StaticTypeWarningCode.ILLEGAL_SYNC_GENERATOR_RETURN_TYPE, found 0
+ await super.test_yield_sync_to_stream();
+ }
}
@reflectiveTest
@@ -30,4 +1332,14 @@
extends StrongModeStaticTypeWarningCodeTest_Driver {
@override
bool get enableKernelDriver => true;
+
+ @override
+ bool get previewDart2 => true;
+
+ @override
+ @failingTest
+ test_genericMethodWrongNumberOfTypeArguments() async {
+ // Bad state: Found 0 argument types for 1 type arguments
+ await super.test_genericMethodWrongNumberOfTypeArguments();
+ }
}
diff --git a/pkg/analyzer/test/generated/static_warning_code_kernel_test.dart b/pkg/analyzer/test/generated/static_warning_code_kernel_test.dart
index 0875808..aa9081d 100644
--- a/pkg/analyzer/test/generated/static_warning_code_kernel_test.dart
+++ b/pkg/analyzer/test/generated/static_warning_code_kernel_test.dart
@@ -376,71 +376,71 @@
@override
@failingTest
@potentialAnalyzerProblem
- test_assignmentToFinal_localVariable() async {
- return super.test_assignmentToFinal_localVariable();
+ test_assignmentToFinalLocal_localVariable() async {
+ return super.test_assignmentToFinalLocal_localVariable();
}
@override
@failingTest
@potentialAnalyzerProblem
- test_assignmentToFinal_localVariable_plusEq() async {
- return super.test_assignmentToFinal_localVariable_plusEq();
+ test_assignmentToFinalLocal_localVariable_plusEq() async {
+ return super.test_assignmentToFinalLocal_localVariable_plusEq();
}
@override
@failingTest
@potentialAnalyzerProblem
- test_assignmentToFinal_parameter() async {
- return super.test_assignmentToFinal_parameter();
+ test_assignmentToFinalLocal_parameter() async {
+ return super.test_assignmentToFinalLocal_parameter();
}
@override
@failingTest
@potentialAnalyzerProblem
- test_assignmentToFinal_postfixMinusMinus() async {
- return super.test_assignmentToFinal_postfixMinusMinus();
+ test_assignmentToFinalLocal_postfixMinusMinus() async {
+ return super.test_assignmentToFinalLocal_postfixMinusMinus();
}
@override
@failingTest
@potentialAnalyzerProblem
- test_assignmentToFinal_postfixPlusPlus() async {
- return super.test_assignmentToFinal_postfixPlusPlus();
+ test_assignmentToFinalLocal_postfixPlusPlus() async {
+ return super.test_assignmentToFinalLocal_postfixPlusPlus();
}
@override
@failingTest
@potentialAnalyzerProblem
- test_assignmentToFinal_prefixMinusMinus() async {
- return super.test_assignmentToFinal_prefixMinusMinus();
+ test_assignmentToFinalLocal_prefixMinusMinus() async {
+ return super.test_assignmentToFinalLocal_prefixMinusMinus();
}
@override
@failingTest
@potentialAnalyzerProblem
- test_assignmentToFinal_prefixPlusPlus() async {
- return super.test_assignmentToFinal_prefixPlusPlus();
+ test_assignmentToFinalLocal_prefixPlusPlus() async {
+ return super.test_assignmentToFinalLocal_prefixPlusPlus();
}
@override
@failingTest
@potentialAnalyzerProblem
- test_assignmentToFinal_suffixMinusMinus() async {
- return super.test_assignmentToFinal_suffixMinusMinus();
+ test_assignmentToFinalLocal_suffixMinusMinus() async {
+ return super.test_assignmentToFinalLocal_suffixMinusMinus();
}
@override
@failingTest
@potentialAnalyzerProblem
- test_assignmentToFinal_suffixPlusPlus() async {
- return super.test_assignmentToFinal_suffixPlusPlus();
+ test_assignmentToFinalLocal_suffixPlusPlus() async {
+ return super.test_assignmentToFinalLocal_suffixPlusPlus();
}
@override
@failingTest
@potentialAnalyzerProblem
- test_assignmentToFinal_topLevelVariable() async {
- return super.test_assignmentToFinal_topLevelVariable();
+ test_assignmentToFinalLocal_topLevelVariable() async {
+ return super.test_assignmentToFinalLocal_topLevelVariable();
}
@override
@@ -1740,27 +1740,6 @@
@override
@failingTest
@potentialAnalyzerProblem
- test_typeAnnotationGenericFunctionParameter_localFunction() async {
- return super.test_typeAnnotationGenericFunctionParameter_localFunction();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_typeAnnotationGenericFunctionParameter_method() async {
- return super.test_typeAnnotationGenericFunctionParameter_method();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
- test_typeAnnotationGenericFunctionParameter_topLevelFunction() async {
- return super.test_typeAnnotationGenericFunctionParameter_topLevelFunction();
- }
-
- @override
- @failingTest
- @potentialAnalyzerProblem
test_typeParameterReferencedByStatic_field() async {
return super.test_typeParameterReferencedByStatic_field();
}
diff --git a/pkg/analyzer/test/generated/static_warning_code_test.dart b/pkg/analyzer/test/generated/static_warning_code_test.dart
index ae7719f..5454994 100644
--- a/pkg/analyzer/test/generated/static_warning_code_test.dart
+++ b/pkg/analyzer/test/generated/static_warning_code_test.dart
@@ -716,110 +716,110 @@
verify([source]);
}
- test_assignmentToFinal_localVariable() async {
+ test_assignmentToFinalLocal_localVariable() async {
Source source = addSource(r'''
f() {
final x = 0;
x = 1;
}''');
await computeAnalysisResult(source);
- assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
+ assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL_LOCAL]);
verify([source]);
}
- test_assignmentToFinal_localVariable_plusEq() async {
+ test_assignmentToFinalLocal_localVariable_plusEq() async {
Source source = addSource(r'''
f() {
final x = 0;
x += 1;
}''');
await computeAnalysisResult(source);
- assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
+ assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL_LOCAL]);
verify([source]);
}
- test_assignmentToFinal_parameter() async {
+ test_assignmentToFinalLocal_parameter() async {
Source source = addSource(r'''
f(final x) {
x = 1;
}''');
await computeAnalysisResult(source);
- assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
+ assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL_LOCAL]);
verify([source]);
}
- test_assignmentToFinal_postfixMinusMinus() async {
+ test_assignmentToFinalLocal_postfixMinusMinus() async {
Source source = addSource(r'''
f() {
final x = 0;
x--;
}''');
await computeAnalysisResult(source);
- assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
+ assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL_LOCAL]);
verify([source]);
}
- test_assignmentToFinal_postfixPlusPlus() async {
+ test_assignmentToFinalLocal_postfixPlusPlus() async {
Source source = addSource(r'''
f() {
final x = 0;
x++;
}''');
await computeAnalysisResult(source);
- assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
+ assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL_LOCAL]);
verify([source]);
}
- test_assignmentToFinal_prefixMinusMinus() async {
+ test_assignmentToFinalLocal_prefixMinusMinus() async {
Source source = addSource(r'''
f() {
final x = 0;
--x;
}''');
await computeAnalysisResult(source);
- assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
+ assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL_LOCAL]);
verify([source]);
}
- test_assignmentToFinal_prefixPlusPlus() async {
+ test_assignmentToFinalLocal_prefixPlusPlus() async {
Source source = addSource(r'''
f() {
final x = 0;
++x;
}''');
await computeAnalysisResult(source);
- assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
+ assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL_LOCAL]);
verify([source]);
}
- test_assignmentToFinal_suffixMinusMinus() async {
+ test_assignmentToFinalLocal_suffixMinusMinus() async {
Source source = addSource(r'''
f() {
final x = 0;
x--;
}''');
await computeAnalysisResult(source);
- assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
+ assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL_LOCAL]);
verify([source]);
}
- test_assignmentToFinal_suffixPlusPlus() async {
+ test_assignmentToFinalLocal_suffixPlusPlus() async {
Source source = addSource(r'''
f() {
final x = 0;
x++;
}''');
await computeAnalysisResult(source);
- assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
+ assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL_LOCAL]);
verify([source]);
}
- test_assignmentToFinal_topLevelVariable() async {
+ test_assignmentToFinalLocal_topLevelVariable() async {
Source source = addSource(r'''
final x = 0;
f() { x = 1; }''');
await computeAnalysisResult(source);
- assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL]);
+ assertErrors(source, [StaticWarningCode.ASSIGNMENT_TO_FINAL_LOCAL]);
verify([source]);
}
@@ -3389,45 +3389,6 @@
]);
}
- test_typeAnnotationGenericFunctionParameter_localFunction() async {
- Source source = addSource(r'''
-class A {
- void method() {
- T local<T>(Object t) {
- return (t is T) ? t : null;
- }
- }
-}''');
- await computeAnalysisResult(source);
- assertErrors(
- source, [StaticWarningCode.TYPE_ANNOTATION_GENERIC_FUNCTION_PARAMETER]);
- verify([source]);
- }
-
- test_typeAnnotationGenericFunctionParameter_method() async {
- Source source = addSource(r'''
-class A {
- T method<T>(Object t) {
- return (t is T) ? t : null;
- }
-}''');
- await computeAnalysisResult(source);
- assertErrors(
- source, [StaticWarningCode.TYPE_ANNOTATION_GENERIC_FUNCTION_PARAMETER]);
- verify([source]);
- }
-
- test_typeAnnotationGenericFunctionParameter_topLevelFunction() async {
- Source source = addSource(r'''
-T function<T>(Object t) {
- return (t is T) ? t : null;
-}''');
- await computeAnalysisResult(source);
- assertErrors(
- source, [StaticWarningCode.TYPE_ANNOTATION_GENERIC_FUNCTION_PARAMETER]);
- verify([source]);
- }
-
test_typeParameterReferencedByStatic_field() async {
Source source = addSource(r'''
class A<K> {
diff --git a/pkg/analyzer/test/generated/strong_mode_kernel_test.dart b/pkg/analyzer/test/generated/strong_mode_kernel_test.dart
index a0a5a93..8112f42 100644
--- a/pkg/analyzer/test/generated/strong_mode_kernel_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_kernel_test.dart
@@ -2,6 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'strong_mode_test.dart';
@@ -30,6 +31,334 @@
@override
bool get enableNewAnalysisDriver => true;
+
+ @override
+ bool get previewDart2 => true;
+
+ @override
+ @failingTest
+ test_async_star_method_propagation() async {
+ // Bad state: No type information for Stream at 124
+ await super.test_async_star_method_propagation();
+ }
+
+ @override
+ @failingTest
+ test_async_star_propagation() async {
+ // Bad state: No type information for Stream at 105
+ await super.test_async_star_propagation();
+ }
+
+ @override
+ @failingTest
+ test_constrainedByBounds2() async {
+ // Expected: InterfaceTypeImpl:<int>
+ await super.test_constrainedByBounds2();
+ }
+
+ @override
+ @failingTest
+ test_constrainedByBounds3() async {
+ // Expected: InterfaceTypeImpl:<int>
+ await super.test_constrainedByBounds3();
+ }
+
+ @override
+ @failingTest
+ test_constrainedByBounds4() async {
+ // Bad state: Expected a type for 4 at 119; got one for kernel offset 118
+ await super.test_constrainedByBounds4();
+ }
+
+ @override
+ @failingTest
+ test_constrainedByBounds5() async {
+ // Bad state: Expected a type for 4 at 119; got one for kernel offset 118
+ await super.test_constrainedByBounds5();
+ }
+
+ @override
+ @failingTest
+ test_covarianceChecks() async {
+ // NoSuchMethodError: The method 'toList' was called on null.
+ await super.test_covarianceChecks();
+ }
+
+ @override
+ @failingTest
+ test_covarianceChecks_genericMethods() async {
+ // NoSuchMethodError: The method 'toList' was called on null.
+ await super.test_covarianceChecks_genericMethods();
+ }
+
+ @override
+ @failingTest
+ test_covarianceChecks_returnFunction() async {
+ // AnalysisException: Element mismatch in /test.dart at class C<T>
+ await super.test_covarianceChecks_returnFunction();
+ }
+
+ @override
+ @failingTest
+ test_covarianceChecks_superclass() async {
+ // NoSuchMethodError: The method 'toList' was called on null.
+ await super.test_covarianceChecks_superclass();
+ }
+
+ @override
+ @failingTest
+ test_functionLiteral_assignment_typedArguments() async {
+ // Expected: InterfaceTypeImpl:<String>
+ await super.test_functionLiteral_assignment_typedArguments();
+ }
+
+ @override
+ @failingTest
+ test_functionLiteral_assignment_unTypedArguments() async {
+ // Expected: InterfaceTypeImpl:<String>
+ await super.test_functionLiteral_assignment_unTypedArguments();
+ }
+
+ @override
+ @failingTest
+ test_functionLiteral_functionExpressionInvocation_typedArguments() async {
+ // Bad state: Expected a type for null at 154; got one for kernel offset 142
+ await super
+ .test_functionLiteral_functionExpressionInvocation_typedArguments();
+ }
+
+ @override
+ @failingTest
+ test_functionLiteral_functionExpressionInvocation_unTypedArguments() async {
+ // Bad state: Expected a type for null at 150; got one for kernel offset 142
+ await super
+ .test_functionLiteral_functionExpressionInvocation_unTypedArguments();
+ }
+
+ @override
+ @failingTest
+ test_functionLiteral_functionInvocation_typedArguments() async {
+ // Expected: InterfaceTypeImpl:<String>
+ await super.test_functionLiteral_functionInvocation_typedArguments();
+ }
+
+ @override
+ @failingTest
+ test_functionLiteral_functionInvocation_unTypedArguments() async {
+ // Expected: InterfaceTypeImpl:<String>
+ await super.test_functionLiteral_functionInvocation_unTypedArguments();
+ }
+
+ @override
+ @failingTest
+ test_functionLiteral_methodInvocation_typedArguments() async {
+ // Expected: InterfaceTypeImpl:<String>
+ await super.test_functionLiteral_methodInvocation_typedArguments();
+ }
+
+ @override
+ @failingTest
+ test_functionLiteral_methodInvocation_unTypedArguments() async {
+ // Expected: InterfaceTypeImpl:<String>
+ await super.test_functionLiteral_methodInvocation_unTypedArguments();
+ }
+
+ @override
+ @failingTest
+ test_futureOr_downwards8() async {
+ // type 'BottomTypeImpl' is not a subtype of type 'InterfaceType' in type cast where
+ await super.test_futureOr_downwards8();
+ }
+
+ @override
+ @failingTest
+ test_futureOr_methods2() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_METHOD, found 0
+ await super.test_futureOr_methods2();
+ }
+
+ @override
+ @failingTest
+ test_futureOr_methods3() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_METHOD, found 0
+ await super.test_futureOr_methods3();
+ }
+
+ @override
+ @failingTest
+ test_futureOr_methods4() async {
+ // Expected 1 errors of type StaticTypeWarningCode.UNDEFINED_METHOD, found 0
+ await super.test_futureOr_methods4();
+ }
+
+ @override
+ @failingTest
+ test_futureOr_no_return() async {
+ // Expected: InterfaceTypeImpl:<Null>
+ await super.test_futureOr_no_return();
+ }
+
+ @override
+ @failingTest
+ test_futureOr_no_return_value() async {
+ // Expected: InterfaceTypeImpl:<Null>
+ await super.test_futureOr_no_return_value();
+ }
+
+ @override
+ @failingTest
+ test_futureOr_return_null() async {
+ // Expected: InterfaceTypeImpl:<Null>
+ await super.test_futureOr_return_null();
+ }
+
+ @override
+ @failingTest
+ test_futureOr_upwards2() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_COULD_NOT_INFER, found 0
+ await super.test_futureOr_upwards2();
+ }
+
+ @override
+ @failingTest
+ test_futureOrNull_no_return() async {
+ // Bad state: Found 2 argument types for 1 type arguments
+ await super.test_futureOrNull_no_return();
+ }
+
+ @override
+ @failingTest
+ test_futureOrNull_no_return_value() async {
+ // Bad state: Found 2 argument types for 1 type arguments
+ await super.test_futureOrNull_no_return_value();
+ }
+
+ @override
+ @failingTest
+ test_futureOrNull_return_null() async {
+ // Bad state: Found 2 argument types for 1 type arguments
+ await super.test_futureOrNull_return_null();
+ }
+
+ @override
+ @failingTest
+ test_generic_partial() async {
+ // AnalysisException: Element mismatch in /test.dart at class A<T>
+ await super.test_generic_partial();
+ }
+
+ @override
+ @failingTest
+ test_inference_error_arguments() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_COULD_NOT_INFER, found 0;
+ // 1 errors of type StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, found 0
+ await super.test_inference_error_arguments();
+ }
+
+ @override
+ @failingTest
+ test_inference_error_arguments2() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_COULD_NOT_INFER, found 0;
+ // 2 errors of type StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, found 0
+ await super.test_inference_error_arguments2();
+ }
+
+ @override
+ @failingTest
+ test_inference_error_extendsFromReturn() async {
+ // Expected 2 errors of type StrongModeCode.STRONG_MODE_INVALID_CAST_LITERAL, found 0
+ await super.test_inference_error_extendsFromReturn();
+ }
+
+ @override
+ @failingTest
+ test_inference_error_extendsFromReturn2() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_COULD_NOT_INFER, found 0
+ await super.test_inference_error_extendsFromReturn2();
+ }
+
+ @override
+ @failingTest
+ test_inference_error_genericFunction() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_COULD_NOT_INFER, found 0;
+ // 1 errors of type StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, found 0
+ await super.test_inference_error_genericFunction();
+ }
+
+ @override
+ @failingTest
+ test_inference_error_returnContext() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_COULD_NOT_INFER, found 0
+ await super.test_inference_error_returnContext();
+ }
+
+ @override
+ @failingTest
+ test_inference_simplePolymorphicRecursion_function() async {
+ // Expected: 'T'
+ await super.test_inference_simplePolymorphicRecursion_function();
+ }
+
+ @override
+ @failingTest
+ test_inference_simplePolymorphicRecursion_interface() async {
+ // Expected: 'T'
+ await super.test_inference_simplePolymorphicRecursion_interface();
+ }
+
+ @override
+ @failingTest
+ test_inference_simplePolymorphicRecursion_simple() async {
+ // RangeError (index): Invalid value: Valid value range is empty: 0
+ await super.test_inference_simplePolymorphicRecursion_simple();
+ }
+
+ @override
+ @failingTest
+ test_inferGenericInstantiation2() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_COULD_NOT_INFER, found 0;
+ // 1 errors of type StaticWarningCode.ARGUMENT_TYPE_NOT_ASSIGNABLE, found 0
+ await super.test_inferGenericInstantiation2();
+ }
+
+ @override
+ @failingTest
+ test_inferredFieldDeclaration_propagation() async {
+ // Expected: InterfaceTypeImpl:<int>
+ await super.test_inferredFieldDeclaration_propagation();
+ }
+
+ @override
+ @failingTest
+ test_instanceCreation() async {
+ // AnalysisException: Element mismatch in /test.dart at class A<S, T>
+ await super.test_instanceCreation();
+ // TODO(brianwilkerson) This test fails as expected when run as part of a
+ // larger group of tests, but does not fail when run individually (such as
+ // on the bots).
+ fail('Flaky test');
+ }
+
+ @override
+ @failingTest
+ test_pinning_multipleConstraints1() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_INVALID_CAST_LITERAL, found 0
+ await super.test_pinning_multipleConstraints1();
+ }
+
+ @override
+ @failingTest
+ test_pinning_multipleConstraints3() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_INVALID_CAST_LITERAL, found 0
+ await super.test_pinning_multipleConstraints3();
+ }
+
+ @override
+ @failingTest
+ test_redirectingConstructor_propagation() async {
+ // AnalysisException: Element mismatch in /test.dart at class A
+ await super.test_redirectingConstructor_propagation();
+ }
}
@reflectiveTest
@@ -42,6 +371,127 @@
bool get enableNewAnalysisDriver => true;
@override
+ bool get previewDart2 => true;
+
+ @override
+ test_futureOr_promotion3() async {
+ // Test passes even though the overridden method fails.
+ await super.test_futureOr_promotion3();
+ }
+
+ @override
+ @failingTest
+ test_genericFunction_parameter() async {
+ // Failed to resolve 1 nodes:
+ await super.test_genericFunction_parameter();
+ }
+
+ @override
+ @failingTest
+ test_genericMethod_explicitTypeParams() async {
+ // Bad state: Found 2 argument types for 1 type arguments
+ await super.test_genericMethod_explicitTypeParams();
+ }
+
+ @override
+ @failingTest
+ test_genericMethod_functionExpressionInvocation_explicit() async {
+ // Bad state: Expected element declaration for analyzer offset 230; got one for kernel offset 233
+ await super.test_genericMethod_functionExpressionInvocation_explicit();
+ }
+
+ @override
+ @failingTest
+ test_genericMethod_functionExpressionInvocation_inferred() async {
+ // Bad state: Expected element declaration for analyzer offset 230; got one for kernel offset 233
+ await super.test_genericMethod_functionExpressionInvocation_inferred();
+ }
+
+ @override
+ @failingTest
+ test_genericMethod_functionInvocation_explicit() async {
+ // Failed to resolve 1 nodes:
+ await super.test_genericMethod_functionInvocation_explicit();
+ }
+
+ @override
+ @failingTest
+ test_genericMethod_functionInvocation_inferred() async {
+ // Failed to resolve 1 nodes:
+ await super.test_genericMethod_functionInvocation_inferred();
+ }
+
+ @override
+ @failingTest
+ test_genericMethod_implicitDynamic() async {
+ // Expected: '<T>((dynamic) → T) → T'
+ await super.test_genericMethod_implicitDynamic();
+ }
+
+ @override
+ @failingTest
+ test_genericMethod_max_doubleDouble_prefixed() async {
+ // Bad state: Expected element reference for analyzer offset 49; got one for kernel offset 54
+ await super.test_genericMethod_max_doubleDouble_prefixed();
+ }
+
+ @override
+ @failingTest
+ test_genericMethod_nestedCapture() async {
+ // Bad state: Found 2 argument types for 1 type arguments
+ await super.test_genericMethod_nestedCapture();
+ }
+
+ @override
+ @failingTest
+ test_genericMethod_override_invalidReturnType() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_INVALID_METHOD_OVERRIDE, found 0
+ await super.test_genericMethod_override_invalidReturnType();
+ }
+
+ @override
+ @failingTest
+ test_genericMethod_override_invalidTypeParamBounds() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_INVALID_METHOD_OVERRIDE, found 0
+ await super.test_genericMethod_override_invalidTypeParamBounds();
+ }
+
+ @override
+ @failingTest
+ test_genericMethod_override_invalidTypeParamCount() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_INVALID_METHOD_OVERRIDE, found 0
+ await super.test_genericMethod_override_invalidTypeParamCount();
+ }
+
+ @override
+ @failingTest
+ test_genericMethod_partiallyAppliedErrorWithBound() async {
+ // Bad state: Found 0 argument types for 1 type arguments
+ await super.test_genericMethod_partiallyAppliedErrorWithBound();
+ }
+
+ @override
+ @failingTest
+ test_genericMethod_tearoff() async {
+ // Failed to resolve 1 nodes:
+ await super.test_genericMethod_tearoff();
+ }
+
+ @override
+ @failingTest
+ test_genericMethod_then_prefixed() async {
+ // Expected 0 errors of type HintCode.UNUSED_IMPORT, found 1 (7)
+ await super.test_genericMethod_then_prefixed();
+ }
+
+ @override
+ @failingTest
+ test_implicitBounds() async {
+ // Expected: 'B<num>'
+ await super.test_implicitBounds();
+ }
+
+ @override
@failingTest
@potentialAnalyzerProblem
test_instantiateToBounds_class_error_recursion() async {
@@ -103,6 +553,76 @@
test_instantiateToBounds_class_ok_referenceOther_multi() async {
return super.test_instantiateToBounds_class_ok_referenceOther_multi();
}
+
+ @override
+ @failingTest
+ test_instantiateToBounds_class_ok_simpleBounds() async {
+ // Expected: 'B<num>'
+ await super.test_instantiateToBounds_class_ok_simpleBounds();
+ }
+
+ @override
+ @failingTest
+ test_notInstantiatedBound_direct_class_class() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_NOT_INSTANTIATED_BOUND, found 0
+ await super.test_notInstantiatedBound_direct_class_class();
+ }
+
+ @override
+ @failingTest
+ test_notInstantiatedBound_direct_class_typedef() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_NOT_INSTANTIATED_BOUND, found 0
+ await super.test_notInstantiatedBound_direct_class_typedef();
+ }
+
+ @override
+ @failingTest
+ test_notInstantiatedBound_direct_typedef_class() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_NOT_INSTANTIATED_BOUND, found 0
+ await super.test_notInstantiatedBound_direct_typedef_class();
+ }
+
+ @override
+ @failingTest
+ test_notInstantiatedBound_functionType() async {
+ // Expected 2 errors of type StrongModeCode.STRONG_MODE_NOT_INSTANTIATED_BOUND, found 0
+ await super.test_notInstantiatedBound_functionType();
+ }
+
+ @override
+ @failingTest
+ test_notInstantiatedBound_indirect_class_class() async {
+ // Expected 1 errors of type StrongModeCode.STRONG_MODE_NOT_INSTANTIATED_BOUND, found 0
+ await super.test_notInstantiatedBound_indirect_class_class();
+ }
+
+ @override
+ @failingTest
+ test_notInstantiatedBound_indirect_class_class2() async {
+ // Expected 2 errors of type StrongModeCode.STRONG_MODE_NOT_INSTANTIATED_BOUND, found 0
+ await super.test_notInstantiatedBound_indirect_class_class2();
+ }
+
+ @override
+ @failingTest
+ test_setterWithDynamicTypeIsError() async {
+ // Expected 2 errors of type StaticWarningCode.NON_VOID_RETURN_FOR_SETTER, found 0
+ await super.test_setterWithDynamicTypeIsError();
+ }
+
+ @override
+ @failingTest
+ test_setterWithNoVoidType() async {
+ // Expected 1 errors of type StaticTypeWarningCode.RETURN_OF_INVALID_TYPE, found 0
+ await super.test_setterWithNoVoidType();
+ }
+
+ @override
+ @failingTest
+ test_setterWithOtherTypeIsError() async {
+ // Expected 2 errors of type StaticWarningCode.NON_VOID_RETURN_FOR_SETTER, found 0
+ await super.test_setterWithOtherTypeIsError();
+ }
}
@reflectiveTest
@@ -113,4 +633,7 @@
@override
bool get enableNewAnalysisDriver => true;
+
+ @override
+ bool get previewDart2 => true;
}
diff --git a/pkg/analyzer/test/generated/strong_mode_test.dart b/pkg/analyzer/test/generated/strong_mode_test.dart
index 80f5c2b..d508efa 100644
--- a/pkg/analyzer/test/generated/strong_mode_test.dart
+++ b/pkg/analyzer/test/generated/strong_mode_test.dart
@@ -2747,50 +2747,6 @@
expect(invocation.staticInvokeType.toString(), type);
}
- fail_futureOr_promotion4() async {
- // Test that promotion from FutureOr<T> to T works for type
- // parameters T
- // TODO(leafp): When the restriction on is checks for generic methods
- // goes away this should pass.
- String code = r'''
- import "dart:async";
- dynamic test<T extends num>(FutureOr<T> x) => (x is T) &&
- (x.abs() == 0);
- ''';
- await resolveTestUnit(code);
- }
-
- fail_genericMethod_tearoff_instantiated() async {
- await resolveTestUnit(r'''
-class C<E> {
- T f<T>(E e) => null;
- static T g<T>(T e) => null;
- static final h = g;
-}
-
-T topF<T>(T e) => null;
-var topG = topF;
-void test<S>(T pf<T>(T e)) {
- var c = new C<int>();
- T lf<T>(T e) => null;
- var methodTearOffInst = c.f<int>;
- var staticTearOffInst = C.g<int>;
- var staticFieldTearOffInst = C.h<int>;
- var topFunTearOffInst = topF<int>;
- var topFieldTearOffInst = topG<int>;
- var localTearOffInst = lf<int>;
- var paramTearOffInst = pf<int>;
-}
-''');
- expectIdentifierType('methodTearOffInst', "(int) → int");
- expectIdentifierType('staticTearOffInst', "(int) → int");
- expectIdentifierType('staticFieldTearOffInst', "(int) → int");
- expectIdentifierType('topFunTearOffInst', "(int) → int");
- expectIdentifierType('topFieldTearOffInst', "(int) → int");
- expectIdentifierType('localTearOffInst', "(int) → int");
- expectIdentifierType('paramTearOffInst', "(int) → int");
- }
-
void setUp() {
super.setUp();
AnalysisOptionsImpl options = new AnalysisOptionsImpl();
@@ -2840,6 +2796,17 @@
await resolveTestUnit(code);
}
+ test_futureOr_promotion3() async {
+ // Test that promotion from FutureOr<T> to T works for type
+ // parameters T
+ String code = r'''
+ import "dart:async";
+ dynamic test<T extends num>(FutureOr<T> x) => (x is T) &&
+ (x.abs() == 0);
+ ''';
+ await resolveTestUnit(code);
+ }
+
test_futureOr_promotion4() async {
// Test that promotion from FutureOr<T> to Future<T> works for type
// parameters T
@@ -3387,6 +3354,22 @@
verify([source]);
}
+ test_genericMethod_partiallyAppliedErrorWithBound() async {
+ await resolveTestUnit(r'''
+void f<X extends List, Y>() => null;
+
+void test() {
+ f<int>();
+}
+''', noErrors: false);
+ assertErrors(testSource, [
+ // Make sure to catch both the missing parameter:
+ StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD,
+ // And the incorrect parameter:
+ StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
+ ]);
+ }
+
test_genericMethod_propagatedType_promotion() async {
// Regression test for:
// https://github.com/dart-lang/sdk/issues/25340
@@ -3441,20 +3424,36 @@
expectIdentifierType('paramTearOff', "<T>(T) → T");
}
- test_genericMethod_partiallyAppliedErrorWithBound() async {
+ @failingTest
+ test_genericMethod_tearoff_instantiated() async {
await resolveTestUnit(r'''
-void f<X extends List, Y>() => null;
-
-void test() {
- f<int>();
+class C<E> {
+ T f<T>(E e) => null;
+ static T g<T>(T e) => null;
+ static final h = g;
}
-''', noErrors: false);
- assertErrors(testSource, [
- // Make sure to catch both the missing parameter:
- StaticTypeWarningCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_METHOD,
- // And the incorrect parameter:
- StaticTypeWarningCode.TYPE_ARGUMENT_NOT_MATCHING_BOUNDS
- ]);
+
+T topF<T>(T e) => null;
+var topG = topF;
+void test<S>(T pf<T>(T e)) {
+ var c = new C<int>();
+ T lf<T>(T e) => null;
+ var methodTearOffInst = c.f<int>;
+ var staticTearOffInst = C.g<int>;
+ var staticFieldTearOffInst = C.h<int>;
+ var topFunTearOffInst = topF<int>;
+ var topFieldTearOffInst = topG<int>;
+ var localTearOffInst = lf<int>;
+ var paramTearOffInst = pf<int>;
+}
+''');
+ expectIdentifierType('methodTearOffInst', "(int) → int");
+ expectIdentifierType('staticTearOffInst', "(int) → int");
+ expectIdentifierType('staticFieldTearOffInst', "(int) → int");
+ expectIdentifierType('topFunTearOffInst', "(int) → int");
+ expectIdentifierType('topFieldTearOffInst', "(int) → int");
+ expectIdentifierType('localTearOffInst', "(int) → int");
+ expectIdentifierType('paramTearOffInst', "(int) → int");
}
test_genericMethod_then() async {
diff --git a/pkg/analyzer/test/src/context/mock_sdk.dart b/pkg/analyzer/test/src/context/mock_sdk.dart
index 9599777..f95bd63 100644
--- a/pkg/analyzer/test/src/context/mock_sdk.dart
+++ b/pkg/analyzer/test/src/context/mock_sdk.dart
@@ -81,6 +81,8 @@
factory Stream.fromIterable(Iterable<T> data) => null;
}
+abstract class StreamIterator<T> {}
+
abstract class StreamSubscription<T> {
Future cancel();
void onData(void handleData(T data));
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_kernel_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_kernel_test.dart
index 17ccb8b..7dd81a7 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_kernel_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_kernel_test.dart
@@ -23,9 +23,9 @@
@override
bool get previewDart2 => true;
+ @override
@failingTest
@potentialAnalyzerProblem
- @override
test_annotation_constructor_withNestedConstructorInvocation() async {
// This test is failing because analyzer and kernel disagree about how to
// resolve annotations and constructors. Kernel is consistent between
@@ -34,6 +34,13 @@
// resolution of the constructor name's element.
await super.test_annotation_constructor_withNestedConstructorInvocation();
}
+
+ @override
+ @failingTest
+ @FastaProblem('https://github.com/dart-lang/sdk/issues/31605')
+ test_constructor_redirected_generic() async {
+ await super.test_constructor_redirected_generic();
+ }
}
@reflectiveTest
@@ -81,13 +88,6 @@
@failingTest
@potentialAnalyzerProblem
@override
- test_const_circular_reference() async {
- await super.test_const_circular_reference();
- }
-
- @failingTest
- @potentialAnalyzerProblem
- @override
test_const_externalConstFactory() async {
await super.test_const_externalConstFactory();
}
diff --git a/pkg/analyzer/test/src/dart/analysis/driver_test.dart b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
index c2c3313..ac4e176 100644
--- a/pkg/analyzer/test/src/dart/analysis/driver_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/driver_test.dart
@@ -102,7 +102,7 @@
@myAnnotation
class C {
@myAnnotation
- int field = 2;
+ int field1 = 2, field2 = 3;
@myAnnotation
C() {}
@@ -112,7 +112,7 @@
}
@myAnnotation
-int topLevelVariable = 3;
+int topLevelVariable1 = 4, topLevelVariable2 = 5;
@myAnnotation
void topLevelFunction() {}
@@ -1122,49 +1122,104 @@
items.forEach((item) {
item;
});
+ items.forEach((item) {
+ item;
+ });
}
''');
AnalysisResult result = await driver.getResult(testFile);
var typeProvider = result.unit.element.context.typeProvider;
- List<Statement> mainStatements = _getMainStatements(result);
+ FunctionDeclaration mainDeclaration = result.unit.declarations[0];
+ FunctionElement mainElement = mainDeclaration.element;
+ BlockFunctionBody mainBody = mainDeclaration.functionExpression.body;
+ List<Statement> mainStatements = mainBody.block.statements;
VariableDeclarationStatement itemsStatement = mainStatements[0];
var itemsElement = itemsStatement.variables.variables[0].element;
- ExpressionStatement forStatement = mainStatements[1];
- MethodInvocation forInvocation = forStatement.expression;
+ // First closure.
+ ParameterElement itemElement1;
+ {
+ ExpressionStatement forStatement = mainStatements[1];
+ MethodInvocation forInvocation = forStatement.expression;
- SimpleIdentifier forTarget = forInvocation.target;
- expect(forTarget.staticElement, itemsElement);
+ SimpleIdentifier forTarget = forInvocation.target;
+ expect(forTarget.staticElement, itemsElement);
- var closureTypeStr = '(int) → Null';
- FunctionExpression closure = forInvocation.argumentList.arguments[0];
- FunctionElement closureElement = closure.element;
- ParameterElement itemElement = closureElement.parameters[0];
+ var closureTypeStr = '(int) → Null';
+ FunctionExpression closure = forInvocation.argumentList.arguments[0];
- expect(closureElement.returnType, typeProvider.nullType);
- expect(closureElement.type.element, same(closureElement));
- expect(closureElement.type.toString(), closureTypeStr);
- expect(closure.staticType, same(closureElement.type));
+ FunctionElementImpl closureElement = closure.element;
+ expect(closureElement.enclosingElement, same(mainElement));
- List<FormalParameter> closureParameters = closure.parameters.parameters;
- expect(closureParameters, hasLength(1));
+ ParameterElement itemElement = closureElement.parameters[0];
+ itemElement1 = itemElement;
- SimpleFormalParameter itemNode = closureParameters[0];
- _assertSimpleParameter(itemNode, itemElement,
- name: 'item',
- offset: 56,
- kind: ParameterKind.REQUIRED,
- type: typeProvider.intType);
+ expect(closureElement.returnType, typeProvider.nullType);
+ expect(closureElement.type.element, same(closureElement));
+ expect(closureElement.type.toString(), closureTypeStr);
+ expect(closure.staticType, same(closureElement.type));
- BlockFunctionBody closureBody = closure.body;
- List<Statement> closureStatements = closureBody.block.statements;
+ List<FormalParameter> closureParameters = closure.parameters.parameters;
+ expect(closureParameters, hasLength(1));
- ExpressionStatement itemStatement = closureStatements[0];
- SimpleIdentifier itemIdentifier = itemStatement.expression;
- expect(itemIdentifier.staticElement, itemElement);
- expect(itemIdentifier.staticType, typeProvider.intType);
+ SimpleFormalParameter itemNode = closureParameters[0];
+ _assertSimpleParameter(itemNode, itemElement,
+ name: 'item',
+ offset: 56,
+ kind: ParameterKind.REQUIRED,
+ type: typeProvider.intType);
+
+ BlockFunctionBody closureBody = closure.body;
+ List<Statement> closureStatements = closureBody.block.statements;
+
+ ExpressionStatement itemStatement = closureStatements[0];
+ SimpleIdentifier itemIdentifier = itemStatement.expression;
+ expect(itemIdentifier.staticElement, itemElement);
+ expect(itemIdentifier.staticType, typeProvider.intType);
+ }
+
+ // Second closure, same names, different elements.
+ {
+ ExpressionStatement forStatement = mainStatements[2];
+ MethodInvocation forInvocation = forStatement.expression;
+
+ SimpleIdentifier forTarget = forInvocation.target;
+ expect(forTarget.staticElement, itemsElement);
+
+ var closureTypeStr = '(int) → Null';
+ FunctionExpression closure = forInvocation.argumentList.arguments[0];
+
+ FunctionElementImpl closureElement = closure.element;
+ expect(closureElement.enclosingElement, same(mainElement));
+
+ ParameterElement itemElement = closureElement.parameters[0];
+ expect(itemElement, isNot(same(itemElement1)));
+
+ expect(closureElement.returnType, typeProvider.nullType);
+ expect(closureElement.type.element, same(closureElement));
+ expect(closureElement.type.toString(), closureTypeStr);
+ expect(closure.staticType, same(closureElement.type));
+
+ List<FormalParameter> closureParameters = closure.parameters.parameters;
+ expect(closureParameters, hasLength(1));
+
+ SimpleFormalParameter itemNode = closureParameters[0];
+ _assertSimpleParameter(itemNode, itemElement,
+ name: 'item',
+ offset: 97,
+ kind: ParameterKind.REQUIRED,
+ type: typeProvider.intType);
+
+ BlockFunctionBody closureBody = closure.body;
+ List<Statement> closureStatements = closureBody.block.statements;
+
+ ExpressionStatement itemStatement = closureStatements[0];
+ SimpleIdentifier itemIdentifier = itemStatement.expression;
+ expect(itemIdentifier.staticElement, itemElement);
+ expect(itemIdentifier.staticType, typeProvider.intType);
+ }
}
test_conditionalExpression() async {
@@ -1276,6 +1331,195 @@
}
}
+ test_constructor_initializer_this() async {
+ addTestFile(r'''
+class C {
+ C(int a, [int b]);
+ C.named(int a, {int b});
+ C.one(int p) : this(1, 2);
+ C.two(int p) : this.named(3, b: 4);
+}
+''');
+ AnalysisResult result = await driver.getResult(testFile);
+
+ ClassDeclaration cNode = result.unit.declarations[0];
+ ClassElement cElement = cNode.element;
+
+ {
+ var unnamedConstructor = cElement.constructors[0];
+
+ ConstructorDeclaration constructor = cNode.members[2];
+ RedirectingConstructorInvocation initializer =
+ constructor.initializers[0];
+ expect(initializer.staticElement, same(unnamedConstructor));
+ expect(initializer.constructorName, isNull);
+
+ List<Expression> arguments = initializer.argumentList.arguments;
+
+ Expression aArgument = arguments[0];
+ ParameterElement aElement = unnamedConstructor.parameters[0];
+ expect(aArgument.staticParameterElement, same(aElement));
+
+ Expression bArgument = arguments[1];
+ ParameterElement bElement = unnamedConstructor.parameters[1];
+ expect(bArgument.staticParameterElement, same(bElement));
+ }
+
+ {
+ var namedConstructor = cElement.constructors[1];
+
+ ConstructorDeclaration constructor = cNode.members[3];
+ RedirectingConstructorInvocation initializer =
+ constructor.initializers[0];
+ expect(initializer.staticElement, same(namedConstructor));
+
+ var constructorName = initializer.constructorName;
+ expect(constructorName.staticElement, same(namedConstructor));
+ expect(constructorName.staticType, isNull);
+
+ List<Expression> arguments = initializer.argumentList.arguments;
+
+ Expression aArgument = arguments[0];
+ ParameterElement aElement = namedConstructor.parameters[0];
+ expect(aArgument.staticParameterElement, same(aElement));
+
+ NamedExpression bArgument = arguments[1];
+ ParameterElement bElement = namedConstructor.parameters[1];
+ expect(bArgument.name.label.staticElement, same(bElement));
+ expect(bArgument.staticParameterElement, same(bElement));
+ }
+ }
+
+ test_constructor_redirected() async {
+ addTestFile(r'''
+class A implements B {
+ A(int a);
+ A.named(double a);
+}
+class B {
+ factory B.one(int b) = A;
+ factory B.two(double b) = A.named;
+}
+''');
+ AnalysisResult result = await driver.getResult(testFile);
+ expect(result.errors, isEmpty);
+
+ ClassDeclaration aNode = result.unit.declarations[0];
+ ClassElement aElement = aNode.element;
+
+ ClassDeclaration bNode = result.unit.declarations[1];
+
+ {
+ ConstructorElement aUnnamed = aElement.constructors[0];
+
+ ConstructorDeclaration constructor = bNode.members[0];
+ ConstructorElement element = constructor.element;
+ expect(element.redirectedConstructor, same(aUnnamed));
+
+ var constructorName = constructor.redirectedConstructor;
+ expect(constructorName.staticElement, same(aUnnamed));
+
+ TypeName typeName = constructorName.type;
+ expect(typeName.type, aElement.type);
+
+ SimpleIdentifier identifier = typeName.name;
+ expect(identifier.staticElement, same(aElement));
+ expect(identifier.staticType, aElement.type);
+
+ expect(constructorName.name, isNull);
+ }
+
+ {
+ ConstructorElement aNamed = aElement.constructors[1];
+
+ ConstructorDeclaration constructor = bNode.members[1];
+ ConstructorElement element = constructor.element;
+ expect(element.redirectedConstructor, same(aNamed));
+
+ var constructorName = constructor.redirectedConstructor;
+ expect(constructorName.staticElement, same(aNamed));
+
+ TypeName typeName = constructorName.type;
+ expect(typeName.type, aElement.type);
+
+ SimpleIdentifier identifier = typeName.name;
+ expect(identifier.staticElement, same(aElement));
+ expect(identifier.staticType, aElement.type);
+
+ expect(constructorName.name.staticElement, aNamed);
+ expect(constructorName.name.staticType, isNull);
+ }
+ }
+
+ test_constructor_redirected_generic() async {
+ addTestFile(r'''
+class A<T> implements B<T> {
+ A(int a);
+ A.named(double a);
+}
+class B<U> {
+ factory B.one(int b) = A<U>;
+ factory B.two(double b) = A<U>.named;
+}
+''');
+ AnalysisResult result = await driver.getResult(testFile);
+ expect(result.errors, isEmpty);
+
+ ClassDeclaration aNode = result.unit.declarations[0];
+ ClassElement aElement = aNode.element;
+
+ ClassDeclaration bNode = result.unit.declarations[1];
+ TypeParameterType uType = bNode.element.typeParameters[0].type;
+ InterfaceType auType = aElement.type.instantiate([uType]);
+
+ {
+ ConstructorElement expectedElement = aElement.constructors[0];
+
+ ConstructorDeclaration constructor = bNode.members[0];
+ ConstructorElement element = constructor.element;
+
+ ConstructorMember actualMember = element.redirectedConstructor;
+ expect(actualMember.baseElement, same(expectedElement));
+ expect(actualMember.definingType, auType);
+
+ var constructorName = constructor.redirectedConstructor;
+ expect(constructorName.staticElement, same(actualMember));
+
+ TypeName typeName = constructorName.type;
+ expect(typeName.type, auType);
+
+ SimpleIdentifier identifier = typeName.name;
+ expect(identifier.staticElement, same(aElement));
+ expect(identifier.staticType, auType);
+
+ expect(constructorName.name, isNull);
+ }
+
+ {
+ ConstructorElement expectedElement = aElement.constructors[1];
+
+ ConstructorDeclaration constructor = bNode.members[1];
+ ConstructorElement element = constructor.element;
+
+ ConstructorMember actualMember = element.redirectedConstructor;
+ expect(actualMember.baseElement, same(expectedElement));
+ expect(actualMember.definingType, auType);
+
+ var constructorName = constructor.redirectedConstructor;
+ expect(constructorName.staticElement, same(actualMember));
+
+ TypeName typeName = constructorName.type;
+ expect(typeName.type, auType);
+
+ SimpleIdentifier identifier = typeName.name;
+ expect(identifier.staticElement, same(aElement));
+ expect(identifier.staticType, auType);
+
+ expect(constructorName.name.staticElement, same(actualMember));
+ expect(constructorName.name.staticType, isNull);
+ }
+ }
+
test_error_unresolvedTypeAnnotation() async {
String content = r'''
main() {
@@ -1321,6 +1565,147 @@
expect(fElement.type, typeProvider.listType.instantiate([tElement.type]));
}
+ test_formalParameter_functionTyped() async {
+ addTestFile(r'''
+class A {
+ A(String p(int a));
+}
+''');
+ AnalysisResult result = await driver.getResult(testFile);
+ var typeProvider = result.unit.element.context.typeProvider;
+
+ ClassDeclaration clazz = result.unit.declarations[0];
+ ConstructorDeclaration constructor = clazz.members[0];
+ List<FormalParameter> parameters = constructor.parameters.parameters;
+
+ FunctionTypedFormalParameter p = parameters[0];
+ expect(p.element, same(constructor.element.parameters[0]));
+
+ {
+ FunctionType type = p.identifier.staticType;
+ expect(type.returnType, typeProvider.stringType);
+
+ expect(type.parameters, hasLength(1));
+ expect(type.parameters[0].type, typeProvider.intType);
+ }
+
+ _assertTypeNameSimple(p.returnType, typeProvider.stringType);
+
+ {
+ SimpleFormalParameter a = p.parameters.parameters[0];
+ _assertTypeNameSimple(a.type, typeProvider.intType);
+ expect(a.identifier.staticType, typeProvider.intType);
+ }
+ }
+
+ test_formalParameter_functionTyped_fieldFormal_typed() async {
+ // TODO(scheglov) Add "untyped" version with precise type in field.
+ addTestFile(r'''
+class A {
+ Function f;
+ A(String this.f(int a));
+}
+''');
+ AnalysisResult result = await driver.getResult(testFile);
+ var typeProvider = result.unit.element.context.typeProvider;
+
+ ClassDeclaration clazz = result.unit.declarations[0];
+
+ FieldDeclaration fDeclaration = clazz.members[0];
+ VariableDeclaration fNode = fDeclaration.fields.variables[0];
+ FieldElement fElement = fNode.element;
+
+ ConstructorDeclaration constructor = clazz.members[1];
+
+ FieldFormalParameterElement pElement = constructor.element.parameters[0];
+ expect(pElement.field, same(fElement));
+
+ List<FormalParameter> parameters = constructor.parameters.parameters;
+ FieldFormalParameter p = parameters[0];
+ expect(p.element, same(pElement));
+
+ expect(p.identifier.staticElement, same(pElement));
+ expect(p.identifier.staticType.toString(), '(int) → String');
+
+ {
+ FunctionType type = p.identifier.staticType;
+ expect(type.returnType, typeProvider.stringType);
+
+ expect(type.parameters, hasLength(1));
+ expect(type.parameters[0].type, typeProvider.intType);
+ }
+
+ _assertTypeNameSimple(p.type, typeProvider.stringType);
+
+ {
+ SimpleFormalParameter a = p.parameters.parameters[0];
+ _assertTypeNameSimple(a.type, typeProvider.intType);
+ expect(a.identifier.staticType, typeProvider.intType);
+ }
+ }
+
+ test_formalParameter_simple_fieldFormal() async {
+ addTestFile(r'''
+class A {
+ int f;
+ A(this.f);
+}
+''');
+ AnalysisResult result = await driver.getResult(testFile);
+ var typeProvider = result.unit.element.context.typeProvider;
+
+ ClassDeclaration clazz = result.unit.declarations[0];
+
+ FieldDeclaration fDeclaration = clazz.members[0];
+ VariableDeclaration fNode = fDeclaration.fields.variables[0];
+ FieldElement fElement = fNode.element;
+
+ ConstructorDeclaration constructor = clazz.members[1];
+ List<FormalParameter> parameters = constructor.parameters.parameters;
+
+ FieldFormalParameterElement parameterElement =
+ constructor.element.parameters[0];
+ expect(parameterElement.field, same(fElement));
+
+ FieldFormalParameter parameterNode = parameters[0];
+ expect(parameterNode.type, isNull);
+ expect(parameterNode.element, same(parameterElement));
+
+ expect(parameterNode.identifier.staticElement, same(parameterElement));
+ expect(parameterNode.identifier.staticType, typeProvider.intType);
+ }
+
+ test_formalParameter_simple_fieldFormal_typed() async {
+ addTestFile(r'''
+class A {
+ int f;
+ A(int this.f);
+}
+''');
+ AnalysisResult result = await driver.getResult(testFile);
+ var typeProvider = result.unit.element.context.typeProvider;
+
+ ClassDeclaration clazz = result.unit.declarations[0];
+
+ FieldDeclaration fDeclaration = clazz.members[0];
+ VariableDeclaration fNode = fDeclaration.fields.variables[0];
+ FieldElement fElement = fNode.element;
+
+ ConstructorDeclaration constructor = clazz.members[1];
+ List<FormalParameter> parameters = constructor.parameters.parameters;
+
+ FieldFormalParameterElement parameterElement =
+ constructor.element.parameters[0];
+ expect(parameterElement.field, same(fElement));
+
+ FieldFormalParameter parameterNode = parameters[0];
+ _assertTypeNameSimple(parameterNode.type, typeProvider.intType);
+ expect(parameterNode.element, same(parameterElement));
+
+ expect(parameterNode.identifier.staticElement, same(parameterElement));
+ expect(parameterNode.identifier.staticType, typeProvider.intType);
+ }
+
test_indexExpression() async {
String content = r'''
main() {
@@ -1416,6 +1801,53 @@
}
}
+ test_instanceCreation_namedArgument() async {
+ addTestFile(r'''
+class X {
+ X(int a, {bool b, double c});
+}
+var v = new X(1, b: true, c: 3.0);
+''');
+
+ AnalysisResult result = await driver.getResult(testFile);
+ CompilationUnit unit = result.unit;
+
+ ClassDeclaration xNode = unit.declarations[0];
+ ClassElement xElement = xNode.element;
+ ConstructorElement constructorElement = xElement.constructors[0];
+
+ TopLevelVariableDeclaration vDeclaration = unit.declarations[1];
+ VariableDeclaration vNode = vDeclaration.variables.variables[0];
+
+ InstanceCreationExpression creation = vNode.initializer;
+ List<Expression> arguments = creation.argumentList.arguments;
+ expect(creation.staticElement, constructorElement);
+ expect(creation.staticType, xElement.type);
+
+ TypeName typeName = creation.constructorName.type;
+ expect(typeName.typeArguments, isNull);
+
+ Identifier typeIdentifier = typeName.name;
+ expect(typeIdentifier.staticElement, xElement);
+ expect(typeIdentifier.staticType, xElement.type);
+
+ expect(creation.constructorName.name, isNull);
+
+ Expression aArgument = arguments[0];
+ ParameterElement aElement = constructorElement.parameters[0];
+ expect(aArgument.staticParameterElement, same(aElement));
+
+ NamedExpression bArgument = arguments[1];
+ ParameterElement bElement = constructorElement.parameters[1];
+ expect(bArgument.name.label.staticElement, same(bElement));
+ expect(bArgument.staticParameterElement, same(bElement));
+
+ NamedExpression cArgument = arguments[2];
+ ParameterElement cElement = constructorElement.parameters[2];
+ expect(cArgument.name.label.staticElement, same(cElement));
+ expect(cArgument.staticParameterElement, same(cElement));
+ }
+
test_instanceCreation_noTypeArguments() async {
String content = r'''
class C {
@@ -2069,14 +2501,12 @@
}
test_local_variable() async {
- String content = r'''
+ addTestFile(r'''
void main() {
var v = 42;
v;
}
-''';
- addTestFile(content);
-
+''');
AnalysisResult result = await driver.getResult(testFile);
expect(result.path, testFile);
expect(result.errors, isEmpty);
@@ -2293,6 +2723,28 @@
expect(identifier.staticType, typeProvider.numType);
}
+ test_local_variable_multiple() async {
+ addTestFile(r'''
+void main() {
+ var a = 1, b = 2.3;
+}
+''');
+ AnalysisResult result = await driver.getResult(testFile);
+ var typeProvider = result.unit.element.context.typeProvider;
+
+ List<Statement> statements = _getMainStatements(result);
+
+ VariableDeclarationStatement declarationStatement = statements[0];
+
+ VariableDeclaration aNode = declarationStatement.variables.variables[0];
+ LocalVariableElement aElement = aNode.element;
+ expect(aElement.type, typeProvider.intType);
+
+ VariableDeclaration bNode = declarationStatement.variables.variables[1];
+ LocalVariableElement bElement = bNode.element;
+ expect(bElement.type, typeProvider.doubleType);
+ }
+
test_local_variable_ofLocalFunction() async {
addTestFile(r'''
void main() {
@@ -2578,6 +3030,185 @@
}
}
+ test_methodInvocation_namedArgument() async {
+ addTestFile(r'''
+void main() {
+ foo(1, b: true, c: 3.0);
+}
+void foo(int a, {bool b, double c}) {}
+''');
+ AnalysisResult result = await driver.getResult(testFile);
+ List<Statement> mainStatements = _getMainStatements(result);
+
+ FunctionDeclaration foo = result.unit.declarations[1];
+ ExecutableElement fooElement = foo.element;
+
+ ExpressionStatement statement = mainStatements[0];
+ MethodInvocation invocation = statement.expression;
+ List<Expression> arguments = invocation.argumentList.arguments;
+
+ Expression aArgument = arguments[0];
+ ParameterElement aElement = fooElement.parameters[0];
+ expect(aArgument.staticParameterElement, same(aElement));
+
+ NamedExpression bArgument = arguments[1];
+ ParameterElement bElement = fooElement.parameters[1];
+ expect(bArgument.name.label.staticElement, same(bElement));
+ expect(bArgument.staticParameterElement, same(bElement));
+
+ NamedExpression cArgument = arguments[2];
+ ParameterElement cElement = fooElement.parameters[2];
+ expect(cArgument.name.label.staticElement, same(cElement));
+ expect(cArgument.staticParameterElement, same(cElement));
+ }
+
+ test_methodInvocation_notFunction_field_dynamic() async {
+ addTestFile(r'''
+class C {
+ dynamic f;
+ foo() {
+ f(1);
+ }
+}
+''');
+ AnalysisResult result = await driver.getResult(testFile);
+
+ ClassDeclaration cDeclaration = result.unit.declarations[0];
+
+ FieldDeclaration fDeclaration = cDeclaration.members[0];
+ VariableDeclaration fNode = fDeclaration.fields.variables[0];
+ FieldElement fElement = fNode.element;
+
+ MethodDeclaration fooDeclaration = cDeclaration.members[1];
+ BlockFunctionBody fooBody = fooDeclaration.body;
+ List<Statement> fooStatements = fooBody.block.statements;
+
+ ExpressionStatement statement = fooStatements[0];
+ MethodInvocation invocation = statement.expression;
+ expect(invocation.methodName.staticElement, same(fElement.getter));
+ expect(invocation.staticInvokeType, DynamicTypeImpl.instance);
+ expect(invocation.staticType, DynamicTypeImpl.instance);
+
+ List<Expression> arguments = invocation.argumentList.arguments;
+
+ Expression argument = arguments[0];
+ expect(argument.staticParameterElement, isNull);
+ }
+
+ test_methodInvocation_notFunction_getter_dynamic() async {
+ addTestFile(r'''
+class C {
+ get f => null;
+ foo() {
+ f(1);
+ }
+}
+''');
+ AnalysisResult result = await driver.getResult(testFile);
+
+ ClassDeclaration cDeclaration = result.unit.declarations[0];
+
+ MethodDeclaration fDeclaration = cDeclaration.members[0];
+ PropertyAccessorElement fElement = fDeclaration.element;
+
+ MethodDeclaration fooDeclaration = cDeclaration.members[1];
+ BlockFunctionBody fooBody = fooDeclaration.body;
+ List<Statement> fooStatements = fooBody.block.statements;
+
+ ExpressionStatement statement = fooStatements[0];
+ MethodInvocation invocation = statement.expression;
+ expect(invocation.methodName.staticElement, same(fElement));
+ expect(invocation.staticInvokeType, DynamicTypeImpl.instance);
+ expect(invocation.staticType, DynamicTypeImpl.instance);
+
+ List<Expression> arguments = invocation.argumentList.arguments;
+
+ Expression argument = arguments[0];
+ expect(argument.staticParameterElement, isNull);
+ }
+
+ test_methodInvocation_notFunction_local_dynamic() async {
+ addTestFile(r'''
+main(f) {
+ f(1);
+}
+''');
+ AnalysisResult result = await driver.getResult(testFile);
+
+ FunctionDeclaration mainDeclaration = result.unit.declarations[0];
+ FunctionExpression mainFunction = mainDeclaration.functionExpression;
+ ParameterElement fElement = mainFunction.parameters.parameters[0].element;
+
+ BlockFunctionBody mainBody = mainFunction.body;
+ List<Statement> mainStatements = mainBody.block.statements;
+
+ ExpressionStatement statement = mainStatements[0];
+ MethodInvocation invocation = statement.expression;
+ expect(invocation.methodName.staticElement, same(fElement));
+ expect(invocation.staticInvokeType, DynamicTypeImpl.instance);
+ expect(invocation.staticType, DynamicTypeImpl.instance);
+
+ List<Expression> arguments = invocation.argumentList.arguments;
+
+ Expression argument = arguments[0];
+ expect(argument.staticParameterElement, isNull);
+ }
+
+ test_methodInvocation_notFunction_local_functionTyped() async {
+ addTestFile(r'''
+main(String f(int a)) {
+ f(1);
+}
+''');
+ AnalysisResult result = await driver.getResult(testFile);
+ var typeProvider = result.unit.element.context.typeProvider;
+
+ FunctionDeclaration mainDeclaration = result.unit.declarations[0];
+ FunctionExpression mainFunction = mainDeclaration.functionExpression;
+ ParameterElement fElement = mainFunction.parameters.parameters[0].element;
+
+ BlockFunctionBody mainBody = mainFunction.body;
+ List<Statement> mainStatements = mainBody.block.statements;
+
+ ExpressionStatement statement = mainStatements[0];
+ MethodInvocation invocation = statement.expression;
+ expect(invocation.methodName.staticElement, same(fElement));
+ expect(invocation.staticInvokeType.toString(), '(int) → String');
+ expect(invocation.staticType, typeProvider.stringType);
+
+ List<Expression> arguments = invocation.argumentList.arguments;
+
+ Expression argument = arguments[0];
+ expect(argument.staticParameterElement, isNotNull);
+ }
+
+ test_methodInvocation_notFunction_topLevelVariable_dynamic() async {
+ addTestFile(r'''
+dynamic f;
+main() {
+ f(1);
+}
+''');
+ AnalysisResult result = await driver.getResult(testFile);
+
+ TopLevelVariableDeclaration fDeclaration = result.unit.declarations[0];
+ VariableDeclaration fNode = fDeclaration.variables.variables[0];
+ TopLevelVariableElement fElement = fNode.element;
+
+ List<Statement> mainStatements = _getMainStatements(result);
+
+ ExpressionStatement statement = mainStatements[0];
+ MethodInvocation invocation = statement.expression;
+ expect(invocation.methodName.staticElement, same(fElement.getter));
+ expect(invocation.staticInvokeType, DynamicTypeImpl.instance);
+ expect(invocation.staticType, DynamicTypeImpl.instance);
+
+ List<Expression> arguments = invocation.argumentList.arguments;
+
+ Expression argument = arguments[0];
+ expect(argument.staticParameterElement, isNull);
+ }
+
test_methodInvocation_staticMethod() async {
addTestFile(r'''
main() {
@@ -2796,38 +3427,6 @@
}
}
- test_namedArgument() async {
- addTestFile(r'''
-void main() {
- foo(1, b: true, c: 3.0);
-}
-void foo(int a, {bool b, double c}) {}
-''');
- AnalysisResult result = await driver.getResult(testFile);
- List<Statement> mainStatements = _getMainStatements(result);
-
- FunctionDeclaration foo = result.unit.declarations[1];
- ExecutableElement fooElement = foo.element;
-
- ExpressionStatement statement = mainStatements[0];
- MethodInvocation invocation = statement.expression;
- List<Expression> arguments = invocation.argumentList.arguments;
-
- Expression aArgument = arguments[0];
- ParameterElement aElement = fooElement.parameters[0];
- expect(aArgument.staticParameterElement, same(aElement));
-
- NamedExpression bArgument = arguments[1];
- ParameterElement bElement = fooElement.parameters[1];
- expect(bArgument.name.label.staticElement, same(bElement));
- expect(bArgument.staticParameterElement, same(bElement));
-
- NamedExpression cArgument = arguments[2];
- ParameterElement cElement = fooElement.parameters[2];
- expect(cArgument.name.label.staticElement, same(cElement));
- expect(cArgument.staticParameterElement, same(cElement));
- }
-
test_postfixExpression_local() async {
String content = r'''
main() {
@@ -3956,6 +4555,53 @@
}
}
+ test_top_field_class_multiple() async {
+ String content = r'''
+class C {
+ var a = 1, b = 2.3;
+}
+''';
+ addTestFile(content);
+
+ AnalysisResult result = await driver.getResult(testFile);
+ CompilationUnit unit = result.unit;
+ CompilationUnitElement unitElement = unit.element;
+ var typeProvider = unitElement.context.typeProvider;
+
+ ClassDeclaration cNode = unit.declarations[0];
+ ClassElement cElement = cNode.element;
+
+ FieldDeclaration fieldDeclaration = cNode.members[0];
+
+ {
+ FieldElement aElement = cElement.getField('a');
+
+ VariableDeclaration aNode = fieldDeclaration.fields.variables[0];
+ expect(aNode.element, same(aElement));
+ expect(aElement.type, typeProvider.intType);
+
+ expect(aNode.name.staticElement, same(aElement));
+ expect(aNode.name.staticType, same(aElement.type));
+
+ Expression aValue = aNode.initializer;
+ expect(aValue.staticType, typeProvider.intType);
+ }
+
+ {
+ FieldElement bElement = cElement.getField('b');
+
+ VariableDeclaration bNode = fieldDeclaration.fields.variables[1];
+ expect(bNode.element, same(bElement));
+ expect(bElement.type, typeProvider.doubleType);
+
+ expect(bNode.name.staticElement, same(bElement));
+ expect(bNode.name.staticType, same(bElement.type));
+
+ Expression aValue = bNode.initializer;
+ expect(aValue.staticType, typeProvider.doubleType);
+ }
+ }
+
test_top_field_top() async {
String content = r'''
var a = 1;
@@ -4000,6 +4646,47 @@
}
}
+ test_top_field_top_multiple() async {
+ String content = r'''
+var a = 1, b = 2.3;
+''';
+ addTestFile(content);
+
+ AnalysisResult result = await driver.getResult(testFile);
+ CompilationUnit unit = result.unit;
+ CompilationUnitElement unitElement = unit.element;
+ var typeProvider = unitElement.context.typeProvider;
+
+ TopLevelVariableDeclaration variableDeclaration = unit.declarations[0];
+ expect(variableDeclaration.variables.type, isNull);
+
+ {
+ VariableDeclaration aNode = variableDeclaration.variables.variables[0];
+ TopLevelVariableElement aElement = aNode.element;
+ expect(aElement, same(unitElement.topLevelVariables[0]));
+ expect(aElement.type, typeProvider.intType);
+
+ expect(aNode.name.staticElement, same(aElement));
+ expect(aNode.name.staticType, aElement.type);
+
+ Expression aValue = aNode.initializer;
+ expect(aValue.staticType, typeProvider.intType);
+ }
+
+ {
+ VariableDeclaration bNode = variableDeclaration.variables.variables[1];
+ TopLevelVariableElement bElement = bNode.element;
+ expect(bElement, same(unitElement.topLevelVariables[1]));
+ expect(bElement.type, typeProvider.doubleType);
+
+ expect(bNode.name.staticElement, same(bElement));
+ expect(bNode.name.staticType, bElement.type);
+
+ Expression aValue = bNode.initializer;
+ expect(aValue.staticType, typeProvider.doubleType);
+ }
+ }
+
test_top_function_namedParameters() async {
addTestFile(r'''
double f(int a, {String b, bool c: 1 == 2}) {}
diff --git a/pkg/analyzer/test/src/fasta/message_coverage_test.dart b/pkg/analyzer/test/src/fasta/message_coverage_test.dart
index 2911531..f40c351 100644
--- a/pkg/analyzer/test/src/fasta/message_coverage_test.dart
+++ b/pkg/analyzer/test/src/fasta/message_coverage_test.dart
@@ -135,6 +135,7 @@
fail(buffer.toString());
}
+ @failingTest
test_translatedMessageCoverage() {
String analyzerPath = path.join(package_root.packageRoot, 'analyzer');
String astBuilderPath =
diff --git a/pkg/analyzer/test/src/fasta/recovery/missing_code_test.dart b/pkg/analyzer/test/src/fasta/recovery/missing_code_test.dart
index 81ccbf4..3bf15d4 100644
--- a/pkg/analyzer/test/src/fasta/recovery/missing_code_test.dart
+++ b/pkg/analyzer/test/src/fasta/recovery/missing_code_test.dart
@@ -9,12 +9,95 @@
main() {
defineReflectiveSuite(() {
+ defineReflectiveTests(ListLiteralTest);
+ defineReflectiveTests(MapLiteralTest);
defineReflectiveTests(MissingCodeTest);
defineReflectiveTests(ParameterListTest);
});
}
/**
+ * Test how well the parser recovers when tokens are missing in a list literal.
+ */
+@reflectiveTest
+class ListLiteralTest extends AbstractRecoveryTest {
+ void test_extraComma() {
+ testRecovery('''
+f() => [a, , b];
+''', [ParserErrorCode.MISSING_IDENTIFIER], '''
+f() => [a, _s_, b];
+''');
+ }
+
+ @failingTest
+ void test_missingComma() {
+ testRecovery('''
+f() => [a, b c];
+''', [ParserErrorCode.EXPECTED_TOKEN], '''
+f() => [a, b, c];
+''');
+ }
+}
+
+/**
+ * Test how well the parser recovers when tokens are missing in a map literal.
+ */
+@reflectiveTest
+class MapLiteralTest extends AbstractRecoveryTest {
+ void test_missingColonAndValue_last() {
+ testRecovery('''
+f() => {a };
+''', [ParserErrorCode.UNEXPECTED_TOKEN, ParserErrorCode.MISSING_IDENTIFIER], '''
+f() => {a: _s_};
+''');
+ }
+
+ void test_extraComma() {
+ testRecovery('''
+f() => {a: b, , c: d};
+''', [
+ ParserErrorCode.MISSING_IDENTIFIER,
+ ParserErrorCode.UNEXPECTED_TOKEN,
+ ParserErrorCode.MISSING_IDENTIFIER
+ ], '''
+f() => {a: b, _s_: _s_, c: d};
+''');
+ }
+
+ void test_missingComma() {
+ testRecovery('''
+f() => {a: b, c: d e: f};
+''', [ParserErrorCode.UNEXPECTED_TOKEN], '''
+f() => {a: b, c: d, e: f};
+''');
+ }
+
+ void test_missingKey() {
+ testRecovery('''
+f() => {: b};
+''', [ParserErrorCode.MISSING_IDENTIFIER], '''
+f() => {_s_: b};
+''');
+ }
+
+ void test_missingValue_last() {
+ testRecovery('''
+f() => {a: };
+''', [ParserErrorCode.MISSING_IDENTIFIER], '''
+f() => {a: _s_};
+''');
+ }
+
+ void test_missingValue_notLast() {
+ testRecovery('''
+f() => {a: , b: c};
+''', [ParserErrorCode.MISSING_IDENTIFIER], '''
+f() => {a: _s_, b: c};
+''');
+ }
+}
+
+/**
* Test how well the parser recovers when non-paired tokens are missing.
*/
@reflectiveTest
@@ -76,6 +159,18 @@
testUserDefinableOperatorWithSuper('|');
}
+ void test_cascade_missingRight() {
+ testRecovery('''
+f(x) {
+ x..
+}
+''', [ParserErrorCode.MISSING_IDENTIFIER, ParserErrorCode.EXPECTED_TOKEN], '''
+f(x) {
+ x.. _s_;
+}
+''');
+ }
+
void test_classDeclaration_missingName() {
testRecovery('''
class {}
diff --git a/pkg/analyzer/test/src/fasta/recovery/recovery_test_support.dart b/pkg/analyzer/test/src/fasta/recovery/recovery_test_support.dart
index 7c56e59..cf2c3b8 100644
--- a/pkg/analyzer/test/src/fasta/recovery/recovery_test_support.dart
+++ b/pkg/analyzer/test/src/fasta/recovery/recovery_test_support.dart
@@ -20,12 +20,20 @@
{CompilationUnit adjustValidUnitBeforeComparison(CompilationUnit unit)}) {
CompilationUnit invalidUnit =
parseCompilationUnit(invalidCode, codes: errorCodes);
+ validateTokenStream(invalidUnit.beginToken);
CompilationUnit validUnit = parseCompilationUnit(validCode);
if (adjustValidUnitBeforeComparison != null) {
validUnit = adjustValidUnitBeforeComparison(validUnit);
}
ResultComparator.compare(invalidUnit, validUnit);
}
+
+ void validateTokenStream(Token token) {
+ while (!token.isEof) {
+ expect(token.end, lessThanOrEqualTo(token.next.offset));
+ token = token.next;
+ }
+ }
}
/**
diff --git a/pkg/analyzer/test/src/fasta/resolution_applier_test.dart b/pkg/analyzer/test/src/fasta/resolution_applier_test.dart
index a327082..6c720dd 100644
--- a/pkg/analyzer/test/src/fasta/resolution_applier_test.dart
+++ b/pkg/analyzer/test/src/fasta/resolution_applier_test.dart
@@ -35,14 +35,8 @@
/// [referencedElements], and [types] to the body of the function.
/// 3. Verify that everything in the function body that should be resolved
/// _is_ resolved.
- void applyTypes(
- String content,
- List<Element> declaredElements,
- List<int> declareElementOffsets,
- List<Element> referencedElements,
- List<int> referencedElementOffsets,
- List<DartType> types,
- List<int> typeOffsets) {
+ void applyTypes(String content, List<Element> declaredElements,
+ List<Element> referencedElements, List<DartType> types) {
CompilationUnit unit = parseCompilationUnit(content);
expect(unit, isNotNull);
expect(unit.declarations, hasLength(1));
@@ -51,11 +45,8 @@
ResolutionApplier applier = new ResolutionApplier(
new _TestTypeContext(),
declaredElements,
- declareElementOffsets,
referencedElements,
- referencedElementOffsets,
- types.map((type) => new _KernelWrapperOfType(type)).toList(),
- typeOffsets);
+ types.map((type) => new _KernelWrapperOfType(type)).toList());
body.accept(applier);
applier.checkDone();
@@ -76,24 +67,15 @@
f(String s, int i) {
return s + i;
}
-''', [], [], [
+''', [], [
_createFunctionParameter('s', 9),
new MethodElementImpl('+', -1),
_createFunctionParameter('i', 16),
- ], [
- 30,
- 32,
- 34
], <DartType>[
typeProvider.stringType,
new FunctionTypeImpl(new FunctionElementImpl('+', -1)),
typeProvider.intType,
typeProvider.stringType,
- ], [
- 30,
- 32,
- 32,
- 34
]);
}
@@ -102,26 +84,16 @@
f(Object a) {
return a.b().c();
}
-''', [], [], [
+''', [], [
_createFunctionParameter('a', 9),
new MethodElementImpl('b', -1),
new MethodElementImpl('c', -1)
- ], [
- 23,
- 25,
- 29
], <DartType>[
typeProvider.objectType,
typeProvider.objectType,
typeProvider.objectType,
typeProvider.objectType,
typeProvider.objectType
- ], [
- 23,
- 25,
- 26,
- 29,
- 30
]);
}
@@ -141,71 +113,50 @@
f() {
int Function(String, bool x) foo;
}
-''', [new LocalVariableElementImpl('foo', 37)], [37], [], [],
- <DartType>[functionType], [37]);
+''', [new LocalVariableElementImpl('foo', 37)], [], <DartType>[functionType]);
}
void test_listLiteral_const_noAnnotation() {
applyTypes(r'''
get f => const ['a', 'b', 'c'];
-''', [], [], [], [], <DartType>[
+''', [], [], <DartType>[
typeProvider.stringType,
typeProvider.stringType,
typeProvider.stringType,
typeProvider.listType.instantiate([typeProvider.stringType])
- ], [
- 16,
- 21,
- 26,
- 9
]);
}
void test_listLiteral_const_typeAnnotation() {
applyTypes(r'''
get f => const <String>['a', 'b', 'c'];
-''', [], [], [], [], <DartType>[
+''', [], [], <DartType>[
typeProvider.stringType,
typeProvider.stringType,
typeProvider.stringType,
typeProvider.listType.instantiate([typeProvider.stringType])
- ], [
- 24,
- 29,
- 34,
- 9
]);
}
void test_listLiteral_noAnnotation() {
applyTypes(r'''
get f => ['a', 'b', 'c'];
-''', [], [], [], [], <DartType>[
+''', [], [], <DartType>[
typeProvider.stringType,
typeProvider.stringType,
typeProvider.stringType,
typeProvider.listType.instantiate([typeProvider.stringType])
- ], [
- 10,
- 15,
- 20,
- 9
]);
}
void test_listLiteral_typeAnnotation() {
applyTypes(r'''
get f => <String>['a', 'b', 'c'];
-''', [], [], [], [], <DartType>[
+''', [], [], <DartType>[
typeProvider.stringType,
typeProvider.stringType,
typeProvider.stringType,
typeProvider.listType.instantiate([typeProvider.stringType])
- ], [
- 18,
- 23,
- 28,
- 17
]);
}
@@ -218,14 +169,13 @@
f() {
Map<String, List<String>> m = {};
}
-''', [new LocalVariableElementImpl('m', 34)], [34], [], [],
- <DartType>[mapType, mapType], [34, 38]);
+''', [new LocalVariableElementImpl('m', 34)], [], <DartType>[mapType, mapType]);
}
void test_mapLiteral_const_noAnnotation() {
applyTypes(r'''
get f => const {'a' : 1, 'b' : 2, 'c' : 3};
-''', [], [], [], [], <DartType>[
+''', [], [], <DartType>[
typeProvider.stringType,
typeProvider.intType,
typeProvider.stringType,
@@ -234,21 +184,13 @@
typeProvider.intType,
typeProvider.mapType
.instantiate([typeProvider.stringType, typeProvider.intType])
- ], [
- 16,
- 22,
- 25,
- 31,
- 34,
- 40,
- 9
]);
}
void test_mapLiteral_const_typeAnnotation() {
applyTypes(r'''
get f => const <String, int>{'a' : 1, 'b' : 2, 'c' : 3};
-''', [], [], [], [], <DartType>[
+''', [], [], <DartType>[
typeProvider.stringType,
typeProvider.intType,
typeProvider.stringType,
@@ -257,21 +199,13 @@
typeProvider.intType,
typeProvider.mapType
.instantiate([typeProvider.stringType, typeProvider.intType])
- ], [
- 29,
- 35,
- 38,
- 44,
- 47,
- 53,
- 9
]);
}
void test_mapLiteral_noAnnotation() {
applyTypes(r'''
get f => {'a' : 1, 'b' : 2, 'c' : 3};
-''', [], [], [], [], <DartType>[
+''', [], [], <DartType>[
typeProvider.stringType,
typeProvider.intType,
typeProvider.stringType,
@@ -280,21 +214,13 @@
typeProvider.intType,
typeProvider.mapType
.instantiate([typeProvider.stringType, typeProvider.intType])
- ], [
- 10,
- 16,
- 19,
- 25,
- 28,
- 34,
- 9
]);
}
void test_mapLiteral_typeAnnotation() {
applyTypes(r'''
get f => <String, int>{'a' : 1, 'b' : 2, 'c' : 3};
-''', [], [], [], [], <DartType>[
+''', [], [], <DartType>[
typeProvider.stringType,
typeProvider.intType,
typeProvider.stringType,
@@ -303,14 +229,6 @@
typeProvider.intType,
typeProvider.mapType
.instantiate([typeProvider.stringType, typeProvider.intType])
- ], [
- 23,
- 29,
- 32,
- 38,
- 41,
- 47,
- 22
]);
}
@@ -319,18 +237,12 @@
f(String s) {
return s.length;
}
-''', [], [], [
+''', [], [
_createFunctionParameter('s', 9),
new MethodElementImpl('length', -1)
- ], [
- 23,
- 25
], <DartType>[
typeProvider.stringType,
typeProvider.intType,
- ], [
- 23,
- 25
]);
}
@@ -339,24 +251,15 @@
f(String s) {
return s.substring(3, 7);
}
-''', [], [], [
+''', [], [
_createFunctionParameter('s', 9),
new MethodElementImpl('length', -1)
- ], [
- 23,
- 25
], <DartType>[
typeProvider.stringType,
typeProvider.intType,
typeProvider.intType,
typeProvider.stringType,
typeProvider.stringType
- ], [
- 23,
- 25,
- 34,
- 35,
- 38
]);
}
@@ -380,8 +283,7 @@
A<int, String> foo;
}
//typedef B A<B, C>(C x);
-''', [new LocalVariableElementImpl('foo', 23)], [], [], [],
- <DartType>[functionType], []);
+''', [new LocalVariableElementImpl('foo', 23)], [], <DartType>[functionType]);
}
/// Return a newly created parameter element with the given [name] and
diff --git a/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart b/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
index 840e620..9e05d71 100644
--- a/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
+++ b/pkg/analyzer/test/src/summary/resynthesize_kernel_test.dart
@@ -436,7 +436,8 @@
..logger = new PerformanceLog(null)
..fileSystem = new _FileSystemAdaptor(resourceProvider)
..byteStore = new MemoryByteStore());
- var driver = new KernelDriver(options, uriTranslator,
+ var driver = new KernelDriver(
+ options, uriTranslator, new KernelErrorListener(),
metadataFactory: new AnalyzerMetadataFactory());
KernelResult kernelResult = await driver.getKernel(testUri);
@@ -451,7 +452,7 @@
}
kernelResult.dependencies.forEach(addLibrary);
- addLibrary(kernelResult.library);
+ addLibrary(kernelResult.libraryResult.library);
if (DEBUG) {
String testUriStr = testUri.toString();
diff --git a/pkg/analyzer/test/src/task/options_test.dart b/pkg/analyzer/test/src/task/options_test.dart
index c2366a2..9479152 100644
--- a/pkg/analyzer/test/src/task/options_test.dart
+++ b/pkg/analyzer/test/src/task/options_test.dart
@@ -270,7 +270,6 @@
removeCode(StrongModeCode.TOP_LEVEL_INSTANCE_GETTER);
removeCode(StrongModeCode.TOP_LEVEL_TYPE_ARGUMENTS);
removeCode(StrongModeCode.TOP_LEVEL_UNSUPPORTED);
- removeCode(StrongModeCode.UNSAFE_BLOCK_CLOSURE_INFERENCE);
} else if (errorType == TodoCode) {
declaredNames.remove('TODO_REGEX');
}
diff --git a/pkg/analyzer_cli/lib/src/driver.dart b/pkg/analyzer_cli/lib/src/driver.dart
index 0f54ab7..103d93f 100644
--- a/pkg/analyzer_cli/lib/src/driver.dart
+++ b/pkg/analyzer_cli/lib/src/driver.dart
@@ -252,7 +252,7 @@
// Create a context, or re-use the previous one.
try {
- _createAnalysisContext(options);
+ _createContextAndAnalyze(options);
} on _DriverError catch (error) {
outSink.writeln(error.msg);
return ErrorSeverity.ERROR;
@@ -567,7 +567,7 @@
/// Create an analysis context that is prepared to analyze sources according
/// to the given [options], and store it in [_context].
- void _createAnalysisContext(CommandLineOptions options) {
+ void _createContextAndAnalyze(CommandLineOptions options) {
// If not the same command-line options, clear cached information.
if (!_equalCommandLineOptions(_previousOptions, options)) {
_previousOptions = options;
@@ -699,7 +699,8 @@
a.lint == b.lint &&
AnalysisOptionsImpl.compareLints(a.lintRules, b.lintRules) &&
a.preserveComments == b.preserveComments &&
- a.strongMode == b.strongMode;
+ a.strongMode == b.strongMode &&
+ a.useFastaParser == b.useFastaParser;
}
_PackageInfo _findPackages(CommandLineOptions options) {
@@ -977,12 +978,14 @@
class _DriverError implements Exception {
String msg;
+
_DriverError(this.msg);
}
class _PackageInfo {
Packages packages;
Map<String, List<file_system.Folder>> packageMap;
+
_PackageInfo(this.packages, this.packageMap);
}
diff --git a/pkg/analyzer_cli/test/all.dart b/pkg/analyzer_cli/test/all.dart
index 567870e..82706ab 100644
--- a/pkg/analyzer_cli/test/all.dart
+++ b/pkg/analyzer_cli/test/all.dart
@@ -15,7 +15,7 @@
import 'reporter_test.dart' as reporter_test;
import 'sdk_ext_test.dart' as sdk_ext_test;
import 'super_mixin_test.dart' as super_mixin_test;
-//import 'strong_mode_test.dart' as strong_mode_test;
+import 'strong_mode_test.dart' as strong_mode_test;
main() {
analysis_options_test.main();
@@ -31,7 +31,5 @@
reporter_test.main();
sdk_ext_test.main();
super_mixin_test.main();
- // TODO(pq): fix tests to run safely on the bots
- // https://github.com/dart-lang/sdk/issues/25001
- //strong_mode_test.main();
+ strong_mode_test.main();
}
diff --git a/pkg/analyzer_cli/test/driver_test.dart b/pkg/analyzer_cli/test/driver_test.dart
index ea9d072..42230ab 100644
--- a/pkg/analyzer_cli/test/driver_test.dart
+++ b/pkg/analyzer_cli/test/driver_test.dart
@@ -30,8 +30,11 @@
defineReflectiveSuite(() {
defineReflectiveTests(BuildModeTest);
defineReflectiveTests(ExitCodesTest);
+ defineReflectiveTests(ExitCodesTest_PreviewDart2);
defineReflectiveTests(LinterTest);
+ defineReflectiveTests(LinterTest_PreviewDart2);
defineReflectiveTests(OptionsTest);
+ defineReflectiveTests(OptionsTest_PreviewDart2);
}, name: 'Driver');
}
@@ -47,19 +50,26 @@
/// Normalize text with bullets.
String bulletToDash(item) => '$item'.replaceAll('•', '-');
+ bool get usePreviewDart2 => false;
+
/// Start a driver for the given [source], optionally providing additional
- /// [args] and an [options] file path. The value of [options] defaults to
- /// an empty options file to avoid unwanted configuration from an otherwise
+ /// [args] and an [options] file path. The value of [options] defaults to an
+ /// empty options file to avoid unwanted configuration from an otherwise
/// discovered options file.
- Future<Null> drive(String source,
- {String options: emptyOptionsFile,
- List<String> args: const <String>[]}) async {
+ Future<Null> drive(
+ String source, {
+ String options: emptyOptionsFile,
+ List<String> args: const <String>[],
+ }) async {
driver = new Driver(isTesting: true);
- var cmd = [
+ var cmd = <String>[
'--options',
path.join(testDirectory, options),
_adjustFileSpec(source)
]..addAll(args);
+ if (usePreviewDart2) {
+ cmd.insert(0, '--preview-dart-2');
+ }
await driver.start(cmd);
}
@@ -591,6 +601,27 @@
}
@reflectiveTest
+class ExitCodesTest_PreviewDart2 extends ExitCodesTest {
+ @override
+ bool get usePreviewDart2 => true;
+
+ @override
+ @failingTest
+ test_fatalErrors() {
+ // TODO(devoncarew): This test times out when used with @failingTest.
+ return new Future.error('failing test');
+ }
+
+ @override
+ @failingTest
+ test_fatalWarnings() => super.test_fatalWarnings();
+
+ @override
+ @failingTest
+ test_notFatalWarnings() => super.test_notFatalWarnings();
+}
+
+@reflectiveTest
class LinterTest extends BaseTest {
String get optionsFileName => AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE;
@@ -688,6 +719,12 @@
}
@reflectiveTest
+class LinterTest_PreviewDart2 extends LinterTest {
+ @override
+ bool get usePreviewDart2 => true;
+}
+
+@reflectiveTest
class OptionsTest extends BaseTest {
String get optionsFileName => AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE;
@@ -794,6 +831,33 @@
}
}
+@reflectiveTest
+class OptionsTest_PreviewDart2 extends OptionsTest {
+ @override
+ bool get usePreviewDart2 => true;
+
+ @override
+ @failingTest
+ test_basic_filters() => super.test_basic_filters();
+
+ @override
+ @failingTest
+ test_basic_language() => super.test_basic_language();
+
+ @override
+ @failingTest
+ test_basic_strongMode() => super.test_basic_strongMode();
+
+ @override
+ @failingTest
+ test_includeDirective() => super.test_includeDirective();
+
+ @override
+ @failingTest
+ test_withFlags_overrideFatalWarning() =>
+ super.test_withFlags_overrideFatalWarning();
+}
+
class TestSource implements Source {
TestSource();
diff --git a/pkg/analyzer_cli/test/strong_mode_test.dart b/pkg/analyzer_cli/test/strong_mode_test.dart
index a122e98..51c647c 100644
--- a/pkg/analyzer_cli/test/strong_mode_test.dart
+++ b/pkg/analyzer_cli/test/strong_mode_test.dart
@@ -13,9 +13,7 @@
import 'driver_test.dart';
main() {
- // TODO(pq): fix tests to run safely on the bots
- // https://github.com/dart-lang/sdk/issues/25001
-// defineReflectiveTests(StrongModeTest);
+ defineReflectiveTests(StrongModeTest);
}
/// End-to-end test for --strong checking.
diff --git a/pkg/compiler/lib/src/compile_time_constants.dart b/pkg/compiler/lib/src/compile_time_constants.dart
index 3462968..817f22f 100644
--- a/pkg/compiler/lib/src/compile_time_constants.dart
+++ b/pkg/compiler/lib/src/compile_time_constants.dart
@@ -270,8 +270,8 @@
node, element.messageKind, element.messageArguments);
} else {
assert(elementType is MethodTypeVariableType);
- reporter.reportErrorMessage(
- node, MessageKind.TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED);
+ // Used to `reportErrorMessage` here, but with Dart 2 upcoming
+ // very soon we do not emit this message any more.
}
} else {
// We need to throw an exception at runtime.
diff --git a/pkg/compiler/lib/src/dart2js.dart b/pkg/compiler/lib/src/dart2js.dart
index 9d89aca..2fa6522 100644
--- a/pkg/compiler/lib/src/dart2js.dart
+++ b/pkg/compiler/lib/src/dart2js.dart
@@ -289,8 +289,6 @@
void setUseKernel(String argument) {
useKernel = true;
- // TODO(sigmund): remove once we support inlining with `useKernel`.
- options.add(Flags.disableInlining);
passThrough(argument);
}
diff --git a/pkg/compiler/lib/src/diagnostics/messages.dart b/pkg/compiler/lib/src/diagnostics/messages.dart
index 97252ba5c..c803871 100644
--- a/pkg/compiler/lib/src/diagnostics/messages.dart
+++ b/pkg/compiler/lib/src/diagnostics/messages.dart
@@ -404,8 +404,6 @@
TYPE_ARGUMENT_COUNT_MISMATCH,
TYPE_VARIABLE_IN_CONSTANT,
TYPE_VARIABLE_WITHIN_STATIC_MEMBER,
- TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED,
- TYPE_VARIABLE_FROM_METHOD_CONSIDERED_DYNAMIC,
TYPEDEF_FORMAL_WITH_DEFAULT,
UNARY_OPERATOR_BAD_ARITY,
UNBOUND_LABEL,
@@ -1200,43 +1198,6 @@
"""
]),
- MessageKind.TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED: const MessageTemplate(
- MessageKind.TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED,
- "Method type variables do not have a runtime value.",
- howToFix: "Try using the upper bound of the type variable, "
- "or refactor the code to avoid needing this runtime value.",
- examples: const [
- """
-// Method type variables are not reified, so they cannot be returned.
-Type f<T>() => T;
-
-main() => f<int>();
-""",
- """
-// Method type variables are not reified, so they cannot be tested dynamically.
-bool f<T>(Object o) => o is T;
-
-main() => f<int>(42);
-"""
- ]),
-
- MessageKind.TYPE_VARIABLE_FROM_METHOD_CONSIDERED_DYNAMIC:
- const MessageTemplate(
- MessageKind.TYPE_VARIABLE_FROM_METHOD_CONSIDERED_DYNAMIC,
- "Method type variables are treated as `dynamic` in `as` "
- "expressions.",
- howToFix:
- "Try using the upper bound of the type variable, or check "
- "that the blind success of the test does not introduce bugs.",
- examples: const [
- """
-// Method type variables are not reified, so they cannot be tested dynamically.
-bool f<T>(Object o) => o as T;
-
-main() => f<int>(42);
-"""
- ]),
-
MessageKind.INVALID_TYPE_VARIABLE_BOUND: const MessageTemplate(
MessageKind.INVALID_TYPE_VARIABLE_BOUND,
"'#{typeArgument}' is not a subtype of bound '#{bound}' for "
@@ -2707,8 +2668,7 @@
MessageKind.EXPECTED_IDENTIFIER_NOT_RESERVED_WORD: const MessageTemplate(
MessageKind.EXPECTED_IDENTIFIER_NOT_RESERVED_WORD,
"'#{keyword}' is a reserved word and can't be used here.",
- howToFix: "Try using a different name.",
- examples: const ["do() {} main() {}"]),
+ howToFix: "Try using a different name."),
MessageKind.NAMED_FUNCTION_EXPRESSION: const MessageTemplate(
MessageKind.NAMED_FUNCTION_EXPRESSION,
diff --git a/pkg/compiler/lib/src/elements/types.dart b/pkg/compiler/lib/src/elements/types.dart
index d0d7896..0bb9763 100644
--- a/pkg/compiler/lib/src/elements/types.dart
+++ b/pkg/compiler/lib/src/elements/types.dart
@@ -2,6 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+import '../common/names.dart';
import '../common_elements.dart';
import '../util/util.dart' show equalElements;
import 'entities.dart';
@@ -70,6 +71,9 @@
/// Whether this type contains a type variable.
bool get containsTypeVariables => false;
+ /// Is `true` if this type is the 'Object' type defined in 'dart:core'.
+ bool get isObject => false;
+
/// Applies [f] to each occurence of a [ResolutionTypeVariableType] within
/// this type.
void forEachTypeVariable(f(TypeVariableType variable)) {}
@@ -118,7 +122,7 @@
/// Returns `true` if [a] and [b] are assumed to be equivalent.
bool isAssumed(FunctionTypeVariable a, FunctionTypeVariable b) {
- return _assumptionMap[a].contains(b);
+ return _assumptionMap[a]?.contains(b) ?? false;
}
}
@@ -130,6 +134,11 @@
bool get isInterfaceType => true;
+ bool get isObject {
+ return element.name == 'Object' &&
+ element.library.canonicalUri == Uris.dart_core;
+ }
+
bool get containsTypeVariables =>
typeArguments.any((type) => type.containsTypeVariables);
@@ -379,7 +388,7 @@
/// type.
final int index;
- /// The bound of this existential type.
+ /// The bound of this function type variable.
final DartType bound;
FunctionTypeVariable(this.index, this.bound);
@@ -397,7 +406,7 @@
if (index != -1) {
return arguments[index];
}
- // The existential type was not substituted.
+ // The function type variable was not substituted.
return this;
}
@@ -613,6 +622,13 @@
for (int index = 0; index < typeVariables.length; index++) {
assumptions.assume(typeVariables[index], other.typeVariables[index]);
}
+ for (int index = 0; index < typeVariables.length; index++) {
+ if (!typeVariables[index]
+ .bound
+ ._equals(other.typeVariables[index].bound, assumptions)) {
+ return false;
+ }
+ }
}
bool result = returnType == other.returnType &&
_equalTypes(parameterTypes, other.parameterTypes, assumptions) &&
@@ -636,12 +652,16 @@
if (typeVariables.isNotEmpty) {
sb.write('<');
bool needsComma = false;
- // TODO(johnniwinther): Include bounds.
for (FunctionTypeVariable typeVariable in typeVariables) {
if (needsComma) {
sb.write(',');
}
sb.write(typeVariable);
+ DartType bound = typeVariable.bound;
+ if (!bound.isObject) {
+ sb.write(' extends ');
+ sb.write(typeVariable.bound);
+ }
needsComma = true;
}
sb.write('>');
@@ -781,6 +801,8 @@
extends BaseDartTypeVisitor<bool, T> {
CommonElements get commonElements;
+ final _Assumptions assumptions = new _Assumptions();
+
/// Ensures that the super hierarchy of [type] is computed.
void ensureResolved(InterfaceType type) {}
@@ -860,6 +882,26 @@
return false;
}
+ if (tf.typeVariables.length != sf.typeVariables.length) {
+ return false;
+ }
+ for (int i = 0; i < tf.typeVariables.length; i++) {
+ assumptions.assume(tf.typeVariables[i], sf.typeVariables[i]);
+ }
+ for (int i = 0; i < tf.typeVariables.length; i++) {
+ if (!tf.typeVariables[i].bound
+ ._equals(sf.typeVariables[i].bound, assumptions)) {
+ return false;
+ }
+ }
+ bool result = visitFunctionTypeInternal(tf, sf);
+ for (int i = 0; i < tf.typeVariables.length; i++) {
+ assumptions.forget(tf.typeVariables[i], sf.typeVariables[i]);
+ }
+ return result;
+ }
+
+ bool visitFunctionTypeInternal(FunctionType tf, FunctionType sf) {
// TODO(johnniwinther): Rewrite the function subtyping to be more readable
// but still as efficient.
@@ -973,6 +1015,11 @@
if (invalidTypeVariableBounds(bound, s)) return false;
return true;
}
+
+ bool visitFunctionTypeVariable(FunctionTypeVariable t, DartType s) {
+ if (!s.isFunctionTypeVariable) return false;
+ return assumptions.isAssumed(t, s);
+ }
}
abstract class MoreSpecificVisitor<T extends DartType>
diff --git a/pkg/compiler/lib/src/js_backend/runtime_types.dart b/pkg/compiler/lib/src/js_backend/runtime_types.dart
index 5f1be34..89ee3d0 100644
--- a/pkg/compiler/lib/src/js_backend/runtime_types.dart
+++ b/pkg/compiler/lib/src/js_backend/runtime_types.dart
@@ -79,7 +79,7 @@
/// in the return type or the argument types.
Set<ClassEntity> getReferencedClasses(FunctionType type);
- /// Return all classes that are uses a type arguments.
+ /// Return all classes that use type arguments.
Set<ClassEntity> getRequiredArgumentClasses();
}
diff --git a/pkg/compiler/lib/src/js_emitter/program_builder/collector.dart b/pkg/compiler/lib/src/js_emitter/program_builder/collector.dart
index 384d30a..8b04d86 100644
--- a/pkg/compiler/lib/src/js_emitter/program_builder/collector.dart
+++ b/pkg/compiler/lib/src/js_emitter/program_builder/collector.dart
@@ -235,7 +235,7 @@
// It is important that this is the penultimate step, at this point,
// neededClasses must only contain classes that have been resolved and
// codegen'd. The rtiNeededClasses may contain additional classes, but
- // these are thought to not have been instantiated, so we neeed to be able
+ // these are thought to not have been instantiated, so we need to be able
// to identify them later and make sure we only emit "empty shells" without
// fields, etc.
classesOnlyNeededForRti = new Set<ClassEntity>();
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 9e7e03b..c77ab3b 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
@@ -1109,7 +1109,7 @@
bool isIntercepted = false;
if (method is InstanceMethod) {
- MethodElement element = method.element;
+ FunctionEntity element = method.element;
isIntercepted = _interceptorData.isInterceptedMethod(element);
}
int requiredParameterCount = 0;
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 68206e7..9f50a9b 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
@@ -36,7 +36,7 @@
import '../../compiler.dart' show Compiler;
import '../../constants/values.dart' show ConstantValue, FunctionConstantValue;
import '../../common_elements.dart' show CommonElements;
-import '../../elements/elements.dart' show ClassElement, MethodElement;
+import '../../elements/elements.dart' show ClassElement;
import '../../elements/entities.dart';
import '../../hash/sha1.dart' show Hasher;
import '../../io/code_output.dart';
diff --git a/pkg/compiler/lib/src/js_model/locals.dart b/pkg/compiler/lib/src/js_model/locals.dart
index f0bd765..4e09ba2 100644
--- a/pkg/compiler/lib/src/js_model/locals.dart
+++ b/pkg/compiler/lib/src/js_model/locals.dart
@@ -440,7 +440,10 @@
for (ir.VariableDeclaration variable in node.positionalParameters) {
f(localsMap.getLocalVariable(variable));
}
- for (ir.VariableDeclaration variable in node.namedParameters) {
+ List<ir.VariableDeclaration> namedParameters =
+ new List<ir.VariableDeclaration>.from(node.namedParameters);
+ namedParameters.sort(namedOrdering);
+ for (ir.VariableDeclaration variable in namedParameters) {
f(localsMap.getLocalVariable(variable));
}
}
diff --git a/pkg/compiler/lib/src/kernel/deferred_load.dart b/pkg/compiler/lib/src/kernel/deferred_load.dart
index 5fc4f97..ea96d26 100644
--- a/pkg/compiler/lib/src/kernel/deferred_load.dart
+++ b/pkg/compiler/lib/src/kernel/deferred_load.dart
@@ -15,8 +15,8 @@
class KernelDeferredLoadTask extends DeferredLoadTask {
KernelToElementMapForImpact _elementMap;
- Map<ir.Library, Set<ir.Member>> _additionalExportsSets =
- <ir.Library, Set<ir.Member>>{};
+ Map<ir.Library, Set<ir.NamedNode>> _additionalExportsSets =
+ <ir.Library, Set<ir.NamedNode>>{};
KernelDeferredLoadTask(Compiler compiler, this._elementMap) : super(compiler);
@@ -85,8 +85,8 @@
"KernelDeferredLoadTask.addMirrorElementsForLibrary");
}
- Set<ir.Member> additionalExports(ir.Library library) {
- return _additionalExportsSets[library] ??= new Set<ir.Member>.from(
+ Set<ir.NamedNode> additionalExports(ir.Library library) {
+ return _additionalExportsSets[library] ??= new Set<ir.NamedNode>.from(
library.additionalExports.map((ir.Reference ref) => ref.node));
}
diff --git a/pkg/compiler/lib/src/kernel/element_map_impl.dart b/pkg/compiler/lib/src/kernel/element_map_impl.dart
index 951c0da..2d6dc79 100644
--- a/pkg/compiler/lib/src/kernel/element_map_impl.dart
+++ b/pkg/compiler/lib/src/kernel/element_map_impl.dart
@@ -445,10 +445,10 @@
typeParameters
.add(getDartType(new ir.TypeParameterType(typeParameter)));
}
- // TODO(johnniwinther): Support bounds.
typeVariables = new List<FunctionTypeVariable>.generate(
node.typeParameters.length,
- (int index) => new FunctionTypeVariable(index, const DynamicType()));
+ (int index) => new FunctionTypeVariable(
+ index, getDartType(node.typeParameters[index].bound)));
DartType subst(DartType type) {
return type.subst(typeVariables, typeParameters);
@@ -1589,9 +1589,11 @@
List<FunctionTypeVariable> typeVariables;
for (ir.TypeParameter typeParameter in node.typeParameters) {
if (enableFunctionTypeVariables) {
- // TODO(johnniwinther): Support bounds.
+ // TODO(johnniwinther): Support recursive type variable bounds, like
+ // `void Function<T extends Foo<T>>(T t)` when #31531 is fixed.
+ DartType bound = typeParameter.bound.accept(this);
FunctionTypeVariable typeVariable =
- new FunctionTypeVariable(index, const DynamicType());
+ new FunctionTypeVariable(index, bound);
currentFunctionTypeParameters[typeParameter] = typeVariable;
typeVariables ??= <FunctionTypeVariable>[];
typeVariables.add(typeVariable);
diff --git a/pkg/compiler/lib/src/resolution/members.dart b/pkg/compiler/lib/src/resolution/members.dart
index 0cc75e9..d939a65 100644
--- a/pkg/compiler/lib/src/resolution/members.dart
+++ b/pkg/compiler/lib/src/resolution/members.dart
@@ -1131,13 +1131,6 @@
sendStructure = new IsStructure(type);
}
- // GENERIC_METHODS: Method type variables are not reified so we must warn
- // about the error which will occur at runtime.
- if (type is MethodTypeVariableType) {
- reporter.reportWarningMessage(
- node, MessageKind.TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED);
- }
-
registry.registerTypeUse(new TypeUse.isCheck(type));
registry.registerSendStructure(node, sendStructure);
return const NoneResult();
@@ -1152,13 +1145,6 @@
ResolutionDartType type =
resolveTypeAnnotation(typeNode, registerCheckedModeCheck: false);
- // GENERIC_METHODS: Method type variables are not reified, so we must inform
- // the developer about the potentially bug-inducing semantics.
- if (type is MethodTypeVariableType) {
- reporter.reportHintMessage(
- node, MessageKind.TYPE_VARIABLE_FROM_METHOD_CONSIDERED_DYNAMIC);
- }
-
registry.registerTypeUse(new TypeUse.asCast(type));
registry.registerSendStructure(node, new AsStructure(type));
return const NoneResult();
@@ -1927,12 +1913,6 @@
// TODO(johnniwinther): Clean up registration of elements and selectors
// for this case.
} else {
- // GENERIC_METHODS: Method type variables are not reified so we must warn
- // about the error which will occur at runtime.
- if (element.type is MethodTypeVariableType) {
- reporter.reportWarningMessage(
- node, MessageKind.TYPE_VARIABLE_FROM_METHOD_NOT_REIFIED);
- }
semantics = new StaticAccess.typeParameterTypeLiteral(element);
}
diff --git a/pkg/compiler/lib/src/resolved_uri_translator.dart b/pkg/compiler/lib/src/resolved_uri_translator.dart
index 4363775..f40aeb3 100644
--- a/pkg/compiler/lib/src/resolved_uri_translator.dart
+++ b/pkg/compiler/lib/src/resolved_uri_translator.dart
@@ -122,7 +122,10 @@
importingLibrary.canonicalUri.path
.contains('tests/compiler/dart2js_native') ||
importingLibrary.canonicalUri.path
- .contains('tests/compiler/dart2js_extra'));
+ .contains('tests/compiler/dart2js_extra') ||
+ (importingLibrary.canonicalUri.scheme == 'package' &&
+ importingLibrary.canonicalUri.path
+ .startsWith('dart_internal/')));
if (!allowInternalLibraryAccess) {
if (importingLibrary != null) {
diff --git a/pkg/compiler/lib/src/ssa/builder_kernel.dart b/pkg/compiler/lib/src/ssa/builder_kernel.dart
index 8d4c2d4..803a408 100644
--- a/pkg/compiler/lib/src/ssa/builder_kernel.dart
+++ b/pkg/compiler/lib/src/ssa/builder_kernel.dart
@@ -190,9 +190,10 @@
if (target is ir.Procedure) {
if (target.isExternal) {
buildExternalFunctionNode(
- _ensureDefaultArgumentValues(target.function));
+ targetElement, _ensureDefaultArgumentValues(target.function));
} else {
- buildFunctionNode(_ensureDefaultArgumentValues(target.function));
+ buildFunctionNode(
+ targetElement, _ensureDefaultArgumentValues(target.function));
}
} else if (target is ir.Field) {
if (handleConstantField(targetElement, registry, closedWorld)) {
@@ -204,9 +205,11 @@
}
buildField(target);
} else if (target is ir.FunctionExpression) {
- buildFunctionNode(_ensureDefaultArgumentValues(target.function));
+ buildFunctionNode(
+ targetElement, _ensureDefaultArgumentValues(target.function));
} else if (target is ir.FunctionDeclaration) {
- buildFunctionNode(_ensureDefaultArgumentValues(target.function));
+ buildFunctionNode(
+ targetElement, _ensureDefaultArgumentValues(target.function));
} else {
throw 'No case implemented to handle target: '
'$target for $targetElement';
@@ -215,7 +218,7 @@
case MemberKind.constructor:
ir.Constructor constructor = definition.node;
_ensureDefaultArgumentValues(constructor.function);
- buildConstructor(constructor);
+ buildConstructor(targetElement, constructor);
break;
case MemberKind.constructorBody:
ir.Constructor constructor = definition.node;
@@ -284,37 +287,37 @@
return _elementMap.getFieldConstantValue(field);
}
- void buildField(ir.Field field) {
- _inLazyInitializerExpression = field.isStatic;
- openFunction();
- if (field.isInstanceMember && options.enableTypeAssertions) {
+ void buildField(ir.Field node) {
+ _inLazyInitializerExpression = node.isStatic;
+ FieldEntity field = _elementMap.getMember(node);
+ openFunction(field);
+ if (node.isInstanceMember && options.enableTypeAssertions) {
HInstruction thisInstruction = localsHandler.readThis(
- sourceInformation: _sourceInformationBuilder.buildGet(field));
+ sourceInformation: _sourceInformationBuilder.buildGet(node));
// Use dynamic type because the type computed by the inferrer is
// narrowed to the type annotation.
- FieldEntity fieldEntity = _elementMap.getMember(field);
HInstruction parameter =
- new HParameterValue(fieldEntity, commonMasks.dynamicType);
+ new HParameterValue(field, commonMasks.dynamicType);
// Add the parameter as the last instruction of the entry block.
// If the method is intercepted, we want the actual receiver
// to be the first parameter.
graph.entry.addBefore(graph.entry.last, parameter);
HInstruction value = typeBuilder.potentiallyCheckOrTrustType(
- parameter, _getDartTypeIfValid(field.type));
- add(new HFieldSet(fieldEntity, thisInstruction, value));
+ parameter, _getDartTypeIfValid(node.type));
+ add(new HFieldSet(field, thisInstruction, value));
} else {
- if (field.initializer != null) {
- field.initializer.accept(this);
+ if (node.initializer != null) {
+ node.initializer.accept(this);
HInstruction fieldValue = pop();
HInstruction checkInstruction = typeBuilder.potentiallyCheckOrTrustType(
- fieldValue, _getDartTypeIfValid(field.type));
+ fieldValue, _getDartTypeIfValid(node.type));
stack.add(checkInstruction);
} else {
stack.add(graph.addConstantNull(closedWorld));
}
HInstruction value = pop();
closeAndGotoExit(
- new HReturn(value, _sourceInformationBuilder.buildReturn(field)));
+ new HReturn(value, _sourceInformationBuilder.buildReturn(node)));
}
closeFunction();
}
@@ -344,16 +347,20 @@
/// parameters. If the class has type parameters but does not need them, bind
/// to `dynamic` (represented as `null`) so the bindings are available for
/// building types up the inheritance chain of generative constructors.
- void _addClassTypeVariablesIfNeeded(ir.Member constructor) {
- ir.Class enclosing = constructor.enclosingClass;
- ClassEntity cls = _elementMap.getClass(enclosing);
- bool needParameters;
- enclosing.typeParameters.forEach((ir.TypeParameter typeParameter) {
- TypeVariableType typeVariableType =
- _elementMap.getDartType(new ir.TypeParameterType(typeParameter));
+ void _addClassTypeVariablesIfNeeded(MemberEntity member) {
+ if (!member.isConstructor && member is! ConstructorBodyEntity) {
+ return;
+ }
+ ClassEntity cls = member.enclosingClass;
+ InterfaceType thisType = _elementMap.elementEnvironment.getThisType(cls);
+ if (thisType.typeArguments.isEmpty) {
+ return;
+ }
+ bool needsRti = rtiNeed.classNeedsRti(cls);
+ thisType.typeArguments.forEach((DartType _typeVariable) {
+ TypeVariableType typeVariableType = _typeVariable;
HInstruction param;
- needParameters ??= rtiNeed.classNeedsRti(cls);
- if (needParameters) {
+ if (needsRti) {
param = addParameter(typeVariableType.element, commonMasks.nonNullType);
} else {
// Unused, so bind to `dynamic`.
@@ -391,34 +398,30 @@
/// implication is that a class cannot be extended or mixed-in twice. If we in
/// future support repeated uses of a mixin class, we should do so by cloning
/// the mixin class in the Kernel input.
- void buildConstructor(ir.Constructor constructor) {
+ void buildConstructor(ConstructorEntity constructor, ir.Constructor node) {
SourceInformation sourceInformation =
- _sourceInformationBuilder.buildCreate(constructor);
- ir.Class constructedClass = constructor.enclosingClass;
+ _sourceInformationBuilder.buildCreate(node);
+ ClassEntity cls = constructor.enclosingClass;
if (_inliningStack.isEmpty) {
- openFunction(constructor.function);
+ openFunction(constructor, node.function);
}
- _addClassTypeVariablesIfNeeded(constructor);
- _potentiallyAddFunctionParameterTypeChecks(constructor.function);
// [fieldValues] accumulates the field initializer values, which may be
// overwritten by initializer-list initializers.
- Map<FieldEntity, HInstruction> fieldValues = <FieldEntity, HInstruction>{};
- List<ir.Constructor> constructorChain = <ir.Constructor>[];
- _buildInitializers(constructor, constructorChain, fieldValues);
+ ConstructorData constructorData = new ConstructorData();
+ _buildInitializers(node, constructorData);
List<HInstruction> constructorArguments = <HInstruction>[];
// Doing this instead of fieldValues.forEach because we haven't defined the
// order of the arguments here. We can define that with JElements.
- ClassEntity cls = _elementMap.getClass(constructedClass);
bool isCustomElement = nativeData.isNativeOrExtendsNative(cls) &&
!nativeData.isJsInteropClass(cls);
InterfaceType thisType = _elementMap.elementEnvironment.getThisType(cls);
List<FieldEntity> fields = <FieldEntity>[];
_worldBuilder.forEachInstanceField(cls,
(ClassEntity enclosingClass, FieldEntity member) {
- var value = fieldValues[member];
+ HInstruction value = constructorData.fieldValues[member];
if (value == null) {
assert(isCustomElement || reporter.hasReportedError,
'No initializer value for field ${member}');
@@ -431,6 +434,10 @@
}
});
+ addImplicitInstantiation(thisType);
+ List<DartType> instantiatedTypes =
+ new List<InterfaceType>.from(currentImplicitInstantiations);
+
HInstruction newObject;
if (isCustomElement) {
// Bulk assign to the initialized fields.
@@ -450,10 +457,11 @@
// Read the values of the type arguments and create a HTypeInfoExpression
// to set on the newly create object.
List<HInstruction> typeArguments = <HInstruction>[];
- for (ir.DartType typeParameter
- in constructedClass.thisType.typeArguments) {
- HInstruction argument = localsHandler.readLocal(localsHandler
- .getTypeVariableAsLocal(_elementMap.getDartType(typeParameter)));
+ InterfaceType thisType =
+ _elementMap.elementEnvironment.getThisType(cls);
+ for (DartType typeVariable in thisType.typeArguments) {
+ HInstruction argument = localsHandler
+ .readLocal(localsHandler.getTypeVariableAsLocal(typeVariable));
typeArguments.add(argument);
}
@@ -468,15 +476,15 @@
newObject = new HCreate(cls, constructorArguments,
new TypeMask.nonNullExact(cls, closedWorld), sourceInformation,
- instantiatedTypes: <InterfaceType>[thisType],
- hasRtiInput: hasRtiInput);
+ instantiatedTypes: instantiatedTypes, hasRtiInput: hasRtiInput);
add(newObject);
}
+ removeImplicitInstantiation(thisType);
HInstruction interceptor;
// Generate calls to the constructor bodies.
- for (ir.Constructor body in constructorChain.reversed) {
+ for (ir.Constructor body in constructorData.constructorChain.reversed) {
if (_isEmptyStatement(body.function.body)) continue;
List<HInstruction> bodyCallInputs = <HInstruction>[];
@@ -492,9 +500,9 @@
// Pass uncaptured arguments first, captured arguments in a box, then type
// arguments.
- ConstructorEntity constructorElement = _elementMap.getConstructor(body);
+ ConstructorEntity inlinedConstructor = _elementMap.getConstructor(body);
- inlinedFrom(constructorElement, () {
+ inlinedFrom(inlinedConstructor, () {
void handleParameter(ir.VariableDeclaration node) {
Local parameter = localsMap.getLocalVariable(node);
// If [parameter] is boxed, it will be a field in the box passed as
@@ -513,20 +521,20 @@
// If there are locals that escape (i.e. mutated in closures), we pass the
// box to the constructor.
CapturedScope scopeData =
- closureDataLookup.getCapturedScope(constructorElement);
+ closureDataLookup.getCapturedScope(inlinedConstructor);
if (scopeData.requiresContextBox) {
bodyCallInputs.add(localsHandler.readLocal(scopeData.context));
}
// Pass type arguments.
- ir.Class currentClass = body.enclosingClass;
- if (closedWorld.rtiNeed
- .classNeedsRti(_elementMap.getClass(currentClass))) {
- for (ir.DartType typeParameter
- in currentClass.thisType.typeArguments) {
- HInstruction argument = localsHandler.readLocal(
- localsHandler.getTypeVariableAsLocal(
- _elementMap.getDartType(typeParameter)));
+ ClassEntity inlinedConstructorClass = inlinedConstructor.enclosingClass;
+ if (closedWorld.rtiNeed.classNeedsRti(inlinedConstructorClass)) {
+ InterfaceType thisType = _elementMap.elementEnvironment
+ .getThisType(inlinedConstructorClass);
+ for (DartType typeVariable in thisType.typeArguments) {
+ DartType result = localsHandler.substInContext(typeVariable);
+ HInstruction argument =
+ typeBuilder.analyzeTypeArgument(result, sourceElement);
bodyCallInputs.add(argument);
}
}
@@ -534,15 +542,12 @@
ConstructorBodyEntity constructorBody =
_elementMap.getConstructorBody(body);
if (!isCustomElement && // TODO(13836): Fix inlining.
- _tryInlineMethod(constructorBody, null, null, bodyCallInputs,
- constructor, sourceInformation)) {
+ _tryInlineMethod(constructorBody, null, null, bodyCallInputs, node,
+ sourceInformation)) {
pop();
} else {
- _invokeConstructorBody(
- body,
- bodyCallInputs,
- _sourceInformationBuilder
- .buildDeclaration(_elementMap.getMember(constructor)));
+ _invokeConstructorBody(body, bodyCallInputs,
+ _sourceInformationBuilder.buildDeclaration(constructor));
}
});
}
@@ -584,10 +589,35 @@
/// Collects the values for field initializers for the direct fields of
/// [clazz].
- void _collectFieldValues(
- ir.Class clazz, Map<FieldEntity, HInstruction> fieldValues) {
+ void _collectFieldValues(ir.Class clazz, ConstructorData constructorData) {
+ void ensureTypeVariablesForInitializers(ClassEntity enclosingClass) {
+ if (!constructorData.includedClasses.add(enclosingClass)) return;
+ if (rtiNeed.classNeedsRti(enclosingClass)) {
+ // If [enclosingClass] needs RTI, we have to give a value to its type
+ // parameters. For a super constructor call, the type is the supertype
+ // of current class. For a redirecting constructor, the type is the
+ // current type. [LocalsHandler.substInContext] takes care of both.
+ InterfaceType thisType =
+ _elementMap.elementEnvironment.getThisType(enclosingClass);
+ InterfaceType type = localsHandler.substInContext(thisType);
+ List<DartType> arguments = type.typeArguments;
+ List<DartType> typeVariables = thisType.typeArguments;
+ assert(arguments.length == typeVariables.length);
+ Iterator<DartType> variables = typeVariables.iterator;
+ type.typeArguments.forEach((DartType argument) {
+ variables.moveNext();
+ TypeVariableType typeVariable = variables.current;
+ localsHandler.updateLocal(
+ localsHandler.getTypeVariableAsLocal(typeVariable),
+ typeBuilder.analyzeTypeArgument(argument, sourceElement));
+ });
+ }
+ }
+
ClassEntity cls = _elementMap.getClass(clazz);
_worldBuilder.forEachDirectInstanceField(cls, (FieldEntity field) {
+ ensureTypeVariablesForInitializers(field.enclosingClass);
+
MemberDefinition definition = _elementMap.getMemberDefinition(field);
ir.Field node;
switch (definition.kind) {
@@ -601,7 +631,8 @@
// Unassigned fields of native classes are not initialized to
// prevent overwriting pre-initialized native properties.
if (!nativeData.isNativeOrExtendsNative(cls)) {
- fieldValues[field] = graph.addConstantNull(closedWorld);
+ constructorData.fieldValues[field] =
+ graph.addConstantNull(closedWorld);
}
} else if (node.initializer is! ir.NullLiteral ||
!nativeData.isNativeClass(cls)) {
@@ -611,7 +642,7 @@
// initializer.
inlinedFrom(field, () {
node.initializer.accept(this);
- fieldValues[field] = pop();
+ constructorData.fieldValues[field] = pop();
});
}
});
@@ -623,37 +654,35 @@
/// Collects field initializers all the way up the inheritance chain.
void _buildInitializers(
- ir.Constructor constructor,
- List<ir.Constructor> constructorChain,
- Map<FieldEntity, HInstruction> fieldValues) {
+ ir.Constructor constructor, ConstructorData constructorData) {
assert(
_elementMap.getConstructor(constructor) == localsMap.currentMember,
failedAt(
localsMap.currentMember,
'Expected ${localsMap.currentMember} '
'but found ${_elementMap.getConstructor(constructor)}.'));
- constructorChain.add(constructor);
+ constructorData.constructorChain.add(constructor);
if (!isRedirectingConstructor(constructor)) {
// Compute values for field initializers, but only if this is not a
// redirecting constructor, since the target will compute the fields.
- _collectFieldValues(constructor.enclosingClass, fieldValues);
+ _collectFieldValues(constructor.enclosingClass, constructorData);
}
var foundSuperOrRedirectCall = false;
for (var initializer in constructor.initializers) {
if (initializer is ir.FieldInitializer) {
initializer.value.accept(this);
- fieldValues[_elementMap.getField(initializer.field)] = pop();
+ constructorData.fieldValues[_elementMap.getField(initializer.field)] =
+ pop();
} else if (initializer is ir.SuperInitializer) {
assert(!foundSuperOrRedirectCall);
foundSuperOrRedirectCall = true;
- _inlineSuperInitializer(
- initializer, constructorChain, fieldValues, constructor);
+ _inlineSuperInitializer(initializer, constructorData, constructor);
} else if (initializer is ir.RedirectingInitializer) {
assert(!foundSuperOrRedirectCall);
foundSuperOrRedirectCall = true;
_inlineRedirectingInitializer(
- initializer, constructorChain, fieldValues, constructor);
+ initializer, constructorData, constructor);
} else if (initializer is ir.LocalInitializer) {
// LocalInitializer is like a let-expression that is in scope for the
// rest of the initializers.
@@ -724,33 +753,11 @@
return builtArguments;
}
- /// Creates localsHandler bindings for type parameters of a Supertype.
- void _bindSupertypeTypeParameters(ir.Supertype supertype) {
- ir.Class cls = supertype.classNode;
- var parameters = cls.typeParameters;
- var arguments = supertype.typeArguments;
- assert(arguments.length == parameters.length);
-
- for (int i = 0; i < parameters.length; i++) {
- ir.DartType argument = arguments[i];
- ir.TypeParameter parameter = parameters[i];
-
- localsHandler.updateLocal(
- localsHandler.getTypeVariableAsLocal(
- _elementMap.getDartType(new ir.TypeParameterType(parameter))),
- typeBuilder.analyzeTypeArgument(
- _elementMap.getDartType(argument), sourceElement));
- }
- }
-
/// Inlines the given redirecting [constructor]'s initializers by collecting
/// its field values and building its constructor initializers. We visit super
/// constructors all the way up to the [Object] constructor.
- void _inlineRedirectingInitializer(
- ir.RedirectingInitializer initializer,
- List<ir.Constructor> constructorChain,
- Map<FieldEntity, HInstruction> fieldValues,
- ir.Constructor caller) {
+ void _inlineRedirectingInitializer(ir.RedirectingInitializer initializer,
+ ConstructorData constructorData, ir.Constructor caller) {
var superOrRedirectConstructor = initializer.target;
var arguments = _normalizeAndBuildArguments(
superOrRedirectConstructor.function, initializer.arguments);
@@ -762,17 +769,14 @@
// effective target, so we don't do it here.
_inlineSuperOrRedirectCommon(initializer, superOrRedirectConstructor,
- arguments, constructorChain, fieldValues, caller);
+ arguments, constructorData, caller);
}
/// Inlines the given super [constructor]'s initializers by collecting its
/// field values and building its constructor initializers. We visit super
/// constructors all the way up to the [Object] constructor.
- void _inlineSuperInitializer(
- ir.SuperInitializer initializer,
- List<ir.Constructor> constructorChain,
- Map<FieldEntity, HInstruction> fieldValues,
- ir.Constructor caller) {
+ void _inlineSuperInitializer(ir.SuperInitializer initializer,
+ ConstructorData constructorData, ir.Constructor caller) {
var target = initializer.target;
var arguments =
_normalizeAndBuildArguments(target.function, initializer.arguments);
@@ -781,40 +785,31 @@
ir.Supertype supertype = callerClass.supertype;
if (callerClass.mixedInType != null) {
- _bindSupertypeTypeParameters(callerClass.mixedInType);
- _collectFieldValues(callerClass.mixedInType.classNode, fieldValues);
+ _collectFieldValues(callerClass.mixedInType.classNode, constructorData);
}
// The class of the super-constructor may not be the supertype class. In
// this case, we must go up the class hierarchy until we reach the class
// containing the super-constructor.
while (supertype.classNode != target.enclosingClass) {
- _bindSupertypeTypeParameters(supertype);
-
- if (supertype.classNode.mixedInType != null) {
- _bindSupertypeTypeParameters(supertype.classNode.mixedInType);
- }
-
// Fields from unnamed mixin application classes (ie Object&Foo) get
// "collected" with the regular supertype fields, so we must bind type
// parameters from both the supertype and the supertype's mixin classes
// before collecting the field values.
- _collectFieldValues(supertype.classNode, fieldValues);
+ _collectFieldValues(supertype.classNode, constructorData);
supertype = supertype.classNode.supertype;
}
- _bindSupertypeTypeParameters(supertype);
supertype = supertype.classNode.supertype;
_inlineSuperOrRedirectCommon(
- initializer, target, arguments, constructorChain, fieldValues, caller);
+ initializer, target, arguments, constructorData, caller);
}
void _inlineSuperOrRedirectCommon(
ir.Initializer initializer,
ir.Constructor constructor,
List<HInstruction> arguments,
- List<ir.Constructor> constructorChain,
- Map<FieldEntity, HInstruction> fieldValues,
+ ConstructorData constructorData,
ir.Constructor caller) {
var index = 0;
@@ -841,38 +836,30 @@
localsHandler.scopeInfo = newScopeInfo;
localsHandler.enterScope(closureDataLookup.getCapturedScope(element),
_sourceInformationBuilder.buildDeclaration(element));
- _buildInitializers(constructor, constructorChain, fieldValues);
+ _buildInitializers(constructor, constructorData);
});
localsHandler.scopeInfo = oldScopeInfo;
}
/// Builds generative constructor body.
void buildConstructorBody(ir.Constructor constructor) {
- openFunction(constructor.function);
- _addClassTypeVariablesIfNeeded(constructor);
- _potentiallyAddFunctionParameterTypeChecks(constructor.function);
+ openFunction(
+ _elementMap.getConstructorBody(constructor), constructor.function);
constructor.function.body.accept(this);
closeFunction();
}
/// Builds a SSA graph for FunctionNodes, found in FunctionExpressions and
/// Procedures.
- void buildFunctionNode(ir.FunctionNode functionNode) {
- openFunction(functionNode);
- ir.TreeNode parent = functionNode.parent;
- if (parent is ir.Procedure && parent.kind == ir.ProcedureKind.Factory) {
- _addClassTypeVariablesIfNeeded(parent);
- }
- _potentiallyAddFunctionParameterTypeChecks(functionNode);
+ void buildFunctionNode(
+ FunctionEntity function, ir.FunctionNode functionNode) {
+ openFunction(function, functionNode);
// If [functionNode] is `operator==` we explicitly add a null check at the
// beginning of the method. This is to avoid having call sites do the null
// check.
- if (parent is ir.Procedure &&
- parent.kind == ir.ProcedureKind.Operator &&
- parent.name.name == '==') {
- FunctionEntity method = _elementMap.getMethod(parent);
- if (!_commonElements.operatorEqHandlesNullArgument(method)) {
+ if (function.name == '==') {
+ if (!_commonElements.operatorEqHandlesNullArgument(function)) {
handleIf(
visitCondition: () {
HParameterValue parameter = parameters.values.first;
@@ -921,14 +908,12 @@
}
/// Builds a SSA graph for FunctionNodes of external methods.
- void buildExternalFunctionNode(ir.FunctionNode functionNode) {
+ void buildExternalFunctionNode(
+ FunctionEntity function, ir.FunctionNode functionNode) {
+ // TODO(johnniwinther): Non-js-interop external functions should
+ // throw a runtime error.
assert(functionNode.body == null);
- openFunction(functionNode);
- ir.TreeNode parent = functionNode.parent;
- if (parent is ir.Procedure && parent.kind == ir.ProcedureKind.Factory) {
- _addClassTypeVariablesIfNeeded(parent);
- }
- _potentiallyAddFunctionParameterTypeChecks(functionNode);
+ openFunction(function, functionNode);
if (closedWorld.nativeData.isNativeMember(targetElement)) {
nativeEmitter.nativeMethods.add(targetElement);
@@ -1007,7 +992,7 @@
}
}
- void openFunction([ir.FunctionNode function]) {
+ void openFunction(MemberEntity member, [ir.FunctionNode function]) {
Map<Local, TypeMask> parameterMap = <Local, TypeMask>{};
if (function != null) {
void handleParameter(ir.VariableDeclaration node) {
@@ -1036,6 +1021,13 @@
close(new HGoto()).addSuccessor(block);
open(block);
+
+ _addClassTypeVariablesIfNeeded(member);
+ if (function != null) {
+ _potentiallyAddFunctionParameterTypeChecks(function);
+ }
+ _insertTraceCall(member);
+ _insertCoverageCall(member);
}
void closeFunction() {
@@ -1101,6 +1093,7 @@
@override
void visitBlock(ir.Block block) {
assert(!isAborted());
+ if (!isReachable) return; // This can only happen when inlining.
for (ir.Statement statement in block.statements) {
statement.accept(this);
if (!isReachable) {
@@ -2195,7 +2188,10 @@
localsHandler = new LocalsHandler.from(savedLocals);
buildSwitchCase(switchCase);
if (!isAborted() &&
- switchCase == switchCases.last &&
+ // TODO(johnniwinther): Reinsert this if `isReachable` is no longer
+ // set to `false` when `_tryInlineMethod` sees an always throwing
+ // method.
+ //switchCase == switchCases.last &&
!isDefaultCase(switchCase)) {
// If there is no default, we will add one later to avoid
// the critical edge. So we generate a break statement to make
@@ -4016,6 +4012,7 @@
TypeMask typeMask = new TypeMask.nonNullExact(cls, closedWorld);
InterfaceType instanceType = _elementMap.createInterfaceType(
target.enclosingClass, node.arguments.types);
+ instanceType = localsHandler.substInContext(instanceType);
if (_checkAllTypeVariableBounds(
constructor, instanceType, sourceInformation)) {
@@ -4038,7 +4035,6 @@
if (closedWorld.rtiNeed.classNeedsRti(cls)) {
_addTypeArguments(arguments, node.arguments, sourceInformation);
}
- instanceType = localsHandler.substInContext(instanceType);
addImplicitInstantiation(instanceType);
_pushStaticInvocation(constructor, arguments, typeMask,
sourceInformation: sourceInformation, instanceType: instanceType);
@@ -4266,7 +4262,6 @@
* Try to inline [element] within the correct context of the builder. The
* insertion point is the state of the builder.
*/
- // TODO(redemption): Use this.
bool _tryInlineMethod(
FunctionEntity function,
Selector selector,
@@ -4275,9 +4270,8 @@
ir.Node currentNode,
SourceInformation sourceInformation,
{InterfaceType instanceType}) {
- // TODO(johnniwinther,sra): Remove this when inlining is more mature.
- if (function.library.canonicalUri.scheme == 'dart') {
- // Temporarily disable inlining of platform libraries.
+ if (function.isExternal) {
+ // Don't inline external methods; these should just fail at runtime.
return false;
}
@@ -4336,6 +4330,10 @@
// so we should not query for its type.
if (function is! ConstructorBodyEntity) {
if (globalInferenceResults.resultOfMember(function).throwsAlways) {
+ // TODO(johnniwinther): It seems wrong to set `isReachable` to `false`
+ // since we are _not_ going to inline [function]. This has
+ // implications in switch cases where we might need to insert a
+ // `break` that was skipped due to `isReachable` being `false`.
isReachable = false;
return false;
}
@@ -4684,7 +4682,7 @@
MemberDefinition definition = _elementMap.getMemberDefinition(function);
switch (definition.kind) {
case MemberKind.constructor:
- buildConstructor(definition.node);
+ buildConstructor(function, definition.node);
return;
case MemberKind.constructorBody:
ir.Constructor constructor = definition.node;
@@ -4730,7 +4728,7 @@
return _allInlinedFunctionsCalledOnce && _isFunctionCalledOnce(element);
}
- void _insertTraceCall(FunctionEntity element) {
+ void _insertTraceCall(MemberEntity element) {
if (JavaScriptBackend.TRACE_METHOD == 'console') {
if (element == commonElements.traceHelper) return;
n(e) => e == null ? '' : e.name;
@@ -4742,7 +4740,7 @@
}
}
- void _insertCoverageCall(FunctionEntity element) {
+ void _insertCoverageCall(MemberEntity element) {
if (JavaScriptBackend.TRACE_METHOD == 'post') {
if (element == commonElements.traceHelper) return;
// TODO(sigmund): create a better uuid for elements.
@@ -4756,6 +4754,19 @@
}
}
+/// Data collected to create a constructor.
+class ConstructorData {
+ /// Inlined (super) constructors.
+ final List<ir.Constructor> constructorChain = <ir.Constructor>[];
+
+ /// Initial values for all instance fields.
+ final Map<FieldEntity, HInstruction> fieldValues =
+ <FieldEntity, HInstruction>{};
+
+ /// Classes for which type variables have been prepared.
+ final Set<ClassEntity> includedClasses = new Set<ClassEntity>();
+}
+
class KernelInliningState {
final FunctionEntity function;
final Local oldReturnLocal;
@@ -4798,6 +4809,13 @@
InlineWeeder visitor = new InlineWeeder(maxInliningNodes, allowLoops);
ir.FunctionNode node = getFunctionNode(elementMap, function);
node.accept(visitor);
+ if (function.isConstructor) {
+ MemberDefinition definition = elementMap.getMemberDefinition(function);
+ ir.Node node = definition.node;
+ if (node is ir.Constructor) {
+ node.initializers.forEach((n) => n.accept(visitor));
+ }
+ }
return visitor.tooDifficultReason;
}
@@ -4831,17 +4849,22 @@
}
visitReturnStatement(ir.ReturnStatement node) {
+ if (!registerNode()) return;
if (seenReturn) {
tooDifficultReason = 'code after return';
- } else {
- seenReturn = true;
+ return;
}
+ node.visitChildren(this);
+ seenReturn = true;
}
visitThrow(ir.Throw node) {
+ if (!registerNode()) return;
if (seenReturn) {
tooDifficultReason = 'code after return';
+ return;
}
+ node.visitChildren(this);
}
_handleLoop() {
diff --git a/pkg/compiler/lib/src/ssa/kernel_impact.dart b/pkg/compiler/lib/src/ssa/kernel_impact.dart
index 8853267..9f3166d 100644
--- a/pkg/compiler/lib/src/ssa/kernel_impact.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_impact.dart
@@ -43,7 +43,7 @@
KernelImpactBuilder(this.elementMap, this.currentMember, this.reporter)
: this.impactBuilder =
new ResolutionWorldImpactBuilder('${currentMember.name}') {
- this.classEnsurer = new _ClassEnsurer(this);
+ this.classEnsurer = new _ClassEnsurer(this, this.elementMap.types);
}
CommonElements get commonElements => elementMap.commonElements;
@@ -656,10 +656,13 @@
class _ClassEnsurer extends BaseDartTypeVisitor<dynamic, Null> {
final KernelImpactBuilder builder;
+ final DartTypes types;
+ final seenTypes = new Set<InterfaceType>();
- _ClassEnsurer(this.builder);
+ _ClassEnsurer(this.builder, this.types);
void ensureClassesInType(DartType type) {
+ seenTypes.clear();
type.accept(this, null);
}
@@ -682,10 +685,15 @@
@override
visitInterfaceType(InterfaceType type, _) {
+ if (!seenTypes.add(type)) {
+ return;
+ }
builder.impactBuilder.registerSeenClass(type.element);
type.typeArguments.forEach((t) {
t.accept(this, null);
});
+ var supertype = types.getSupertype(type.element);
+ supertype?.accept(this, null);
}
@override
diff --git a/pkg/compiler/lib/src/ssa/locals_handler.dart b/pkg/compiler/lib/src/ssa/locals_handler.dart
index 5b33fe2..6626095 100644
--- a/pkg/compiler/lib/src/ssa/locals_handler.dart
+++ b/pkg/compiler/lib/src/ssa/locals_handler.dart
@@ -76,7 +76,6 @@
/// Substituted type variables occurring in [type] into the context of
/// [contextClass].
DartType substInContext(DartType type) {
- //DartType input = type;
DartType newType = type;
if (instanceType != null) {
ClassEntity typeContext = DartTypes.getClassContext(newType);
diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart
index fdc4754..767e633 100644
--- a/pkg/compiler/lib/src/ssa/optimize.dart
+++ b/pkg/compiler/lib/src/ssa/optimize.dart
@@ -10,7 +10,6 @@
import '../constants/values.dart';
import '../common_elements.dart' show CommonElements;
import '../elements/entities.dart';
-import '../elements/resolution_types.dart';
import '../elements/types.dart';
import '../js/js.dart' as js;
import '../js_backend/backend.dart';
@@ -1305,7 +1304,7 @@
HInstruction selectTypeArgumentFromObjectCreation(int index)) {
InterfaceType thisType = _closedWorld.dartTypes.getThisType(createdClass);
- HInstruction instructionForTypeVariable(ResolutionTypeVariableType tv) {
+ HInstruction instructionForTypeVariable(TypeVariableType tv) {
return selectTypeArgumentFromObjectCreation(
thisType.typeArguments.indexOf(tv));
}
diff --git a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
index c9bd25e..030011b 100644
--- a/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
+++ b/pkg/dev_compiler/lib/src/analyzer/code_generator.dart
@@ -3078,6 +3078,17 @@
var member = _emitMemberName(name,
isStatic: isStatic, type: type, element: accessor);
+ // A static native element should just forward directly to the
+ // JS type's member.
+ if (isStatic && _isExternal(element)) {
+ var nativeName = getAnnotationName(classElem, isNativeAnnotation);
+ if (nativeName != null) {
+ var memberName = getAnnotationName(element, isJSName) ?? member;
+ return js
+ .call('#.#.#', [_callHelper('global'), nativeName, memberName]);
+ }
+ }
+
// For instance members, we add implicit-this.
// For method tear-offs, we ensure it's a bound method.
if (element is MethodElement &&
diff --git a/pkg/dev_compiler/lib/src/kernel/source_map_printer.dart b/pkg/dev_compiler/lib/src/kernel/source_map_printer.dart
index dafae50..6e47bd9 100644
--- a/pkg/dev_compiler/lib/src/kernel/source_map_printer.dart
+++ b/pkg/dev_compiler/lib/src/kernel/source_map_printer.dart
@@ -54,10 +54,11 @@
if (srcInfo is FileUriNode) {
parentsStack.add(srcInfo);
- if (srcInfo is Procedure || srcInfo is Class) mark = false;
- } else if (srcInfo is Constructor) {
- parentsStack.add(srcInfo.parent);
- mark = false;
+ if (srcInfo is Procedure ||
+ srcInfo is Class ||
+ srcInfo is Constructor) {
+ mark = false;
+ }
}
if (mark && srcInfo is Block) mark = false;
} else {
@@ -94,8 +95,6 @@
if (srcInfo is FileUriNode) {
parentsStack.removeLast();
- } else if (srcInfo is Constructor) {
- parentsStack.removeLast();
}
}
@@ -113,8 +112,14 @@
FileUriNode fileParent = parentsStack.last;
Program p = fileParent.enclosingProgram;
Uri fileUri = fileParent.fileUri;
+ while (fileUri == null && fileParent.parent is FileUriNode) {
+ fileParent = fileParent.parent;
+ fileUri = fileParent.fileUri;
+ }
+ if (fileUri == null) return;
var loc = p.getLocation(fileUri, offset);
+ if (loc == null) return;
_previousLine = _line;
_previousColumn = adjustedColumn;
sourceMap.addLocation(
diff --git a/pkg/dev_compiler/test/sourcemap/ddc_common.dart b/pkg/dev_compiler/test/sourcemap/ddc_common.dart
index 6207547..78c653f 100644
--- a/pkg/dev_compiler/test/sourcemap/ddc_common.dart
+++ b/pkg/dev_compiler/test/sourcemap/ddc_common.dart
@@ -4,16 +4,21 @@
import 'dart:io';
+import 'package:front_end/src/api_unstable/ddc.dart' as fe;
import 'package:path/path.dart' as path;
import 'package:sourcemap_testing/src/annotated_code_helper.dart';
import 'package:sourcemap_testing/src/stacktrace_helper.dart';
-import 'package:testing/testing.dart';
import 'package:sourcemap_testing/src/stepping_helper.dart';
+import 'package:testing/testing.dart';
import 'common.dart';
abstract class DdcRunner {
- ProcessResult runDDC(Uri inputFile, Uri outputFile, Uri outWrapperPath);
+ Future<Null> runDDC(Uri inputFile, Uri outputFile, Uri outWrapperPath);
+}
+
+abstract class WithCompilerState {
+ fe.InitializedCompilerState compilerState;
}
class Compile extends Step<Data, Data, ChainContext> {
@@ -37,7 +42,7 @@
var outputFile = outDirUri.resolve(outputFilename);
var outWrapperPath = outDirUri.resolve("wrapper.js");
- ddcRunner.runDDC(testFile, outputFile, outWrapperPath);
+ await ddcRunner.runDDC(testFile, outputFile, outWrapperPath);
return pass(data);
}
@@ -66,7 +71,8 @@
Future<bool> _compile(String input, String output) async {
var outWrapperPath = _getWrapperPathFromDirectoryFile(new Uri.file(input));
- ddcRunner.runDDC(new Uri.file(input), new Uri.file(output), outWrapperPath);
+ await ddcRunner.runDDC(
+ new Uri.file(input), new Uri.file(output), outWrapperPath);
return true;
}
diff --git a/pkg/dev_compiler/test/sourcemap/sourcemaps_ddc_suite.dart b/pkg/dev_compiler/test/sourcemap/sourcemaps_ddc_suite.dart
index 513b64b..684aadc 100644
--- a/pkg/dev_compiler/test/sourcemap/sourcemaps_ddc_suite.dart
+++ b/pkg/dev_compiler/test/sourcemap/sourcemaps_ddc_suite.dart
@@ -4,6 +4,7 @@
import 'dart:io';
+import 'package:dev_compiler/src/analyzer/command.dart';
import 'package:testing/testing.dart';
import 'common.dart';
@@ -37,7 +38,7 @@
const RunDdc([this.debugging = false]);
- ProcessResult runDDC(Uri inputFile, Uri outputFile, Uri outWrapperFile) {
+ Future<Null> runDDC(Uri inputFile, Uri outputFile, Uri outWrapperFile) async {
Uri outDir = outputFile.resolve(".");
String outputFilename = outputFile.pathSegments.last;
@@ -47,11 +48,8 @@
File ddcSdkSummary = findInOutDir("gen/utils/dartdevc/ddc_sdk.sum");
var ddc = getDdcDir().uri.resolve("bin/dartdevc.dart");
- if (!new File.fromUri(ddc).existsSync())
- throw "Couldn't find 'bin/dartdevc.dart'";
List<String> args = <String>[
- ddc.toFilePath(),
"--modules=es6",
"--dart-sdk-summary=${ddcSdkSummary.path}",
"--library-root",
@@ -62,12 +60,11 @@
outputFile.toFilePath(),
inputFile.toFilePath()
];
- ProcessResult runResult = Process.runSync(dartExecutable, args);
- if (runResult.exitCode != 0) {
- print(runResult.stderr);
- print(runResult.stdout);
- throw "Exit code: ${runResult.exitCode} from ddc when running "
- "$dartExecutable "
+
+ var exitCode = compile(args);
+ if (exitCode != 0) {
+ throw "Exit code: $exitCode from ddc when running something like "
+ "$dartExecutable ${ddc.toFilePath()} "
"${args.reduce((value, element) => '$value "$element"')}";
}
@@ -85,8 +82,6 @@
inputFileName.substring(0, inputFileName.lastIndexOf("."));
new File.fromUri(outWrapperFile).writeAsStringSync(
getWrapperContent(jsSdkPath, inputFileNameNoExt, outputFilename));
-
- return runResult;
}
}
diff --git a/pkg/dev_compiler/test/sourcemap/sourcemaps_ddk_suite.dart b/pkg/dev_compiler/test/sourcemap/sourcemaps_ddk_suite.dart
index 7bc4e79..9ce07ce 100644
--- a/pkg/dev_compiler/test/sourcemap/sourcemaps_ddk_suite.dart
+++ b/pkg/dev_compiler/test/sourcemap/sourcemaps_ddk_suite.dart
@@ -2,8 +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.
+import 'dart:async';
import 'dart:io';
+import 'package:dev_compiler/src/kernel/command.dart';
+import 'package:front_end/src/api_unstable/ddc.dart' as fe;
+import 'package:sourcemap_testing/src/stepping_helper.dart';
import 'package:testing/testing.dart';
import 'common.dart';
@@ -14,8 +18,11 @@
return new SourceMapContext(environment);
}
-class SourceMapContext extends ChainContextWithCleanupHelper {
+class SourceMapContext extends ChainContextWithCleanupHelper
+ implements WithCompilerState {
final Map<String, String> environment;
+ fe.InitializedCompilerState compilerState;
+
SourceMapContext(this.environment);
List<Step> _steps;
@@ -23,9 +30,9 @@
List<Step> get steps {
return _steps ??= <Step>[
const Setup(),
- new Compile(new RunDdc(environment.containsKey("debug"))),
+ new Compile(new RunDdc(this, debugging())),
const StepWithD8(),
- new CheckSteps(environment.containsKey("debug")),
+ new CheckSteps(debugging()),
];
}
@@ -33,11 +40,12 @@
}
class RunDdc implements DdcRunner {
+ final WithCompilerState context;
final bool debugging;
- const RunDdc([this.debugging = false]);
+ const RunDdc(this.context, [this.debugging = false]);
- ProcessResult runDDC(Uri inputFile, Uri outputFile, Uri outWrapperFile) {
+ Future<Null> runDDC(Uri inputFile, Uri outputFile, Uri outWrapperFile) async {
Uri outDir = outputFile.resolve(".");
String outputFilename = outputFile.pathSegments.last;
@@ -47,23 +55,30 @@
File ddcSdkSummary = findInOutDir("gen/utils/dartdevc/ddc_sdk.dill");
var ddc = getDdcDir().uri.resolve("bin/dartdevk.dart");
- if (!new File.fromUri(ddc).existsSync())
- throw "Couldn't find 'bin/dartdevk.dart'";
List<String> args = <String>[
- ddc.toFilePath(),
+ "--packages=${sdkRoot.uri.resolve(".packages").toFilePath()}",
"--modules=es6",
"--dart-sdk-summary=${ddcSdkSummary.path}",
"-o",
outputFile.toFilePath(),
inputFile.toFilePath()
];
- ProcessResult runResult = Process.runSync(dartExecutable, args);
- if (runResult.exitCode != 0) {
- print(runResult.stderr);
- print(runResult.stdout);
- throw "Exit code: ${runResult.exitCode} from ddc when running "
- "$dartExecutable "
+
+ bool succeeded = false;
+ try {
+ var result = await compile(args, compilerState: context.compilerState);
+ context.compilerState = result.compilerState;
+ succeeded = result.result;
+ } catch (e, s) {
+ print('Unhandled exception:');
+ print(e);
+ print(s);
+ }
+
+ if (!succeeded) {
+ throw "Error from ddc when executing with something like "
+ "$dartExecutable ${ddc.toFilePath()} "
"${args.reduce((value, element) => '$value "$element"')}";
}
@@ -81,8 +96,6 @@
inputFileName.substring(0, inputFileName.lastIndexOf("."));
new File.fromUri(outWrapperFile).writeAsStringSync(
getWrapperContent(jsSdkPath, inputFileNameNoExt, outputFilename));
-
- return runResult;
}
}
diff --git a/pkg/dev_compiler/test/sourcemap/stacktrace_ddk_suite.dart b/pkg/dev_compiler/test/sourcemap/stacktrace_ddk_suite.dart
index 43f05df..5e5b50a 100644
--- a/pkg/dev_compiler/test/sourcemap/stacktrace_ddk_suite.dart
+++ b/pkg/dev_compiler/test/sourcemap/stacktrace_ddk_suite.dart
@@ -1,3 +1,4 @@
+import 'package:front_end/src/api_unstable/ddc.dart' as fe;
import 'package:testing/testing.dart';
import 'common.dart';
@@ -9,13 +10,20 @@
return new StackTraceContext();
}
-class StackTraceContext extends ChainContextWithCleanupHelper {
- final List<Step> steps = <Step>[
- const Setup(),
- const SetCwdToSdkRoot(),
- const TestStackTrace(
- const ddk.RunDdc(false), "ddk.", const ["ddk.", "ddc."]),
- ];
+class StackTraceContext extends ChainContextWithCleanupHelper
+ implements WithCompilerState {
+ fe.InitializedCompilerState compilerState;
+
+ List<Step> _steps;
+
+ List<Step> get steps {
+ return _steps ??= <Step>[
+ const Setup(),
+ const SetCwdToSdkRoot(),
+ new TestStackTrace(
+ new ddk.RunDdc(this, false), "ddk.", const ["ddk.", "ddc."]),
+ ];
+ }
}
main(List<String> arguments) => runMe(arguments, createContext, "testing.json");
diff --git a/pkg/dev_compiler/tool/build_sdk.sh b/pkg/dev_compiler/tool/build_sdk.sh
index b25f30a..62c012d 100755
--- a/pkg/dev_compiler/tool/build_sdk.sh
+++ b/pkg/dev_compiler/tool/build_sdk.sh
@@ -6,10 +6,10 @@
echo "*** Patching SDK"
{ # Try
dart -c tool/patch_sdk.dart ../.. tool/input_sdk gen/patched_sdk \
- > tool/sdk_expected_errors.txt
+ > gen/sdk_analyzer_errors.txt
} || { # Catch
# Show errors if the sdk didn't compile.
- cat tool/sdk_expected_errors.txt
+ cat gen/sdk_analyzer_errors.txt
exit 1
}
@@ -31,9 +31,9 @@
-o gen/sdk/common/dart_sdk.js \
--modules=legacy \
-o gen/sdk/legacy/dart_sdk.js \
- "$@" > tool/sdk_expected_errors.txt
+ "$@" > gen/sdk_analyzer_errors.txt
} || { # Catch
# Show errors if the sdk didn't compile.
- cat tool/sdk_expected_errors.txt
+ cat gen/sdk_analyzer_errors.txt
exit 1
}
diff --git a/pkg/dev_compiler/tool/ddc b/pkg/dev_compiler/tool/ddc
index 1caca36..1d30ae3 100755
--- a/pkg/dev_compiler/tool/ddc
+++ b/pkg/dev_compiler/tool/ddc
@@ -29,7 +29,7 @@
fi
if [ "$KERNEL" = true ]; then
- dart -c $DDC_PATH/bin/dartdevk.dart \
+ dart -c $DDC_PATH/bin/dartdevk.dart --modules=node \
-o $BASENAME.js $*
else
dart -c $DDC_PATH/bin/dartdevc.dart --modules=node --library-root=$LIBROOT \
diff --git a/pkg/dev_compiler/tool/ddw b/pkg/dev_compiler/tool/ddw
index 8d2442f..9169c84 100755
--- a/pkg/dev_compiler/tool/ddw
+++ b/pkg/dev_compiler/tool/ddw
@@ -30,7 +30,7 @@
fi
if [ "$KERNEL" = true ]; then
- dart -c $DDC_PATH/bin/dartdevk.dart \
+ dart -c $DDC_PATH/bin/dartdevk.dart --modules=node \
-o $BASENAME.js $*
else
dart -c $DDC_PATH/bin/dartdevc.dart --modules=node --library-root=$LIBROOT \
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 133f070..2955ef8 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
@@ -327,6 +327,14 @@
jsType, _setterSig, JS('', '() => #[#]', dartExtType, _setterSig));
}
+/// Apply the previously registered extension to the type of [nativeObject].
+/// This is intended for types that are not available to polyfill at startup.
+applyExtension(name, nativeObject) {
+ var dartExtType = JS('', '#.get(#)', _extensionMap, name);
+ var jsType = JS('', '#.constructor', nativeObject);
+ _applyExtension(jsType, dartExtType);
+}
+
/// Apply all registered extensions to a window. This is intended for
/// different frames, where registrations need to be reapplied.
applyAllExtensions(global) {
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart
index 6fdf32f..dc2d82e 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/generators.dart
@@ -156,6 +156,7 @@
() => {
this.isAdding = false;
this.scheduleGenerator();
+ if (!this.isScheduled) this.isSuspendedAtYield = true;
}, { onError: (e, s) => this.throwError(e, s) });
}
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 92dddf2..e85d898 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
@@ -94,7 +94,7 @@
var raw = _rawJSType();
if (raw != null) return raw;
_warn('Cannot find native JavaScript type ($_dartName) for type check');
- return _dynamic;
+ return JS('', '#.Object', global_);
}
@JSExportName('is')
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 f815459..4adfd4f 100644
--- a/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
+++ b/pkg/dev_compiler/tool/input_sdk/private/js_helper.dart
@@ -837,6 +837,11 @@
}
}
+/// Expose browser JS classes.
+void applyExtension(name, nativeObject) {
+ dart.applyExtension(name, nativeObject);
+}
+
/// Used internally by DDC to map ES6 symbols to Dart.
class PrivateSymbol implements Symbol {
// TODO(jmesserly): could also get this off the native symbol instead of
diff --git a/pkg/dev_compiler/tool/sdk_expected_errors.txt b/pkg/dev_compiler/tool/sdk_expected_errors.txt
deleted file mode 100644
index cd24172..0000000
--- a/pkg/dev_compiler/tool/sdk_expected_errors.txt
+++ /dev/null
@@ -1,85 +0,0 @@
-[warning] The final variable 'length' must be initialized. (dart:_interceptors/js_string.dart, line 15, col 9)
-[warning] The final variable 'origin' must be initialized. (dart:html, line 193, col 3)
-[warning] The final variable 'origin' must be initialized. (dart:html, line 863, col 3)
-[warning] The final variables 'form', 'labels' and '3' more must be initialized. (dart:html, line 1679, col 3)
-[warning] The final variable 'options' must be initialized. (dart:html, line 8979, col 3)
-[warning] The final variables '_attributes', '_childElementCount' and '19' more must be initialized. (dart:html, line 13235, col 3)
-[warning] The final variables 'elements', 'form' and '4' more must be initialized. (dart:html, line 17108, col 3)
-[warning] The final variable 'length' must be initialized. (dart:html, line 18058, col 3)
-[warning] The final variables '_get_contentWindow' and 'sandbox' must be initialized. (dart:html, line 20770, col 3)
-[warning] The final variables 'complete', 'currentSrc' and '2' more must be initialized. (dart:html, line 20977, col 3)
-[warning] The final variables '_get_valueAsDate', 'entries' and '6' more must be initialized. (dart:html, line 21142, col 3)
-[warning] The final variables 'form', 'labels' and '4' more must be initialized. (dart:html, line 22352, col 3)
-[warning] The final variables 'control' and 'form' must be initialized. (dart:html, line 22499, col 3)
-[warning] The final variable 'form' must be initialized. (dart:html, line 22538, col 3)
-[warning] The final variables 'import', 'relList' and '2' more must be initialized. (dart:html, line 22627, col 3)
-[warning] The final variable 'areas' must be initialized. (dart:html, line 22790, col 3)
-[warning] The final variables 'audioDecodedByteCount', 'audioTracks' and '16' more must be initialized. (dart:html, line 23091, col 3)
-[warning] The final variable 'labels' must be initialized. (dart:html, line 24685, col 3)
-[warning] The final variables 'baseUri', 'childNodes' and '11' more must be initialized. (dart:html, line 26229, col 3)
-[warning] The final variables 'form', 'validationMessage' and '2' more must be initialized. (dart:html, line 27181, col 3)
-[warning] The final variables 'form' and 'index' must be initialized. (dart:html, line 27363, col 3)
-[warning] The final variables 'form', 'htmlFor' and '5' more must be initialized. (dart:html, line 27417, col 3)
-[warning] The final variables 'labels' and 'position' must be initialized. (dart:html, line 28979, col 3)
-[warning] The final variables 'form', 'labels' and '4' more must be initialized. (dart:html, line 30908, col 3)
-[warning] The final variable 'sheet' must be initialized. (dart:html, line 33383, col 3)
-[warning] The final variable 'cellIndex' must be initialized. (dart:html, line 33648, col 3)
-[warning] The final variables '_rows' and '_tBodies' must be initialized. (dart:html, line 33767, col 3)
-[warning] The final variables '_cells', 'rowIndex' and '1' more must be initialized. (dart:html, line 33884, col 3)
-[warning] The final variable '_rows' must be initialized. (dart:html, line 33953, col 3)
-[warning] The final variable 'content' must be initialized. (dart:html, line 33997, col 3)
-[warning] The final variables 'form', 'labels' and '5' more must be initialized. (dart:html, line 34086, col 3)
-[warning] The final variables 'readyState' and 'track' must be initialized. (dart:html, line 35146, col 3)
-[warning] The final variables 'decodedFrameCount', 'droppedFrameCount' and '2' more must be initialized. (dart:html, line 36053, col 3)
-[warning] The final variable 'sourceCapabilities' must be initialized. (dart:html, line 46029, col 3)
-[warning] The final variables 'href' and 'target' must be initialized. (dart:svg, line 56, col 3)
-[warning] The final variables 'requiredExtensions', 'requiredFeatures' and '2' more must be initialized. (dart:svg, line 512, col 3)
-[warning] The final variables 'cx', 'cy' and '1' more must be initialized. (dart:svg, line 583, col 3)
-[warning] The final variable 'clipPathUnits' must be initialized. (dart:svg, line 620, col 3)
-[warning] The final variables 'cx', 'cy' and '2' more must be initialized. (dart:svg, line 719, col 3)
-[warning] The final variables 'height', 'in1' and '6' more must be initialized. (dart:svg, line 765, col 3)
-[warning] The final variables 'height', 'in1' and '6' more must be initialized. (dart:svg, line 858, col 3)
-[warning] The final variables 'height', 'in1' and '4' more must be initialized. (dart:svg, line 947, col 3)
-[warning] The final variables 'height', 'in1' and '10' more must be initialized. (dart:svg, line 999, col 3)
-[warning] The final variables 'bias', 'divisor' and '15' more must be initialized. (dart:svg, line 1107, col 3)
-[warning] The final variables 'diffuseConstant', 'height' and '8' more must be initialized. (dart:svg, line 1228, col 3)
-[warning] The final variables 'height', 'in1' and '8' more must be initialized. (dart:svg, line 1305, col 3)
-[warning] The final variables 'azimuth' and 'elevation' must be initialized. (dart:svg, line 1401, col 3)
-[warning] The final variables 'height', 'result' and '3' more must be initialized. (dart:svg, line 1444, col 3)
-[warning] The final variables 'height', 'in1' and '6' more must be initialized. (dart:svg, line 1637, col 3)
-[warning] The final variables 'height', 'href' and '5' more must be initialized. (dart:svg, line 1710, col 3)
-[warning] The final variables 'height', 'result' and '3' more must be initialized. (dart:svg, line 1777, col 3)
-[warning] The final variable 'in1' must be initialized. (dart:svg, line 1833, col 3)
-[warning] The final variables 'height', 'in1' and '7' more must be initialized. (dart:svg, line 1867, col 3)
-[warning] The final variables 'dx', 'dy' and '6' more must be initialized. (dart:svg, line 1947, col 3)
-[warning] The final variables 'x', 'y' and '1' more must be initialized. (dart:svg, line 2015, col 3)
-[warning] The final variables 'height', 'in1' and '9' more must be initialized. (dart:svg, line 2062, col 3)
-[warning] The final variables 'limitingConeAngle', 'pointsAtX' and '6' more must be initialized. (dart:svg, line 2144, col 3)
-[warning] The final variables 'height', 'in1' and '4' more must be initialized. (dart:svg, line 2211, col 3)
-[warning] The final variables 'baseFrequencyX', 'baseFrequencyY' and '9' more must be initialized. (dart:svg, line 2272, col 3)
-[warning] The final variables 'filterUnits', 'height' and '5' more must be initialized. (dart:svg, line 2376, col 3)
-[warning] The final variables 'height', 'width' and '2' more must be initialized. (dart:svg, line 2479, col 3)
-[warning] The final variables 'farthestViewportElement', 'nearestViewportElement' and '4' more must be initialized. (dart:svg, line 2574, col 3)
-[warning] The final variables 'height', 'href' and '4' more must be initialized. (dart:svg, line 2648, col 3)
-[warning] The final variables 'x1', 'x2' and '2' more must be initialized. (dart:svg, line 2882, col 3)
-[warning] The final variables 'x1', 'x2' and '2' more must be initialized. (dart:svg, line 2923, col 3)
-[warning] The final variables 'markerHeight', 'markerUnits' and '7' more must be initialized. (dart:svg, line 2964, col 3)
-[warning] The final variables 'height', 'maskContentUnits' and '7' more must be initialized. (dart:svg, line 3059, col 3)
-[warning] The final variable 'pathLength' must be initialized. (dart:svg, line 3343, col 3)
-[warning] The final variables 'height', 'href' and '11' more must be initialized. (dart:svg, line 3385, col 3)
-[warning] The final variables 'animatedPoints' and 'points' must be initialized. (dart:svg, line 3550, col 3)
-[warning] The final variables 'animatedPoints' and 'points' must be initialized. (dart:svg, line 3583, col 3)
-[warning] The final variables 'cx', 'cy' and '4' more must be initialized. (dart:svg, line 3694, col 3)
-[warning] The final variables 'height', 'rx' and '4' more must be initialized. (dart:svg, line 3773, col 3)
-[warning] The final variable 'href' must be initialized. (dart:svg, line 3822, col 3)
-[warning] The final variable 'gradientOffset' must be initialized. (dart:svg, line 3890, col 3)
-[warning] The final variable 'sheet' must be initialized. (dart:svg, line 4022, col 3)
-[warning] The final variables 'ownerSvgElement' and 'viewportElement' must be initialized. (dart:svg, line 4536, col 3)
-[warning] The final variables 'currentTranslate', 'currentView' and '8' more must be initialized. (dart:svg, line 4880, col 3)
-[warning] The final variables 'preserveAspectRatio' and 'viewBox' must be initialized. (dart:svg, line 5086, col 3)
-[warning] The final variables 'lengthAdjust' and 'textLength' must be initialized. (dart:svg, line 5160, col 3)
-[warning] The final variables 'href', 'method' and '2' more must be initialized. (dart:svg, line 5261, col 3)
-[warning] The final variables 'dx', 'dy' and '3' more must be initialized. (dart:svg, line 5323, col 3)
-[warning] The final variables 'height', 'href' and '3' more must be initialized. (dart:svg, line 5622, col 3)
-[warning] The final variables 'preserveAspectRatio', 'viewBox' and '1' more must be initialized. (dart:svg, line 5669, col 3)
-[warning] The final variables 'gradientTransform', 'gradientUnits' and '2' more must be initialized. (dart:svg, line 5827, col 3)
diff --git a/pkg/expect/lib/expect.dart b/pkg/expect/lib/expect.dart
index 86cea6b..020e409 100644
--- a/pkg/expect/lib/expect.dart
+++ b/pkg/expect/lib/expect.dart
@@ -497,6 +497,15 @@
f, (error) => error is UnsupportedError, reason ?? "UnsupportedError");
}
+ /// Reports that there is an error in the test itself and not the code under
+ /// test.
+ ///
+ /// It may be using the expect API incorrectly or failing some other
+ /// invariant that the test expects to be true.
+ static void testError(String message) {
+ _fail("Test error: $message");
+ }
+
static String _getMessage(String reason) =>
(reason == null) ? "" : ", '$reason'";
diff --git a/pkg/expect/lib/minitest.dart b/pkg/expect/lib/minitest.dart
index d3057c2..d3f2ce6 100644
--- a/pkg/expect/lib/minitest.dart
+++ b/pkg/expect/lib/minitest.dart
@@ -21,6 +21,7 @@
///
/// Eventually, it would be good to refactor those tests to use the expect
/// package directly and remove this.
+import 'dart:async';
import 'package:expect/expect.dart';
@@ -77,7 +78,10 @@
_groups.add(new _Group());
try {
- body();
+ var result = body();
+ if (result is Future) {
+ Expect.testError("group() does not support asynchronous functions.");
+ }
} finally {
_groups.removeLast();
}
@@ -86,15 +90,29 @@
void test(String description, body()) {
// TODO(rnystrom): Do something useful with the description.
for (var group in _groups) {
- if (group.setUpFunction != null) group.setUpFunction();
+ if (group.setUpFunction != null) {
+ var result = group.setUpFunction();
+ if (result is Future) {
+ Expect.testError("setUp() does not support asynchronous functions.");
+ }
+ }
}
try {
- body();
+ var result = body();
+ if (result is Future) {
+ Expect.testError("test() does not support asynchronous functions.");
+ }
} finally {
for (var i = _groups.length - 1; i >= 0; i--) {
var group = _groups[i];
- if (group.tearDownFunction != null) group.tearDownFunction();
+ if (group.tearDownFunction != null) {
+ var result = group.tearDownFunction();
+ if (result is Future) {
+ Expect
+ .testError("tearDown() does not support asynchronous functions.");
+ }
+ }
}
}
}
@@ -137,10 +155,9 @@
Expect.setEquals(value, actual);
});
-// TODO(bob): Do something useful with the description.
Object predicate(bool fn(Object value), [String description]) =>
new _Expectation((actual) {
- Expect.isTrue(fn(actual));
+ Expect.isTrue(fn(actual), description);
});
Object inInclusiveRange(num min, num max) => new _Expectation((actual) {
diff --git a/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart b/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart
index c08284c..d2eedd1 100644
--- a/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart
+++ b/pkg/front_end/lib/src/api_prototype/incremental_kernel_generator.dart
@@ -10,6 +10,9 @@
import 'package:front_end/src/minimal_incremental_kernel_generator.dart';
import 'package:kernel/kernel.dart';
+import 'package:front_end/src/fasta/incremental_compiler.dart'
+ show IncrementalCompiler;
+
import 'compiler_options.dart';
/// The type of the function that clients can pass to track used files.
@@ -140,10 +143,13 @@
CompilerOptions options, Uri entryPoint,
{WatchUsedFilesFn watch, bool useMinimalGenerator: false}) async {
var processedOptions = new ProcessedOptions(options, false, [entryPoint]);
- return await CompilerContext.runWithOptions(processedOptions, (_) async {
+ return await CompilerContext.runWithOptions(processedOptions,
+ (compilerContext) async {
var uriTranslator = await processedOptions.getUriTranslator();
var sdkOutlineBytes = await processedOptions.loadSdkSummaryBytes();
- if (useMinimalGenerator) {
+ if (const String.fromEnvironment("ikg-variant") == "fasta") {
+ return new IncrementalCompiler(compilerContext);
+ } else if (useMinimalGenerator) {
return new MinimalIncrementalKernelGenerator(
processedOptions, uriTranslator, sdkOutlineBytes, entryPoint,
watch: watch);
diff --git a/pkg/front_end/lib/src/api_unstable/dart2js.dart b/pkg/front_end/lib/src/api_unstable/dart2js.dart
index 3276f89..fc92b87 100644
--- a/pkg/front_end/lib/src/api_unstable/dart2js.dart
+++ b/pkg/front_end/lib/src/api_unstable/dart2js.dart
@@ -5,7 +5,6 @@
import 'dart:async' show Future;
import 'package:front_end/src/base/processed_options.dart';
-import 'package:front_end/src/fasta/scanner/token.dart' show StringToken;
import 'package:front_end/src/kernel_generator_impl.dart';
import 'package:kernel/kernel.dart' show Program;
import 'package:kernel/target/targets.dart' show Target;
@@ -52,7 +51,6 @@
processedOpts.inputs.clear();
processedOpts.inputs.add(input);
processedOpts.clearFileSystemCache();
- StringToken.canonicalizer.clear();
var compilerResult = await CompilerContext.runWithOptions(processedOpts,
(CompilerContext context) async {
diff --git a/pkg/front_end/lib/src/api_unstable/ddc.dart b/pkg/front_end/lib/src/api_unstable/ddc.dart
index 18ea8cf..b50f8a1 100644
--- a/pkg/front_end/lib/src/api_unstable/ddc.dart
+++ b/pkg/front_end/lib/src/api_unstable/ddc.dart
@@ -6,7 +6,6 @@
import 'package:front_end/src/api_prototype/physical_file_system.dart';
import 'package:front_end/src/base/processed_options.dart';
-import 'package:front_end/src/fasta/scanner/token.dart' show StringToken;
import 'package:front_end/src/kernel_generator_impl.dart';
import 'package:front_end/src/multi_root_file_system.dart';
import 'package:kernel/kernel.dart' show Program;
@@ -57,9 +56,6 @@
(await oldState.processedOpts.loadInputSummaries(null))
.forEach((p) => p.libraries.forEach((lib) => lib.isExternal = false));
- // Avoid static leak.
- StringToken.canonicalizer.clear();
-
return oldState;
}
diff --git a/pkg/front_end/lib/src/fasta/builder/class_builder.dart b/pkg/front_end/lib/src/fasta/builder/class_builder.dart
index 315e710..48d6b74 100644
--- a/pkg/front_end/lib/src/fasta/builder/class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/class_builder.dart
@@ -219,11 +219,11 @@
library.addCompileTimeError(message, charOffset, fileUri, context: context);
}
- void addWarning(Message message, int charOffset) {
- library.addWarning(message, charOffset, fileUri);
+ void addWarning(Message message, int charOffset, {LocatedMessage context}) {
+ library.addWarning(message, charOffset, fileUri, context: context);
}
- void addNit(Message message, int charOffset) {
- library.addNit(message, charOffset, fileUri);
+ void addNit(Message message, int charOffset, {LocatedMessage context}) {
+ library.addNit(message, charOffset, fileUri, context: context);
}
}
diff --git a/pkg/front_end/lib/src/fasta/builder/invalid_type_builder.dart b/pkg/front_end/lib/src/fasta/builder/invalid_type_builder.dart
index 0346e02..4b67433 100644
--- a/pkg/front_end/lib/src/fasta/builder/invalid_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/invalid_type_builder.dart
@@ -4,7 +4,7 @@
library fasta.invalid_type_builder;
-import '../fasta_codes.dart' show Message;
+import '../fasta_codes.dart' show LocatedMessage;
import 'builder.dart' show TypeBuilder, TypeDeclarationBuilder;
@@ -13,7 +13,7 @@
InvalidTypeBuilder(String name, int charOffset, [Uri fileUri])
: super(null, 0, name, null, charOffset, fileUri);
- Message get message;
+ LocatedMessage get message;
String get debugName => "InvalidTypeBuilder";
}
diff --git a/pkg/front_end/lib/src/fasta/builder/library_builder.dart b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
index b441474..dea20dc 100644
--- a/pkg/front_end/lib/src/fasta/builder/library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/builder/library_builder.dart
@@ -45,9 +45,6 @@
LibraryBuilder partOfLibrary;
- /// True if a compile-time error has been reported in this library.
- bool hasCompileTimeErrors = false;
-
bool mayImplementRestrictedTypes = false;
LibraryBuilder(Uri fileUri, this.scope, this.exportScope)
@@ -82,7 +79,6 @@
void addCompileTimeError(Message message, int charOffset, Uri fileUri,
{bool wasHandled: false, LocatedMessage context}) {
fileUri ??= this.fileUri;
- hasCompileTimeErrors = true;
loader.addCompileTimeError(message, charOffset, fileUri,
wasHandled: wasHandled, context: context);
}
@@ -126,8 +122,6 @@
int finishDeferredLoadTearoffs() => 0;
- int finishStaticInvocations() => 0;
-
int finishNativeMethods() => 0;
int finishPatchMethods() => 0;
diff --git a/pkg/front_end/lib/src/fasta/compiler_context.dart b/pkg/front_end/lib/src/fasta/compiler_context.dart
index 5a319d0..3194861 100644
--- a/pkg/front_end/lib/src/fasta/compiler_context.dart
+++ b/pkg/front_end/lib/src/fasta/compiler_context.dart
@@ -6,16 +6,22 @@
import 'dart:async' show Zone, runZoned;
-import 'package:front_end/src/api_prototype/compiler_options.dart';
-import 'package:front_end/src/api_prototype/file_system.dart';
-import 'package:front_end/src/base/processed_options.dart';
-import 'package:front_end/src/fasta/fasta_codes.dart';
import 'package:kernel/ast.dart' show Source;
+
+import '../api_prototype/compiler_options.dart' show CompilerOptions;
+
+import '../api_prototype/file_system.dart' show FileSystem;
+
+import '../base/processed_options.dart' show ProcessedOptions;
+
+import 'scanner/token.dart' show StringToken;
+
import 'command_line_reporting.dart' as command_line_reporting;
import 'colors.dart' show computeEnableColors;
-import 'fasta_codes.dart' show LocatedMessage, Message;
+import 'fasta_codes.dart'
+ show LocatedMessage, Message, messageInternalProblemMissingContext;
import 'severity.dart' show Severity;
@@ -84,9 +90,14 @@
}
/// Perform [action] in a [Zone] where [this] will be available as
- /// `CompilerContext.current.options`.
+ /// `CompilerContext.current`.
T runInContext<T>(T action(CompilerContext c)) {
- return runZoned(() => action(this), zoneValues: {compilerContextKey: this});
+ try {
+ return runZoned(() => action(this),
+ zoneValues: {compilerContextKey: this});
+ } finally {
+ clear();
+ }
}
/// Perform [action] in a [Zone] where [options] will be available as
@@ -104,4 +115,8 @@
static bool get enableColors {
return current.enableColorsCached ??= computeEnableColors(current);
}
+
+ static void clear() {
+ StringToken.canonicalizer.clear();
+ }
}
diff --git a/pkg/front_end/lib/src/fasta/dill/dill_target.dart b/pkg/front_end/lib/src/fasta/dill/dill_target.dart
index af316d7..7da0d21 100644
--- a/pkg/front_end/lib/src/fasta/dill/dill_target.dart
+++ b/pkg/front_end/lib/src/fasta/dill/dill_target.dart
@@ -66,10 +66,5 @@
void addDirectSupertype(ClassBuilder cls, Set<ClassBuilder> set) {}
@override
- List<ClassBuilder> collectAllClasses() {
- return null;
- }
-
- @override
void breakCycle(ClassBuilder cls) {}
}
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes.dart b/pkg/front_end/lib/src/fasta/fasta_codes.dart
index ee786717..59eee7e 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes.dart
@@ -72,7 +72,7 @@
const Template({this.messageTemplate, this.tipTemplate, this.withArguments});
}
-class LocatedMessage {
+class LocatedMessage implements Comparable<LocatedMessage> {
final Uri uri;
final int charOffset;
@@ -88,6 +88,14 @@
String get tip => messageObject.tip;
Map<String, dynamic> get arguments => messageObject.arguments;
+
+ int compareTo(LocatedMessage other) {
+ int result = "${uri}".compareTo("${other.uri}");
+ if (result != 0) return result;
+ result = charOffset.compareTo(other.charOffset);
+ if (result != 0) return result;
+ return message.compareTo(message);
+ }
}
String relativizeUri(Uri uri) {
diff --git a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
index a2ca05a..e5e5b6e 100644
--- a/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
+++ b/pkg/front_end/lib/src/fasta/fasta_codes_generated.dart
@@ -335,6 +335,59 @@
tip: r"""Try specifying the file explicitly with the --packages option.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<
+ Message Function(
+ String
+ string)> templateCantInferTypeDueToCircularity = const Template<
+ Message Function(String string)>(
+ messageTemplate:
+ r"""Can't infer the type of '#string': circularity found during type inference.""",
+ tipTemplate: r"""Specify the type explicitly.""",
+ withArguments: _withArgumentsCantInferTypeDueToCircularity);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String string)> codeCantInferTypeDueToCircularity =
+ const Code<Message Function(String string)>(
+ "CantInferTypeDueToCircularity",
+ templateCantInferTypeDueToCircularity,
+);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsCantInferTypeDueToCircularity(String string) {
+ return new Message(codeCantInferTypeDueToCircularity,
+ message:
+ """Can't infer the type of '$string': circularity found during type inference.""",
+ tip: """Specify the type explicitly.""",
+ arguments: {'string': string});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<Message Function(String string)>
+ templateCantInferTypeDueToInconsistentOverrides =
+ const Template<Message Function(String string)>(
+ messageTemplate:
+ r"""Can't infer the type of '#string': overridden members must all have the same type.""",
+ tipTemplate: r"""Specify the type explicitly.""",
+ withArguments: _withArgumentsCantInferTypeDueToInconsistentOverrides);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String string)>
+ codeCantInferTypeDueToInconsistentOverrides =
+ const Code<Message Function(String string)>(
+ "CantInferTypeDueToInconsistentOverrides",
+ templateCantInferTypeDueToInconsistentOverrides,
+);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsCantInferTypeDueToInconsistentOverrides(String string) {
+ return new Message(codeCantInferTypeDueToInconsistentOverrides,
+ message:
+ """Can't infer the type of '$string': overridden members must all have the same type.""",
+ tip: """Specify the type explicitly.""",
+ arguments: {'string': string});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Code<Null> codeCatchSyntax = messageCatchSyntax;
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
@@ -1270,7 +1323,7 @@
const Code<Message Function(Token token)> codeExpectedIdentifier =
const Code<Message Function(Token token)>(
"ExpectedIdentifier", templateExpectedIdentifier,
- analyzerCode: "MISSING_IDENTIFIER", dart2jsCode: "EXPECTED_IDENTIFIER");
+ analyzerCode: "MISSING_IDENTIFIER", dart2jsCode: "*fatal*");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsExpectedIdentifier(Token token) {
@@ -1319,7 +1372,7 @@
const Code<Message Function(String string)> codeExpectedToken =
const Code<Message Function(String string)>(
"ExpectedToken", templateExpectedToken,
- analyzerCode: "EXPECTED_TOKEN", dart2jsCode: "GENERIC");
+ analyzerCode: "EXPECTED_TOKEN", dart2jsCode: "*fatal*");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
Message _withArgumentsExpectedToken(String string) {
@@ -3356,6 +3409,26 @@
message: r"""An operator can't have optional parameters.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Template<Message Function(String name)> templateOverriddenMethodCause =
+ const Template<Message Function(String name)>(
+ messageTemplate: r"""This is the overriden method ('#name').""",
+ withArguments: _withArgumentsOverriddenMethodCause);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Message Function(String name)> codeOverriddenMethodCause =
+ const Code<Message Function(String name)>(
+ "OverriddenMethodCause",
+ templateOverriddenMethodCause,
+);
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+Message _withArgumentsOverriddenMethodCause(String name) {
+ return new Message(codeOverriddenMethodCause,
+ message: """This is the overriden method ('$name').""",
+ arguments: {'name': name});
+}
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<
Message Function(
String name,
@@ -3792,6 +3865,18 @@
message: r"""An optional named parameter can't start with '_'.""");
// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const Code<Null> codeRedirectionInNonFactory = messageRedirectionInNonFactory;
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
+const MessageCode messageRedirectionInNonFactory = const MessageCode(
+ "RedirectionInNonFactory",
+ analyzerCode: "REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR",
+ dart2jsCode: "*fatal*",
+ message: r"""Only factory constructor can specify '=' redirection.""",
+ tip:
+ r"""Try making this a factory constructor, or remove the redirection.""");
+
+// DO NOT EDIT. THIS FILE IS GENERATED. SEE TOP OF FILE.
const Template<Message Function(String name)>
templateRedirectionTargetNotFound =
const Template<Message Function(String name)>(
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index 15f806a..30ac413 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -11,10 +11,16 @@
import '../api_prototype/incremental_kernel_generator.dart'
show DeltaProgram, IncrementalKernelGenerator;
+import 'builder/builder.dart' show LibraryBuilder;
+
import 'dill/dill_target.dart' show DillTarget;
import 'kernel/kernel_target.dart' show KernelTarget;
+import 'source/source_graph.dart' show SourceGraph;
+
+import 'source/source_library_builder.dart' show SourceLibraryBuilder;
+
import 'compiler_context.dart' show CompilerContext;
import 'problems.dart' show unsupported;
@@ -63,12 +69,15 @@
DillTarget platform;
+ KernelTarget userCode;
+
IncrementalCompiler(this.context)
: ticker = new Ticker(isVerbose: context.options.verbose);
@override
Future<FastaDelta> computeDelta({Uri entryPoint}) async {
return context.runInContext<Future<FastaDelta>>((CompilerContext c) async {
+ ticker.reset();
if (platform == null) {
UriTranslator uriTranslator = await c.options.getUriTranslator();
ticker.logMs("Read packages file");
@@ -85,21 +94,84 @@
List<Uri> invalidatedUris = this.invalidatedUris.toList();
this.invalidatedUris.clear();
- print("Changed URIs: ${invalidatedUris.join('\n')}");
- KernelTarget kernelTarget = new KernelTarget(
+ List<LibraryBuilder> reusedLibraries =
+ computeReusedLibraries(invalidatedUris);
+ ticker.logMs("Decided to reuse ${reusedLibraries.length} libraries");
+
+ userCode = new KernelTarget(
c.fileSystem, false, platform, platform.uriTranslator,
uriToSource: c.uriToSource);
+ for (LibraryBuilder library in reusedLibraries) {
+ userCode.loader.builders[library.uri] = library;
+ }
- kernelTarget.read(entryPoint);
+ userCode.read(entryPoint);
- await kernelTarget.buildOutlines();
+ await userCode.buildOutlines();
return new FastaDelta(
- await kernelTarget.buildProgram(verify: c.options.verify));
+ await userCode.buildProgram(verify: c.options.verify));
});
}
+ List<LibraryBuilder> computeReusedLibraries(Iterable<Uri> invalidatedUris) {
+ if (userCode == null) return const <LibraryBuilder>[];
+
+ // [invalidatedUris] converted to a set.
+ Set<Uri> invalidatedFileUris = invalidatedUris.toSet();
+
+ // Maps all non-platform LibraryBuilders from their import URI.
+ Map<Uri, LibraryBuilder> builders = <Uri, LibraryBuilder>{};
+
+ // Invalidated URIs translated back to their import URI (package:, dart:,
+ // etc.).
+ List<Uri> invalidatedImportUris = <Uri>[];
+
+ // Compute [builders] and [invalidatedImportUris].
+ userCode.loader.builders.forEach((Uri uri, LibraryBuilder library) {
+ if (library.loader != platform.loader) {
+ assert(library is SourceLibraryBuilder);
+ builders[uri] = library;
+ if (invalidatedFileUris.contains(uri) ||
+ (uri != library.fileUri &&
+ invalidatedFileUris.contains(library.fileUri))) {
+ invalidatedImportUris.add(uri);
+ }
+ }
+ });
+
+ SourceGraph graph = new SourceGraph(builders);
+
+ // Compute direct dependencies for each import URI (the reverse of the
+ // edges returned by `graph.neighborsOf`).
+ Map<Uri, Set<Uri>> directDependencies = <Uri, Set<Uri>>{};
+ for (Uri vertex in graph.vertices) {
+ for (Uri neighbor in graph.neighborsOf(vertex)) {
+ (directDependencies[neighbor] ??= new Set<Uri>()).add(vertex);
+ }
+ }
+
+ // Remove all dependencies of [invalidatedImportUris] from builders.
+ List<Uri> workList = invalidatedImportUris;
+ while (workList.isNotEmpty) {
+ LibraryBuilder current = builders.remove(workList.removeLast());
+ // [current] is null if the corresponding key (URI) has already been
+ // removed.
+ if (current != null) {
+ Set<Uri> s = directDependencies[current.uri];
+ if (s != null) {
+ // [s] is null for leaves.
+ for (Uri dependency in s) {
+ workList.add(dependency);
+ }
+ }
+ }
+ }
+
+ return builders.values.toList();
+ }
+
@override
void invalidate(Uri uri) {
invalidatedUris.add(uri);
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 af82655..9a47639 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -1427,9 +1427,7 @@
debugEvent("LiteralInt");
int value = int.parse(token.lexeme, onError: (_) => null);
if (value == null) {
- push(buildCompileTimeError(
- fasta.templateIntegerLiteralIsOutOfRange.withArguments(token),
- token.charOffset));
+ push(new LargeIntAccessor(this, token));
} else {
push(new ShadowIntLiteral(value)..fileOffset = offsetForToken(token));
}
@@ -2207,6 +2205,17 @@
String operator = token.stringValue;
if (optional("-", token)) {
operator = "unary-";
+
+ var new_receiver = null;
+ if (receiver is LargeIntAccessor) {
+ int value =
+ int.parse("-" + receiver.token.lexeme, onError: (_) => null);
+ if (value != null) {
+ new_receiver = new ShadowIntLiteral(value)
+ ..fileOffset = offsetForToken(token);
+ }
+ }
+ if (new_receiver != null) receiver = new_receiver;
}
bool isSuper = false;
Expression receiverValue;
@@ -2689,7 +2698,9 @@
} else if (declaration is ExpressionStatement) {
// If [declaration] isn't a [FunctionDeclaration], it must be because
// there was a compile-time error.
- assert(library.hasCompileTimeErrors);
+ // TODO(askesc): Be more specific about the error code when we have
+ // errors represented as explicit invalid nodes.
+ assert(library.loader.handledErrors.isNotEmpty);
// TODO(paulberry,ahe): ensure that when integrating with analyzer, type
// inference is still performed for the dropped declaration.
@@ -3599,8 +3610,10 @@
}
@override
- StaticGet makeStaticGet(Member readTarget, Token token) {
- return new ShadowStaticGet(readTarget)..fileOffset = offsetForToken(token);
+ StaticGet makeStaticGet(Member readTarget, Token token,
+ {int targetOffset: -1, Class targetClass}) {
+ return new ShadowStaticGet(targetOffset, targetClass, readTarget)
+ ..fileOffset = offsetForToken(token);
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart b/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
index d6091aa..04b5bf2 100644
--- a/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/fasta_accessors.dart
@@ -10,7 +10,10 @@
import '../../scanner/token.dart' show Token;
import '../fasta_codes.dart'
- show messageInvalidInitializer, messageLoadLibraryTakesNoArguments;
+ show
+ messageInvalidInitializer,
+ messageLoadLibraryTakesNoArguments,
+ templateIntegerLiteralIsOutOfRange;
import '../messages.dart' show Message;
@@ -29,6 +32,7 @@
LoadLibraryAccessor,
PropertyAccessor,
ReadOnlyAccessor,
+ DelayedErrorAccessor,
StaticAccessor,
SuperIndexAccessor,
SuperPropertyAccessor,
@@ -126,7 +130,8 @@
bool checkArguments(FunctionNode function, Arguments arguments,
List<TypeParameter> typeParameters);
- StaticGet makeStaticGet(Member readTarget, Token token);
+ StaticGet makeStaticGet(Member readTarget, Token token,
+ {int targetOffset: -1, Class targetClass});
dynamic deprecated_addCompileTimeError(int charOffset, String message);
@@ -790,7 +795,7 @@
@override
ShadowComplexAssignment startComplexAssignment(Expression rhs) =>
- new ShadowStaticAssignment(rhs);
+ new ShadowStaticAssignment(targetOffset, targetClass, rhs);
}
class LoadLibraryAccessor extends kernel.LoadLibraryAccessor
@@ -984,6 +989,18 @@
}
}
+class LargeIntAccessor extends kernel.DelayedErrorAccessor with FastaAccessor {
+ final String plainNameForRead = null;
+
+ LargeIntAccessor(BuilderHelper helper, Token token) : super(helper, token);
+
+ Expression buildError() => helper.buildCompileTimeError(
+ templateIntegerLiteralIsOutOfRange.withArguments(token),
+ token.charOffset);
+
+ Expression doInvocation(int offset, Arguments arguments) => buildError();
+}
+
class ParenthesizedExpression extends ReadOnlyAccessor {
ParenthesizedExpression(
BuilderHelper helper, Expression expression, Token token)
@@ -1011,9 +1028,8 @@
int offset = offsetForToken(token);
if (declaration is KernelInvalidTypeBuilder) {
KernelInvalidTypeBuilder declaration = this.declaration;
- helper.library.addWarning(
- declaration.message, declaration.charOffset, declaration.fileUri);
- helper.addWarning(declaration.message, offset, token.length);
+ helper.addWarning(
+ declaration.message.messageObject, offset, token.length);
super.expression = new Throw(
new StringLiteral(declaration.message.message)
..fileOffset = offsetForToken(token))
diff --git a/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart b/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart
index 8f7b16f..758d701 100644
--- a/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/frontend_accessors.dart
@@ -689,7 +689,8 @@
if (readTarget == null) {
return makeInvalidRead();
} else {
- var read = helper.makeStaticGet(readTarget, token);
+ var read = helper.makeStaticGet(readTarget, token,
+ targetOffset: targetOffset, targetClass: targetClass);
complexAssignment?.read = read;
return read;
}
@@ -755,6 +756,23 @@
super._finish(makeLet(value, body), complexAssignment);
}
+abstract class DelayedErrorAccessor extends Accessor {
+ DelayedErrorAccessor(BuilderHelper helper, Token token)
+ : super(helper, token);
+
+ Expression buildError();
+
+ Expression _makeSimpleRead() => buildError();
+ Expression _makeSimpleWrite(Expression value, bool voidContext,
+ ShadowComplexAssignment complexAssignment) =>
+ buildError();
+ Expression _makeRead(ShadowComplexAssignment complexAssignment) =>
+ buildError();
+ Expression _makeWrite(Expression value, bool voidContext,
+ ShadowComplexAssignment complexAssignment) =>
+ buildError();
+}
+
Expression makeLet(VariableDeclaration variable, Expression body) {
if (variable == null) return body;
return new Let(variable, body);
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
index 44fd803..f261875 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_class_builder.dart
@@ -32,6 +32,7 @@
messagePatchClassTypeVariablesMismatch,
messagePatchDeclarationMismatch,
messagePatchDeclarationOrigin,
+ templateOverriddenMethodCause,
templateOverrideFewerNamedArguments,
templateOverrideFewerPositionalArguments,
templateOverrideMismatchNamedParameter,
@@ -238,7 +239,11 @@
"$name::${declaredMember.name.name}",
"${interfaceMember.enclosingClass.name}::"
"${interfaceMember.name.name}"),
- declaredMember.fileOffset);
+ declaredMember.fileOffset,
+ context: templateOverriddenMethodCause
+ .withArguments(interfaceMember.name.name)
+ .withLocation(
+ interfaceMember.fileUri, interfaceMember.fileOffset));
}
if (declaredFunction.positionalParameters.length <
interfaceFunction.requiredParameterCount ||
@@ -249,7 +254,11 @@
"$name::${declaredMember.name.name}",
"${interfaceMember.enclosingClass.name}::"
"${interfaceMember.name.name}"),
- declaredMember.fileOffset);
+ declaredMember.fileOffset,
+ context: templateOverriddenMethodCause
+ .withArguments(interfaceMember.name.name)
+ .withLocation(
+ interfaceMember.fileUri, interfaceMember.fileOffset));
}
if (interfaceFunction.requiredParameterCount <
declaredFunction.requiredParameterCount) {
@@ -258,7 +267,11 @@
"$name::${declaredMember.name.name}",
"${interfaceMember.enclosingClass.name}::"
"${interfaceMember.name.name}"),
- declaredMember.fileOffset);
+ declaredMember.fileOffset,
+ context: templateOverriddenMethodCause
+ .withArguments(interfaceMember.name.name)
+ .withLocation(
+ interfaceMember.fileUri, interfaceMember.fileOffset));
}
if (declaredFunction.namedParameters.isEmpty &&
interfaceFunction.namedParameters.isEmpty) {
@@ -271,7 +284,11 @@
"$name::${declaredMember.name.name}",
"${interfaceMember.enclosingClass.name}::"
"${interfaceMember.name.name}"),
- declaredMember.fileOffset);
+ declaredMember.fileOffset,
+ context: templateOverriddenMethodCause
+ .withArguments(interfaceMember.name.name)
+ .withLocation(
+ interfaceMember.fileUri, interfaceMember.fileOffset));
}
Iterator<VariableDeclaration> declaredNamedParameters =
declaredFunction.namedParameters.iterator;
@@ -289,7 +306,11 @@
interfaceNamedParameters.current.name,
"${interfaceMember.enclosingClass.name}::"
"${interfaceMember.name.name}"),
- declaredMember.fileOffset);
+ declaredMember.fileOffset,
+ context: templateOverriddenMethodCause
+ .withArguments(interfaceMember.name.name)
+ .withLocation(
+ interfaceMember.fileUri, interfaceMember.fileOffset));
break outer;
}
}
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 a6e179d..744fd1a 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
@@ -81,7 +81,7 @@
isEligibleForInference &&
!isInstanceMember) {
library.loader.typeInferenceEngine
- .recordStaticFieldInferenceCandidate(field);
+ .recordStaticFieldInferenceCandidate(field, library);
}
return field;
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart
index d784706..a682a2d 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_function_type_builder.dart
@@ -72,9 +72,8 @@
positionalParameterNames: positionalParameterNames);
}
- Supertype buildSupertype(LibraryBuilder library) {
- int charOffset = -1; // TODO(ahe): Provide these.
- Uri fileUri = null; // TODO(ahe): Provide these.
+ Supertype buildSupertype(
+ LibraryBuilder library, int charOffset, Uri fileUri) {
library.addCompileTimeError(
messageSupertypeIsFunction, charOffset, fileUri);
return null;
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_invalid_type_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_invalid_type_builder.dart
index 9093eb1..2784668 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_invalid_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_invalid_type_builder.dart
@@ -6,7 +6,7 @@
import 'package:kernel/ast.dart' show DartType, InvalidType;
-import '../fasta_codes.dart' show Message, templateTypeNotFound;
+import '../fasta_codes.dart' show LocatedMessage, Message, templateTypeNotFound;
import 'kernel_builder.dart'
show InvalidTypeBuilder, KernelTypeBuilder, LibraryBuilder;
@@ -14,11 +14,12 @@
class KernelInvalidTypeBuilder
extends InvalidTypeBuilder<KernelTypeBuilder, DartType> {
@override
- final Message message;
+ final LocatedMessage message;
KernelInvalidTypeBuilder(String name, int charOffset, Uri fileUri,
[Message message])
- : message = message ?? templateTypeNotFound.withArguments(name),
+ : message = (message ?? templateTypeNotFound.withArguments(name))
+ .withLocation(fileUri, charOffset),
super(name, charOffset, fileUri);
DartType buildType(
@@ -29,7 +30,7 @@
/// [Arguments] have already been built.
DartType buildTypesWithBuiltArguments(
LibraryBuilder library, List<DartType> arguments) {
- library.addWarning(message, charOffset, fileUri);
+ library.addWarning(message.messageObject, message.charOffset, message.uri);
return const InvalidType();
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
index 723f871..84bfc98 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_library_builder.dart
@@ -10,8 +10,6 @@
import 'package:front_end/src/fasta/import.dart';
import 'package:kernel/ast.dart';
-import 'package:kernel/clone.dart' show CloneVisitor;
-
import '../../scanner/token.dart' show Token;
import '../fasta_codes.dart'
@@ -92,8 +90,6 @@
final Map<String, SourceClassBuilder> mixinApplicationClasses =
<String, SourceClassBuilder>{};
- final List<List> argumentsWithMissingDefaultValues = <List>[];
-
final List<KernelFunctionBuilder> nativeMethods = <KernelFunctionBuilder>[];
final List<KernelTypeVariableBuilder> boundlessTypeVariables =
@@ -967,45 +963,6 @@
return total;
}
- int finishStaticInvocations() {
- CloneVisitor cloner;
- for (var list in argumentsWithMissingDefaultValues) {
- final Arguments arguments = list[0];
- final FunctionNode function = list[1];
-
- Expression defaultArgumentFrom(Expression expression) {
- if (expression == null) {
- return new NullLiteral();
- }
- cloner ??= new CloneVisitor();
- return cloner.clone(expression);
- }
-
- for (int i = function.requiredParameterCount;
- i < function.positionalParameters.length;
- i++) {
- arguments.positional[i] ??=
- defaultArgumentFrom(function.positionalParameters[i].initializer)
- ..parent = arguments;
- }
- Map<String, VariableDeclaration> names;
- for (NamedExpression expression in arguments.named) {
- if (expression.value == null) {
- if (names == null) {
- names = <String, VariableDeclaration>{};
- for (VariableDeclaration parameter in function.namedParameters) {
- names[parameter.name] = parameter;
- }
- }
- expression.value =
- defaultArgumentFrom(names[expression.name].initializer)
- ..parent = expression;
- }
- }
- }
- return argumentsWithMissingDefaultValues.length;
- }
-
void addNativeMethod(KernelFunctionBuilder method) {
nativeMethods.add(method);
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_mixin_application_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_mixin_application_builder.dart
index bc432b7..bd92c44 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_mixin_application_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_mixin_application_builder.dart
@@ -34,9 +34,8 @@
}
@override
- Supertype buildSupertype(LibraryBuilder library) {
- int charOffset = -1; // TODO(ahe): Provide these.
- Uri fileUri = null; // TODO(ahe): Provide these.
+ Supertype buildSupertype(
+ LibraryBuilder library, int charOffset, Uri fileUri) {
return unsupported("buildSupertype", charOffset, fileUri);
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_named_type_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_named_type_builder.dart
index 6ce7bda..9a45b86 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_named_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_named_type_builder.dart
@@ -31,9 +31,8 @@
return new KernelInvalidTypeBuilder("$name", charOffset, fileUri);
}
- Supertype handleInvalidSupertype(LibraryBuilder library) {
- int charOffset = -1; // TODO(ahe): Provide these.
- Uri fileUri = null; // TODO(ahe): Provide these.
+ Supertype handleInvalidSupertype(
+ LibraryBuilder library, int charOffset, Uri fileUri) {
var template = builder.isTypeVariable
? templateSupertypeIsTypeVariable
: templateSupertypeIsIllegal;
@@ -46,12 +45,13 @@
return builder.buildType(library, arguments);
}
- Supertype buildSupertype(LibraryBuilder library) {
+ Supertype buildSupertype(
+ LibraryBuilder library, int charOffset, Uri fileUri) {
if (builder is KernelClassBuilder) {
KernelClassBuilder builder = this.builder;
return builder.buildSupertype(library, arguments);
} else {
- return handleInvalidSupertype(library);
+ return handleInvalidSupertype(library, charOffset, fileUri);
}
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
index e247e2f..c2ee7b3 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
@@ -358,6 +358,15 @@
@override
int finishPatch() {
if (!isPatch) return 0;
+
+ // TODO(ahe): restore file-offset once we track both origin and patch file
+ // URIs. See https://github.com/dart-lang/sdk/issues/31579
+ origin.procedure.fileUri = fileUri;
+ origin.procedure.fileOffset = procedure.fileOffset;
+ origin.procedure.fileEndOffset = procedure.fileEndOffset;
+ origin.procedure.annotations
+ .forEach((m) => m.fileOffset = procedure.fileOffset);
+
origin.procedure.isAbstract = procedure.isAbstract;
origin.procedure.isExternal = procedure.isExternal;
origin.procedure.function = procedure.function;
@@ -410,7 +419,7 @@
this.charOpenParenOffset,
int charEndOffset,
[String nativeMethodName])
- : constructor = new Constructor(null)
+ : constructor = new Constructor(null, fileUri: compilationUnit?.fileUri)
..fileOffset = charOffset
..fileEndOffset = charEndOffset,
super(metadata, modifiers, returnType, name, typeVariables, formals,
@@ -519,6 +528,15 @@
@override
int finishPatch() {
if (!isPatch) return 0;
+
+ // TODO(ahe): restore file-offset once we track both origin and patch file
+ // URIs. See https://github.com/dart-lang/sdk/issues/31579
+ origin.constructor.fileUri = fileUri;
+ origin.constructor.fileOffset = constructor.fileOffset;
+ origin.constructor.fileEndOffset = constructor.fileEndOffset;
+ origin.constructor.annotations
+ .forEach((m) => m.fileOffset = constructor.fileOffset);
+
origin.constructor.isExternal = constructor.isExternal;
origin.constructor.function = constructor.function;
origin.constructor.function.parent = constructor.function;
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 6e3b588..846289e 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
@@ -325,8 +325,8 @@
/// Creates API members for this class.
void setupApiMembers(InterfaceResolver interfaceResolver) {
- interfaceResolver.createApiMembers(
- this, _inferenceInfo.gettersAndMethods, _inferenceInfo.setters);
+ interfaceResolver.createApiMembers(this, _inferenceInfo.gettersAndMethods,
+ _inferenceInfo.setters, _inferenceInfo.builder.library);
}
static void clearClassInferenceInfo(ShadowClass class_) {
@@ -1734,7 +1734,16 @@
/// Concrete shadow object representing an assignment to a static variable.
class ShadowStaticAssignment extends ShadowComplexAssignment {
- ShadowStaticAssignment(Expression rhs) : super(rhs);
+ /// If [_targetClass] is not `null`, the offset at which the explicit
+ /// reference to it is; otherwise `-1`.
+ int _targetOffset;
+
+ /// The [Class] that was explicitly referenced to get the target [Procedure],
+ /// or `null` if the class is implicit.
+ Class _targetClass;
+
+ ShadowStaticAssignment(this._targetOffset, this._targetClass, Expression rhs)
+ : super(rhs);
@override
DartType _getWriteType(ShadowTypeInferrer inferrer) {
@@ -1745,8 +1754,8 @@
@override
DartType _inferExpression(
ShadowTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
- typeNeeded = inferrer.listener
- .staticAssignEnter(desugared, this.write, typeContext) ||
+ typeNeeded = inferrer.listener.staticAssignEnter(
+ desugared, _targetOffset, _targetClass, this.write, typeContext) ||
typeNeeded;
DartType readType;
var read = this.read;
@@ -1776,19 +1785,33 @@
/// Concrete shadow object representing a read of a static variable in kernel
/// form.
class ShadowStaticGet extends StaticGet implements ShadowExpression {
- ShadowStaticGet(Member target) : super(target);
+ /// If [_targetClass] is not `null`, the offset at which the explicit
+ /// reference to it is; otherwise `-1`.
+ int _targetOffset;
+
+ /// The [Class] that was explicitly referenced to get the target [Procedure],
+ /// or `null` if the class is implicit.
+ Class _targetClass;
+
+ ShadowStaticGet(this._targetOffset, this._targetClass, Member target)
+ : super(target);
@override
DartType _inferExpression(
ShadowTypeInferrer inferrer, DartType typeContext, bool typeNeeded) {
- typeNeeded =
- inferrer.listener.staticGetEnter(this, typeContext) || typeNeeded;
+ typeNeeded = inferrer.listener
+ .staticGetEnter(this, _targetOffset, _targetClass, typeContext) ||
+ typeNeeded;
var target = this.target;
if (target is ShadowField && target._inferenceNode != null) {
target._inferenceNode.resolve();
target._inferenceNode = null;
}
- var inferredType = typeNeeded ? target.getterType : null;
+ var type = target.getterType;
+ if (target is Procedure && target.kind == ProcedureKind.Method) {
+ type = inferrer.instantiateTearOff(type, typeContext, this);
+ }
+ var inferredType = typeNeeded ? type : null;
inferrer.listener.staticGetExit(this, inferredType);
return inferredType;
}
@@ -2451,8 +2474,11 @@
new InstrumentationValueForType(promotedType));
}
this.promotedType = promotedType;
- var inferredType =
- typeNeeded ? (promotedType ?? declaredOrInferredType) : null;
+ var type = promotedType ?? declaredOrInferredType;
+ if (variable._isLocalFunction) {
+ type = inferrer.instantiateTearOff(type, typeContext, this);
+ }
+ var inferredType = typeNeeded ? type : null;
inferrer.listener.variableGetExit(this, inferredType);
return inferredType;
}
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
index b572b7d..24a0534 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_target.dart
@@ -183,30 +183,17 @@
});
}
- List<ClassBuilder> collectAllClasses() {
- List<ClassBuilder> result = <ClassBuilder>[];
- loader.builders.forEach((Uri uri, LibraryBuilder library) {
- library.forEach((String name, Builder member) {
- if (member is KernelClassBuilder) {
- result.add(member);
- }
- });
- // TODO(ahe): Translate this if needed:
- // if (library is KernelLibraryBuilder) {
- // result.addAll(library.mixinApplicationClasses);
- // }
- });
- return result;
- }
-
- List<SourceClassBuilder> collectAllSourceClasses() {
+ /// Returns classes defined in libraries in [loader].
+ List<SourceClassBuilder> collectMyClasses() {
List<SourceClassBuilder> result = <SourceClassBuilder>[];
loader.builders.forEach((Uri uri, LibraryBuilder library) {
- library.forEach((String name, Builder member) {
- if (member is SourceClassBuilder && !member.isPatch) {
- result.add(member);
- }
- });
+ if (library.loader == loader) {
+ library.forEach((String name, Builder member) {
+ if (member is SourceClassBuilder && !member.isPatch) {
+ result.add(member);
+ }
+ });
+ }
});
return result;
}
@@ -242,11 +229,11 @@
loader.resolveParts();
loader.computeLibraryScopes();
loader.resolveTypes();
- loader.checkSemantics();
+ List<SourceClassBuilder> myClasses = collectMyClasses();
+ loader.checkSemantics(myClasses);
loader.buildProgram();
- List<SourceClassBuilder> sourceClasses = collectAllSourceClasses();
installDefaultSupertypes();
- installDefaultConstructors(sourceClasses);
+ installDefaultConstructors(myClasses);
loader.resolveConstructors();
loader.finishTypeVariables(objectClassBuilder);
program =
@@ -255,10 +242,10 @@
program.addMetadataRepository(metadataCollector.repository);
}
loader.computeHierarchy(program);
- loader.checkOverrides(sourceClasses);
+ loader.checkOverrides(myClasses);
if (!loader.target.disableTypeInference) {
- loader.prepareTopLevelInference(sourceClasses);
- loader.performTopLevelInference(sourceClasses);
+ loader.prepareTopLevelInference(myClasses);
+ loader.performTopLevelInference(myClasses);
}
} on deprecated_InputError catch (e) {
ticker.logMs("Got deprecated_InputError");
@@ -287,9 +274,9 @@
try {
ticker.logMs("Building program");
await loader.buildBodies();
- loader.finishStaticInvocations();
loader.finishDeferredLoadTearoffs();
- finishAllConstructors();
+ List<SourceClassBuilder> myClasses = collectMyClasses();
+ finishAllConstructors(myClasses);
loader.finishNativeMethods();
loader.finishPatchMethods();
runBuildTransformations();
@@ -380,19 +367,22 @@
void installDefaultSupertypes() {
Class objectClass = this.objectClass;
loader.builders.forEach((Uri uri, LibraryBuilder library) {
- library.forEach((String name, Builder builder) {
- if (builder is SourceClassBuilder) {
- Class cls = builder.target;
- if (cls != objectClass) {
- cls.supertype ??= objectClass.asRawSupertype;
- builder.supertype ??= new KernelNamedTypeBuilder("Object", null)
- ..bind(objectClassBuilder);
+ if (library.loader == loader) {
+ library.forEach((String name, Builder builder) {
+ if (builder is SourceClassBuilder) {
+ Class cls = builder.target;
+ if (cls != objectClass) {
+ cls.supertype ??= objectClass.asRawSupertype;
+ builder.supertype ??= new KernelNamedTypeBuilder("Object", null)
+ ..bind(objectClassBuilder);
+ }
+ if (builder.isMixinApplication) {
+ cls.mixedInType = builder.mixedInType
+ .buildSupertype(library, builder.charOffset, builder.fileUri);
+ }
}
- if (builder.isMixinApplication) {
- cls.mixedInType = builder.mixedInType.buildSupertype(library);
- }
- }
- });
+ });
+ }
});
ticker.logMs("Installed Object as implicit superclass");
}
@@ -523,9 +513,9 @@
isSyntheticDefault: true);
}
- void finishAllConstructors() {
+ void finishAllConstructors(List<SourceClassBuilder> builders) {
Class objectClass = this.objectClass;
- for (SourceClassBuilder builder in collectAllSourceClasses()) {
+ for (SourceClassBuilder builder in builders) {
Class cls = builder.target;
if (cls != objectClass) {
finishConstructors(builder);
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_type_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_type_builder.dart
index ff7d5b2..44fc100 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_type_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_type_builder.dart
@@ -13,5 +13,5 @@
DartType build(LibraryBuilder library);
- Supertype buildSupertype(LibraryBuilder library);
+ Supertype buildSupertype(LibraryBuilder library, int charOffset, Uri fileUri);
}
diff --git a/pkg/front_end/lib/src/fasta/loader.dart b/pkg/front_end/lib/src/fasta/loader.dart
index dd8a8e7..576e2a6 100644
--- a/pkg/front_end/lib/src/fasta/loader.dart
+++ b/pkg/front_end/lib/src/fasta/loader.dart
@@ -142,8 +142,10 @@
Future<Null> buildBodies() async {
assert(coreLibrary != null);
for (LibraryBuilder library in builders.values) {
- currentUriForCrashReporting = library.uri;
- await buildBody(library);
+ if (library.loader == this) {
+ currentUriForCrashReporting = library.uri;
+ await buildBody(library);
+ }
}
currentUriForCrashReporting = null;
logSummary(templateSourceBodySummary);
diff --git a/pkg/front_end/lib/src/fasta/parser/forwarding_listener.dart b/pkg/front_end/lib/src/fasta/parser/forwarding_listener.dart
index 54a46f2..ff2104f 100644
--- a/pkg/front_end/lib/src/fasta/parser/forwarding_listener.dart
+++ b/pkg/front_end/lib/src/fasta/parser/forwarding_listener.dart
@@ -998,6 +998,11 @@
}
@override
+ void handleInterpolationExpression(Token leftBracket, Token rightBracket) {
+ listener?.handleInterpolationExpression(leftBracket, rightBracket);
+ }
+
+ @override
void handleInvalidExpression(Token token) {
listener?.handleInvalidExpression(token);
}
diff --git a/pkg/front_end/lib/src/fasta/parser/listener.dart b/pkg/front_end/lib/src/fasta/parser/listener.dart
index cf5e615..8a9cf34 100644
--- a/pkg/front_end/lib/src/fasta/parser/listener.dart
+++ b/pkg/front_end/lib/src/fasta/parser/listener.dart
@@ -609,6 +609,8 @@
void beginLiteralString(Token token) {}
+ void handleInterpolationExpression(Token leftBracket, Token rightBracket) {}
+
void endLiteralString(int interpolationCount, Token endToken) {
logEvent("LiteralString");
}
diff --git a/pkg/front_end/lib/src/fasta/parser/modifier_context.dart b/pkg/front_end/lib/src/fasta/parser/modifier_context.dart
index 75091be..c8920ee 100644
--- a/pkg/front_end/lib/src/fasta/parser/modifier_context.dart
+++ b/pkg/front_end/lib/src/fasta/parser/modifier_context.dart
@@ -783,13 +783,13 @@
// to be interpreted as the top level function's identifier.
if (identical(next, afterModifiers)) {
beforeName = next;
- parser.rewriter.insertToken(
+ parser.rewriter.insertTokenAfter(
+ next,
new SyntheticStringToken(
TokenType.IDENTIFIER,
'#synthetic_function_${next.charOffset}',
token.charOffset,
- 0),
- next.next);
+ 0));
return next;
}
// If the next token is an operator, then skip it
diff --git a/pkg/front_end/lib/src/fasta/parser/parser.dart b/pkg/front_end/lib/src/fasta/parser/parser.dart
index c5d0ff8..9af160a 100644
--- a/pkg/front_end/lib/src/fasta/parser/parser.dart
+++ b/pkg/front_end/lib/src/fasta/parser/parser.dart
@@ -462,12 +462,12 @@
if (next.isOperator && optional('(', next.next)) {
// This appears to be a top level operator declaration, which is invalid.
reportRecoverableError(next, fasta.messageTopLevelOperator);
- // Insert a synthetic identifer
+ // Insert a synthetic identifier
// and continue parsing as a top level function.
- rewriter.insertToken(
+ rewriter.insertTokenAfter(
+ next,
new SyntheticStringToken(TokenType.IDENTIFIER,
- '#synthetic_function_${next.charOffset}', token.charOffset, 0),
- next.next);
+ '#synthetic_function_${next.charOffset}', token.charOffset, 0));
return parseTopLevelMember(next);
}
// Ignore any preceding modifiers and just report the unexpected token
@@ -1065,7 +1065,7 @@
Token replacement = link(
new SyntheticBeginToken(TokenType.OPEN_PAREN, next.charOffset),
new SyntheticToken(TokenType.CLOSE_PAREN, next.charOffset));
- rewriter.insertToken(replacement, next);
+ rewriter.insertTokenAfter(token, replacement);
}
return parseFormalParameters(token, kind);
}
@@ -1347,9 +1347,10 @@
}
Token skipBlock(Token token) {
+ Token previousToken = token;
token = token.next;
if (!optional('{', token)) {
- token = recoverFromMissingBlock(token);
+ token = recoverFromMissingBlock(previousToken);
}
Token closeBrace = closeBraceTokenFor(token);
if (closeBrace == null ||
@@ -1511,9 +1512,9 @@
Token extendsKeyword =
new SyntheticKeywordToken(Keyword.EXTENDS, next.offset);
Token superclassToken = new SyntheticStringToken(
- TokenType.IDENTIFIER, 'Object', next.offset);
- rewriter.insertToken(extendsKeyword, next);
- rewriter.insertToken(superclassToken, next);
+ TokenType.IDENTIFIER, 'Object', next.offset, 0);
+ rewriter.insertTokenAfter(token, extendsKeyword);
+ rewriter.insertTokenAfter(extendsKeyword, superclassToken);
token = parseType(extendsKeyword);
token = parseMixinApplicationRest(token);
listener.handleClassExtends(extendsKeyword);
@@ -1632,7 +1633,7 @@
Message message = context.recoveryTemplate.withArguments(next);
Token identifier = new SyntheticStringToken(
TokenType.IDENTIFIER, stringValue, next.charOffset, 0);
- return rewriteAndRecover(token, message, identifier);
+ return rewriteAndRecover(token, message, identifier).next;
}
/// Parse a simple identifier at the given [token], and return the identifier
@@ -1670,9 +1671,7 @@
// forgotten the `operator` keyword.
token = rewriteAndRecover(token, fasta.messageMissingOperatorKeyword,
new SyntheticKeywordToken(Keyword.OPERATOR, next.offset));
- // TODO(brianwilkerson): Remove the invocation of `previous` when
- // `rewriteAndRecover` returns the token before the new token.
- return parseOperatorName(token.previous);
+ return parseOperatorName(token);
} else {
reportRecoverableErrorWithToken(next, context.recoveryTemplate);
if (context == IdentifierContext.methodDeclaration) {
@@ -1723,6 +1722,27 @@
return token;
}
+ /// Return `true` if the given [token] should be treated like the start of
+ /// an expression for the purposes of recovery.
+ bool isExpressionStartForRecovery(Token next) =>
+ next.isKeywordOrIdentifier ||
+ next.type == TokenType.DOUBLE ||
+ next.type == TokenType.HASH ||
+ next.type == TokenType.HEXADECIMAL ||
+ next.type == TokenType.IDENTIFIER ||
+ next.type == TokenType.INT ||
+ next.type == TokenType.STRING ||
+ optional('{', next) ||
+ optional('(', next) ||
+ optional('[', next) ||
+ optional('[]', next) ||
+ optional('<', next) ||
+ optional('!', next) ||
+ optional('-', next) ||
+ optional('~', next) ||
+ optional('++', next) ||
+ optional('--', next);
+
/// Return `true` if the given [token] should be treated like an identifier in
/// the given [context] for the purposes of recovery.
bool isIdentifierForRecovery(Token token, IdentifierContext context) {
@@ -1744,7 +1764,7 @@
} else if (context == IdentifierContext.combinator) {
followingValues = [';'];
} else if (context == IdentifierContext.fieldDeclaration) {
- followingValues = [';', '=', ','];
+ followingValues = [';', '=', ',', '}'];
} else if (context == IdentifierContext.enumDeclaration) {
followingValues = ['{'];
} else if (context == IdentifierContext.enumValueDeclaration) {
@@ -1755,6 +1775,7 @@
return true;
}
followingValues = [
+ '.',
',',
'(',
')',
@@ -2469,7 +2490,8 @@
Message message = fasta.templateExpectedButGot.withArguments('.');
Token newToken =
new SyntheticToken(TokenType.PERIOD, token.charOffset);
- periodAfterThis = rewriteAndRecover(thisKeyword, message, newToken);
+ periodAfterThis =
+ rewriteAndRecover(thisKeyword, message, newToken).next;
} else {
periodAfterThis = token;
}
@@ -2479,7 +2501,6 @@
if (!token.isIdentifier) {
// Recover from a missing identifier by inserting one.
token = insertSyntheticIdentifier(beforeToken, nameContext);
- beforeToken = previousToken(periodAfterThis, token);
}
beforeNameToken = beforeToken;
beforeToken = nameToken = token;
@@ -2576,7 +2597,6 @@
// We need to recompute the before tokens because [ensureIdentifier]
// can cause synthetic tokens to be inserted.
beforeToken = previousToken(beforeToken, token);
- beforeNameToken = previousToken(beforeNameToken, nameToken);
} else {
listener.handleNoName(nameToken);
}
@@ -2634,59 +2654,21 @@
Function endStuff, Function handleNoStuff) {
// TODO(brianwilkerson): Rename to `parseStuffOpt`?
- bool rewriteEndToken(Token beforeEnd) {
- Token end = beforeEnd.next;
- String value = end?.stringValue;
- if (value != null && value.length > 1) {
- if (identical(value, '>>')) {
- Token replacement = new Token(TokenType.GT, end.charOffset);
- replacement.next = new Token(TokenType.GT, end.charOffset + 1);
- rewriter.replaceTokenFollowing(beforeEnd, replacement);
- return true;
- } else if (identical(value, '>=')) {
- Token replacement = new Token(TokenType.GT, end.charOffset);
- replacement.next = new Token(TokenType.EQ, end.charOffset + 1);
- rewriter.replaceTokenFollowing(beforeEnd, replacement);
- return true;
- } else if (identical(value, '>>=')) {
- Token replacement = new Token(TokenType.GT, end.charOffset);
- replacement.next = new Token(TokenType.GT, end.charOffset + 1);
- replacement.next.next = new Token(TokenType.EQ, end.charOffset + 2);
- rewriter.replaceTokenFollowing(beforeEnd, replacement);
- return true;
- }
- }
- return false;
- }
-
// TODO(brianwilkerson): Remove the invocation of `previous` when
// `injectGenericCommentTypeList` returns the last consumed token.
token = listener.injectGenericCommentTypeList(token.next).previous;
Token next = token.next;
if (optional('<', next)) {
BeginToken begin = next;
- Token end = begin.endToken;
- if (end != null) {
- Token beforeEnd = previousToken(begin, end);
- if (rewriteEndToken(beforeEnd)) {
- begin.endToken = null;
- }
- }
+ rewriteLtEndGroupOpt(begin);
beginStuff(begin);
int count = 0;
do {
token = stuffParser(token.next);
++count;
} while (optional(',', token.next));
- if (end == null) {
- if (rewriteEndToken(token)) {
- begin.endToken = null;
- }
- }
- token = token.next;
+ token = begin.endToken = ensureGt(token);
endStuff(count, begin, token);
- expect('>', token);
- begin.endToken ??= token;
return token;
}
handleNoStuff(next);
@@ -2760,15 +2742,13 @@
Token afterModifiers =
identifiers.isNotEmpty ? identifiers.head.next.next : beforeStart.next;
return isField
- ? parseFields(beforeStart, identifiers.reverse(), beforeType?.next,
- beforeName, true)
+ ? parseFields(beforeStart, identifiers.reverse(), beforeName, true)
: parseTopLevelMethod(
beforeStart, afterModifiers, beforeType, getOrSet, beforeName);
}
- Token parseFields(Token start, Link<Token> modifiers, Token type,
- Token beforeName, bool isTopLevel) {
- // TODO(brianwilkerson): Remove the parameter `type` because it isn't used.
+ Token parseFields(
+ Token start, Link<Token> modifiers, Token beforeName, bool isTopLevel) {
Token varFinalOrConst = null;
for (Token beforeModifier in modifiers) {
Token modifier = beforeModifier.next;
@@ -3213,10 +3193,11 @@
/// If the next token is a colon, return it. Otherwise, report an
/// error, insert a synthetic colon, and return the inserted colon.
Token ensureColon(Token token) {
- if (optional(':', token.next)) return token.next;
+ Token next = token.next;
+ if (optional(':', next)) return next;
Message message = fasta.templateExpectedButGot.withArguments(':');
- Token newToken = new SyntheticToken(TokenType.COLON, token.charOffset);
- return rewriteAndRecover(token, message, newToken);
+ Token newToken = new SyntheticToken(TokenType.COLON, next.charOffset);
+ return rewriteAndRecover(token, message, newToken).next;
}
Token ensureParseLiteralString(Token token) {
@@ -3231,8 +3212,24 @@
return parseLiteralString(token);
}
- /// If the given [token] is a semi-colon, return it. Otherwise, report an
- /// error, insert a synthetic semi-colon, and return the inserted semi-colon.
+ /// If the token after [token] is a '>', return it.
+ /// If the next token is a composite greater-than token such as '>>',
+ /// then replace that token with separate tokens, and return the first '>'.
+ /// Otherwise, report an error, insert a synthetic '>',
+ /// and return that newly inserted synthetic '>'.
+ Token ensureGt(Token token) {
+ Token next = token.next;
+ String value = next.stringValue;
+ if (value == '>') {
+ return next;
+ }
+ rewriteGtCompositeOrRecover(token, next, value);
+ return token.next;
+ }
+
+ /// If the token after [token] is a semi-colon, return it.
+ /// Otherwise, report an error, insert a synthetic semi-colon,
+ /// and return the inserted semi-colon.
Token ensureSemicolon(Token token) {
// TODO(danrubel): Once all expect(';'...) call sites have been converted
// to use this method, remove similar semicolon recovery code
@@ -3241,13 +3238,45 @@
if (optional(';', next)) return next;
Message message = fasta.templateExpectedButGot.withArguments(';');
Token newToken = new SyntheticToken(TokenType.SEMICOLON, next.charOffset);
- return rewriteAndRecover(token, message, newToken);
+ return rewriteAndRecover(token, message, newToken).next;
}
+ /// Report an error at the token after [token] that has the given [message].
+ /// Insert the [newToken] after [token] and return [token].
Token rewriteAndRecover(Token token, Message message, Token newToken) {
- token = token.next;
- reportRecoverableError(token, message);
- return rewriter.insertToken(newToken, token);
+ reportRecoverableError(token.next, message);
+ rewriter.insertTokenAfter(token, newToken);
+ return token;
+ }
+
+ void rewriteGtCompositeOrRecover(Token token, Token next, String value) {
+ assert(value != '>');
+ Token replacement = new Token(TokenType.GT, next.charOffset);
+ if (identical(value, '>>')) {
+ replacement.next = new Token(TokenType.GT, next.charOffset + 1);
+ } else if (identical(value, '>=')) {
+ replacement.next = new Token(TokenType.EQ, next.charOffset + 1);
+ } else if (identical(value, '>>=')) {
+ replacement.next = new Token(TokenType.GT, next.charOffset + 1);
+ replacement.next.next = new Token(TokenType.EQ, next.charOffset + 2);
+ } else {
+ // Recovery
+ rewriteAndRecover(token, fasta.templateExpectedToken.withArguments('>'),
+ new SyntheticToken(TokenType.GT, next.offset));
+ return;
+ }
+ rewriter.replaceTokenFollowing(token, replacement);
+ }
+
+ void rewriteLtEndGroupOpt(BeginToken beginToken) {
+ assert(optional('<', beginToken));
+ Token end = beginToken.endGroup;
+ String value = end?.stringValue;
+ if (value != null && value.length > 1) {
+ Token beforeEnd = previousToken(beginToken, end);
+ rewriteGtCompositeOrRecover(beforeEnd, end, value);
+ beginToken.endGroup = null;
+ }
}
/// Report the given token as unexpected and return the next token if the next
@@ -3372,9 +3401,10 @@
}
Token skipClassBody(Token token) {
+ Token previousToken = token;
token = token.next;
if (!optional('{', token)) {
- token = recoverFromMissingClassBody(token);
+ token = recoverFromMissingClassBody(previousToken);
}
Token closeBrace = closeBraceTokenFor(token);
if (closeBrace == null ||
@@ -3395,10 +3425,11 @@
Token parseClassBody(Token token, Token beforeBody) {
// TODO(brianwilkerson): Remove the parameter `beforeBody` because it is not
// being used.
+ Token previousToken = token;
Token begin = token = token.next;
listener.beginClassBody(token);
if (!optional('{', token)) {
- token = begin = recoverFromMissingClassBody(token);
+ token = begin = recoverFromMissingClassBody(previousToken);
}
int count = 0;
while (notEofOrValue('}', token.next)) {
@@ -3459,7 +3490,15 @@
Link<Token> identifiers = findMemberName(start);
if (identifiers.isEmpty) {
- return recoverFromInvalidClassMember(start);
+ if ((isValidTypeReference(token) || optional('var', token)) &&
+ isPostIdentifierForRecovery(
+ token.next, IdentifierContext.fieldDeclaration)) {
+ // Recovery: Looks like a field declaration but missing a field name.
+ insertSyntheticIdentifier(token, IdentifierContext.fieldDeclaration);
+ return parseFields(start, const Link<Token>(), token, false);
+ } else {
+ return recoverFromInvalidClassMember(start);
+ }
}
Token afterName = identifiers.head.next;
identifiers = identifiers.tail;
@@ -3530,8 +3569,7 @@
Token lastModifier = identifiers.isNotEmpty ? identifiers.head.next : start;
token = isField
- ? parseFields(
- start, identifiers.reverse(), beforeType?.next, beforeName, false)
+ ? parseFields(start, identifiers.reverse(), beforeName, false)
: parseMethod(start, lastModifier, beforeType, getOrSet, beforeName);
listener.endMember();
return token;
@@ -3622,12 +3660,10 @@
}
} else {
token = ensureIdentifier(beforeName, IdentifierContext.methodDeclaration);
+ token = parseQualifiedRestOpt(
+ token, IdentifierContext.methodDeclarationContinuation);
}
- // TODO(brianwilkerson): Move the next statement inside the else above
- // because operator names can't be qualified.
- token = parseQualifiedRestOpt(
- token, IdentifierContext.methodDeclarationContinuation);
bool isGetter = false;
if (getOrSet == null) {
token = parseTypeVariablesOpt(token);
@@ -3657,6 +3693,7 @@
allowAbstract = true;
}
if (optional('=', next)) {
+ reportRecoverableError(next, fasta.messageRedirectionInNonFactory);
token = parseRedirectingFactoryBody(token);
} else {
token = parseFunctionBody(token, false, allowAbstract);
@@ -3971,7 +4008,7 @@
Token begin = next;
int statementCount = 0;
if (!optional('{', next)) {
- token = recoverFromMissingFunctionBody(next);
+ token = recoverFromMissingFunctionBody(token);
listener.handleInvalidFunctionBody(token);
return token.endGroup;
}
@@ -4450,11 +4487,9 @@
listener.beginCascade(cascadeOperator);
if (optional('[', token.next)) {
token = parseArgumentOrIndexStar(token, null);
- } else if (token.next.isIdentifier) {
+ } else {
token = parseSend(token, IdentifierContext.expressionContinuation);
listener.endBinaryExpression(cascadeOperator);
- } else {
- return reportUnexpectedToken(token.next);
}
Token next = token.next;
Token mark;
@@ -4548,7 +4583,7 @@
Message message = fasta.templateExpectedButGot.withArguments(']');
Token newToken = new SyntheticToken(
TokenType.CLOSE_SQUARE_BRACKET, next.charOffset);
- next = rewriteAndRecover(token, message, newToken);
+ next = rewriteAndRecover(token, message, newToken).next;
}
listener.handleIndexedExpression(openSquareBracket, next);
token = next;
@@ -4673,6 +4708,7 @@
}
Token parseParenthesizedExpression(Token token) {
+ Token previousToken = token;
token = token.next;
if (!optional('(', token)) {
// Recover
@@ -4683,7 +4719,7 @@
BeginToken replacement = link(
new SyntheticBeginToken(TokenType.OPEN_PAREN, token.charOffset),
new SyntheticToken(TokenType.CLOSE_PAREN, token.charOffset));
- token = rewriter.insertToken(replacement, token);
+ token = rewriter.insertTokenAfter(previousToken, replacement).next;
}
BeginToken begin = token;
token = parseExpression(token).next;
@@ -4788,17 +4824,41 @@
int count = 0;
bool old = mayParseFunctionExpressions;
mayParseFunctionExpressions = true;
- do {
+ while (true) {
if (optional('}', token.next)) {
token = token.next;
break;
}
- token = parseMapLiteralEntry(token).next;
+ token = parseMapLiteralEntry(token);
+ Token next = token.next;
++count;
- } while (optional(',', token));
+ if (!optional(',', next)) {
+ if (optional('}', next)) {
+ token = next;
+ break;
+ }
+ // Recovery
+ if (isExpressionStartForRecovery(next)) {
+ // If this looks like the start of an expression,
+ // then report an error, insert the comma, and continue parsing.
+ next = rewriteAndRecover(
+ token,
+ fasta.templateExpectedButGot.withArguments(','),
+ new SyntheticToken(TokenType.COMMA, next.offset))
+ .next;
+ } else {
+ reportRecoverableError(
+ next, fasta.templateExpectedButGot.withArguments('}'));
+ // Scanner guarantees a closing curly bracket
+ token = beginToken.endGroup;
+ break;
+ }
+ }
+ token = next;
+ }
+ assert(optional('}', token));
mayParseFunctionExpressions = old;
listener.handleLiteralMap(count, beginToken, constKeyword, token);
- expect('}', token);
return token;
}
@@ -4864,10 +4924,9 @@
// Assume the listener rejects non-string keys.
// TODO(brianwilkerson): Change the assumption above by moving error
// checking into the parser, making it possible to recover.
- token = parseExpression(token).next;
- Token colon = token;
- expect(':', colon);
token = parseExpression(token);
+ Token colon = ensureColon(token);
+ token = parseExpression(colon);
listener.endLiteralMapEntry(colon, token.next);
return token;
}
@@ -4886,9 +4945,9 @@
reportRecoverableError(
token, fasta.templateExpectedButGot.withArguments('('));
BeginToken replacement = link(
- new SyntheticBeginToken(TokenType.OPEN_PAREN, token.offset),
- new SyntheticToken(TokenType.CLOSE_PAREN, token.offset));
- rewriter.insertToken(replacement, next);
+ new SyntheticBeginToken(TokenType.OPEN_PAREN, next.offset),
+ new SyntheticToken(TokenType.CLOSE_PAREN, next.offset));
+ rewriter.insertTokenAfter(token, replacement);
}
token = parseArguments(token);
return token;
@@ -5044,24 +5103,28 @@
listener.beginLiteralString(token);
// Parsing the prefix, for instance 'x of 'x${id}y${id}z'
int interpolationCount = 0;
- var kind = token.next.kind;
+ Token next = token.next;
+ var kind = next.kind;
while (kind != EOF_TOKEN) {
if (identical(kind, STRING_INTERPOLATION_TOKEN)) {
// Parsing ${expression}.
- token = parseExpression(token.next).next;
+ token = parseExpression(next).next;
expect('}', token);
+ listener.handleInterpolationExpression(next, token);
} else if (identical(kind, STRING_INTERPOLATION_IDENTIFIER_TOKEN)) {
// Parsing $identifier.
- token = parseIdentifierExpression(token.next);
+ token = parseIdentifierExpression(next);
+ listener.handleInterpolationExpression(next, null);
} else {
break;
}
++interpolationCount;
// Parsing the infix/suffix, for instance y and z' of 'x${id}y${id}z'
token = parseStringPart(token);
- kind = token.next.kind;
+ next = token.next;
+ kind = next.kind;
}
- listener.endLiteralString(interpolationCount, token.next);
+ listener.endLiteralString(interpolationCount, next);
return token;
}
@@ -5184,31 +5247,14 @@
break;
}
// Recovery
- // TODO(danrubel): Consider using isPostIdentifierForRecovery
- // and isStartOfNextSibling.
- if (next.isKeywordOrIdentifier ||
- next.type == TokenType.DOUBLE ||
- next.type == TokenType.HASH ||
- next.type == TokenType.HEXADECIMAL ||
- next.type == TokenType.IDENTIFIER ||
- next.type == TokenType.INT ||
- next.type == TokenType.STRING ||
- optional('{', next) ||
- optional('(', next) ||
- optional('[', next) ||
- optional('[]', next) ||
- optional('<', next) ||
- optional('!', next) ||
- optional('-', next) ||
- optional('~', next) ||
- optional('++', next) ||
- optional('--', next)) {
+ if (isExpressionStartForRecovery(next)) {
// If this looks like the start of an expression,
// then report an error, insert the comma, and continue parsing.
next = rewriteAndRecover(
- token,
- fasta.templateExpectedButGot.withArguments(','),
- new SyntheticToken(TokenType.COMMA, next.offset));
+ token,
+ fasta.templateExpectedButGot.withArguments(','),
+ new SyntheticToken(TokenType.COMMA, next.offset))
+ .next;
} else {
reportRecoverableError(
next, fasta.templateExpectedButGot.withArguments(')'));
@@ -5525,11 +5571,12 @@
/// ;
/// ```
Token parseBlock(Token token) {
+ Token previousToken = token;
Token begin = token = token.next;
listener.beginBlock(begin);
int statementCount = 0;
if (!optional('{', token)) {
- token = recoverFromMissingBlock(token);
+ token = recoverFromMissingBlock(previousToken);
}
while (notEofOrValue('}', token.next)) {
Token startToken = token.next;
@@ -5964,44 +6011,47 @@
next, fasta.templateExpectedClassMember);
}
- /// Report that the given [token] was expected to be the beginning of a block
- /// but isn't, insert a synthetic pair of curly braces, and return the opening
- /// curly brace.
- Token recoverFromMissingBlock(Token token) {
+ /// Report that the token after [previousToken] was expected to be the
+ /// beginning of a block but isn't, insert a synthetic pair of curly braces,
+ /// and return the opening curly brace.
+ Token recoverFromMissingBlock(Token previousToken) {
// TODO(brianwilkerson): Add context information (as a parameter) so that we
// can (a) generate a better error and (b) unify this method with
// `recoverFromMissingClassBody` and `recoverFromMissingFunctionBody`.
+ Token token = previousToken.next;
reportRecoverableError(token, fasta.messageExpectedBlock);
BeginToken replacement = link(
new SyntheticBeginToken(TokenType.OPEN_CURLY_BRACKET, token.offset),
new SyntheticToken(TokenType.CLOSE_CURLY_BRACKET, token.offset));
- rewriter.insertToken(replacement, token);
+ rewriter.insertTokenAfter(previousToken, replacement);
return replacement;
}
- /// Report that the given [token] was expected to be the beginning of a class
- /// body but isn't, insert a synthetic pair of curly braces, and return the
- /// opening curly brace.
- Token recoverFromMissingClassBody(Token token) {
+ /// Report that the token after [previousToken] was expected to be the
+ /// beginning of a class body but isn't, insert a synthetic pair of curly
+ /// braces, and return the opening curly brace.
+ Token recoverFromMissingClassBody(Token previousToken) {
+ Token token = previousToken.next;
reportRecoverableError(
token, fasta.templateExpectedClassBody.withArguments(token));
BeginToken replacement = link(
new SyntheticBeginToken(TokenType.OPEN_CURLY_BRACKET, token.offset),
new SyntheticToken(TokenType.CLOSE_CURLY_BRACKET, token.offset));
- rewriter.insertToken(replacement, token);
+ rewriter.insertTokenAfter(previousToken, replacement);
return replacement;
}
- /// Report that the given [token] was expected to be the beginning of a block
- /// function body but isn't, insert a synthetic pair of curly braces, and
- /// return the opening curly brace.
- Token recoverFromMissingFunctionBody(Token token) {
+ /// Report that the token after [previousToken] was expected to be the
+ /// beginning of a block function body but isn't, insert a synthetic pair of
+ /// curly braces, and return the opening curly brace.
+ Token recoverFromMissingFunctionBody(Token previousToken) {
+ Token token = previousToken.next;
reportRecoverableError(
token, fasta.templateExpectedFunctionBody.withArguments(token));
BeginToken replacement = link(
new SyntheticBeginToken(TokenType.OPEN_CURLY_BRACKET, token.offset),
new SyntheticToken(TokenType.CLOSE_CURLY_BRACKET, token.offset));
- rewriter.insertToken(replacement, token);
+ rewriter.insertTokenAfter(previousToken, replacement);
return replacement;
}
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 758574b..aa850f9 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
@@ -31,18 +31,17 @@
TokenStreamRewriter();
/// Insert the chain of tokens starting at the [insertedToken] immediately
- /// before the [followingToken]. The [followingToken] is assumed to be
- /// reachable from, but not the same as, the [previousToken].
- Token insertToken(Token insertedToken, Token followingToken) {
- Token previous = followingToken.previous;
- previous.next = insertedToken;
- insertedToken.previous = previous;
+ /// after the [previousToken]. Return the [previousToken].
+ Token insertTokenAfter(Token previousToken, Token insertedToken) {
+ Token afterToken = previousToken.next;
+ previousToken.next = insertedToken;
+ insertedToken.previous = previousToken;
Token lastReplacement = _lastTokenInChain(insertedToken);
- lastReplacement.next = followingToken;
- followingToken.previous = lastReplacement;
+ lastReplacement.next = afterToken;
+ afterToken.previous = lastReplacement;
- return insertedToken;
+ return previousToken;
}
/// Replace the single token immediately following the [previousToken] with
diff --git a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
index 94f43c1..f159350 100644
--- a/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_class_builder.dart
@@ -128,14 +128,17 @@
scope.forEach(buildBuilders);
constructors.forEach(buildBuilders);
- actualCls.supertype = supertype?.buildSupertype(library);
- actualCls.mixedInType = mixedInType?.buildSupertype(library);
+ actualCls.supertype =
+ supertype?.buildSupertype(library, charOffset, fileUri);
+ actualCls.mixedInType =
+ mixedInType?.buildSupertype(library, charOffset, fileUri);
// TODO(ahe): If `cls.supertype` is null, and this isn't Object, report a
// compile-time error.
cls.isAbstract = isAbstract;
if (interfaces != null) {
for (KernelTypeBuilder interface in interfaces) {
- Supertype supertype = interface.buildSupertype(library);
+ Supertype supertype =
+ interface.buildSupertype(library, charOffset, fileUri);
if (supertype != null) {
// TODO(ahe): Report an error if supertype is null.
actualCls.implementedTypes.add(supertype);
@@ -205,6 +208,11 @@
@override
int finishPatch() {
if (!isPatch) return 0;
+
+ // TODO(ahe): restore file-offset once we track both origin and patch file
+ // URIs. See https://github.com/dart-lang/sdk/issues/31579
+ cls.annotations.forEach((m) => m.fileOffset = origin.cls.fileOffset);
+
int count = 0;
scope.forEach((String name, Builder builder) {
count += builder.finishPatch();
diff --git a/pkg/front_end/lib/src/fasta/source/source_graph.dart b/pkg/front_end/lib/src/fasta/source/source_graph.dart
new file mode 100644
index 0000000..00297c6
--- /dev/null
+++ b/pkg/front_end/lib/src/fasta/source/source_graph.dart
@@ -0,0 +1,48 @@
+// 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.source_graph;
+
+import '../builder/builder.dart' show LibraryBuilder;
+
+import '../export.dart' show Export;
+
+import '../graph/graph.dart' show Graph;
+
+import '../import.dart' show Import;
+
+import 'source_library_builder.dart' show SourceLibraryBuilder;
+
+class SourceGraph implements Graph<Uri> {
+ final Map<Uri, LibraryBuilder> builders;
+
+ SourceGraph(this.builders);
+
+ Iterable<Uri> get vertices => builders.keys;
+
+ Iterable<Uri> neighborsOf(Uri vertex) sync* {
+ SourceLibraryBuilder library = builders[vertex];
+ if (library == null) {
+ throw "Library not found: $vertex";
+ }
+ for (Import import in library.imports) {
+ Uri uri = import.imported.uri;
+ if (builders.containsKey(uri)) {
+ yield uri;
+ }
+ }
+ for (Export export in library.exports) {
+ Uri uri = export.exported.uri;
+ if (builders.containsKey(uri)) {
+ yield uri;
+ }
+ }
+ for (SourceLibraryBuilder part in library.parts) {
+ Uri uri = part.uri;
+ if (builders.containsKey(uri)) {
+ yield uri;
+ }
+ }
+ }
+}
diff --git a/pkg/front_end/lib/src/fasta/source/source_loader.dart b/pkg/front_end/lib/src/fasta/source/source_loader.dart
index 180d4cb..5c71111 100644
--- a/pkg/front_end/lib/src/fasta/source/source_loader.dart
+++ b/pkg/front_end/lib/src/fasta/source/source_loader.dart
@@ -209,12 +209,13 @@
void resolveParts() {
List<Uri> parts = <Uri>[];
builders.forEach((Uri uri, LibraryBuilder library) {
- if (library is SourceLibraryBuilder) {
- if (library.isPart) {
- library.validatePart();
+ if (library.loader == this) {
+ SourceLibraryBuilder sourceLibrary = library;
+ if (sourceLibrary.isPart) {
+ sourceLibrary.validatePart();
parts.add(uri);
} else {
- library.includeParts();
+ sourceLibrary.includeParts();
}
}
});
@@ -222,7 +223,7 @@
ticker.logMs("Resolved parts");
builders.forEach((Uri uri, LibraryBuilder library) {
- if (library is SourceLibraryBuilder) {
+ if (library.loader == this) {
library.applyPatches();
}
});
@@ -233,8 +234,9 @@
Set<LibraryBuilder> exporters = new Set<LibraryBuilder>();
Set<LibraryBuilder> exportees = new Set<LibraryBuilder>();
builders.forEach((Uri uri, LibraryBuilder library) {
- if (library is SourceLibraryBuilder) {
- library.buildInitialScopes();
+ if (library.loader == this) {
+ SourceLibraryBuilder sourceLibrary = library;
+ sourceLibrary.buildInitialScopes();
}
if (library.exporters.isNotEmpty) {
exportees.add(library);
@@ -266,10 +268,18 @@
}
} while (wasChanged);
builders.forEach((Uri uri, LibraryBuilder library) {
- if (library is SourceLibraryBuilder) {
- library.addImportsToScope();
+ if (library.loader == this) {
+ SourceLibraryBuilder sourceLibrary = library;
+ sourceLibrary.addImportsToScope();
}
});
+ for (LibraryBuilder exportee in exportees) {
+ // TODO(ahe): Change how we track exporters. Currently, when a library
+ // (exporter) exports another library (exportee) we add a reference to
+ // exporter to exportee. This creates a reference in the wrong direction
+ // and can lead to memory leaks.
+ exportee.exporters.clear();
+ }
ticker.logMs("Computed library scopes");
// debugPrintExports();
}
@@ -314,23 +324,19 @@
void finishDeferredLoadTearoffs() {
int count = 0;
builders.forEach((Uri uri, LibraryBuilder library) {
- count += library.finishDeferredLoadTearoffs();
+ if (library.loader == this) {
+ count += library.finishDeferredLoadTearoffs();
+ }
});
ticker.logMs("Finished deferred load tearoffs $count");
}
- void finishStaticInvocations() {
- int count = 0;
- builders.forEach((Uri uri, LibraryBuilder library) {
- count += library.finishStaticInvocations();
- });
- ticker.logMs("Finished static invocations $count");
- }
-
void resolveConstructors() {
int count = 0;
builders.forEach((Uri uri, LibraryBuilder library) {
- count += library.resolveConstructors(null);
+ if (library.loader == this) {
+ count += library.resolveConstructors(null);
+ }
});
ticker.logMs("Resolved $count constructors");
}
@@ -338,7 +344,9 @@
void finishTypeVariables(ClassBuilder object) {
int count = 0;
builders.forEach((Uri uri, LibraryBuilder library) {
- count += library.finishTypeVariables(object);
+ if (library.loader == this) {
+ count += library.finishTypeVariables(object);
+ }
});
ticker.logMs("Resolved $count type-variable bounds");
}
@@ -346,7 +354,9 @@
void finishNativeMethods() {
int count = 0;
builders.forEach((Uri uri, LibraryBuilder library) {
- count += library.finishNativeMethods();
+ if (library.loader == this) {
+ count += library.finishNativeMethods();
+ }
});
ticker.logMs("Finished $count native methods");
}
@@ -354,7 +364,9 @@
void finishPatchMethods() {
int count = 0;
builders.forEach((Uri uri, LibraryBuilder library) {
- count += library.finishPatchMethods();
+ if (library.loader == this) {
+ count += library.finishPatchMethods();
+ }
});
ticker.logMs("Finished $count patch methods");
}
@@ -410,36 +422,49 @@
return output;
}
- void checkSemantics() {
- List<ClassBuilder> allClasses = target.collectAllClasses();
- Iterable<ClassBuilder> candidates = cyclicCandidates(allClasses);
- Map<ClassBuilder, Set<ClassBuilder>> realCycles =
- <ClassBuilder, Set<ClassBuilder>>{};
- for (ClassBuilder cls in candidates) {
- Set<ClassBuilder> cycles = cyclicCandidates(allSupertypes(cls));
- if (cycles.isNotEmpty) {
- realCycles[cls] = cycles;
+ void checkSemantics(List<SourceClassBuilder> classes) {
+ Iterable<ClassBuilder> candidates = cyclicCandidates(classes);
+ if (candidates.isNotEmpty) {
+ Map<ClassBuilder, Set<ClassBuilder>> realCycles =
+ <ClassBuilder, Set<ClassBuilder>>{};
+ for (ClassBuilder cls in candidates) {
+ Set<ClassBuilder> cycles = cyclicCandidates(allSupertypes(cls));
+ if (cycles.isNotEmpty) {
+ realCycles[cls] = cycles;
+ }
}
- }
- Set<ClassBuilder> reported = new Set<ClassBuilder>();
- realCycles.forEach((ClassBuilder cls, Set<ClassBuilder> cycles) {
- target.breakCycle(cls);
- if (reported.add(cls)) {
+ Map<LocatedMessage, ClassBuilder> messages =
+ <LocatedMessage, ClassBuilder>{};
+ realCycles.forEach((ClassBuilder cls, Set<ClassBuilder> cycles) {
+ target.breakCycle(cls);
List<ClassBuilder> involved = <ClassBuilder>[];
for (ClassBuilder cls in cycles) {
if (realCycles.containsKey(cls)) {
involved.add(cls);
- reported.add(cls);
}
}
- String involvedString =
- involved.map((c) => c.fullNameForErrors).join("', '");
- cls.addCompileTimeError(
- templateCyclicClassHierarchy.withArguments(
- cls.fullNameForErrors, involvedString),
- cls.charOffset);
+ // Sort the class names alphabetically to ensure the order is stable.
+ // TODO(ahe): It's possible that a better UX would be to sort the
+ // classes based on walking the class hierarchy in breadth-first order.
+ String involvedString = (involved
+ .where((c) => c != cls)
+ .map((c) => c.fullNameForErrors)
+ .toList()
+ ..sort())
+ .join("', '");
+ messages[templateCyclicClassHierarchy
+ .withArguments(cls.fullNameForErrors, involvedString)
+ .withLocation(cls.fileUri, cls.charOffset)] = cls;
+ });
+
+ // Report all classes involved in a cycle, sorted to ensure stability as
+ // [cyclicCandidates] is sensitive to if the platform (or other modules)
+ // are included in [classes].
+ for (LocatedMessage message in messages.keys.toList()..sort()) {
+ messages[message]
+ .addCompileTimeError(message.messageObject, message.charOffset);
}
- });
+ }
ticker.logMs("Found cycles");
Set<ClassBuilder> blackListedClasses = new Set<ClassBuilder>.from([
coreLibrary["bool"],
@@ -448,7 +473,7 @@
coreLibrary["double"],
coreLibrary["String"],
]);
- for (ClassBuilder cls in allClasses) {
+ for (ClassBuilder cls in classes) {
if (cls.library.loader != this) continue;
Set<ClassBuilder> directSupertypes = new Set<ClassBuilder>();
target.addDirectSupertype(cls, directSupertypes);
@@ -497,8 +522,9 @@
void buildProgram() {
builders.forEach((Uri uri, LibraryBuilder library) {
- if (library is SourceLibraryBuilder) {
- L target = library.build(coreLibrary);
+ if (library.loader == this) {
+ SourceLibraryBuilder sourceLibrary = library;
+ L target = sourceLibrary.build(coreLibrary);
if (!library.isPatch) {
libraries.add(target);
}
@@ -517,7 +543,9 @@
void checkOverrides(List<SourceClassBuilder> sourceClasses) {
assert(hierarchy != null);
for (SourceClassBuilder builder in sourceClasses) {
- builder.checkOverrides(hierarchy);
+ if (builder.library.loader == this) {
+ builder.checkOverrides(hierarchy);
+ }
}
ticker.logMs("Checked overrides");
}
@@ -539,7 +567,7 @@
instrumentation,
target.strongMode);
builders.forEach((Uri uri, LibraryBuilder library) {
- if (library is SourceLibraryBuilder) {
+ if (library.loader == this) {
library.prepareTopLevelInference(library, null);
}
});
@@ -574,7 +602,7 @@
typeInferenceEngine.finishTopLevelInitializingFormals();
if (instrumentation != null) {
builders.forEach((Uri uri, LibraryBuilder library) {
- if (library is SourceLibraryBuilder) {
+ if (library.loader == this) {
library.instrumentTopLevelInference(instrumentation);
}
});
@@ -644,10 +672,7 @@
message.code == fasta_codes.codeConstConstructorWithBody ||
message.code == fasta_codes.codeConstructorNotFound ||
message.code == fasta_codes.codeSuperclassHasNoDefaultConstructor ||
- message.code == fasta_codes.codeSupertypeIsIllegal ||
- message.code == fasta_codes.codeSupertypeIsTypeVariable ||
message.code == fasta_codes.codeTypeArgumentsOnTypeVariable ||
- message.code == fasta_codes.codeTypeNotFound ||
message.code == fasta_codes.codeUnspecified)) {
// TODO(ahe): All warnings should have a charOffset, but currently, some
// warnings lack them.
diff --git a/pkg/front_end/lib/src/fasta/source/stack_listener.dart b/pkg/front_end/lib/src/fasta/source/stack_listener.dart
index a82e12d..6bb8712 100644
--- a/pkg/front_end/lib/src/fasta/source/stack_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/stack_listener.dart
@@ -397,6 +397,7 @@
for (int i = 0; i < count; i++) {
final value = table[startIndex + i];
tailList[i] = value is NullValue ? null : value;
+ table[startIndex + i] = null;
}
arrayLength -= count;
diff --git a/pkg/front_end/lib/src/fasta/target_implementation.dart b/pkg/front_end/lib/src/fasta/target_implementation.dart
index 095b493..938f7cae 100644
--- a/pkg/front_end/lib/src/fasta/target_implementation.dart
+++ b/pkg/front_end/lib/src/fasta/target_implementation.dart
@@ -48,9 +48,6 @@
/// Add the classes extended or implemented directly by [cls] to [set].
void addDirectSupertype(ClassBuilder cls, Set<ClassBuilder> set);
- /// Returns all classes that will be included in the resulting program.
- List<ClassBuilder> collectAllClasses();
-
/// The class [cls] is involved in a cyclic definition. This method should
/// ensure that the cycle is broken, for example, by removing superclass and
/// implemented interfaces.
diff --git a/pkg/front_end/lib/src/fasta/ticker.dart b/pkg/front_end/lib/src/fasta/ticker.dart
index ffa94366..b785cba 100644
--- a/pkg/front_end/lib/src/fasta/ticker.dart
+++ b/pkg/front_end/lib/src/fasta/ticker.dart
@@ -29,4 +29,9 @@
previousTick = sw.elapsed;
}
}
+
+ void reset() {
+ sw.reset();
+ previousTick = sw.elapsed;
+ }
}
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 ea8dc78..25f7ae3 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
@@ -3,7 +3,9 @@
// BSD-style license that can be found in the LICENSE.md file.
import 'package:front_end/src/base/instrumentation.dart';
+import 'package:front_end/src/fasta/builder/library_builder.dart';
import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart';
+import 'package:front_end/src/fasta/messages.dart';
import 'package:front_end/src/fasta/problems.dart';
import 'package:front_end/src/fasta/type_inference/type_inference_engine.dart';
import 'package:front_end/src/fasta/type_inference/type_inferrer.dart';
@@ -29,17 +31,43 @@
/// Concrete class derived from [InferenceNode] to represent type inference of
/// getters, setters, and fields based on inheritance.
class AccessorInferenceNode extends MemberInferenceNode {
- AccessorInferenceNode(InterfaceResolver interfaceResolver,
- Procedure declaredMethod, List<Member> candidates, int start, int end)
- : super(interfaceResolver, declaredMethod, candidates, start, end);
+ AccessorInferenceNode(
+ InterfaceResolver interfaceResolver,
+ Procedure declaredMethod,
+ List<Member> candidates,
+ int start,
+ int end,
+ LibraryBuilder library,
+ Uri fileUri)
+ : super(interfaceResolver, declaredMethod, candidates, start, end,
+ library, fileUri);
+
+ String get _name {
+ if (_declaredMethod is! SyntheticAccessor && _declaredMethod.isSetter) {
+ return _declaredMethod.function.positionalParameters[0].name;
+ }
+ return _declaredMethod.name.name;
+ }
+
+ int get _offset {
+ if (_declaredMethod is! SyntheticAccessor && _declaredMethod.isSetter) {
+ return _declaredMethod.function.positionalParameters[0].fileOffset;
+ }
+ return _declaredMethod.fileOffset;
+ }
@override
void resolveInternal() {
var declaredMethod = _declaredMethod;
var kind = declaredMethod.kind;
var overriddenTypes = _computeAccessorOverriddenTypes();
- if (!isCircular) {
- var inferredType = _matchTypes(overriddenTypes);
+ if (isCircular) {
+ _library.addCompileTimeError(
+ templateCantInferTypeDueToCircularity.withArguments(_name),
+ _offset,
+ _fileUri);
+ } else {
+ var inferredType = _matchTypes(overriddenTypes, _name, _offset);
if (declaredMethod is SyntheticAccessor) {
declaredMethod._field.type = inferredType;
} else {
@@ -673,8 +701,8 @@
///
/// If [setters] is `true`, the list will be populated by setters; otherwise
/// it will be populated by getters and methods.
- void createApiMembers(
- Class class_, List<Member> getters, List<Member> setters) {
+ void createApiMembers(Class class_, List<Member> getters,
+ List<Member> setters, LibraryBuilder library) {
var candidates = ClassHierarchy.mergeSortedLists(
getCandidates(class_, false), getCandidates(class_, true));
// Now create getter and perhaps setter forwarding nodes for each unique
@@ -722,7 +750,9 @@
inheritedGetterStart,
getterEnd,
inheritedSetterStart,
- setterEnd);
+ setterEnd,
+ library,
+ class_.fileUri);
}
var forwardingNode = new ForwardingNode(
this,
@@ -755,7 +785,9 @@
inheritedSetterStart,
setterEnd,
inheritedGetterStart,
- getterEnd);
+ getterEnd,
+ library,
+ class_.fileUri);
}
}
var forwardingNode = new ForwardingNode(
@@ -844,21 +876,23 @@
int start,
int end,
int crossStart,
- int crossEnd) {
+ int crossEnd,
+ LibraryBuilder library,
+ Uri fileUri) {
if (!_requiresTypeInference(procedure)) return null;
switch (procedure.kind) {
case ProcedureKind.Getter:
case ProcedureKind.Setter:
if (strongMode && start < end) {
return new AccessorInferenceNode(
- this, procedure, candidates, start, end);
+ this, procedure, candidates, start, end, library, fileUri);
} else if (strongMode && crossStart < crossEnd) {
- return new AccessorInferenceNode(
- this, procedure, candidates, crossStart, crossEnd);
+ return new AccessorInferenceNode(this, procedure, candidates,
+ crossStart, crossEnd, library, fileUri);
} else if (procedure is SyntheticAccessor &&
procedure._field.initializer != null) {
var node = new FieldInitializerInferenceNode(
- _typeInferenceEngine, procedure._field);
+ _typeInferenceEngine, procedure._field, library);
ShadowField.setInferenceNode(procedure._field, node);
return node;
}
@@ -866,7 +900,7 @@
default: // Method || Operator
if (strongMode) {
return new MethodInferenceNode(
- this, procedure, candidates, start, end);
+ this, procedure, candidates, start, end, library, fileUri);
}
return null;
}
@@ -1086,10 +1120,14 @@
/// [_declaredMethod].
final int _end;
- MemberInferenceNode(this._interfaceResolver, this._declaredMethod,
- this._candidates, this._start, this._end);
+ final LibraryBuilder _library;
- DartType _matchTypes(Iterable<DartType> types) {
+ final Uri _fileUri;
+
+ MemberInferenceNode(this._interfaceResolver, this._declaredMethod,
+ this._candidates, this._start, this._end, this._library, this._fileUri);
+
+ DartType _matchTypes(Iterable<DartType> types, String name, int charOffset) {
var iterator = types.iterator;
if (!iterator.moveNext()) {
// No overridden types. Infer `dynamic`.
@@ -1098,7 +1136,11 @@
var inferredType = iterator.current;
while (iterator.moveNext()) {
if (inferredType != iterator.current) {
- // TODO(paulberry): Types don't match. Report an error.
+ // Types don't match. Report an error.
+ _library.addCompileTimeError(
+ templateCantInferTypeDueToInconsistentOverrides.withArguments(name),
+ charOffset,
+ _fileUri);
return const DynamicType();
}
}
@@ -1109,17 +1151,26 @@
/// Concrete class derived from [InferenceNode] to represent type inference of
/// methods.
class MethodInferenceNode extends MemberInferenceNode {
- MethodInferenceNode(InterfaceResolver interfaceResolver,
- Procedure declaredMethod, List<Member> candidates, int start, int end)
- : super(interfaceResolver, declaredMethod, candidates, start, end);
+ MethodInferenceNode(
+ InterfaceResolver interfaceResolver,
+ Procedure declaredMethod,
+ List<Member> candidates,
+ int start,
+ int end,
+ LibraryBuilder library,
+ Uri fileUri)
+ : super(interfaceResolver, declaredMethod, candidates, start, end,
+ library, fileUri);
@override
void resolveInternal() {
var declaredMethod = _declaredMethod;
var overriddenTypes = _computeMethodOverriddenTypes();
if (ShadowProcedure.hasImplicitReturnType(declaredMethod)) {
- declaredMethod.function.returnType =
- _matchTypes(overriddenTypes.map((type) => type.returnType));
+ declaredMethod.function.returnType = _matchTypes(
+ overriddenTypes.map((type) => type.returnType),
+ declaredMethod.name.name,
+ declaredMethod.fileOffset);
}
var positionalParameters = declaredMethod.function.positionalParameters;
for (int i = 0; i < positionalParameters.length; i++) {
@@ -1141,7 +1192,9 @@
// tools are free to either emit an error, or to defer the error to
// override checking.
positionalParameters[i].type = _matchTypes(
- overriddenTypes.map((type) => getPositionalParameterType(type, i)));
+ overriddenTypes.map((type) => getPositionalParameterType(type, i)),
+ positionalParameters[i].name,
+ positionalParameters[i].fileOffset);
}
}
var namedParameters = declaredMethod.function.namedParameters;
@@ -1149,7 +1202,9 @@
if (ShadowVariableDeclaration.isImplicitlyTyped(namedParameters[i])) {
var name = namedParameters[i].name;
namedParameters[i].type = _matchTypes(
- overriddenTypes.map((type) => getNamedParameterType(type, name)));
+ overriddenTypes.map((type) => getNamedParameterType(type, name)),
+ namedParameters[i].name,
+ namedParameters[i].fileOffset);
}
}
// Circularities should never occur with method inference, since the
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
index 2404585..b933a4887 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart
@@ -3,7 +3,9 @@
// BSD-style license that can be found in the LICENSE.md file.
import 'package:front_end/src/base/instrumentation.dart';
+import 'package:front_end/src/fasta/builder/library_builder.dart';
import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart';
+import 'package:front_end/src/fasta/messages.dart';
import 'package:front_end/src/fasta/source/source_library_builder.dart';
import 'package:front_end/src/fasta/type_inference/type_inference_listener.dart';
import 'package:front_end/src/fasta/type_inference/type_inferrer.dart';
@@ -34,7 +36,10 @@
/// The field whose type should be inferred.
final ShadowField field;
- FieldInitializerInferenceNode(this._typeInferenceEngine, this.field);
+ final LibraryBuilder _library;
+
+ FieldInitializerInferenceNode(
+ this._typeInferenceEngine, this.field, this._library);
@override
void resolveInternal() {
@@ -47,7 +52,12 @@
var inferredType = typeInferrer.inferDeclarationType(
typeInferrer.inferFieldTopLevel(field, null, true));
if (isCircular) {
- // TODO(paulberry): report the appropriate error.
+ // Report the appropriate error.
+ _library.addCompileTimeError(
+ templateCantInferTypeDueToCircularity
+ .withArguments(field.name.name),
+ field.fileOffset,
+ field.fileUri);
inferredType = const DynamicType();
}
field.setInferredType(
@@ -227,7 +237,8 @@
void recordInitializingFormal(ShadowVariableDeclaration formal);
/// Records that the given static [field] will need top level type inference.
- void recordStaticFieldInferenceCandidate(ShadowField field);
+ void recordStaticFieldInferenceCandidate(
+ ShadowField field, LibraryBuilder library);
}
/// Derived class containing generic implementations of
@@ -299,8 +310,9 @@
initializingFormals.add(formal);
}
- void recordStaticFieldInferenceCandidate(ShadowField field) {
- var node = new FieldInitializerInferenceNode(this, field);
+ void recordStaticFieldInferenceCandidate(
+ ShadowField field, LibraryBuilder library) {
+ var node = new FieldInitializerInferenceNode(this, field, library);
ShadowField.setInferenceNode(field, node);
staticInferenceNodes.add(node);
}
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.dart
index 60f5508..4a42bac 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inference_listener.dart
@@ -394,8 +394,8 @@
void returnStatementExit(ReturnStatement statement) =>
genericStatementExit('returnStatement', statement);
- bool staticAssignEnter(
- Expression expression, Expression write, DartType typeContext) =>
+ bool staticAssignEnter(Expression expression, int targetOffset,
+ Class targetClass, Expression write, DartType typeContext) =>
genericExpressionEnter("staticAssign", expression, typeContext);
void staticAssignExit(
@@ -407,7 +407,8 @@
DartType inferredType) =>
genericExpressionExit("staticAssign", expression, inferredType);
- bool staticGetEnter(StaticGet expression, DartType typeContext) =>
+ bool staticGetEnter(StaticGet expression, int targetOffset, Class targetClass,
+ DartType typeContext) =>
genericExpressionEnter("staticGet", expression, typeContext);
void staticGetExit(StaticGet expression, DartType inferredType) =>
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 ab6c6cc..aab2c19 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
@@ -33,6 +33,7 @@
FunctionNode,
FunctionType,
Initializer,
+ Instantiation,
InterfaceType,
InvocationExpression,
Let,
@@ -742,7 +743,10 @@
/// Determines the dispatch category of a [PropertyGet] and adds an "as" check
/// if necessary due to contravariance.
- void handlePropertyGetContravariance(
+ ///
+ /// Returns the "as" check if it was added; otherwise returns the original
+ /// expression.
+ Expression handlePropertyGetContravariance(
Expression receiver,
Object interfaceMember,
PropertyGet desugaredGet,
@@ -763,13 +767,14 @@
interfaceMember is Procedure) {
checkReturn = interfaceMember.isGenericContravariant;
}
+ var replacedExpression = desugaredGet ?? expression;
if (checkReturn) {
- var expressionToReplace = desugaredGet ?? expression;
- expressionToReplace.parent.replaceChild(
- expressionToReplace,
- new AsExpression(expressionToReplace, inferredType)
- ..isTypeError = true
- ..fileOffset = fileOffset);
+ var expressionToReplace = replacedExpression;
+ var parent = expressionToReplace.parent;
+ replacedExpression = new AsExpression(expressionToReplace, inferredType)
+ ..isTypeError = true
+ ..fileOffset = fileOffset;
+ parent.replaceChild(expressionToReplace, replacedExpression);
}
if (instrumentation != null) {
int offset = expression.fileOffset;
@@ -790,6 +795,7 @@
new InstrumentationValueForType(inferredType));
}
}
+ return replacedExpression;
}
/// Determines the dispatch category of a [PropertySet].
@@ -900,11 +906,9 @@
Substitution substitution;
List<DartType> formalTypes;
List<DartType> actualTypes;
- List<Expression> expressions;
if (inferenceNeeded || typeChecksNeeded) {
formalTypes = [];
actualTypes = [];
- expressions = [];
}
if (inferenceNeeded) {
if (isConst && typeContext != null) {
@@ -946,7 +950,6 @@
if (inferenceNeeded || typeChecksNeeded) {
formalTypes.add(formalType);
actualTypes.add(expressionType);
- expressions.add(expression);
}
if (isOverloadedArithmeticOperator) {
returnType = typeSchemaEnvironment.getTypeOfOverloadedArithmetic(
@@ -969,13 +972,16 @@
arguments.types.addAll(inferredTypes);
}
if (typeChecksNeeded) {
+ int numPositionalArgs = arguments.positional.length;
for (int i = 0; i < formalTypes.length; i++) {
var formalType = formalTypes[i];
var expectedType = substitution != null
? substitution.substituteType(formalType)
: formalType;
var actualType = actualTypes[i];
- var expression = expressions[i];
+ var expression = i < numPositionalArgs
+ ? arguments.positional[i]
+ : arguments.named[i - numPositionalArgs].value;
checkAssignability(
expectedType, actualType, expression, expression.fileOffset);
}
@@ -1248,9 +1254,14 @@
}
}
var inferredType = getCalleeType(interfaceMember, receiverType);
- // TODO(paulberry): Infer tear-off type arguments if appropriate.
- handlePropertyGetContravariance(receiver, interfaceMember, desugaredGet,
- expression, inferredType, fileOffset);
+ var replacedExpression = handlePropertyGetContravariance(receiver,
+ interfaceMember, desugaredGet, expression, inferredType, fileOffset);
+ if ((interfaceMember is Procedure &&
+ interfaceMember.kind == ProcedureKind.Method) ||
+ interfaceMember == 'call') {
+ inferredType =
+ instantiateTearOff(inferredType, typeContext, replacedExpression);
+ }
if (identical(interfaceMember, 'call')) {
listener.propertyGetExitCall(expression, inferredType);
} else {
@@ -1275,6 +1286,36 @@
/// the statement type and calls the appropriate specialized "infer" method.
void inferStatement(Statement statement);
+ /// Performs the type inference steps necessary to instantiate a tear-off
+ /// (if necessary).
+ DartType instantiateTearOff(
+ DartType tearoffType, DartType context, Expression expression) {
+ if (strongMode &&
+ tearoffType is FunctionType &&
+ context is FunctionType &&
+ context.typeParameters.isEmpty) {
+ var typeParameters = tearoffType.typeParameters;
+ if (typeParameters.isNotEmpty) {
+ var inferredTypes = new List<DartType>.filled(
+ typeParameters.length, const UnknownType());
+ var instantiatedType = tearoffType.withoutTypeParameters;
+ typeSchemaEnvironment.inferGenericFunctionOrType(
+ instantiatedType, typeParameters, [], [], context, inferredTypes);
+ if (!isTopLevel) {
+ var parent = expression.parent;
+ parent.replaceChild(
+ expression,
+ new Instantiation(expression, inferredTypes)
+ ..fileOffset = expression.fileOffset);
+ }
+ var substitution =
+ Substitution.fromPairs(typeParameters, inferredTypes);
+ return substitution.substituteType(instantiatedType);
+ }
+ }
+ return tearoffType;
+ }
+
/// Determines the dispatch category of a [MethodInvocation] and returns a
/// boolean indicating whether an "as" check will need to be added due to
/// contravariance.
diff --git a/pkg/front_end/lib/src/incremental/kernel_driver.dart b/pkg/front_end/lib/src/incremental/kernel_driver.dart
index 189e2fd..492ad53 100644
--- a/pkg/front_end/lib/src/incremental/kernel_driver.dart
+++ b/pkg/front_end/lib/src/incremental/kernel_driver.dart
@@ -5,6 +5,7 @@
import 'dart:async';
import 'package:front_end/src/api_prototype/byte_store.dart';
+import 'package:front_end/src/api_prototype/compilation_message.dart';
import 'package:front_end/src/api_prototype/file_system.dart';
import 'package:front_end/src/base/api_signature.dart';
import 'package:front_end/src/base/performance_logger.dart';
@@ -87,6 +88,9 @@
/// Factory for working with metadata.
final MetadataFactory _metadataFactory;
+ /// The listener to errors during kernel compilation.
+ final KernelErrorListener kernelErrorListener;
+
/// The optional SDK outline loaded from [_sdkOutlineBytes].
/// Might be `null` if the bytes are not provided, or if not loaded yet.
Program _sdkOutline;
@@ -104,7 +108,7 @@
/// The object that provides additional information for tests.
final _TestView _testView = new _TestView();
- KernelDriver(this._options, this.uriTranslator,
+ KernelDriver(this._options, this.uriTranslator, this.kernelErrorListener,
{List<int> sdkOutlineBytes,
KernelDriverFileAddedFn fileAddedFn,
MetadataFactory metadataFactory})
@@ -181,7 +185,13 @@
// We need to be able to access dart:core and dart:async classes.
if (_sdkOutline != null) {
results.add(new LibraryCycleResult(
- new LibraryCycle(), '<sdk>', {}, _sdkOutline.libraries));
+ new LibraryCycle(),
+ '<sdk>',
+ {},
+ _sdkOutline.libraries
+ // TODO are there errors to report here?
+ .map((l) => new LibraryResult(l, []))
+ .toList()));
}
var lastCycle = cycles.last;
@@ -227,19 +237,19 @@
KernelSequenceResult sequence = await getKernelSequence(uri);
var dependencies = <Library>[];
- Library requestedLibrary;
+ LibraryResult requestedLibrary;
for (var i = 0; i < sequence.results.length; i++) {
- List<Library> libraries = sequence.results[i].kernelLibraries;
+ List<LibraryResult> libraryResults = sequence.results[i].libraryResults;
if (i == sequence.results.length - 1) {
- for (var library in libraries) {
- if (library.importUri == uri) {
- requestedLibrary = library;
+ for (var libraryResult in libraryResults) {
+ if (libraryResult.library.importUri == uri) {
+ requestedLibrary = libraryResult;
} else {
- dependencies.add(library);
+ dependencies.add(libraryResult.library);
}
}
} else {
- dependencies.addAll(libraries);
+ dependencies.addAll(libraryResults.map((l) => l.library));
}
}
@@ -278,11 +288,16 @@
return await _fsState.getFile(uri);
});
- List<LibraryCycle> cycles = _logger.run('Compute library cycles', () {
- List<LibraryCycle> cycles = entryLibrary.topologicalOrder;
- _logger.writeln('Computed ${cycles.length} cycles.');
- return cycles;
- });
+ List<LibraryCycle> cycles;
+ if (_fsState.skipSdkLibraries.contains(uri)) {
+ cycles = <LibraryCycle>[];
+ } else {
+ cycles = _logger.run('Compute library cycles', () {
+ List<LibraryCycle> cycles = entryLibrary.topologicalOrder;
+ _logger.writeln('Computed ${cycles.length} cycles.');
+ return cycles;
+ });
+ }
DillTarget dillTarget = new DillTarget(
new Ticker(isVerbose: false), uriTranslator, _options.target);
@@ -299,7 +314,13 @@
// We need to be able to access dart:core and dart:async classes.
if (_sdkOutline != null) {
results.add(new LibraryCycleResult(
- new LibraryCycle(), '<sdk>', {}, _sdkOutline.libraries));
+ new LibraryCycle(),
+ '<sdk>',
+ {},
+ _sdkOutline.libraries
+ // TODO are there errors to report here?
+ .map((l) => new LibraryResult(l, []))
+ .toList()));
}
_testView.compiledCycles.clear();
@@ -345,7 +366,8 @@
/// All the libraries for [CoreTypes] are expected to be in the first result.
TypeEnvironment _buildTypeEnvironment(
CanonicalName nameRoot, List<LibraryCycleResult> results) {
- var coreLibraries = results.first.kernelLibraries;
+ var coreLibraries =
+ results.first.libraryResults.map((l) => l.library).toList();
var program = new Program(nameRoot: nameRoot, libraries: coreLibraries);
return new TypeEnvironment(
new CoreTypes(program), new IncrementalClassHierarchy());
@@ -400,7 +422,13 @@
await appendNewDillLibraries(program);
return new LibraryCycleResult(
- cycle, signature, program.uriToSource, program.libraries);
+ cycle,
+ signature,
+ program.uriToSource,
+ program.libraries
+ // TODO report errors here
+ .map((l) => new LibraryResult(l, []))
+ .toList());
});
}
}
@@ -419,6 +447,7 @@
await kernelTarget.buildOutlines(nameRoot: nameRoot);
return await kernelTarget.buildProgram();
});
+
_testView.compiledCycles.add(cycle);
// Add newly compiled libraries into DILL.
@@ -428,6 +457,15 @@
.where((library) => libraryUris.contains(library.importUri))
.toList();
+ final indexedErrors = <Uri, List<CompilationMessage>>{};
+ kernelErrorListener.errors.forEach((error) =>
+ indexedErrors.putIfAbsent(error.span.sourceUrl, () => []).add(error));
+ List<LibraryResult> kernelLibrariesResults = kernelLibraries
+ .map((l) => new LibraryResult(l, indexedErrors[l.fileUri]))
+ .toList();
+
+ kernelErrorListener.errors.clear();
+
// Remove source for libraries outside of the cycle.
{
var urisToRemoveSources = <Uri>[];
@@ -447,7 +485,7 @@
});
return new LibraryCycleResult(
- cycle, signature, program.uriToSource, kernelLibraries);
+ cycle, signature, program.uriToSource, kernelLibrariesResults);
});
}
@@ -567,9 +605,9 @@
final TypeEnvironment types;
/// The library of the requested file.
- final Library library;
+ final LibraryResult libraryResult;
- KernelResult(this.dependencies, this.types, this.library);
+ KernelResult(this.dependencies, this.types, this.libraryResult);
}
/// The result of compiling of a sequence of libraries.
@@ -598,10 +636,18 @@
/// Kernel libraries for libraries in the [cycle]. Bodies of dependencies
/// are not included, but but references to those dependencies are included.
- final List<Library> kernelLibraries;
+ final List<LibraryResult> libraryResults;
LibraryCycleResult(
- this.cycle, this.signature, this.uriToSource, this.kernelLibraries);
+ this.cycle, this.signature, this.uriToSource, this.libraryResults);
+}
+
+/// A [Library] produced by front end and the errors produced from compiling it.
+class LibraryResult {
+ final Library library;
+ final List<CompilationMessage> errors;
+
+ LibraryResult(this.library, this.errors);
}
/// Factory for creating [MetadataCollector]s and [MetadataRepository]s.
@@ -626,3 +672,9 @@
/// It does not include libraries which were read from the cache.
final List<LibraryCycle> compiledCycles = [];
}
+
+/// A simple errors listener for [CompilationMessage]s from kernel.
+class KernelErrorListener {
+ final List<CompilationMessage> errors = [];
+ void onError(CompilationMessage error) => errors.add(error);
+}
diff --git a/pkg/front_end/lib/src/scanner/token.dart b/pkg/front_end/lib/src/scanner/token.dart
index d52abcf..4e858ff 100644
--- a/pkg/front_end/lib/src/scanner/token.dart
+++ b/pkg/front_end/lib/src/scanner/token.dart
@@ -702,7 +702,7 @@
int get length => _length ?? super.length;
@override
- Token copy() => new SyntheticStringToken(type, _value, offset);
+ Token copy() => new SyntheticStringToken(type, _value, offset, _length);
}
/**
diff --git a/pkg/front_end/messages.yaml b/pkg/front_end/messages.yaml
index 56bc399..32caeb0 100644
--- a/pkg/front_end/messages.yaml
+++ b/pkg/front_end/messages.yaml
@@ -236,7 +236,7 @@
ExpectedIdentifier:
template: "Expected an identifier, but got '#lexeme'."
analyzerCode: MISSING_IDENTIFIER
- dart2jsCode: EXPECTED_IDENTIFIER
+ dart2jsCode: "*fatal*"
script: "do() {} main() {}"
EqualityCannotBeEqualityOperand:
@@ -260,7 +260,7 @@
ExpectedToken:
template: "Expected to find '#string'."
analyzerCode: EXPECTED_TOKEN
- dart2jsCode: GENERIC
+ dart2jsCode: "*fatal*"
ExpectedType:
template: "Expected a type, but got '#lexeme'."
@@ -1148,6 +1148,9 @@
OverrideTypeVariablesMismatch:
template: "Declared type variables of '#name' doesn't match those on overridden method '#name2'."
+OverriddenMethodCause:
+ template: "This is the overriden method ('#name')."
+
OverrideMismatchNamedParameter:
template: "The method '#name' doesn't have the named parameter '#name2' of overriden method '#name3'."
@@ -1291,6 +1294,14 @@
script:
- "factory class C {}"
+RedirectionInNonFactory:
+ template: "Only factory constructor can specify '=' redirection."
+ tip: "Try making this a factory constructor, or remove the redirection."
+ analyzerCode: REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR
+ dart2jsCode: "*fatal*"
+ script:
+ - "class C { C() = D; }"
+
TopLevelOperator:
template: "Operators must be declared within a class."
tip: "Try removing the operator, moving it to a class, or converting it to be a function."
@@ -1662,3 +1673,11 @@
Indexed #count libraries (#count2 bytes) in #string, that is,
#string2 bytes/ms, and
#string3 ms/libraries.
+
+CantInferTypeDueToInconsistentOverrides:
+ template: "Can't infer the type of '#string': overridden members must all have the same type."
+ tip: "Specify the type explicitly."
+
+CantInferTypeDueToCircularity:
+ template: "Can't infer the type of '#string': circularity found during type inference."
+ tip: "Specify the type explicitly."
diff --git a/pkg/front_end/test/fasta/graph_test.dart b/pkg/front_end/test/fasta/graph_test.dart
index b9a2d2f..f9732b1 100644
--- a/pkg/front_end/test/fasta/graph_test.dart
+++ b/pkg/front_end/test/fasta/graph_test.dart
@@ -6,8 +6,13 @@
import 'package:expect/expect.dart' show Expect;
+import 'package:test_reflective_loader/test_reflective_loader.dart'
+ show defineReflectiveSuite, defineReflectiveTests, reflectiveTest;
+
import 'package:front_end/src/fasta/graph/graph.dart';
+import '../src/dependency_walker_test.dart' show DependencyWalkerTest;
+
class TestGraph implements Graph<String> {
final Map<String, List<String>> graph;
@@ -18,7 +23,7 @@
Iterable<String> neighborsOf(String vertex) => graph[vertex];
}
-test(String expected, Map<String, List<String>> graph) {
+void test(String expected, Map<String, List<String>> graph) {
List<List<String>> result = computeStrongComponents(new TestGraph(graph));
Expect.stringEquals(expected, "$result");
}
@@ -60,4 +65,29 @@
"B": ["C"],
"A": ["B"],
});
+
+ test("[[A], [B], [C], [D]]", {
+ "A": [],
+ "B": ["A"],
+ "C": ["A"],
+ "D": ["B", "C"],
+ });
+
+ // TODO(ahe): Move the tests from DependencyWalkerTest here.
+ defineReflectiveSuite(() {
+ defineReflectiveTests(GraphTest);
+ });
+}
+
+@reflectiveTest
+class GraphTest extends DependencyWalkerTest {
+ void checkGraph(Map<String, List<String>> graph, String startingNodeName,
+ List<List<String>> expectedEvaluations, List<bool> expectedSccFlags) {
+ List<List<String>> result = computeStrongComponents(new TestGraph(graph));
+ List<List<String>> expectedReversed = <List<String>>[];
+ for (List<String> list in expectedEvaluations) {
+ expectedReversed.add(list.reversed.toList());
+ }
+ Expect.stringEquals(expectedReversed.join(", "), result.join(", "));
+ }
}
diff --git a/pkg/front_end/test/fasta/incremental_test.dart b/pkg/front_end/test/fasta/incremental_test.dart
index a587ef1..54c5e9f 100644
--- a/pkg/front_end/test/fasta/incremental_test.dart
+++ b/pkg/front_end/test/fasta/incremental_test.dart
@@ -192,9 +192,9 @@
foundSources = true;
context.compiler.invalidate(uri);
if (edits == 0) {
- print("==> t.dart <==");
+ print("==> $uri <==");
} else {
- print("==> t.dart (edit #$edits) <==");
+ print("==> $uri (edit #$edits) <==");
}
print(source.trimRight());
}
diff --git a/pkg/front_end/test/fasta/parser/token_stream_rewriter_test.dart b/pkg/front_end/test/fasta/parser/token_stream_rewriter_test.dart
index 6be8843..6a5ddce 100644
--- a/pkg/front_end/test/fasta/parser/token_stream_rewriter_test.dart
+++ b/pkg/front_end/test/fasta/parser/token_stream_rewriter_test.dart
@@ -4,8 +4,7 @@
import 'package:front_end/src/fasta/parser/token_stream_rewriter.dart';
import 'package:front_end/src/fasta/scanner/token.dart';
-import 'package:front_end/src/scanner/token.dart'
- show BeginToken, Token, TokenType;
+import 'package:front_end/src/scanner/token.dart' show Token;
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
@@ -21,19 +20,19 @@
/// Indicates whether the tests should set up [Token.previous].
bool get setPrevious;
- void test_insertToken_end_single() {
+ void test_insertTokenAfter_end_single() {
var a = _makeToken(0, 'a');
var b = _makeToken(1, 'b');
var eof = _link([a]);
var rewriter = new TokenStreamRewriter();
- expect(rewriter.insertToken(b, eof), same(b));
+ expect(rewriter.insertTokenAfter(a, b), same(a));
expect(a.next, same(b));
expect(b.next, same(eof));
expect(eof.previous, same(b));
expect(b.previous, same(a));
}
- void test_insertToken_middle_multiple() {
+ void test_insertTokenAfter_middle_multiple() {
var a = _makeToken(0, 'a');
var b = _makeToken(1, 'b');
var c = _makeToken(2, 'c');
@@ -42,20 +41,38 @@
_link([a, b, e]);
_link([c, d]);
var rewriter = new TokenStreamRewriter();
- rewriter.insertToken(c, e);
+ rewriter.insertTokenAfter(b, c);
expect(a.next, same(b));
expect(b.next, same(c));
expect(c.next, same(d));
expect(d.next, same(e));
}
- void test_insertToken_middle_single() {
+ void test_insertTokenAfter_middle_single() {
var a = _makeToken(0, 'a');
var b = _makeToken(1, 'b');
var c = _makeToken(2, 'c');
_link([a, c]);
var rewriter = new TokenStreamRewriter();
- rewriter.insertToken(b, c);
+ rewriter.insertTokenAfter(a, b);
+ expect(a.next, same(b));
+ expect(b.next, same(c));
+ }
+
+ void test_insertTokenAfter_second_insertion_earlier_in_stream() {
+ var a = _makeToken(0, 'a');
+ var b = _makeToken(1, 'b');
+ var c = _makeToken(2, 'c');
+ var d = _makeToken(3, 'd');
+ var e = _makeToken(4, 'e');
+ _link([a, c, e]);
+ var rewriter = new TokenStreamRewriter();
+ rewriter.insertTokenAfter(c, d);
+ expect(c.next, same(d));
+ expect(d.next, same(e));
+ // The next call to rewriter should be able to find the insertion point
+ // even though it is before the insertion point used above.
+ rewriter.insertTokenAfter(a, b);
expect(a.next, same(b));
expect(b.next, same(c));
}
@@ -89,41 +106,6 @@
expect(c.next, same(d));
}
- void test_second_insertion_earlier_in_stream() {
- var a = _makeToken(0, 'a');
- var b = _makeToken(1, 'b');
- var c = _makeToken(2, 'c');
- var d = _makeToken(3, 'd');
- var e = _makeToken(4, 'e');
- _link([a, c, e]);
- var rewriter = new TokenStreamRewriter();
- rewriter.insertToken(d, e);
- expect(c.next, same(d));
- expect(d.next, same(e));
- // The next call to rewriter should be able to find the insertion point
- // even though it is before the insertion point used above.
- rewriter.insertToken(b, c);
- expect(a.next, same(b));
- expect(b.next, same(c));
- }
-
- void test_skip_group() {
- var a = _makeBeginGroupToken(0);
- var b = _makeToken(1, 'b');
- var c = _makeToken(2, 'c');
- var d = _makeToken(3, 'd');
- var e = _makeToken(4, 'e');
- a.endGroup = c;
- _link([a, b, c, e]);
- // The rewriter should skip from a to c when finding the insertion position;
- // we test this by corrupting b's next pointer.
- b.next = null;
- var rewriter = new TokenStreamRewriter();
- rewriter.insertToken(d, e);
- expect(c.next, same(d));
- expect(d.next, same(e));
- }
-
/// Links together the given [tokens] and adds an EOF token to the end of the
/// token stream.
///
@@ -145,10 +127,6 @@
return eof;
}
- BeginToken _makeBeginGroupToken(int charOffset) {
- return new BeginToken(TokenType.OPEN_PAREN, charOffset);
- }
-
StringToken _makeToken(int charOffset, String text) {
return new StringToken.fromString(null, text, charOffset);
}
@@ -166,36 +144,6 @@
@override
bool get setPrevious => false;
-
- @override
- @failingTest
- void test_insertToken_end_single() {
- super.test_insertToken_end_single();
- }
-
- @override
- @failingTest
- void test_insertToken_middle_multiple() {
- super.test_insertToken_middle_multiple();
- }
-
- @override
- @failingTest
- void test_insertToken_middle_single() {
- super.test_insertToken_middle_single();
- }
-
- @override
- @failingTest
- void test_second_insertion_earlier_in_stream() {
- super.test_second_insertion_earlier_in_stream();
- }
-
- @override
- @failingTest
- void test_skip_group() {
- super.test_skip_group();
- }
}
/// Concrete implementation of [TokenStreamRewriterTest] in which
diff --git a/pkg/front_end/test/fasta/testing/analyzer_diet_listener.dart b/pkg/front_end/test/fasta/testing/analyzer_diet_listener.dart
index 8813c76..4721579 100644
--- a/pkg/front_end/test/fasta/testing/analyzer_diet_listener.dart
+++ b/pkg/front_end/test/fasta/testing/analyzer_diet_listener.dart
@@ -19,7 +19,7 @@
import 'package:analyzer/src/fasta/ast_builder.dart' show AstBuilder;
import 'package:analyzer/src/fasta/resolution_applier.dart'
- show ResolutionApplier, TypeContext;
+ show ValidatingResolutionApplier, TypeContext;
import 'package:analyzer/src/fasta/resolution_storer.dart'
show InstrumentedResolutionStorer;
@@ -184,13 +184,13 @@
// Now apply the resolution data and inferred types to the analyzer AST.
var translatedDeclarations = _translateDeclarations(_kernelDeclarations);
var translatedReferences = _translateReferences(_kernelReferences);
- var resolutionApplier = new ResolutionApplier(
+ var resolutionApplier = new ValidatingResolutionApplier(
new _TestTypeContext(),
translatedDeclarations,
- _declarationOffsets,
translatedReferences,
- _referenceOffsets,
_kernelTypes,
+ _declarationOffsets,
+ _referenceOffsets,
_typeOffsets);
ast.AstNode fields = listener.finishFields();
fields.accept(resolutionApplier);
@@ -242,15 +242,17 @@
// Now apply the resolution data and inferred types to the analyzer AST.
var translatedDeclarations = _translateDeclarations(_kernelDeclarations);
var translatedReferences = _translateReferences(_kernelReferences);
- var resolutionApplier = new ResolutionApplier(
+ var resolutionApplier = new ValidatingResolutionApplier(
new _TestTypeContext(),
translatedDeclarations,
- _declarationOffsets,
translatedReferences,
- _referenceOffsets,
_kernelTypes,
+ _declarationOffsets,
+ _referenceOffsets,
_typeOffsets);
+ ast.AstNode formalsAsAstNode = formals;
ast.AstNode bodyAsAstNode = body;
+ formalsAsAstNode?.accept(resolutionApplier);
bodyAsAstNode.accept(resolutionApplier);
resolutionApplier.checkDone();
diff --git a/pkg/front_end/test/src/incremental/kernel_driver_test.dart b/pkg/front_end/test/src/incremental/kernel_driver_test.dart
index 80eb87b..94252e4 100644
--- a/pkg/front_end/test/src/incremental/kernel_driver_test.dart
+++ b/pkg/front_end/test/src/incremental/kernel_driver_test.dart
@@ -7,12 +7,12 @@
import 'package:front_end/src/api_prototype/byte_store.dart';
import 'package:front_end/src/api_prototype/compiler_options.dart';
import 'package:front_end/src/api_prototype/memory_file_system.dart';
+import 'package:front_end/src/api_prototype/summary_generator.dart';
import 'package:front_end/src/base/performance_logger.dart';
import 'package:front_end/src/base/processed_options.dart';
import 'package:front_end/src/fasta/kernel/utils.dart';
import 'package:front_end/src/fasta/uri_translator_impl.dart';
import 'package:front_end/src/incremental/kernel_driver.dart';
-import 'package:front_end/src/api_prototype/summary_generator.dart';
import 'package:kernel/ast.dart';
import 'package:kernel/binary/ast_from_binary.dart';
import 'package:kernel/target/targets.dart';
@@ -63,7 +63,7 @@
KernelResult result = await driver.getKernel(cUri);
_assertKernelResult(result, cUri,
includes: [aUri, bUri, Uri.parse('dart:core')]);
- expect(_getLibraryText(result.library), r'''
+ expect(_getLibraryText(result.libraryResult.library), r'''
library;
import self as self;
import "dart:core" as core;
@@ -85,7 +85,7 @@
KernelResult result = await driver.getKernel(cUri);
_assertKernelResult(result, cUri,
includes: [aUri, bUri, Uri.parse('dart:core')]);
- expect(_getLibraryText(result.library), r'''
+ expect(_getLibraryText(result.libraryResult.library), r'''
library;
import self as self;
import "dart:core" as core;
@@ -122,7 +122,7 @@
// We still get c.dart as the library, and b.dart in dependencies.
_assertKernelResult(result, cUri,
includes: [aUri, bUri, Uri.parse('dart:core')]);
- expect(_getLibraryText(result.library), r'''
+ expect(_getLibraryText(result.libraryResult.library), r'''
library;
import self as self;
import "dart:core" as core;
@@ -143,7 +143,7 @@
KernelResult result = await driver.getKernel(cUri);
_assertKernelResult(result, cUri,
includes: [aUri, bUri, Uri.parse('dart:core')]);
- expect(_getLibraryText(result.library), r'''
+ expect(_getLibraryText(result.libraryResult.library), r'''
library;
import self as self;
import "dart:core" as core;
@@ -550,7 +550,7 @@
driver.invalidate(aUri);
var kernelResult = await driver.getKernelSequence(bUri);
var allLibraries = kernelResult.results
- .map((c) => c.kernelLibraries)
+ .map((c) => c.libraryResults.map((result) => result.library))
.expand((libs) => libs)
.toList();
@@ -572,6 +572,22 @@
serializeProgram(program,
filter: (library) => !library.importUri.isScheme('dart'));
}
+
+ // Ask dart:core, should be served from the outline.
+ {
+ var dartCoreUri = Uri.parse('dart:core');
+ var kernelResult = await driver.getKernelSequence(dartCoreUri);
+ bool hasDartCore = false;
+ for (var libraryResult in kernelResult.results) {
+ for (var libResult in libraryResult.libraryResults) {
+ if (libResult.library.importUri == dartCoreUri) {
+ hasDartCore = true;
+ break;
+ }
+ }
+ }
+ expect(hasDartCore, isTrue);
+ }
}
test_limitedStore_exportDependencies() async {
@@ -907,7 +923,7 @@
List<Library> _allLibraries(KernelSequenceResult result) {
return result.results
- .map((cycle) => cycle.kernelLibraries)
+ .map((cycle) => cycle.libraryResults.map((result) => result.library))
.expand((libraries) => libraries)
.toList();
}
@@ -929,8 +945,8 @@
void _assertKernelResult(KernelResult result, Uri libraryUri,
{List<Uri> includes: const [], List<Uri> excludes: const []}) {
- expect(result.library, isNotNull);
- expect(result.library.importUri, libraryUri);
+ expect(result.libraryResult?.library, isNotNull);
+ expect(result.libraryResult.library.importUri, libraryUri);
List<Uri> dependencyUris = [];
for (var library in result.dependencies) {
@@ -950,8 +966,8 @@
List<Uri> libraryUris = [];
for (LibraryCycleResult cycleResult in result.results) {
uriToSource.addAll(cycleResult.uriToSource);
- for (var library in cycleResult.kernelLibraries) {
- libraryUris.add(library.importUri);
+ for (var result in cycleResult.libraryResults) {
+ libraryUris.add(result.library.importUri);
}
}
for (var shouldInclude in includes) {
@@ -993,14 +1009,15 @@
..strongMode = true
..target = new NoneTarget(new TargetFlags(strongMode: true));
- driver = new KernelDriver(new ProcessedOptions(options), uriTranslator,
+ driver = new KernelDriver(
+ new ProcessedOptions(options), uriTranslator, new KernelErrorListener(),
sdkOutlineBytes: sdkOutlineBytes, fileAddedFn: fileAddedFn);
}
Library _getLibrary(KernelSequenceResult result, Uri uri) {
for (var cycleResult in result.results) {
- for (var library in cycleResult.kernelLibraries) {
- if (library.importUri == uri) return library;
+ for (var result in cycleResult.libraryResults) {
+ if (result.library.importUri == uri) return result.library;
}
}
throw fail('No library found with URI "$uri"');
diff --git a/pkg/front_end/test/subpackage_relationships_test.dart b/pkg/front_end/test/subpackage_relationships_test.dart
index 9ddcf3f..e8331ad 100644
--- a/pkg/front_end/test/subpackage_relationships_test.dart
+++ b/pkg/front_end/test/subpackage_relationships_test.dart
@@ -56,7 +56,6 @@
'lib/src/api_prototype',
'lib/src/base',
'lib/src/fasta',
- 'lib/src/fasta/scanner',
]),
'lib/src/base': new SubpackageRules(allowedDependencies: [
'lib/src/api_prototype',
@@ -75,6 +74,7 @@
'lib/src/fasta/kernel',
'lib/src/fasta/parser',
'lib/src/fasta/scanner',
+ 'lib/src/fasta/source',
'lib/src/fasta/util',
'lib/src/scanner',
]),
@@ -88,6 +88,7 @@
'lib/src/fasta',
'lib/src/fasta/kernel',
]),
+ 'lib/src/fasta/graph': new SubpackageRules(),
'lib/src/fasta/kernel': new SubpackageRules(allowedDependencies: [
'lib/src/api_prototype',
'lib/src/fasta',
@@ -118,6 +119,7 @@
'lib/src/base',
'lib/src/fasta/builder',
'lib/src/fasta/dill',
+ 'lib/src/fasta/graph',
'lib/src/fasta/kernel',
'lib/src/fasta/parser',
'lib/src/fasta/type_inference',
@@ -134,6 +136,7 @@
]),
'lib/src/fasta/type_inference': new SubpackageRules(allowedDependencies: [
'lib/src/base',
+ 'lib/src/fasta/builder',
'lib/src/fasta',
'lib/src/fasta/kernel',
'lib/src/fasta/source',
@@ -199,6 +202,15 @@
/// Check for problems resulting from URI [src] having a direct dependency on
/// URI [dst].
void checkDependency(Uri src, Uri dst) {
+ var srcSubpackage = subpackageForUri(src);
+ if (srcSubpackage == null) return;
+ var srcSubpackageRules = subpackageRules[srcSubpackage];
+ if (srcSubpackageRules == null) {
+ problem('$src is in subpackage "$srcSubpackage", which is not found in '
+ 'subpackageRules');
+ return;
+ }
+ srcSubpackageRules.actuallyContainsFiles = true;
if (dst.scheme == 'dart') return;
if (dst.scheme != 'package') {
problem('$src depends on $dst, which is neither a package: or dart: URI');
@@ -215,15 +227,6 @@
'not found in allowedPackageDependencies');
}
}
- var srcSubpackage = subpackageForUri(src);
- if (srcSubpackage == null) return;
- var srcSubpackageRules = subpackageRules[srcSubpackage];
- if (srcSubpackageRules == null) {
- problem('$src is in subpackage "$srcSubpackage", which is not found in '
- 'subpackageRules');
- return;
- }
- srcSubpackageRules.actuallyContainsFiles = true;
var dstSubPackage = subpackageForUri(dst);
if (dstSubPackage == null) return;
if (dstSubPackage == srcSubpackage) return;
diff --git a/pkg/front_end/testcases/ast_builder.status b/pkg/front_end/testcases/ast_builder.status
index 9b5c308..60e5a87 100644
--- a/pkg/front_end/testcases/ast_builder.status
+++ b/pkg/front_end/testcases/ast_builder.status
@@ -12,7 +12,6 @@
call: Crash
cascade: Crash
classes: Crash
-default_values: Crash
duplicated_named_args_3: Crash
expressions: Crash
function_type_is_check: Crash
@@ -40,82 +39,31 @@
inference/downwards_inference_annotations_type_variable: Fail
inference/downwards_inference_annotations_type_variable_local: Crash
inference/downwards_inference_annotations_typedef: Crash
-inference/downwards_inference_initializing_formal_default_formal: Crash
-inference/downwards_inference_on_constructor_arguments_infer_downwards: Crash
-inference/downwards_inference_on_function_arguments_infer_downwards: Crash
inference/downwards_inference_on_function_of_t_using_the_t: Crash
-inference/downwards_inference_on_generic_constructor_arguments_empty_list: Crash
-inference/downwards_inference_on_generic_constructor_arguments_infer_downwards: Crash
inference/downwards_inference_on_generic_function_expressions: Crash
inference/downwards_inference_on_instance_creations_infer_downwards: Crash
-inference/downwards_inference_on_list_literals_infer_downwards: Crash
-inference/downwards_inference_on_list_literals_infer_if_value_types_match_context: Crash
-inference/downwards_inference_on_map_literals: Crash
inference/downwards_inference_yield_yield_star: Fail
inference/field_initializer_context_explicit: Crash
inference/field_initializer_context_implicit: Crash
inference/field_initializer_context_this: Crash
inference/field_initializer_parameter: Crash
inference/for_loop_initializer_expression: Crash
-inference/future_then: Crash
-inference/future_then_2: Crash
-inference/future_then_3: Crash
-inference/future_then_4: Crash
-inference/future_then_5: Crash
-inference/future_then_6: Crash
-inference/future_then_conditional: Crash
-inference/future_then_conditional_2: Crash
-inference/future_then_conditional_3: Crash
-inference/future_then_conditional_4: Crash
-inference/future_then_conditional_5: Crash
-inference/future_then_conditional_6: Crash
inference/future_then_explicit_future: Fail
-inference/future_then_ifNull: Crash
-inference/future_then_upwards: Crash
-inference/future_then_upwards_2: Crash
-inference/future_then_upwards_3: Crash
-inference/future_union_async_conditional: Crash
-inference/future_union_async_conditional_2: Crash
-inference/future_union_downwards: Crash
-inference/future_union_downwards_2: Crash
-inference/future_union_downwards_3: Crash
-inference/future_union_downwards_4: Crash
inference/generic_functions_return_typedef: Fail
inference/generic_methods_basic_downward_inference: Crash
inference/generic_methods_downwards_inference_fold: Crash
inference/generic_methods_infer_generic_instantiation: Crash
inference/generic_methods_infer_js_builtin: Fail
inference/generic_methods_nested_generic_instantiation: Crash
-inference/greatest_closure_multiple_params: Crash
-inference/infer_assign_to_static: Crash
inference/infer_correctly_on_multiple_variables_declared_together: Crash
inference/infer_from_complex_expressions_if_outer_most_value_is_precise: Crash
-inference/infer_from_variables_in_cycle_libs_when_flag_is_on2: Crash
-inference/infer_from_variables_in_cycle_libs_when_flag_is_on2_a: Crash
-inference/infer_from_variables_in_cycle_libs_when_flag_is_on: Crash
-inference/infer_from_variables_in_cycle_libs_when_flag_is_on_a: Crash
-inference/infer_from_variables_in_non_cycle_imports_with_flag2: Crash
-inference/infer_generic_method_type_named: Crash
-inference/infer_generic_method_type_positional2: Crash
-inference/infer_generic_method_type_positional: Crash
inference/infer_local_function_referenced_before_declaration: Crash
-inference/infer_method_missing_params: Crash
inference/infer_rethrow: Crash
inference/infer_statics_transitively3: Crash
-inference/infer_statics_transitively: Crash
-inference/infer_statics_transitively_2_a: Crash
-inference/infer_statics_transitively_a: Crash
-inference/infer_statics_with_method_invocations: Crash
-inference/infer_statics_with_method_invocations_a: Crash
-inference/inferred_initializing_formal_checks_default_value: Crash
-inference/inferred_type_is_enum: Crash
-inference/inferred_type_is_enum_values: Crash
-inference/inferred_type_uses_synthetic_function_type_named_param: Crash
-inference/inferred_type_uses_synthetic_function_type_positional_param: Crash
+inference/instantiate_tearoff: Crash
+inference/instantiate_tearoff_after_contravariance_check: Crash
+inference/instantiate_tearoff_of_call: Crash
inference/lambda_does_not_have_propagated_type_hint: Crash
-inference/parameter_defaults_downwards: Crash
-inference/parameter_defaults_upwards: Crash
-inference/static_method_tear_off: Crash
inference/super_initializer: Crash
inference/super_initializer_substitution: Crash
inference/switch_continue: Crash
@@ -130,7 +78,6 @@
inference/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr2: Crash
inference/unsafe_block_closure_inference_function_call_implicit_type_param_via_expr: Crash
inference/unsafe_block_closure_inference_function_call_no_type_param_via_expr: Crash
-inference_new/infer_assign_to_static: Crash
inference_new/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr2: Crash
inference_new/unsafe_block_closure_inference_function_call_explicit_type_param_via_expr2: Crash
invalid_cast: Crash
@@ -138,9 +85,6 @@
metadata_enum: Crash
metadata_named_mixin_application: Crash
micro: Crash
-named_parameters: Crash
-null_aware: Crash
-optional: Crash
qualified: Crash
rasta/abstract_constructor: Crash
rasta/bad_continue: Crash
@@ -166,14 +110,12 @@
rasta/issue_000069: Crash
rasta/issue_000070: Crash
rasta/malformed_function: Crash
-rasta/mandatory_parameter_initializer: VerificationError
-rasta/mixin_library: Crash
+rasta/mandatory_parameter_initializer: Crash
rasta/parser_error: Crash
rasta/previsit_deferred: Crash
rasta/static: Crash
rasta/super: Crash
rasta/super_initializer: Crash
-rasta/super_mixin: Crash
rasta/supports_reflection: VerificationError
rasta/this_invoke: Crash
rasta/try_label: Crash
@@ -201,14 +143,9 @@
regress/issue_31187: Crash
regress/issue_31198: Crash
reorder_super: Crash
-runtime_checks/covariant_generic_parameter_in_interface: Crash
-runtime_checks/forwarding_stub_with_default_values: Crash
runtime_checks/implicit_downcast_assert_initializer: Crash
runtime_checks/implicit_downcast_constructor_initializer: Crash
-runtime_checks_new/contravariant_combiner: Crash
-runtime_checks_new/derived_class_typed: Crash
runtime_checks_new/for_in_call_kinds: Crash
-runtime_checks_new/implicit_downcast_field: Crash
statements: Crash
super_rasta_copy: Crash
type_variable_as_super: Crash
diff --git a/pkg/front_end/testcases/cycles.dart.direct.expect b/pkg/front_end/testcases/cycles.dart.direct.expect
index c4479ea..f77118c 100644
--- a/pkg/front_end/testcases/cycles.dart.direct.expect
+++ b/pkg/front_end/testcases/cycles.dart.direct.expect
@@ -22,7 +22,7 @@
: super core::Object::•()
;
}
-static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/cycles.dart:7:7: Error: 'B' is a supertype of itself via 'A', 'C', 'B'.\nclass B extends A {}\n ^"]/* from null */;
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/cycles.dart:5:7: Error: 'A' is a supertype of itself via 'B', 'C'.\nclass A implements C {}\n ^", "pkg/front_end/testcases/cycles.dart:7:7: Error: 'B' is a supertype of itself via 'A', 'C'.\nclass B extends A {}\n ^", "pkg/front_end/testcases/cycles.dart:9:7: Error: 'C' is a supertype of itself via 'A', 'B'.\nclass C extends B implements D {}\n ^"]/* from null */;
static method main() → dynamic {
core::print(new self::A::•());
core::print(new self::B::•());
diff --git a/pkg/front_end/testcases/duplicated_named_args_3.dart.strong.expect b/pkg/front_end/testcases/duplicated_named_args_3.dart.strong.expect
index 22a2efc..205c40b 100644
--- a/pkg/front_end/testcases/duplicated_named_args_3.dart.strong.expect
+++ b/pkg/front_end/testcases/duplicated_named_args_3.dart.strong.expect
@@ -9,6 +9,6 @@
static method m({core::int a = 0}) → dynamic {}
}
static method test() → void {
- self::C::m(a: const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/duplicated_named_args_3.dart:13:19: Error: Duplicated named argument 'a'.\n C.m(a: 1, a: 2, a: 3);\n ^")));
+ self::C::m(a: const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/duplicated_named_args_3.dart:13:19: Error: Duplicated named argument 'a'.\n C.m(a: 1, a: 2, a: 3);\n ^")) as{TypeError} core::int);
}
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/circular_method_inference.dart.direct.expect b/pkg/front_end/testcases/inference/circular_method_inference.dart.direct.expect
index a191e19..e59a94a 100644
--- a/pkg/front_end/testcases/inference/circular_method_inference.dart.direct.expect
+++ b/pkg/front_end/testcases/inference/circular_method_inference.dart.direct.expect
@@ -14,5 +14,5 @@
;
abstract method f(dynamic x) → dynamic;
}
-static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/circular_method_inference.dart:12:16: Error: 'A' is a supertype of itself via 'B', 'A'.\nabstract class A extends B {\n ^"]/* from null */;
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/circular_method_inference.dart:12:16: Error: 'A' is a supertype of itself via 'B'.\nabstract class A extends B {\n ^", "pkg/front_end/testcases/inference/circular_method_inference.dart:16:16: Error: 'B' is a supertype of itself via 'A'.\nabstract class B extends A {\n ^"]/* from null */;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/circular_method_inference.dart.strong.expect b/pkg/front_end/testcases/inference/circular_method_inference.dart.strong.expect
index a191e19..e59a94a 100644
--- a/pkg/front_end/testcases/inference/circular_method_inference.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/circular_method_inference.dart.strong.expect
@@ -14,5 +14,5 @@
;
abstract method f(dynamic x) → dynamic;
}
-static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/circular_method_inference.dart:12:16: Error: 'A' is a supertype of itself via 'B', 'A'.\nabstract class A extends B {\n ^"]/* from null */;
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/circular_method_inference.dart:12:16: Error: 'A' is a supertype of itself via 'B'.\nabstract class A extends B {\n ^", "pkg/front_end/testcases/inference/circular_method_inference.dart:16:16: Error: 'B' is a supertype of itself via 'A'.\nabstract class B extends A {\n ^"]/* from null */;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/circular_reference_via_closures.dart b/pkg/front_end/testcases/inference/circular_reference_via_closures.dart
index e91299a..2e499a1 100644
--- a/pkg/front_end/testcases/inference/circular_reference_via_closures.dart
+++ b/pkg/front_end/testcases/inference/circular_reference_via_closures.dart
@@ -2,10 +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.
-/*@testedFeatures=inference*/
+/*@testedFeatures=inference,error*/
library test;
-var /*@topType=dynamic*/ x = /*@returnType=dynamic*/ () => /*error:TOP_LEVEL_CYCLE*/ y;
-var /*@topType=dynamic*/ y = /*@returnType=dynamic*/ () => /*error:TOP_LEVEL_CYCLE*/ x;
+var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
+ y;
+var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ y = /*@returnType=dynamic*/ () =>
+ x;
main() {}
diff --git a/pkg/front_end/testcases/inference/circular_reference_via_closures.dart.strong.expect b/pkg/front_end/testcases/inference/circular_reference_via_closures.dart.strong.expect
index fd3ef5e..80af899 100644
--- a/pkg/front_end/testcases/inference/circular_reference_via_closures.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/circular_reference_via_closures.dart.strong.expect
@@ -3,4 +3,5 @@
static field dynamic x = () → dynamic => self::y;
static field dynamic y = () → dynamic => self::x;
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/circular_reference_via_closures.dart:10:67: Error: Can't infer the type of 'y': circularity found during type inference.\nSpecify the type explicitly.\nvar /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ y = /*@returnType=dynamic*/ () =>\n ^", "pkg/front_end/testcases/inference/circular_reference_via_closures.dart:8:67: Error: Can't infer the type of 'x': circularity found during type inference.\nSpecify the type explicitly.\nvar /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>\n ^"]/* from null */;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart b/pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart
index e91299a..2e499a1 100644
--- a/pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart
+++ b/pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart
@@ -2,10 +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.
-/*@testedFeatures=inference*/
+/*@testedFeatures=inference,error*/
library test;
-var /*@topType=dynamic*/ x = /*@returnType=dynamic*/ () => /*error:TOP_LEVEL_CYCLE*/ y;
-var /*@topType=dynamic*/ y = /*@returnType=dynamic*/ () => /*error:TOP_LEVEL_CYCLE*/ x;
+var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
+ y;
+var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ y = /*@returnType=dynamic*/ () =>
+ x;
main() {}
diff --git a/pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.strong.expect b/pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.strong.expect
index fd3ef5e..a19d846 100644
--- a/pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart.strong.expect
@@ -3,4 +3,5 @@
static field dynamic x = () → dynamic => self::y;
static field dynamic y = () → dynamic => self::x;
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart:10:67: Error: Can't infer the type of 'y': circularity found during type inference.\nSpecify the type explicitly.\nvar /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ y = /*@returnType=dynamic*/ () =>\n ^", "pkg/front_end/testcases/inference/circular_reference_via_closures_initializer_types.dart:8:67: Error: Can't infer the type of 'x': circularity found during type inference.\nSpecify the type explicitly.\nvar /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>\n ^"]/* from null */;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/conflicts_can_happen.dart b/pkg/front_end/testcases/inference/conflicts_can_happen.dart
index 8e72908..aaebf32 100644
--- a/pkg/front_end/testcases/inference/conflicts_can_happen.dart
+++ b/pkg/front_end/testcases/inference/conflicts_can_happen.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/*@testedFeatures=inference*/
+/*@testedFeatures=inference,error*/
library test;
class I1 {
@@ -22,12 +22,14 @@
}
class C1 implements A, B {
- /*error:INVALID_METHOD_OVERRIDE*/ get /*@topType=dynamic*/ a => null;
+ get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ a =>
+ null;
}
// Still ambiguous
class C2 implements B, A {
- /*error:INVALID_METHOD_OVERRIDE*/ get /*@topType=dynamic*/ a => null;
+ get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ a =>
+ null;
}
main() {}
diff --git a/pkg/front_end/testcases/inference/conflicts_can_happen.dart.strong.expect b/pkg/front_end/testcases/inference/conflicts_can_happen.dart.strong.expect
index ece81ce..0b25c09 100644
--- a/pkg/front_end/testcases/inference/conflicts_can_happen.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/conflicts_can_happen.dart.strong.expect
@@ -40,4 +40,5 @@
get a() → dynamic
return null;
}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/conflicts_can_happen.dart:25:79: Error: Can't infer the type of 'a': overridden members must all have the same type.\nSpecify the type explicitly.\n get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ a =>\n ^", "pkg/front_end/testcases/inference/conflicts_can_happen.dart:31:79: Error: Can't infer the type of 'a': overridden members must all have the same type.\nSpecify the type explicitly.\n get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ a =>\n ^"]/* from null */;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/conflicts_can_happen2.dart b/pkg/front_end/testcases/inference/conflicts_can_happen2.dart
index 61b622a..85e0bd5 100644
--- a/pkg/front_end/testcases/inference/conflicts_can_happen2.dart
+++ b/pkg/front_end/testcases/inference/conflicts_can_happen2.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/*@testedFeatures=inference*/
+/*@testedFeatures=inference,error*/
library test;
class I1 {
@@ -31,7 +31,8 @@
}
class C2 implements A, B {
- /*error:INVALID_METHOD_OVERRIDE*/ get /*@topType=dynamic*/ a => null;
+ get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ a =>
+ null;
}
main() {}
diff --git a/pkg/front_end/testcases/inference/conflicts_can_happen2.dart.strong.expect b/pkg/front_end/testcases/inference/conflicts_can_happen2.dart.strong.expect
index cc41ea3..60f5c4b 100644
--- a/pkg/front_end/testcases/inference/conflicts_can_happen2.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/conflicts_can_happen2.dart.strong.expect
@@ -47,4 +47,5 @@
get a() → dynamic
return null;
}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/conflicts_can_happen2.dart:34:79: Error: Can't infer the type of 'a': overridden members must all have the same type.\nSpecify the type explicitly.\n get /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ a =>\n ^"]/* from null */;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart.strong.expect b/pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart.strong.expect
index 1f6725e..dd144e6 100644
--- a/pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart.strong.expect
@@ -11,48 +11,48 @@
return null;
}
static method test() → dynamic {
- self::takeIII(let final dynamic #t1 = math::max in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:16:16: Error: A value of type '<T extends dart.core::num>(dart.math::max::T, dart.math::max::T) \u8594 dart.math::max::T' can't be assigned to a variable of type '(dart.core::int, dart.core::int) \u8594 dart.core::int'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::int) \u8594 dart.core::int'.\n takeIII(math.max);\n ^")));
- self::takeDDD(let final dynamic #t2 = math::max in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:17:16: Error: A value of type '<T extends dart.core::num>(dart.math::max::T, dart.math::max::T) \u8594 dart.math::max::T' can't be assigned to a variable of type '(dart.core::double, dart.core::double) \u8594 dart.core::double'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::double) \u8594 dart.core::double'.\n takeDDD(math.max);\n ^")));
- self::takeNNN(let final dynamic #t3 = math::max in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:18:16: Error: A value of type '<T extends dart.core::num>(dart.math::max::T, dart.math::max::T) \u8594 dart.math::max::T' can't be assigned to a variable of type '(dart.core::num, dart.core::num) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::num, dart.core::num) \u8594 dart.core::num'.\n takeNNN(math.max);\n ^")));
- self::takeIDN(let final dynamic #t4 = math::max in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:19:16: Error: A value of type '<T extends dart.core::num>(dart.math::max::T, dart.math::max::T) \u8594 dart.math::max::T' can't be assigned to a variable of type '(dart.core::double, dart.core::int) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::int) \u8594 dart.core::num'.\n takeIDN(math.max);\n ^")));
- self::takeDIN(let final dynamic #t5 = math::max in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:20:16: Error: A value of type '<T extends dart.core::num>(dart.math::max::T, dart.math::max::T) \u8594 dart.math::max::T' can't be assigned to a variable of type '(dart.core::int, dart.core::double) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::double) \u8594 dart.core::num'.\n takeDIN(math.max);\n ^")));
- self::takeIIN(let final dynamic #t6 = math::max in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:21:16: Error: A value of type '<T extends dart.core::num>(dart.math::max::T, dart.math::max::T) \u8594 dart.math::max::T' can't be assigned to a variable of type '(dart.core::int, dart.core::int) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::int) \u8594 dart.core::num'.\n takeIIN(math.max);\n ^")));
- self::takeDDN(let final dynamic #t7 = math::max in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:22:16: Error: A value of type '<T extends dart.core::num>(dart.math::max::T, dart.math::max::T) \u8594 dart.math::max::T' can't be assigned to a variable of type '(dart.core::double, dart.core::double) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::double) \u8594 dart.core::num'.\n takeDDN(math.max);\n ^")));
- self::takeIIO(let final dynamic #t8 = math::max in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:23:16: Error: A value of type '<T extends dart.core::num>(dart.math::max::T, dart.math::max::T) \u8594 dart.math::max::T' can't be assigned to a variable of type '(dart.core::int, dart.core::int) \u8594 dart.core::Object'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::int) \u8594 dart.core::Object'.\n takeIIO(math.max);\n ^")));
- self::takeDDO(let final dynamic #t9 = math::max in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:24:16: Error: A value of type '<T extends dart.core::num>(dart.math::max::T, dart.math::max::T) \u8594 dart.math::max::T' can't be assigned to a variable of type '(dart.core::double, dart.core::double) \u8594 dart.core::Object'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::double) \u8594 dart.core::Object'.\n takeDDO(math.max);\n ^")));
- self::takeOOI(let final dynamic #t10 = math::max in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:26:70: Error: A value of type '<T extends dart.core::num>(dart.math::max::T, dart.math::max::T) \u8594 dart.math::max::T' can't be assigned to a variable of type '(dart.core::Object, dart.core::Object) \u8594 dart.core::int'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::Object, dart.core::Object) \u8594 dart.core::int'.\n takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max);\n ^")));
- self::takeIDI(let final dynamic #t11 = math::max in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:28:73: Error: A value of type '<T extends dart.core::num>(dart.math::max::T, dart.math::max::T) \u8594 dart.math::max::T' can't be assigned to a variable of type '(dart.core::double, dart.core::int) \u8594 dart.core::int'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::int) \u8594 dart.core::int'.\n /*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ math.max);\n ^")));
- self::takeDID(let final dynamic #t12 = math::max in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:30:73: Error: A value of type '<T extends dart.core::num>(dart.math::max::T, dart.math::max::T) \u8594 dart.math::max::T' can't be assigned to a variable of type '(dart.core::int, dart.core::double) \u8594 dart.core::double'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::double) \u8594 dart.core::double'.\n /*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ math.max);\n ^")));
- self::takeOON(let final dynamic #t13 = math::max in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:31:70: Error: A value of type '<T extends dart.core::num>(dart.math::max::T, dart.math::max::T) \u8594 dart.math::max::T' can't be assigned to a variable of type '(dart.core::Object, dart.core::Object) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::Object, dart.core::Object) \u8594 dart.core::num'.\n takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max);\n ^")));
- self::takeOOO(let final dynamic #t14 = math::max in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:32:70: Error: A value of type '<T extends dart.core::num>(dart.math::max::T, dart.math::max::T) \u8594 dart.math::max::T' can't be assigned to a variable of type '(dart.core::Object, dart.core::Object) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::Object, dart.core::Object) \u8594 dart.core::num'.\n takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ math.max);\n ^")));
- self::takeIII(let final dynamic #t15 = math::min in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:35:11: Error: A value of type '<T extends dart.core::num>(dart.math::min::T, dart.math::min::T) \u8594 dart.math::min::T' can't be assigned to a variable of type '(dart.core::int, dart.core::int) \u8594 dart.core::int'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::int) \u8594 dart.core::int'.\n takeIII(min);\n ^")));
- self::takeDDD(let final dynamic #t16 = math::min in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:36:11: Error: A value of type '<T extends dart.core::num>(dart.math::min::T, dart.math::min::T) \u8594 dart.math::min::T' can't be assigned to a variable of type '(dart.core::double, dart.core::double) \u8594 dart.core::double'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::double) \u8594 dart.core::double'.\n takeDDD(min);\n ^")));
- self::takeNNN(let final dynamic #t17 = math::min in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:37:11: Error: A value of type '<T extends dart.core::num>(dart.math::min::T, dart.math::min::T) \u8594 dart.math::min::T' can't be assigned to a variable of type '(dart.core::num, dart.core::num) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::num, dart.core::num) \u8594 dart.core::num'.\n takeNNN(min);\n ^")));
- self::takeIDN(let final dynamic #t18 = math::min in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:38:11: Error: A value of type '<T extends dart.core::num>(dart.math::min::T, dart.math::min::T) \u8594 dart.math::min::T' can't be assigned to a variable of type '(dart.core::double, dart.core::int) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::int) \u8594 dart.core::num'.\n takeIDN(min);\n ^")));
- self::takeDIN(let final dynamic #t19 = math::min in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:39:11: Error: A value of type '<T extends dart.core::num>(dart.math::min::T, dart.math::min::T) \u8594 dart.math::min::T' can't be assigned to a variable of type '(dart.core::int, dart.core::double) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::double) \u8594 dart.core::num'.\n takeDIN(min);\n ^")));
- self::takeIIN(let final dynamic #t20 = math::min in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:40:11: Error: A value of type '<T extends dart.core::num>(dart.math::min::T, dart.math::min::T) \u8594 dart.math::min::T' can't be assigned to a variable of type '(dart.core::int, dart.core::int) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::int) \u8594 dart.core::num'.\n takeIIN(min);\n ^")));
- self::takeDDN(let final dynamic #t21 = math::min in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:41:11: Error: A value of type '<T extends dart.core::num>(dart.math::min::T, dart.math::min::T) \u8594 dart.math::min::T' can't be assigned to a variable of type '(dart.core::double, dart.core::double) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::double) \u8594 dart.core::num'.\n takeDDN(min);\n ^")));
- self::takeIIO(let final dynamic #t22 = math::min in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:42:11: Error: A value of type '<T extends dart.core::num>(dart.math::min::T, dart.math::min::T) \u8594 dart.math::min::T' can't be assigned to a variable of type '(dart.core::int, dart.core::int) \u8594 dart.core::Object'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::int) \u8594 dart.core::Object'.\n takeIIO(min);\n ^")));
- self::takeDDO(let final dynamic #t23 = math::min in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:43:11: Error: A value of type '<T extends dart.core::num>(dart.math::min::T, dart.math::min::T) \u8594 dart.math::min::T' can't be assigned to a variable of type '(dart.core::double, dart.core::double) \u8594 dart.core::Object'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::double) \u8594 dart.core::Object'.\n takeDDO(min);\n ^")));
- self::takeOOI(let final dynamic #t24 = math::min in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:45:65: Error: A value of type '<T extends dart.core::num>(dart.math::min::T, dart.math::min::T) \u8594 dart.math::min::T' can't be assigned to a variable of type '(dart.core::Object, dart.core::Object) \u8594 dart.core::int'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::Object, dart.core::Object) \u8594 dart.core::int'.\n takeOOI(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min);\n ^")));
- self::takeIDI(let final dynamic #t25 = math::min in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:46:72: Error: A value of type '<T extends dart.core::num>(dart.math::min::T, dart.math::min::T) \u8594 dart.math::min::T' can't be assigned to a variable of type '(dart.core::double, dart.core::int) \u8594 dart.core::int'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::int) \u8594 dart.core::int'.\n takeIDI(/*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ min);\n ^")));
- self::takeDID(let final dynamic #t26 = math::min in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:47:72: Error: A value of type '<T extends dart.core::num>(dart.math::min::T, dart.math::min::T) \u8594 dart.math::min::T' can't be assigned to a variable of type '(dart.core::int, dart.core::double) \u8594 dart.core::double'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::double) \u8594 dart.core::double'.\n takeDID(/*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ min);\n ^")));
- self::takeOON(let final dynamic #t27 = math::min in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:48:65: Error: A value of type '<T extends dart.core::num>(dart.math::min::T, dart.math::min::T) \u8594 dart.math::min::T' can't be assigned to a variable of type '(dart.core::Object, dart.core::Object) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::Object, dart.core::Object) \u8594 dart.core::num'.\n takeOON(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min);\n ^")));
- self::takeOOO(let final dynamic #t28 = math::min in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:49:65: Error: A value of type '<T extends dart.core::num>(dart.math::min::T, dart.math::min::T) \u8594 dart.math::min::T' can't be assigned to a variable of type '(dart.core::Object, dart.core::Object) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::Object, dart.core::Object) \u8594 dart.core::num'.\n takeOOO(/*error:COULD_NOT_INFER,error:INVALID_CAST_FUNCTION*/ min);\n ^")));
- self::takeIII(let final dynamic #t29 = new self::C::•().{self::C::m} in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:52:37: Error: A value of type '<T extends dart.core::num>(test::C::m::T, test::C::m::T) \u8594 test::C::m::T' can't be assigned to a variable of type '(dart.core::int, dart.core::int) \u8594 dart.core::int'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::int) \u8594 dart.core::int'.\n takeIII(new C(). /*@target=C::m*/ m);\n ^")));
- self::takeDDD(let final dynamic #t30 = new self::C::•().{self::C::m} in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:53:37: Error: A value of type '<T extends dart.core::num>(test::C::m::T, test::C::m::T) \u8594 test::C::m::T' can't be assigned to a variable of type '(dart.core::double, dart.core::double) \u8594 dart.core::double'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::double) \u8594 dart.core::double'.\n takeDDD(new C(). /*@target=C::m*/ m);\n ^")));
- self::takeNNN(let final dynamic #t31 = new self::C::•().{self::C::m} in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:54:37: Error: A value of type '<T extends dart.core::num>(test::C::m::T, test::C::m::T) \u8594 test::C::m::T' can't be assigned to a variable of type '(dart.core::num, dart.core::num) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::num, dart.core::num) \u8594 dart.core::num'.\n takeNNN(new C(). /*@target=C::m*/ m);\n ^")));
- self::takeIDN(let final dynamic #t32 = new self::C::•().{self::C::m} in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:55:37: Error: A value of type '<T extends dart.core::num>(test::C::m::T, test::C::m::T) \u8594 test::C::m::T' can't be assigned to a variable of type '(dart.core::double, dart.core::int) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::int) \u8594 dart.core::num'.\n takeIDN(new C(). /*@target=C::m*/ m);\n ^")));
- self::takeDIN(let final dynamic #t33 = new self::C::•().{self::C::m} in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:56:37: Error: A value of type '<T extends dart.core::num>(test::C::m::T, test::C::m::T) \u8594 test::C::m::T' can't be assigned to a variable of type '(dart.core::int, dart.core::double) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::double) \u8594 dart.core::num'.\n takeDIN(new C(). /*@target=C::m*/ m);\n ^")));
- self::takeIIN(let final dynamic #t34 = new self::C::•().{self::C::m} in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:57:37: Error: A value of type '<T extends dart.core::num>(test::C::m::T, test::C::m::T) \u8594 test::C::m::T' can't be assigned to a variable of type '(dart.core::int, dart.core::int) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::int) \u8594 dart.core::num'.\n takeIIN(new C(). /*@target=C::m*/ m);\n ^")));
- self::takeDDN(let final dynamic #t35 = new self::C::•().{self::C::m} in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:58:37: Error: A value of type '<T extends dart.core::num>(test::C::m::T, test::C::m::T) \u8594 test::C::m::T' can't be assigned to a variable of type '(dart.core::double, dart.core::double) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::double) \u8594 dart.core::num'.\n takeDDN(new C(). /*@target=C::m*/ m);\n ^")));
- self::takeIIO(let final dynamic #t36 = new self::C::•().{self::C::m} in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:59:37: Error: A value of type '<T extends dart.core::num>(test::C::m::T, test::C::m::T) \u8594 test::C::m::T' can't be assigned to a variable of type '(dart.core::int, dart.core::int) \u8594 dart.core::Object'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::int) \u8594 dart.core::Object'.\n takeIIO(new C(). /*@target=C::m*/ m);\n ^")));
- self::takeDDO(let final dynamic #t37 = new self::C::•().{self::C::m} in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:60:37: Error: A value of type '<T extends dart.core::num>(test::C::m::T, test::C::m::T) \u8594 test::C::m::T' can't be assigned to a variable of type '(dart.core::double, dart.core::double) \u8594 dart.core::Object'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::double) \u8594 dart.core::Object'.\n takeDDO(new C(). /*@target=C::m*/ m);\n ^")));
- self::takeOON(let final dynamic #t38 = new self::C::•().{self::C::m} in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:73:26: Error: A value of type '<T extends dart.core::num>(test::C::m::T, test::C::m::T) \u8594 test::C::m::T' can't be assigned to a variable of type '(dart.core::Object, dart.core::Object) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::Object, dart.core::Object) \u8594 dart.core::num'.\n . /*@target=C::m*/ m);\n ^")));
- self::takeOOO(let final dynamic #t39 = new self::C::•().{self::C::m} in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:75:26: Error: A value of type '<T extends dart.core::num>(test::C::m::T, test::C::m::T) \u8594 test::C::m::T' can't be assigned to a variable of type '(dart.core::Object, dart.core::Object) \u8594 dart.core::num'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::Object, dart.core::Object) \u8594 dart.core::num'.\n . /*@target=C::m*/ m);\n ^")));
- self::takeOOI(let final dynamic #t40 = new self::C::•().{self::C::m} in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:82:26: Error: A value of type '<T extends dart.core::num>(test::C::m::T, test::C::m::T) \u8594 test::C::m::T' can't be assigned to a variable of type '(dart.core::Object, dart.core::Object) \u8594 dart.core::int'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::Object, dart.core::Object) \u8594 dart.core::int'.\n . /*@target=C::m*/ m);\n ^")));
- self::takeIDI(let final dynamic #t41 = new self::C::•().{self::C::m} in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:86:30: Error: A value of type '<T extends dart.core::num>(test::C::m::T, test::C::m::T) \u8594 test::C::m::T' can't be assigned to a variable of type '(dart.core::double, dart.core::int) \u8594 dart.core::int'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::int) \u8594 dart.core::int'.\n . /*@target=C::m*/ m);\n ^")));
- self::takeDID(let final dynamic #t42 = new self::C::•().{self::C::m} in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:89:30: Error: A value of type '<T extends dart.core::num>(test::C::m::T, test::C::m::T) \u8594 test::C::m::T' can't be assigned to a variable of type '(dart.core::int, dart.core::double) \u8594 dart.core::double'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::double) \u8594 dart.core::double'.\n . /*@target=C::m*/ m);\n ^")));
+ self::takeIII(math::max<core::int>);
+ self::takeDDD(math::max<core::double>);
+ self::takeNNN(math::max<core::num>);
+ self::takeIDN(math::max<core::num>);
+ self::takeDIN(math::max<core::num>);
+ self::takeIIN(math::max<core::int>);
+ self::takeDDN(math::max<core::double>);
+ self::takeIIO(math::max<core::int>);
+ self::takeDDO(math::max<core::double>);
+ self::takeOOI((math::max<core::Object>) as{TypeError} (core::Object, core::Object) → core::int);
+ self::takeIDI(let final dynamic #t1 = math::max<core::num> in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:28:73: Error: A value of type '(dart.core::num, dart.core::num) \u8594 dart.core::num' can't be assigned to a variable of type '(dart.core::double, dart.core::int) \u8594 dart.core::int'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::int) \u8594 dart.core::int'.\n /*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ math.max);\n ^")));
+ self::takeDID(let final dynamic #t2 = math::max<core::num> in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:30:73: Error: A value of type '(dart.core::num, dart.core::num) \u8594 dart.core::num' can't be assigned to a variable of type '(dart.core::int, dart.core::double) \u8594 dart.core::double'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::double) \u8594 dart.core::double'.\n /*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ math.max);\n ^")));
+ self::takeOON((math::max<core::Object>) as{TypeError} (core::Object, core::Object) → core::num);
+ self::takeOOO((math::max<core::Object>) as{TypeError} (core::Object, core::Object) → core::num);
+ self::takeIII(math::min<core::int>);
+ self::takeDDD(math::min<core::double>);
+ self::takeNNN(math::min<core::num>);
+ self::takeIDN(math::min<core::num>);
+ self::takeDIN(math::min<core::num>);
+ self::takeIIN(math::min<core::int>);
+ self::takeDDN(math::min<core::double>);
+ self::takeIIO(math::min<core::int>);
+ self::takeDDO(math::min<core::double>);
+ self::takeOOI((math::min<core::Object>) as{TypeError} (core::Object, core::Object) → core::int);
+ self::takeIDI(let final dynamic #t3 = math::min<core::num> in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:46:72: Error: A value of type '(dart.core::num, dart.core::num) \u8594 dart.core::num' can't be assigned to a variable of type '(dart.core::double, dart.core::int) \u8594 dart.core::int'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::int) \u8594 dart.core::int'.\n takeIDI(/*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ min);\n ^")));
+ self::takeDID(let final dynamic #t4 = math::min<core::num> in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:47:72: Error: A value of type '(dart.core::num, dart.core::num) \u8594 dart.core::num' can't be assigned to a variable of type '(dart.core::int, dart.core::double) \u8594 dart.core::double'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::double) \u8594 dart.core::double'.\n takeDID(/*error:COULD_NOT_INFER,error:ARGUMENT_TYPE_NOT_ASSIGNABLE*/ min);\n ^")));
+ self::takeOON((math::min<core::Object>) as{TypeError} (core::Object, core::Object) → core::num);
+ self::takeOOO((math::min<core::Object>) as{TypeError} (core::Object, core::Object) → core::num);
+ self::takeIII(new self::C::•().{self::C::m}<core::int>);
+ self::takeDDD(new self::C::•().{self::C::m}<core::double>);
+ self::takeNNN(new self::C::•().{self::C::m}<core::num>);
+ self::takeIDN(new self::C::•().{self::C::m}<core::num>);
+ self::takeDIN(new self::C::•().{self::C::m}<core::num>);
+ self::takeIIN(new self::C::•().{self::C::m}<core::int>);
+ self::takeDDN(new self::C::•().{self::C::m}<core::double>);
+ self::takeIIO(new self::C::•().{self::C::m}<core::int>);
+ self::takeDDO(new self::C::•().{self::C::m}<core::double>);
+ self::takeOON((new self::C::•().{self::C::m}<core::Object>) as{TypeError} (core::Object, core::Object) → core::num);
+ self::takeOOO((new self::C::•().{self::C::m}<core::Object>) as{TypeError} (core::Object, core::Object) → core::num);
+ self::takeOOI((new self::C::•().{self::C::m}<core::Object>) as{TypeError} (core::Object, core::Object) → core::int);
+ self::takeIDI(let final dynamic #t5 = new self::C::•().{self::C::m}<core::num> in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:86:30: Error: A value of type '(dart.core::num, dart.core::num) \u8594 dart.core::num' can't be assigned to a variable of type '(dart.core::double, dart.core::int) \u8594 dart.core::int'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::double, dart.core::int) \u8594 dart.core::int'.\n . /*@target=C::m*/ m);\n ^")));
+ self::takeDID(let final dynamic #t6 = new self::C::•().{self::C::m}<core::num> in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_infer_generic_instantiation.dart:89:30: Error: A value of type '(dart.core::num, dart.core::num) \u8594 dart.core::num' can't be assigned to a variable of type '(dart.core::int, dart.core::double) \u8594 dart.core::double'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::double) \u8594 dart.core::double'.\n . /*@target=C::m*/ m);\n ^")));
}
static method takeIII((core::int, core::int) → core::int fn) → void {}
static method takeDDD((core::double, core::double) → core::double fn) → void {}
diff --git a/pkg/front_end/testcases/inference/generic_methods_nested_generic_instantiation.dart.strong.expect b/pkg/front_end/testcases/inference/generic_methods_nested_generic_instantiation.dart.strong.expect
index 703cafd..341eac6 100644
--- a/pkg/front_end/testcases/inference/generic_methods_nested_generic_instantiation.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/generic_methods_nested_generic_instantiation.dart.strong.expect
@@ -18,6 +18,6 @@
static method main() → dynamic {
core::List<self::Trace> traces = <self::Trace>[];
core::int longest = traces.{core::Iterable::map}<core::int>((self::Trace trace) → core::int {
- return trace.{self::Trace::frames}.{core::Iterable::map}<core::int>((self::Frame frame) → core::int => frame.{self::Frame::location}.{core::String::length}).{core::Iterable::fold}<core::int>(0, let final dynamic #t1 = math::max in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_nested_generic_instantiation.dart:28:69: Error: A value of type '<T extends dart.core::num>(dart.math::max::T, dart.math::max::T) \u8594 dart.math::max::T' can't be assigned to a variable of type '(dart.core::int, dart.core::int) \u8594 dart.core::int'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::int) \u8594 dart.core::int'.\n . /*@typeArgs=int*/ /*@target=Iterable::fold*/ fold(0, math.max);\n ^")));
- }).{core::Iterable::fold}<core::int>(0, let final dynamic #t2 = math::max in let dynamic _ = null in const core::_ConstantExpressionError::•().{core::_ConstantExpressionError::_throw}(new core::_CompileTimeError::•("pkg/front_end/testcases/inference/generic_methods_nested_generic_instantiation.dart:29:65: Error: A value of type '<T extends dart.core::num>(dart.math::max::T, dart.math::max::T) \u8594 dart.math::max::T' can't be assigned to a variable of type '(dart.core::int, dart.core::int) \u8594 dart.core::int'.\nTry changing the type of the left hand side, or casting the right hand side to '(dart.core::int, dart.core::int) \u8594 dart.core::int'.\n }). /*@typeArgs=int*/ /*@target=Iterable::fold*/ fold(0, math.max);\n ^")));
+ return trace.{self::Trace::frames}.{core::Iterable::map}<core::int>((self::Frame frame) → core::int => frame.{self::Frame::location}.{core::String::length}).{core::Iterable::fold}<core::int>(0, math::max<core::int>);
+ }).{core::Iterable::fold}<core::int>(0, math::max<core::int>);
}
diff --git a/pkg/front_end/testcases/inference/infer_field_override_multiple.dart b/pkg/front_end/testcases/inference/infer_field_override_multiple.dart
index 4003e8c..a7484f4 100644
--- a/pkg/front_end/testcases/inference/infer_field_override_multiple.dart
+++ b/pkg/front_end/testcases/inference/infer_field_override_multiple.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/*@testedFeatures=inference*/
+/*@testedFeatures=inference,error*/
library test;
abstract class A {
@@ -29,15 +29,15 @@
// Superclasses don't have a consistent type for `x` so inference fails, even if
// the types are related.
class F extends A implements C {
- var /*@topType=dynamic*/ x;
+ var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ x;
}
class G extends A implements D {
- var /*@topType=dynamic*/ x;
+ var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ x;
}
class H extends C implements D {
- var /*@topType=dynamic*/ x;
+ var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ x;
}
main() {}
diff --git a/pkg/front_end/testcases/inference/infer_field_override_multiple.dart.strong.expect b/pkg/front_end/testcases/inference/infer_field_override_multiple.dart.strong.expect
index 2897e76..a38ad52 100644
--- a/pkg/front_end/testcases/inference/infer_field_override_multiple.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/infer_field_override_multiple.dart.strong.expect
@@ -50,4 +50,5 @@
: super self::C::•()
;
}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/infer_field_override_multiple.dart:32:79: Error: Can't infer the type of 'x': overridden members must all have the same type.\nSpecify the type explicitly.\n var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ x;\n ^", "pkg/front_end/testcases/inference/infer_field_override_multiple.dart:36:79: Error: Can't infer the type of 'x': overridden members must all have the same type.\nSpecify the type explicitly.\n var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ x;\n ^", "pkg/front_end/testcases/inference/infer_field_override_multiple.dart:40:79: Error: Can't infer the type of 'x': overridden members must all have the same type.\nSpecify the type explicitly.\n var /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ x;\n ^"]/* from null */;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/infer_method_missing_params.dart b/pkg/front_end/testcases/inference/infer_method_missing_params.dart
index 839e425..57a5515 100644
--- a/pkg/front_end/testcases/inference/infer_method_missing_params.dart
+++ b/pkg/front_end/testcases/inference/infer_method_missing_params.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/*@testedFeatures=inference*/
+/*@testedFeatures=inference,error*/
library test;
// All of these cases are error conditions; this test checks how we recover.
@@ -20,9 +20,13 @@
}
abstract class C implements A, B {
- /*@topType=int*/ f(/*@topType=int*/ x, /*@topType=dynamic*/ y);
- /*@topType=int*/ g(/*@topType=int*/ x, [/*@topType=dynamic*/ y]);
- /*@topType=int*/ h(/*@topType=int*/ x, {/*@topType=dynamic*/ y});
+ /*@topType=int*/ f(
+ /*@topType=int*/ x,
+ /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ y);
+ /*@topType=int*/ g(/*@topType=int*/ x,
+ [/*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ y]);
+ /*@topType=int*/ h(/*@topType=int*/ x,
+ {/*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ y});
}
main() {}
diff --git a/pkg/front_end/testcases/inference/infer_method_missing_params.dart.strong.expect b/pkg/front_end/testcases/inference/infer_method_missing_params.dart.strong.expect
index 0eddb83..c07237e 100644
--- a/pkg/front_end/testcases/inference/infer_method_missing_params.dart.strong.expect
+++ b/pkg/front_end/testcases/inference/infer_method_missing_params.dart.strong.expect
@@ -26,4 +26,5 @@
abstract method g(core::int x, [dynamic y = null]) → core::int;
abstract method h(core::int x, {dynamic y = null}) → core::int;
}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference/infer_method_missing_params.dart:25:79: Error: Can't infer the type of 'y': overridden members must all have the same type.\nSpecify the type explicitly.\n /*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ y);\n ^", "pkg/front_end/testcases/inference/infer_method_missing_params.dart:29:80: Error: Can't infer the type of 'y': overridden members must all have the same type.\nSpecify the type explicitly.\n {/*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ y});\n ^", "pkg/front_end/testcases/inference/infer_method_missing_params.dart:27:80: Error: Can't infer the type of 'y': overridden members must all have the same type.\nSpecify the type explicitly.\n [/*@topType=dynamic*/ /*@error=CantInferTypeDueToInconsistentOverrides*/ y]);\n ^"]/* from null */;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/instantiate_tearoff.dart b/pkg/front_end/testcases/inference/instantiate_tearoff.dart
new file mode 100644
index 0000000..10eeb1f
--- /dev/null
+++ b/pkg/front_end/testcases/inference/instantiate_tearoff.dart
@@ -0,0 +1,31 @@
+// 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.
+
+/*@testedFeatures=inference*/
+library test;
+
+T f<T>(T x) => x;
+
+class C {
+ T f<T>(T x) => x;
+ static T g<T>(T x) => x;
+}
+
+class D extends C {
+ void test() {
+ int Function(int) func;
+ func = super. /*@target=C::f*/ f;
+ }
+}
+
+void test() {
+ T h<T>(T x) => x;
+ int Function(int) func;
+ func = f;
+ func = new C(). /*@target=C::f*/ f;
+ func = C.g;
+ func = h;
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/inference/instantiate_tearoff.dart.direct.expect b/pkg/front_end/testcases/inference/instantiate_tearoff.dart.direct.expect
new file mode 100644
index 0000000..47f329d
--- /dev/null
+++ b/pkg/front_end/testcases/inference/instantiate_tearoff.dart.direct.expect
@@ -0,0 +1,34 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ default constructor •() → void
+ : super core::Object::•()
+ ;
+ method f<T extends core::Object>(self::C::f::T x) → self::C::f::T
+ return x;
+ static method g<T extends core::Object>(self::C::g::T x) → self::C::g::T
+ return x;
+}
+class D extends self::C {
+ default constructor •() → void
+ : super self::C::•()
+ ;
+ method test() → void {
+ (core::int) → core::int func;
+ func = super.{self::C::f};
+ }
+}
+static method f<T extends core::Object>(self::f::T x) → self::f::T
+ return x;
+static method test() → void {
+ function h<T extends core::Object>(T x) → T
+ return x;
+ (core::int) → core::int func;
+ func = self::f;
+ func = new self::C::•().f;
+ func = self::C::g;
+ func = h;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/instantiate_tearoff.dart.outline.expect b/pkg/front_end/testcases/inference/instantiate_tearoff.dart.outline.expect
new file mode 100644
index 0000000..c14cfbd
--- /dev/null
+++ b/pkg/front_end/testcases/inference/instantiate_tearoff.dart.outline.expect
@@ -0,0 +1,24 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ default constructor •() → void
+ ;
+ method f<T extends core::Object>(self::C::f::T x) → self::C::f::T
+ ;
+ static method g<T extends core::Object>(self::C::g::T x) → self::C::g::T
+ ;
+}
+class D extends self::C {
+ default constructor •() → void
+ ;
+ method test() → void
+ ;
+}
+static method f<T extends core::Object>(self::f::T x) → self::f::T
+ ;
+static method test() → void
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/inference/instantiate_tearoff.dart.strong.expect b/pkg/front_end/testcases/inference/instantiate_tearoff.dart.strong.expect
new file mode 100644
index 0000000..c6f2f60
--- /dev/null
+++ b/pkg/front_end/testcases/inference/instantiate_tearoff.dart.strong.expect
@@ -0,0 +1,34 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C extends core::Object {
+ default constructor •() → void
+ : super core::Object::•()
+ ;
+ method f<T extends core::Object>(self::C::f::T x) → self::C::f::T
+ return x;
+ static method g<T extends core::Object>(self::C::g::T x) → self::C::g::T
+ return x;
+}
+class D extends self::C {
+ default constructor •() → void
+ : super self::C::•()
+ ;
+ method test() → void {
+ (core::int) → core::int func;
+ func = super.{self::C::f}<core::int>;
+ }
+}
+static method f<T extends core::Object>(self::f::T x) → self::f::T
+ return x;
+static method test() → void {
+ function h<T extends core::Object>(T x) → T
+ return x;
+ (core::int) → core::int func;
+ func = self::f<core::int>;
+ func = new self::C::•().{self::C::f}<core::int>;
+ func = self::C::g<core::int>;
+ func = h<core::int>;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart b/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart
new file mode 100644
index 0000000..d272786
--- /dev/null
+++ b/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart
@@ -0,0 +1,18 @@
+// 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.
+
+/*@testedFeatures=inference*/
+library test;
+
+class C<T> {
+ void Function(T) f<U>(U x) => /*@returnType=Null*/ (/*@type=C::T*/ y) {};
+}
+
+void test(C<String> c) {
+ // Tear-off of c.f needs to be type checked due to contravariance. The
+ // instantiation should occur after the type check.
+ void Function(String) Function(int) tearoff = c. /*@target=C::f*/ f;
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart.direct.expect b/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart.direct.expect
new file mode 100644
index 0000000..aee70c3
--- /dev/null
+++ b/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart.direct.expect
@@ -0,0 +1,15 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ default constructor •() → void
+ : super core::Object::•()
+ ;
+ method f<U extends core::Object>(self::C::f::U x) → (self::C::T) → void
+ return (dynamic y) → dynamic {};
+}
+static method test(self::C<core::String> c) → void {
+ (core::int) → (core::String) → void tearoff = c.f;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart.outline.expect b/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart.outline.expect
new file mode 100644
index 0000000..5b4814c
--- /dev/null
+++ b/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart.outline.expect
@@ -0,0 +1,14 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ default constructor •() → void
+ ;
+ method f<U extends core::Object>(self::C::f::U x) → (self::C::T) → void
+ ;
+}
+static method test(self::C<core::String> c) → void
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart.strong.expect b/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart.strong.expect
new file mode 100644
index 0000000..fb13da1
--- /dev/null
+++ b/pkg/front_end/testcases/inference/instantiate_tearoff_after_contravariance_check.dart.strong.expect
@@ -0,0 +1,15 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+class C<T extends core::Object> extends core::Object {
+ default constructor •() → void
+ : super core::Object::•()
+ ;
+ generic-contravariant method f<U extends core::Object>(self::C::f::U x) → (self::C::T) → void
+ return (self::C::T y) → core::Null {};
+}
+static method test(self::C<core::String> c) → void {
+ (core::int) → (core::String) → void tearoff = c.{self::C::f} as{TypeError} <U extends core::Object>(U) → (core::String) → void<core::int>;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/instantiate_tearoff_of_call.dart b/pkg/front_end/testcases/inference/instantiate_tearoff_of_call.dart
new file mode 100644
index 0000000..1967387
--- /dev/null
+++ b/pkg/front_end/testcases/inference/instantiate_tearoff_of_call.dart
@@ -0,0 +1,13 @@
+// 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.
+
+/*@testedFeatures=inference*/
+library test;
+
+void test(T Function<T>(T) f) {
+ int Function(int) func;
+ func = f.call;
+}
+
+main() {}
diff --git a/pkg/front_end/testcases/inference/instantiate_tearoff_of_call.dart.direct.expect b/pkg/front_end/testcases/inference/instantiate_tearoff_of_call.dart.direct.expect
new file mode 100644
index 0000000..258ba0e
--- /dev/null
+++ b/pkg/front_end/testcases/inference/instantiate_tearoff_of_call.dart.direct.expect
@@ -0,0 +1,9 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method test(<T extends core::Object>(T) → T f) → void {
+ (core::int) → core::int func;
+ func = f.call;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference/instantiate_tearoff_of_call.dart.outline.expect b/pkg/front_end/testcases/inference/instantiate_tearoff_of_call.dart.outline.expect
new file mode 100644
index 0000000..65e10ba
--- /dev/null
+++ b/pkg/front_end/testcases/inference/instantiate_tearoff_of_call.dart.outline.expect
@@ -0,0 +1,8 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method test(<T extends core::Object>(T) → T f) → void
+ ;
+static method main() → dynamic
+ ;
diff --git a/pkg/front_end/testcases/inference/instantiate_tearoff_of_call.dart.strong.expect b/pkg/front_end/testcases/inference/instantiate_tearoff_of_call.dart.strong.expect
new file mode 100644
index 0000000..c944bdb
--- /dev/null
+++ b/pkg/front_end/testcases/inference/instantiate_tearoff_of_call.dart.strong.expect
@@ -0,0 +1,9 @@
+library test;
+import self as self;
+import "dart:core" as core;
+
+static method test(<T extends core::Object>(T) → T f) → void {
+ (core::int) → core::int func;
+ func = f.call<core::int>;
+}
+static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference_new/dependency_only_if_generic_method.dart b/pkg/front_end/testcases/inference_new/dependency_only_if_generic_method.dart
index 1245688..68d91d1 100644
--- a/pkg/front_end/testcases/inference_new/dependency_only_if_generic_method.dart
+++ b/pkg/front_end/testcases/inference_new/dependency_only_if_generic_method.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/*@testedFeatures=inference*/
+/*@testedFeatures=inference,error*/
library test;
class A {
@@ -15,9 +15,9 @@
// There's a circularity between b and c because a.f is generic, so the type of
// c is required to infer b, and vice versa.
-var /*@topType=dynamic*/ b = /*@returnType=dynamic*/ () =>
+var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ b = /*@returnType=dynamic*/ () =>
a. /*@typeArgs=dynamic*/ /*@target=A::f*/ f(c);
-var /*@topType=dynamic*/ c = /*@returnType=dynamic*/ () =>
+var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ c = /*@returnType=dynamic*/ () =>
a. /*@typeArgs=dynamic*/ /*@target=A::f*/ f(b);
// e's use of a.g breaks the circularity, because a.g is not generic, therefore
diff --git a/pkg/front_end/testcases/inference_new/dependency_only_if_generic_method.dart.strong.expect b/pkg/front_end/testcases/inference_new/dependency_only_if_generic_method.dart.strong.expect
index c5d787c..1965b1b 100644
--- a/pkg/front_end/testcases/inference_new/dependency_only_if_generic_method.dart.strong.expect
+++ b/pkg/front_end/testcases/inference_new/dependency_only_if_generic_method.dart.strong.expect
@@ -16,4 +16,5 @@
static field dynamic c = () → dynamic => self::a.{self::A::f}<dynamic>(self::b);
static field () → () → core::int d = () → () → core::int => self::a.{self::A::f}<() → core::int>(self::e);
static field () → core::int e = () → core::int => self::a.{self::A::g}(self::d);
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference_new/dependency_only_if_generic_method.dart:20:67: Error: Can't infer the type of 'c': circularity found during type inference.\nSpecify the type explicitly.\nvar /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ c = /*@returnType=dynamic*/ () =>\n ^", "pkg/front_end/testcases/inference_new/dependency_only_if_generic_method.dart:18:67: Error: Can't infer the type of 'b': circularity found during type inference.\nSpecify the type explicitly.\nvar /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ b = /*@returnType=dynamic*/ () =>\n ^"]/* from null */;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference_new/dependency_only_if_overloaded.dart b/pkg/front_end/testcases/inference_new/dependency_only_if_overloaded.dart
index eb8d3d9..0c3cd9b 100644
--- a/pkg/front_end/testcases/inference_new/dependency_only_if_overloaded.dart
+++ b/pkg/front_end/testcases/inference_new/dependency_only_if_overloaded.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/*@testedFeatures=inference*/
+/*@testedFeatures=inference,error*/
library test;
int intValue = 0;
@@ -12,9 +12,9 @@
// There's a circularity between a and b because the type of `int + x` depends
// on the type of x.
-var /*@topType=dynamic*/ a = /*@returnType=num*/ () =>
+var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ a = /*@returnType=num*/ () =>
intValue /*@target=num::+*/ + b;
-var /*@topType=dynamic*/ b = a();
+var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ b = a();
// But there's no circularity between c and d because the type of `num + x` is
// always num.
diff --git a/pkg/front_end/testcases/inference_new/dependency_only_if_overloaded.dart.strong.expect b/pkg/front_end/testcases/inference_new/dependency_only_if_overloaded.dart.strong.expect
index 576fb78..e86a790 100644
--- a/pkg/front_end/testcases/inference_new/dependency_only_if_overloaded.dart.strong.expect
+++ b/pkg/front_end/testcases/inference_new/dependency_only_if_overloaded.dart.strong.expect
@@ -11,4 +11,5 @@
static field core::num d = self::c.call();
static field () → core::double e = () → core::double => self::doubleValue.{core::double::+}(self::f);
static field core::double f = self::e.call();
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference_new/dependency_only_if_overloaded.dart:17:67: Error: Can't infer the type of 'b': circularity found during type inference.\nSpecify the type explicitly.\nvar /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ b = a();\n ^", "pkg/front_end/testcases/inference_new/dependency_only_if_overloaded.dart:15:67: Error: Can't infer the type of 'a': circularity found during type inference.\nSpecify the type explicitly.\nvar /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ a = /*@returnType=num*/ () =>\n ^"]/* from null */;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference_new/field_inference_circularity.dart b/pkg/front_end/testcases/inference_new/field_inference_circularity.dart
index 5cef25d..d8b81a7 100644
--- a/pkg/front_end/testcases/inference_new/field_inference_circularity.dart
+++ b/pkg/front_end/testcases/inference_new/field_inference_circularity.dart
@@ -2,21 +2,21 @@
// 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.
-/*@testedFeatures=inference*/
+/*@testedFeatures=inference,error*/
library test;
// A.x depends on B.x which depends on A.x, so no type is inferred. But types
// can be inferred for A.y and B.y.
class A {
- var /*@topType=dynamic*/ x = /*@returnType=dynamic*/ () =>
+ var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
new B(). /*@target=B::x*/ x;
var /*@topType=() -> dynamic*/ y = /*@returnType=dynamic*/ () =>
new B(). /*@target=B::x*/ x;
}
class B extends A {
- var /*@topType=dynamic*/ x;
+ var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x;
var /*@topType=() -> dynamic*/ y;
}
diff --git a/pkg/front_end/testcases/inference_new/field_inference_circularity.dart.strong.expect b/pkg/front_end/testcases/inference_new/field_inference_circularity.dart.strong.expect
index f6aa303..7770e4d 100644
--- a/pkg/front_end/testcases/inference_new/field_inference_circularity.dart.strong.expect
+++ b/pkg/front_end/testcases/inference_new/field_inference_circularity.dart.strong.expect
@@ -16,4 +16,5 @@
: super self::A::•()
;
}
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference_new/field_inference_circularity.dart:12:69: Error: Can't infer the type of 'x': circularity found during type inference.\nSpecify the type explicitly.\n var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>\n ^", "pkg/front_end/testcases/inference_new/field_inference_circularity.dart:19:69: Error: Can't infer the type of 'x': circularity found during type inference.\nSpecify the type explicitly.\n var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x;\n ^"]/* from null */;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart b/pkg/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart
index b83ee3a..888321e 100644
--- a/pkg/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart
+++ b/pkg/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart
@@ -2,18 +2,19 @@
// 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.
-/*@testedFeatures=inference*/
+/*@testedFeatures=inference,error*/
library test;
// In the code below, there is a circularity between A.b and x.
class A {
- var /*@topType=dynamic*/ b = /*@returnType=dynamic*/ () => x;
+ var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ b = /*@returnType=dynamic*/ () =>
+ x;
var /*@topType=() -> dynamic*/ c = /*@returnType=dynamic*/ () => x;
}
var /*@topType=A*/ a = new A();
-var /*@topType=dynamic*/ x = /*@returnType=dynamic*/ () =>
+var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
a. /*@target=A::b*/ b;
var /*@topType=() -> () -> dynamic*/ y = /*@returnType=() -> dynamic*/ () =>
a. /*@target=A::c*/ c;
diff --git a/pkg/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart.strong.expect b/pkg/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart.strong.expect
index f475a19..3db6238 100644
--- a/pkg/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart.strong.expect
+++ b/pkg/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart.strong.expect
@@ -12,4 +12,5 @@
static field self::A a = new self::A::•();
static field dynamic x = () → dynamic => self::a.{self::A::b};
static field () → () → dynamic y = () → () → dynamic => self::a.{self::A::c};
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart:11:69: Error: Can't infer the type of 'b': circularity found during type inference.\nSpecify the type explicitly.\n var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ b = /*@returnType=dynamic*/ () =>\n ^", "pkg/front_end/testcases/inference_new/infer_instance_field_ref_circular.dart:17:67: Error: Can't infer the type of 'x': circularity found during type inference.\nSpecify the type explicitly.\nvar /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>\n ^"]/* from null */;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/inference_new/strongly_connected_component.dart b/pkg/front_end/testcases/inference_new/strongly_connected_component.dart
index b5f2ef5..0589e0a 100644
--- a/pkg/front_end/testcases/inference_new/strongly_connected_component.dart
+++ b/pkg/front_end/testcases/inference_new/strongly_connected_component.dart
@@ -2,7 +2,7 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-/*@testedFeatures=inference*/
+/*@testedFeatures=inference,error*/
library test;
bool f() => null;
@@ -14,8 +14,10 @@
// circularity, and for error recovery their type is set to `dynamic`.
// Thereafter, z infers without problems.
-var /*@topType=dynamic*/ x = /*@returnType=dynamic*/ () => f() ? y : z;
-var /*@topType=dynamic*/ y = /*@returnType=dynamic*/ () => x;
+var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>
+ f() ? y : z;
+var /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ y = /*@returnType=dynamic*/ () =>
+ x;
var /*@topType=() -> dynamic*/ z = /*@returnType=dynamic*/ () => x;
main() {}
diff --git a/pkg/front_end/testcases/inference_new/strongly_connected_component.dart.strong.expect b/pkg/front_end/testcases/inference_new/strongly_connected_component.dart.strong.expect
index 9d0892a..a51da21 100644
--- a/pkg/front_end/testcases/inference_new/strongly_connected_component.dart.strong.expect
+++ b/pkg/front_end/testcases/inference_new/strongly_connected_component.dart.strong.expect
@@ -5,6 +5,7 @@
static field dynamic x = () → dynamic => self::f() ?{dynamic} self::y : self::z;
static field dynamic y = () → dynamic => self::x;
static field () → dynamic z = () → dynamic => self::x;
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/inference_new/strongly_connected_component.dart:19:67: Error: Can't infer the type of 'y': circularity found during type inference.\nSpecify the type explicitly.\nvar /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ y = /*@returnType=dynamic*/ () =>\n ^", "pkg/front_end/testcases/inference_new/strongly_connected_component.dart:17:67: Error: Can't infer the type of 'x': circularity found during type inference.\nSpecify the type explicitly.\nvar /*@topType=dynamic*/ /*@error=CantInferTypeDueToCircularity*/ x = /*@returnType=dynamic*/ () =>\n ^"]/* from null */;
static method f() → core::bool
return null;
static method main() → dynamic {}
diff --git a/pkg/front_end/testcases/qualified.dart.direct.expect b/pkg/front_end/testcases/qualified.dart.direct.expect
index 3ea9743..9bc9165 100644
--- a/pkg/front_end/testcases/qualified.dart.direct.expect
+++ b/pkg/front_end/testcases/qualified.dart.direct.expect
@@ -25,7 +25,7 @@
static factory b<T extends core::Object>() → self::C<self::C::b::T>
let dynamic #redirecting_factory = lib::C::b in invalid-expression;
}
-static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/qualified.dart: Error: The type 'lib.Missing' can't be used as supertype."]/* from null */;
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/qualified.dart:11:7: Error: The type 'lib.Missing' can't be used as supertype.\nclass Bad extends lib.Missing {\n ^"]/* from null */;
static method main() → dynamic {
new self::C::•<core::String>();
new self::C::a<core::String>();
diff --git a/pkg/front_end/testcases/qualified.dart.strong.expect b/pkg/front_end/testcases/qualified.dart.strong.expect
index 0e14ca2..8540a0d 100644
--- a/pkg/front_end/testcases/qualified.dart.strong.expect
+++ b/pkg/front_end/testcases/qualified.dart.strong.expect
@@ -25,7 +25,7 @@
static factory b<T extends core::Object>() → self::C<self::C::b::T>
let dynamic #redirecting_factory = lib::C::b in invalid-expression;
}
-static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/qualified.dart: Error: The type 'lib.Missing' can't be used as supertype."]/* from null */;
+static const field dynamic #errors = const <dynamic>["pkg/front_end/testcases/qualified.dart:11:7: Error: The type 'lib.Missing' can't be used as supertype.\nclass Bad extends lib.Missing {\n ^"]/* from null */;
static method main() → dynamic {
new self::C::•<core::String>();
new self::C::a<core::String>();
diff --git a/pkg/front_end/testcases/strong.status b/pkg/front_end/testcases/strong.status
index 36cc99b..b92e4f8 100644
--- a/pkg/front_end/testcases/strong.status
+++ b/pkg/front_end/testcases/strong.status
@@ -102,6 +102,7 @@
inference/infer_type_regardless_of_declaration_order_or_cycles: RuntimeError
inference/infer_types_on_generic_instantiations_4: RuntimeError
inference/infer_types_on_generic_instantiations_infer: TypeCheckError
+inference/instantiate_tearoff_of_call: TypeCheckError
inference/instantiate_to_bounds_generic_has_bound_defined_after transform: RuntimeError
inference/unresolved_super: TypeCheckError
inference/unsafe_block_closure_inference_function_call_explicit_dynamic_param_via_expr1: Fail # Issue #25824
diff --git a/pkg/front_end/tool/incremental_perf.dart b/pkg/front_end/tool/incremental_perf.dart
index b4c07ce..b9ef4a2 100644
--- a/pkg/front_end/tool/incremental_perf.dart
+++ b/pkg/front_end/tool/incremental_perf.dart
@@ -106,6 +106,9 @@
timer1.stop();
print("Libraries changed: ${delta.newProgram.libraries.length}");
print("Initial compilation took: ${timer1.elapsedMilliseconds}ms");
+ if (delta.newProgram.libraries.length < 1) {
+ throw "No libraries were changed";
+ }
for (final ChangeSet changeSet in changeSets) {
await applyEdits(changeSet.edits, overlayFs, generator, uriTranslator);
@@ -117,6 +120,9 @@
"Libraries changed: ${delta.newProgram.libraries.length}");
print("Change '${changeSet.name}' - "
"Incremental compilation took: ${iterTimer.elapsedMilliseconds}ms");
+ if (delta.newProgram.libraries.length < 1) {
+ throw "No libraries were changed";
+ }
}
dir.deleteSync(recursive: true);
@@ -239,7 +245,7 @@
final String replacement;
Edit(String uriString, this.original, this.replacement)
- : uri = Uri.base.resolve(uriString);
+ : uri = _resolveOverlayUri(uriString);
String toString() => 'Edit($uri, "$original" -> "$replacement")';
}
@@ -254,8 +260,12 @@
String toString() => 'ChangeSet($name, $edits)';
}
-_resolveOverlayUri(String uriString) =>
- Uri.base.resolve(uriString).replace(scheme: 'org-dartlang-overlay');
+_resolveOverlayUri(String uriString) {
+ Uri result = Uri.base.resolve(uriString);
+ return result.isScheme("file")
+ ? result.replace(scheme: 'org-dartlang-overlay')
+ : result;
+}
ArgParser argParser = new ArgParser()
..addOption('target',
diff --git a/pkg/js_ast/lib/src/nodes.dart b/pkg/js_ast/lib/src/nodes.dart
index c431f8f..480ab21 100644
--- a/pkg/js_ast/lib/src/nodes.dart
+++ b/pkg/js_ast/lib/src/nodes.dart
@@ -1318,7 +1318,7 @@
static RegExp _identifierRE = new RegExp(r'^[A-Za-z_$][A-Za-z_$0-9]*$');
- accept(NodeVisitor visitor);
+ T accept<T>(NodeVisitor<T> visitor);
int get precedenceLevel => PRIMARY;
diff --git a/pkg/kernel/binary.md b/pkg/kernel/binary.md
index 9556f07..5d9b1e3 100644
--- a/pkg/kernel/binary.md
+++ b/pkg/kernel/binary.md
@@ -326,6 +326,7 @@
FileOffset fileEndOffset;
Byte flags (isConst, isExternal);
Name name;
+ UriReference fileUri;
List<Expression> annotations;
FunctionNode function;
List<Initializer> initializers;
@@ -364,6 +365,7 @@
FileOffset fileEndOffset;
Byte flags;
Name name;
+ UriReference fileUri;
List<Expression> annotations;
List<DartType> typeArguments;
MemberReference targetReference;
@@ -802,6 +804,12 @@
Expression body;
}
+type Instantiation extends Expression {
+ Byte tag = 54;
+ Expression expression;
+ List<DartType> typeArguments;
+}
+
type LoadLibrary extends Expression {
Byte tag = 14;
LibraryDependencyReference deferredImport;
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index a2d8545..e443158 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -1222,11 +1222,14 @@
/// invocation should be matched with the type parameters declared in the class.
///
/// For unnamed constructors, the name is an empty string (in a [Name]).
-class Constructor extends Member {
+class Constructor extends Member implements FileUriNode {
int flags = 0;
FunctionNode function;
List<Initializer> initializers;
+ /// The uri of the source file this field was loaded from.
+ Uri fileUri;
+
Constructor(this.function,
{Name name,
bool isConst: false,
@@ -1234,6 +1237,7 @@
bool isSyntheticDefault: false,
List<Initializer> initializers,
int transformerFlags: 0,
+ this.fileUri,
Reference reference})
: this.initializers = initializers ?? <Initializer>[],
super(name, reference) {
@@ -1297,6 +1301,10 @@
DartType get getterType => const BottomType();
DartType get setterType => const BottomType();
+
+ Location _getLocationInEnclosingFile(int offset) {
+ return _getLocationInProgram(enclosingProgram, fileUri, offset);
+ }
}
/// Residue of a redirecting factory constructor for the linking phase.
@@ -1320,9 +1328,12 @@
///
/// Redirecting factory constructors can be unnamed. In this case, the name is
/// an empty string (in a [Name]).
-class RedirectingFactoryConstructor extends Member {
+class RedirectingFactoryConstructor extends Member implements FileUriNode {
int flags = 0;
+ /// The uri of the source file this field was loaded from.
+ Uri fileUri;
+
/// [RedirectingFactoryConstructor]s may redirect to constructors or factories
/// of instantiated generic types, that is, generic types with supplied type
/// arguments. The supplied type arguments are stored in this field.
@@ -1359,6 +1370,7 @@
List<VariableDeclaration> positionalParameters,
List<VariableDeclaration> namedParameters,
int requiredParameterCount,
+ this.fileUri,
Reference reference})
: this.typeArguments = typeArguments ?? <DartType>[],
this.typeParameters = typeParameters ?? <TypeParameter>[],
@@ -1424,6 +1436,10 @@
DartType get getterType => const BottomType();
DartType get setterType => const BottomType();
+
+ Location _getLocationInEnclosingFile(int offset) {
+ return _getLocationInProgram(enclosingProgram, fileUri, offset);
+ }
}
/// A method, getter, setter, index-getter, index-setter, operator overloader,
@@ -2898,6 +2914,39 @@
}
}
+/// An explicit type instantiation of a generic function.
+class Instantiation extends Expression {
+ Expression expression;
+ final List<DartType> typeArguments;
+
+ Instantiation(this.expression, this.typeArguments) {
+ expression?.parent = this;
+ }
+
+ DartType getStaticType(TypeEnvironment types) {
+ FunctionType type = expression.getStaticType(types);
+ return Substitution
+ .fromPairs(type.typeParameters, typeArguments)
+ .substituteType(type.withoutTypeParameters);
+ }
+
+ accept(ExpressionVisitor v) => v.visitInstantiation(this);
+ accept1(ExpressionVisitor1 v, arg) => v.visitInstantiation(this, arg);
+
+ visitChildren(Visitor v) {
+ expression?.accept(v);
+ visitList(typeArguments, v);
+ }
+
+ transformChildren(Transformer v) {
+ if (expression != null) {
+ expression = expression.accept(v);
+ expression?.parent = this;
+ }
+ transformTypeList(typeArguments, v);
+ }
+}
+
/// Expression of form `!x`.
///
/// The `is!` and `!=` operators are desugared into [Not] nodes with `is` and
diff --git a/pkg/kernel/lib/binary/ast_from_binary.dart b/pkg/kernel/lib/binary/ast_from_binary.dart
index edd4923..4dcd262 100644
--- a/pkg/kernel/lib/binary/ast_from_binary.dart
+++ b/pkg/kernel/lib/binary/ast_from_binary.dart
@@ -877,6 +877,7 @@
var fileEndOffset = readOffset();
var flags = readByte();
var name = readName();
+ var fileUri = readUriReference();
var annotations = readAnnotationList(node);
assert(((_) => true)(debugPath.add(node.name?.name ?? 'constructor')));
var function = readFunctionNode(false, -1);
@@ -895,6 +896,7 @@
node.fileEndOffset = fileEndOffset;
node.flags = flags;
node.name = name;
+ node.fileUri = fileUri;
node.annotations = annotations;
node.function = function..parent = node;
node.transformerFlags = transformerFlags;
@@ -959,6 +961,7 @@
var fileEndOffset = readOffset();
var flags = readByte();
var name = readName();
+ var fileUri = readUriReference();
var annotations = readAnnotationList(node);
debugPath.add(node.name?.name ?? 'redirecting-factory-constructor');
var targetReference = readMemberReference();
@@ -978,6 +981,7 @@
node.fileEndOffset = fileEndOffset;
node.flags = flags;
node.name = name;
+ node.fileUri = fileUri;
node.annotations = annotations;
node.targetReference = targetReference;
node.typeArguments.addAll(typeArguments);
@@ -1358,6 +1362,10 @@
var body = readExpression();
variableStack.length = stackHeight;
return new Let(variable, body);
+ case Tag.Instantiation:
+ var expression = readExpression();
+ var typeArguments = readDartTypeList();
+ return new Instantiation(expression, typeArguments);
case Tag.VectorCreation:
var length = readUInt();
return new VectorCreation(length);
diff --git a/pkg/kernel/lib/binary/ast_to_binary.dart b/pkg/kernel/lib/binary/ast_to_binary.dart
index 5098aad..b9b8c99 100644
--- a/pkg/kernel/lib/binary/ast_to_binary.dart
+++ b/pkg/kernel/lib/binary/ast_to_binary.dart
@@ -726,6 +726,7 @@
writeOffset(node.fileEndOffset);
writeByte(node.flags);
writeName(node.name ?? _emptyName);
+ writeUriReference(node.fileUri);
writeAnnotationList(node.annotations);
assert(node.function.typeParameters.isEmpty);
writeNode(node.function);
@@ -788,6 +789,7 @@
writeOffset(node.fileEndOffset);
writeByte(node.flags);
writeName(node.name);
+ writeUriReference(node.fileUri);
writeAnnotationList(node.annotations);
writeReference(node.targetReference);
writeNodeList(node.typeArguments);
@@ -1186,6 +1188,12 @@
--_variableIndexer.stackHeight;
}
+ visitInstantiation(Instantiation node) {
+ writeByte(Tag.Instantiation);
+ writeNode(node.expression);
+ writeNodeList(node.typeArguments);
+ }
+
visitLoadLibrary(LoadLibrary node) {
writeByte(Tag.LoadLibrary);
writeLibraryDependencyReference(node.import);
diff --git a/pkg/kernel/lib/binary/tag.dart b/pkg/kernel/lib/binary/tag.dart
index 4fad0cd..3910e5f 100644
--- a/pkg/kernel/lib/binary/tag.dart
+++ b/pkg/kernel/lib/binary/tag.dart
@@ -64,6 +64,7 @@
static const int AwaitExpression = 51;
static const int FunctionExpression = 52;
static const int Let = 53;
+ static const int Instantiation = 54;
static const int PositiveIntLiteral = 55;
static const int NegativeIntLiteral = 56;
static const int BigIntLiteral = 57;
@@ -134,7 +135,7 @@
/// Internal version of kernel binary format.
/// Bump it when making incompatible changes in kernel binaries.
/// Keep in sync with runtime/vm/kernel_binary.h.
- static const int BinaryFormatVersion = 2;
+ static const int BinaryFormatVersion = 3;
}
abstract class ConstantTag {
diff --git a/pkg/kernel/lib/target/targets.dart b/pkg/kernel/lib/target/targets.dart
index 7dd610a..d22a14e 100644
--- a/pkg/kernel/lib/target/targets.dart
+++ b/pkg/kernel/lib/target/targets.dart
@@ -129,7 +129,9 @@
bool allowPlatformPrivateLibraryAccess(Uri importer, Uri imported) =>
imported.scheme != "dart" ||
!imported.path.startsWith("_") ||
- importer.scheme == "dart";
+ importer.scheme == "dart" ||
+ (importer.scheme == "package" &&
+ importer.path.startsWith("dart_internal/"));
/// Whether the `native` language extension is supported within [library].
///
diff --git a/pkg/kernel/lib/text/ast_to_text.dart b/pkg/kernel/lib/text/ast_to_text.dart
index 96c9bc6..24e7ea2 100644
--- a/pkg/kernel/lib/text/ast_to_text.dart
+++ b/pkg/kernel/lib/text/ast_to_text.dart
@@ -1222,6 +1222,13 @@
writeExpression(node.body);
}
+ visitInstantiation(Instantiation node) {
+ writeExpression(node.expression);
+ writeSymbol('<');
+ writeList(node.typeArguments, writeType);
+ writeSymbol('>');
+ }
+
visitLoadLibrary(LoadLibrary node) {
writeWord('LoadLibrary');
writeSymbol('(');
diff --git a/pkg/kernel/lib/type_checker.dart b/pkg/kernel/lib/type_checker.dart
index 6c8ccb0..f0d1247 100644
--- a/pkg/kernel/lib/type_checker.dart
+++ b/pkg/kernel/lib/type_checker.dart
@@ -281,18 +281,14 @@
fail(arguments, 'Too many positional arguments');
return const BottomType();
}
- if (arguments.types.length != typeParameters.length) {
+ var typeArguments = arguments.types;
+ if (typeArguments.length != typeParameters.length) {
fail(arguments, 'Wrong number of type arguments');
return const BottomType();
}
- var instantiation =
- Substitution.fromPairs(typeParameters, arguments.types);
- var substitution = Substitution.combine(receiver, instantiation);
- for (int i = 0; i < typeParameters.length; ++i) {
- var argument = arguments.types[i];
- var bound = substitution.substituteType(typeParameters[i].bound);
- checkAssignable(arguments, argument, bound);
- }
+ Substitution substitution = _instantiateFunction(
+ typeParameters, typeArguments, arguments,
+ receiverSubstitution: receiver);
for (int i = 0; i < arguments.positional.length; ++i) {
var expectedType = substitution.substituteType(
functionType.positionalParameters[i],
@@ -385,6 +381,21 @@
}
}
+ Substitution _instantiateFunction(List<TypeParameter> typeParameters,
+ List<DartType> typeArguments, TreeNode where,
+ {Substitution receiverSubstitution}) {
+ var instantiation = Substitution.fromPairs(typeParameters, typeArguments);
+ var substitution = receiverSubstitution == null
+ ? instantiation
+ : Substitution.combine(receiverSubstitution, instantiation);
+ for (int i = 0; i < typeParameters.length; ++i) {
+ var argument = typeArguments[i];
+ var bound = substitution.substituteType(typeParameters[i].bound);
+ checkAssignable(where, argument, bound);
+ }
+ return substitution;
+ }
+
@override
DartType visitAsExpression(AsExpression node) {
visitExpression(node.operand);
@@ -479,6 +490,23 @@
}
@override
+ DartType visitInstantiation(Instantiation node) {
+ DartType type = visitExpression(node.expression);
+ if (type is! FunctionType) {
+ fail(node, 'Not a function type: $type');
+ return const BottomType();
+ }
+ FunctionType functionType = type;
+ if (functionType.typeParameters.length != node.typeArguments.length) {
+ fail(node, 'Wrong number of type arguments');
+ return const BottomType();
+ }
+ return _instantiateFunction(
+ functionType.typeParameters, node.typeArguments, node)
+ .substituteType(functionType.withoutTypeParameters);
+ }
+
+ @override
DartType visitListLiteral(ListLiteral node) {
for (int i = 0; i < node.expressions.length; ++i) {
node.expressions[i] =
diff --git a/pkg/kernel/lib/visitor.dart b/pkg/kernel/lib/visitor.dart
index 6db182d..01d56b8 100644
--- a/pkg/kernel/lib/visitor.dart
+++ b/pkg/kernel/lib/visitor.dart
@@ -54,6 +54,7 @@
R visitBoolLiteral(BoolLiteral node) => defaultBasicLiteral(node);
R visitNullLiteral(NullLiteral node) => defaultBasicLiteral(node);
R visitLet(Let node) => defaultExpression(node);
+ R visitInstantiation(Instantiation node) => defaultExpression(node);
R visitLoadLibrary(LoadLibrary node) => defaultExpression(node);
R visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node) =>
defaultExpression(node);
@@ -179,6 +180,7 @@
R visitBoolLiteral(BoolLiteral node) => defaultBasicLiteral(node);
R visitNullLiteral(NullLiteral node) => defaultBasicLiteral(node);
R visitLet(Let node) => defaultExpression(node);
+ R visitInstantiation(Instantiation node) => defaultExpression(node);
R visitLoadLibrary(LoadLibrary node) => defaultExpression(node);
R visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node) =>
defaultExpression(node);
@@ -490,6 +492,8 @@
R visitBoolLiteral(BoolLiteral node, T arg) => defaultBasicLiteral(node, arg);
R visitNullLiteral(NullLiteral node, T arg) => defaultBasicLiteral(node, arg);
R visitLet(Let node, T arg) => defaultExpression(node, arg);
+ R visitInstantiation(Instantiation node, T arg) =>
+ defaultExpression(node, arg);
R visitLoadLibrary(LoadLibrary node, T arg) => defaultExpression(node, arg);
R visitCheckLibraryIsLoaded(CheckLibraryIsLoaded node, T arg) =>
defaultExpression(node, arg);
diff --git a/pkg/status_file/test/data/co19-dart2js.status b/pkg/status_file/test/data/co19-dart2js.status
index 41fe84c..b7155e0 100644
--- a/pkg/status_file/test/data/co19-dart2js.status
+++ b/pkg/status_file/test/data/co19-dart2js.status
@@ -1189,8 +1189,6 @@
LayoutTests/fast/events/scroll-event-does-not-bubble_t01: RuntimeError # Please triage this failure
LayoutTests/fast/events/scroll-event-phase_t01: Skip # Times out. Please triage this failure
LayoutTests/fast/events/tabindex-removal-from-focused-element_t01: Pass, RuntimeError # Please triage this failure
-LayoutTests/fast/eventsource/eventsource-attribute-listeners_t01: RuntimeError # Please triage this failure
-LayoutTests/fast/eventsource/eventsource-constructor_t01: RuntimeError # https://github.com/dart-lang/sdk/issues/29814
LayoutTests/fast/exclusions/parsing/parsing-wrap-flow_t01: RuntimeError # Please triage this failure
LayoutTests/fast/exclusions/parsing/parsing-wrap-through_t01: RuntimeError # Please triage this failure
LayoutTests/fast/files/blob-close-read_t01: RuntimeError # Please triage this failure
@@ -3344,7 +3342,6 @@
LayoutTests/fast/events/selectstart-on-selectall_t01: RuntimeError # Please triage this failure
LayoutTests/fast/events/selectstart-prevent-selectall_t01: RuntimeError # Please triage this failure
LayoutTests/fast/events/tabindex-removal-from-focused-element_t01: Pass, RuntimeError # Please triage this failure
-LayoutTests/fast/eventsource/eventsource-attribute-listeners_t01: RuntimeError # Issue 28983
LayoutTests/fast/eventsource/eventsource-constructor_t01: RuntimeError # Please triage this failure
LayoutTests/fast/exclusions/parsing/parsing-wrap-flow_t01: RuntimeError # Please triage this failure
LayoutTests/fast/exclusions/parsing/parsing-wrap-through_t01: RuntimeError # Please triage this failure
diff --git a/pkg/vm/bin/gen_kernel.dart b/pkg/vm/bin/gen_kernel.dart
index c39bb2b..93d1114 100644
--- a/pkg/vm/bin/gen_kernel.dart
+++ b/pkg/vm/bin/gen_kernel.dart
@@ -35,7 +35,7 @@
''';
const int _badUsageExitCode = 1;
-const int _compileTimeErrorExitCode = 250;
+const int _compileTimeErrorExitCode = 254;
const _severityCaptions = const <Severity, String>{
Severity.error: 'Error: ',
diff --git a/pkg/vm/tool/dart2 b/pkg/vm/tool/dart2
index d849f5b..364820c 100755
--- a/pkg/vm/tool/dart2
+++ b/pkg/vm/tool/dart2
@@ -21,20 +21,29 @@
# Handle the case where dart-sdk/bin has been symlinked to.
CUR_DIR="$(cd "${PROG_NAME%/*}" ; pwd -P)"
-if [[ `uname` == 'Darwin' ]];
-then
+if [[ `uname` == 'Darwin' ]]; then
OUT_DIR="$CUR_DIR"/../../../xcodebuild/
else
OUT_DIR="$CUR_DIR"/../../../out/
fi
export DART_CONFIGURATION=${DART_CONFIGURATION:-ReleaseX64}
-BIN_DIR="$OUT_DIR$DART_CONFIGURATION"
+export DART_USE_SDK=${DART_USE_SDK:0}
+BUILD_DIR="$OUT_DIR$DART_CONFIGURATION"
-exec "$BIN_DIR"/dart \
+if [[ $DART_USE_SDK -eq 1 ]]; then
+ DART_BINARY="$BUILD_DIR"/dart-sdk/bin/dart
+ KERNEL_BINARIES_DIR="$BUILD_DIR"/dart-sdk/lib/_internal
+else
+ DART_BINARY="$BUILD_DIR"/dart
+ KERNEL_BINARIES_DIR="$BUILD_DIR"
+fi
+KERNEL_SERVICE_SNAPSHOT="$BUILD_DIR"/gen/kernel-service.dart.snapshot
+
+exec "$DART_BINARY" \
--strong \
--reify-generic-functions \
--limit-ints-to-64-bits \
- --dfe="${BIN_DIR}/gen/kernel-service.dart.snapshot" \
- --kernel-binaries="${BIN_DIR}" \
+ --dfe="$KERNEL_SERVICE_SNAPSHOT" \
+ --kernel-binaries="$KERNEL_BINARIES_DIR" \
"$@"
diff --git a/pkg/vm/tool/gen_kernel b/pkg/vm/tool/gen_kernel
index ec122ec..5b96047 100755
--- a/pkg/vm/tool/gen_kernel
+++ b/pkg/vm/tool/gen_kernel
@@ -25,6 +25,8 @@
SDK_DIR="$CUR_DIR/../../.."
+# TODO(kustermann): For windows as well as for hosts running on arm, our
+# checked-in dart binaries must be adjusted.
if [[ `uname` == 'Darwin' ]]; then
DART="$SDK_DIR/tools/sdks/mac/dart-sdk/bin/dart"
OUT_DIR="$SDK_DIR/xcodebuild"
diff --git a/pkg/vm/tool/precompiler2 b/pkg/vm/tool/precompiler2
index 6c4190d..a3aee3a 100755
--- a/pkg/vm/tool/precompiler2
+++ b/pkg/vm/tool/precompiler2
@@ -78,7 +78,6 @@
exec "$BIN_DIR"/dart_bootstrap \
--strong \
--reify-generic-functions \
- --kernel-binaries="${BIN_DIR}" \
--snapshot-kind=app-aot \
--use-blobs \
--snapshot="$SNAPSHOT_FILE" \
diff --git a/runtime/bin/BUILD.gn b/runtime/bin/BUILD.gn
index 4c9a73c..33b06b9 100644
--- a/runtime/bin/BUILD.gn
+++ b/runtime/bin/BUILD.gn
@@ -14,13 +14,6 @@
import("io_sources.gni")
import("vmservice/vmservice_sources.gni")
-declare_args() {
- # Controls the kind of core snapshot linked into the standalone VM. Using a
- # core-jit snapshot breaks the ability to change various flags that affect
- # code generation.
- dart_core_snapshot_kind = "core"
-}
-
# Generate a resources.cc file for the service isolate without Observatory.
action("gen_resources_cc") {
visibility = [ ":*" ] # Only targets in this file can see this.
diff --git a/runtime/bin/dartutils.cc b/runtime/bin/dartutils.cc
index 3b7c5a1..e53d6db 100644
--- a/runtime/bin/dartutils.cc
+++ b/runtime/bin/dartutils.cc
@@ -20,6 +20,7 @@
#include "platform/assert.h"
#include "platform/globals.h"
#include "platform/memory_sanitizer.h"
+#include "platform/utils.h"
// Return the error from the containing function if handle is in error handle.
#define RETURN_IF_ERROR(handle) \
@@ -49,13 +50,7 @@
const char* const DartUtils::kHttpScheme = "http:";
const char* const DartUtils::kVMServiceLibURL = "dart:vmservice";
-struct MagicNumberData {
- static const intptr_t kMaxLength = 4;
-
- intptr_t length;
- const uint8_t bytes[kMaxLength];
-};
-
+MagicNumberData appjit_magic_number = {8, {0xdc, 0xdc, 0xf6, 0xf6, 0, 0, 0, 0}};
MagicNumberData snapshot_magic_number = {4, {0xf5, 0xf5, 0xdc, 0xdc}};
MagicNumberData kernel_magic_number = {4, {0x90, 0xab, 0xcd, 0xef}};
MagicNumberData gzip_magic_number = {2, {0x1f, 0x8b, 0, 0}};
@@ -356,12 +351,41 @@
return false;
}
+DartUtils::MagicNumber DartUtils::SniffForMagicNumber(const char* filename) {
+ MagicNumber magic_number = DartUtils::kUnknownMagicNumber;
+ if (File::GetType(NULL, filename, true) == File::kIsFile) {
+ File* file = File::Open(NULL, filename, File::kRead);
+ if (file != NULL) {
+ intptr_t max_magic_length = 0;
+ max_magic_length =
+ Utils::Maximum(max_magic_length, snapshot_magic_number.length);
+ max_magic_length =
+ Utils::Maximum(max_magic_length, appjit_magic_number.length);
+ max_magic_length =
+ Utils::Maximum(max_magic_length, kernel_magic_number.length);
+ max_magic_length =
+ Utils::Maximum(max_magic_length, gzip_magic_number.length);
+ ASSERT(max_magic_length <= 8);
+ uint8_t header[8];
+ if (file->ReadFully(&header, max_magic_length)) {
+ magic_number = DartUtils::SniffForMagicNumber(header, sizeof(header));
+ }
+ file->Close();
+ }
+ }
+ return magic_number;
+}
+
DartUtils::MagicNumber DartUtils::SniffForMagicNumber(const uint8_t* buffer,
intptr_t buffer_length) {
if (CheckMagicNumber(buffer, buffer_length, snapshot_magic_number)) {
return kSnapshotMagicNumber;
}
+ if (CheckMagicNumber(buffer, buffer_length, appjit_magic_number)) {
+ return kAppJITMagicNumber;
+ }
+
if (CheckMagicNumber(buffer, buffer_length, kernel_magic_number)) {
return kKernelMagicNumber;
}
@@ -370,6 +394,10 @@
return kGzipMagicNumber;
}
+ if (CheckMagicNumber(buffer, buffer_length, gzip_magic_number)) {
+ return kGzipMagicNumber;
+ }
+
return kUnknownMagicNumber;
}
diff --git a/runtime/bin/dartutils.h b/runtime/bin/dartutils.h
index e1119fc..8c619c4 100644
--- a/runtime/bin/dartutils.h
+++ b/runtime/bin/dartutils.h
@@ -202,12 +202,16 @@
enum MagicNumber {
kSnapshotMagicNumber,
+ kAppJITMagicNumber,
kKernelMagicNumber,
kGzipMagicNumber,
kUnknownMagicNumber
};
// Checks if the buffer is a script snapshot, kernel file, or gzip file.
+ static MagicNumber SniffForMagicNumber(const char* filename);
+
+ // Checks if the buffer is a script snapshot, kernel file, or gzip file.
static MagicNumber SniffForMagicNumber(const uint8_t* text_buffer,
intptr_t buffer_len);
@@ -644,6 +648,18 @@
DISALLOW_COPY_AND_ASSIGN(ScopedMemBuffer);
};
+struct MagicNumberData {
+ static const intptr_t kMaxLength = 8;
+
+ intptr_t length;
+ const uint8_t bytes[kMaxLength];
+};
+
+extern MagicNumberData appjit_magic_number;
+extern MagicNumberData snapshot_magic_number;
+extern MagicNumberData kernel_magic_number;
+extern MagicNumberData gzip_magic_number;
+
} // namespace bin
} // namespace dart
diff --git a/runtime/bin/dfe.cc b/runtime/bin/dfe.cc
index 2e244ff..192a332 100644
--- a/runtime/bin/dfe.cc
+++ b/runtime/bin/dfe.cc
@@ -20,6 +20,7 @@
kernel_binaries_path_(NULL),
platform_binary_filename_(NULL),
kernel_platform_(NULL),
+ application_kernel_binary_(NULL),
kernel_file_specified_(false) {}
DFE::~DFE() {
@@ -31,10 +32,11 @@
free(platform_binary_filename_);
platform_binary_filename_ = NULL;
- if (kernel_platform_ != NULL) {
- delete reinterpret_cast<kernel::Program*>(kernel_platform_);
- kernel_platform_ = NULL;
- }
+ delete reinterpret_cast<kernel::Program*>(kernel_platform_);
+ kernel_platform_ = NULL;
+
+ delete reinterpret_cast<kernel::Program*>(application_kernel_binary_);
+ application_kernel_binary_ = NULL;
}
void DFE::SetKernelBinaries(const char* name) {
diff --git a/runtime/bin/dfe.h b/runtime/bin/dfe.h
index 262b46e..d644b19 100644
--- a/runtime/bin/dfe.h
+++ b/runtime/bin/dfe.h
@@ -33,6 +33,11 @@
kernel_platform_ = kernel_platform;
}
+ void* application_kernel_binary() const { return application_kernel_binary_; }
+ void set_application_kernel_binary(void* application_kernel_binary) {
+ application_kernel_binary_ = application_kernel_binary;
+ }
+
bool kernel_file_specified() const { return kernel_file_specified_; }
void set_kernel_file_specified(bool value) { kernel_file_specified_ = value; }
@@ -73,6 +78,11 @@
char* kernel_binaries_path_;
char* platform_binary_filename_;
void* kernel_platform_;
+
+ // Kernel binary specified on the cmd line.
+ // Loaded instead of platform if --kernel-binaries is not specified.
+ void* application_kernel_binary_;
+
bool kernel_file_specified_; // Kernel file was specified on the cmd line.
DISALLOW_COPY_AND_ASSIGN(DFE);
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index 2f4be2d..c030a71 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -385,6 +385,11 @@
isolate = Dart_CreateIsolateFromKernel(
script_uri, NULL, dfe.kernel_platform(), flags, isolate_data, error);
skip_library_load = true;
+ } else if (dfe.application_kernel_binary() != NULL) {
+ isolate = Dart_CreateIsolateFromKernel(script_uri, NULL,
+ dfe.application_kernel_binary(),
+ flags, isolate_data, error);
+ skip_library_load = true;
} else {
isolate = Dart_CreateIsolate(script_uri, main, isolate_snapshot_data,
isolate_snapshot_instructions, flags,
@@ -1070,6 +1075,12 @@
Platform::Exit(kErrorExitCode);
}
dfe.set_kernel_platform(kernel_platform);
+ } else {
+ void* application_kernel_binary = dfe.ReadScript(script_name);
+ if (application_kernel_binary != NULL) {
+ dfe.set_application_kernel_binary(application_kernel_binary);
+ dfe.set_kernel_file_specified(true);
+ }
}
#endif
diff --git a/runtime/bin/run_vm_tests.cc b/runtime/bin/run_vm_tests.cc
index d69253ad..9cc4ada 100644
--- a/runtime/bin/run_vm_tests.cc
+++ b/runtime/bin/run_vm_tests.cc
@@ -137,25 +137,33 @@
}
script_uri = kernel_snapshot;
- bin::AppSnapshot* app_snapshot =
- bin::Snapshot::TryReadAppSnapshot(script_uri);
- if (app_snapshot == NULL) {
- *error = strdup("Failed to read kernel service app snapshot");
- return NULL;
- }
-
+ // Kernel isolate uses an app snapshot or the core libraries snapshot.
+ bool isolate_run_script_snapshot = false;
const uint8_t* isolate_snapshot_data = bin::core_isolate_snapshot_data;
const uint8_t* isolate_snapshot_instructions =
bin::core_isolate_snapshot_instructions;
+ bin::AppSnapshot* app_snapshot = NULL;
+ switch (bin::DartUtils::SniffForMagicNumber(script_uri)) {
+ case bin::DartUtils::kAppJITMagicNumber: {
+ app_snapshot = bin::Snapshot::TryReadAppSnapshot(script_uri);
+ ASSERT(app_snapshot != NULL);
- const uint8_t* ignore_vm_snapshot_data;
- const uint8_t* ignore_vm_snapshot_instructions;
- app_snapshot->SetBuffers(
- &ignore_vm_snapshot_data, &ignore_vm_snapshot_instructions,
- &isolate_snapshot_data, &isolate_snapshot_instructions);
-
+ const uint8_t* ignore_vm_snapshot_data;
+ const uint8_t* ignore_vm_snapshot_instructions;
+ app_snapshot->SetBuffers(
+ &ignore_vm_snapshot_data, &ignore_vm_snapshot_instructions,
+ &isolate_snapshot_data, &isolate_snapshot_instructions);
+ break;
+ }
+ case bin::DartUtils::kSnapshotMagicNumber: {
+ isolate_run_script_snapshot = true;
+ break;
+ }
+ default:
+ return NULL;
+ }
bin::IsolateData* isolate_data = new bin::IsolateData(
- script_uri, package_root, packages_config, NULL /* app_snapshot */);
+ script_uri, package_root, packages_config, app_snapshot);
Dart_Isolate isolate = Dart_CreateIsolate(
DART_KERNEL_ISOLATE_NAME, main, isolate_snapshot_data,
isolate_snapshot_instructions, flags, isolate_data, error);
@@ -167,6 +175,18 @@
Dart_EnterScope();
+ if (isolate_run_script_snapshot) {
+ const uint8_t* payload;
+ intptr_t payload_length;
+ void* file = bin::DartUtils::OpenFile(script_uri, false);
+ bin::DartUtils::ReadFile(&payload, &payload_length, file);
+ bin::DartUtils::CloseFile(file);
+
+ bin::DartUtils::SkipSnapshotMagicNumber(&payload, &payload_length);
+ Dart_Handle result = Dart_LoadScriptFromSnapshot(payload, payload_length);
+ CHECK_RESULT(result);
+ }
+
bin::DartUtils::SetOriginalWorkingDirectory();
Dart_Handle result = bin::DartUtils::PrepareForScriptLoading(
false /* is_service_isolate */, false /* trace_loading */);
diff --git a/runtime/bin/snapshot_utils.cc b/runtime/bin/snapshot_utils.cc
index 81b8490..73ca52e 100644
--- a/runtime/bin/snapshot_utils.cc
+++ b/runtime/bin/snapshot_utils.cc
@@ -21,7 +21,6 @@
extern const char* kIsolateSnapshotInstructionsSymbolName;
static const int64_t kAppSnapshotHeaderSize = 5 * kInt64Size;
-static const int64_t kAppSnapshotMagicNumber = 0xf6f6dcdc;
static const int64_t kAppSnapshotPageSize = 4 * KB;
class MappedAppSnapshot : public AppSnapshot {
@@ -86,7 +85,9 @@
file->Release();
return NULL;
}
- if (header[0] != kAppSnapshotMagicNumber) {
+ ASSERT(sizeof(header[0]) == appjit_magic_number.length);
+ if (memcmp(&header[0], appjit_magic_number.bytes,
+ appjit_magic_number.length) != 0) {
file->Release();
return NULL;
}
@@ -287,7 +288,7 @@
ErrorExit(kErrorExitCode, "Unable to write snapshot file '%s'\n", filename);
}
- file->WriteFully(&kAppSnapshotMagicNumber, sizeof(kAppSnapshotMagicNumber));
+ file->WriteFully(appjit_magic_number.bytes, appjit_magic_number.length);
WriteInt64(file, vm_data_size);
WriteInt64(file, vm_instructions_size);
WriteInt64(file, isolate_data_size);
diff --git a/runtime/bin/socket_patch.dart b/runtime/bin/socket_patch.dart
index 2177843..2dfdefa 100644
--- a/runtime/bin/socket_patch.dart
+++ b/runtime/bin/socket_patch.dart
@@ -1549,15 +1549,15 @@
void add(List<int> bytes) => _sink.add(bytes);
- Future<Socket> addStream(Stream<List<int>> stream) {
+ Future addStream(Stream<List<int>> stream) {
return _sink.addStream(stream);
}
- Future<Socket> flush() => _sink.flush();
+ Future flush() => _sink.flush();
- Future<Socket> close() => _sink.close();
+ Future close() => _sink.close();
- Future<Socket> get done => _sink.done;
+ Future get done => _sink.done;
void destroy() {
// Destroy can always be called to get rid of a socket.
diff --git a/runtime/lib/function.cc b/runtime/lib/function.cc
index 89bca1d..0a50260 100644
--- a/runtime/lib/function.cc
+++ b/runtime/lib/function.cc
@@ -80,13 +80,15 @@
TypeArguments::Handle(zone, receiver.function_type_arguments());
const Function& function = Function::Handle(zone, receiver.function());
const Context& context = Context::Handle(zone, receiver.context());
- Context& cloned_context =
- Context::Handle(zone, Context::New(context.num_variables()));
- cloned_context.set_parent(Context::Handle(zone, context.parent()));
- Object& instance = Object::Handle(zone);
- for (int i = 0; i < context.num_variables(); i++) {
- instance = context.At(i);
- cloned_context.SetAt(i, instance);
+ Context& cloned_context = Context::Handle(zone);
+ if (!context.IsNull()) {
+ cloned_context = Context::New(context.num_variables());
+ cloned_context.set_parent(Context::Handle(zone, context.parent()));
+ Object& instance = Object::Handle(zone);
+ for (int i = 0; i < context.num_variables(); i++) {
+ instance = context.At(i);
+ cloned_context.SetAt(i, instance);
+ }
}
return Closure::New(instantiator_type_arguments, function_type_arguments,
function, cloned_context);
diff --git a/runtime/lib/integers_patch.dart b/runtime/lib/integers_patch.dart
index e2610e9..c7116c7 100644
--- a/runtime/lib/integers_patch.dart
+++ b/runtime/lib/integers_patch.dart
@@ -159,6 +159,17 @@
if (result >= positiveOverflowLimit) {
if ((result > positiveOverflowLimit) ||
(smi > _int64OverflowLimits[tableIndex + 2])) {
+ // Although the unsigned overflow limits do not depend on the
+ // platform, the multiplier and block size, which are used to
+ // compute it, do.
+ int X = is64Bit ? 1 : 0;
+ if (radix == 16 &&
+ !(result >= _int64UnsignedOverflowLimits[X] &&
+ (result > _int64UnsignedOverflowLimits[X] ||
+ smi > _int64UnsignedSmiOverflowLimits[X])) &&
+ blockEnd + blockSize > end) {
+ return (result * multiplier) + smi;
+ }
return null;
}
} else if (result <= negativeOverflowLimit) {
@@ -246,6 +257,12 @@
static const _maxInt64 = 0x7fffffffffffffff;
static const _minInt64 = -_maxInt64 - 1;
+ static const _int64UnsignedOverflowLimits = const [0xfffffffff, 0xf];
+ static const _int64UnsignedSmiOverflowLimits = const [
+ 0xfffffff,
+ 0xfffffffffffffff
+ ];
+
/// In the `--limit-ints-to-64-bits` mode calculation of the expression
///
/// result = (result * multiplier) + (sign * smi)
diff --git a/runtime/lib/internal_patch.dart b/runtime/lib/internal_patch.dart
index f6bc981..b9fb751 100644
--- a/runtime/lib/internal_patch.dart
+++ b/runtime/lib/internal_patch.dart
@@ -26,8 +26,11 @@
@patch
Object extractTypeArguments<T>(T instance, Function extract) {
- // TODO(31371): Implement this.
- throw new UnimplementedError();
+ // TODO(31371): Implement this correctly for Dart 2.0.
+ // 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.
+ return extract();
}
class VMLibraryHooks {
diff --git a/runtime/observatory/lib/src/service/object.dart b/runtime/observatory/lib/src/service/object.dart
index f98b1f8..539ac4b 100644
--- a/runtime/observatory/lib/src/service/object.dart
+++ b/runtime/observatory/lib/src/service/object.dart
@@ -2843,12 +2843,18 @@
// Coerce absence to false.
valueAsStringIsTruncated = map['valueAsStringIsTruncated'] == true;
closureFunction = map['closureFunction'];
- closureContext = map['closureContext'];
name = map['name'];
length = map['length'];
pattern = map['pattern'];
typeClass = map['typeClass'];
+ final context = map['closureContext'];
+ if (context is Context) {
+ closureContext = context;
+ } else if (context != null) {
+ assert(context is Instance && context.isNull);
+ }
+
if (mapIsRef) {
return;
}
diff --git a/runtime/observatory/tests/service/contexts_test.dart b/runtime/observatory/tests/service/contexts_test.dart
index d6c7f89..a5fc6eb 100644
--- a/runtime/observatory/tests/service/contexts_test.dart
+++ b/runtime/observatory/tests/service/contexts_test.dart
@@ -55,11 +55,7 @@
return field.load().then((_) {
return field.staticValue.load().then((Instance block) {
expect(block.isClosure, isTrue);
- expect(block.closureContext.isContext, isTrue);
- expect(block.closureContext.length, equals(0));
- return block.closureContext.load().then((Context ctxt) {
- expect(ctxt.parentContext, isNull);
- });
+ expect(block.closureContext, isNull);
});
});
}),
@@ -75,11 +71,7 @@
expect(ctxt.variables.single.value.asValue.isString, isTrue);
expect(ctxt.variables.single.value.asValue.valueAsString,
equals('I could be copied into the block'));
- expect(ctxt.parentContext.isContext, isTrue);
- expect(ctxt.parentContext.length, equals(0));
- return ctxt.parentContext.load().then((Context outerCtxt) {
- expect(outerCtxt.parentContext, isNull);
- });
+ expect(ctxt.parentContext, isNull);
});
});
});
@@ -95,11 +87,7 @@
expect(ctxt.variables.single.value.asValue.isInt, isTrue);
expect(ctxt.variables.single.value.asValue.valueAsString,
equals('43'));
- expect(ctxt.parentContext.isContext, isTrue);
- expect(ctxt.parentContext.length, equals(0));
- return ctxt.parentContext.load().then((Context outerCtxt) {
- expect(outerCtxt.parentContext, isNull);
- });
+ expect(ctxt.parentContext, isNull);
});
});
});
@@ -122,13 +110,7 @@
expect(outerCtxt.variables.single.value.asValue.isInt, isTrue);
expect(outerCtxt.variables.single.value.asValue.valueAsString,
equals('421'));
- expect(outerCtxt.parentContext.isContext, isTrue);
- expect(outerCtxt.parentContext.length, equals(0));
- return outerCtxt.parentContext
- .load()
- .then((Context outerCtxt2) {
- expect(outerCtxt2.parentContext, isNull);
- });
+ expect(outerCtxt.parentContext, isNull);
});
});
});
diff --git a/runtime/observatory/tests/service/service.status b/runtime/observatory/tests/service/service.status
index e8d35c6..15f20e2 100644
--- a/runtime/observatory/tests/service/service.status
+++ b/runtime/observatory/tests/service/service.status
@@ -61,9 +61,32 @@
dev_fs_http_put_weird_char_test: Skip # Windows disallows carriage returns in paths
dev_fs_weird_char_test: Skip # Windows disallows question mark in paths
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $arch == simdbc64 && $compiler == dartk ]
+coverage_optimized_function_test: Crash # Please triage
+rewind_optimized_out_test: RuntimeError # Please triage
+rewind_test: RuntimeError # Please triage
+
[ $builder_tag == strong && $compiler == dart2analyzer ]
*: Skip # Issue 28649
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $compiler == dartk && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
+coverage_leaf_function_test: RuntimeError # Please triage.
+coverage_optimized_function_test: RuntimeError # Please triage.
+dev_fs_spawn_test: RuntimeError # Please triage.
+developer_service_get_isolate_id_test: RuntimeError # Please triage.
+get_object_rpc_test: RuntimeError # Please triage.
+get_source_report_test: RuntimeError # Please triage.
+issue_30555_test: RuntimeError # Please triage.
+library_dependency_test: RuntimeError # Please triage.
+reload_sources_test: Timeout, Skip # Please triage.
+set_name_rpc_test: RuntimeError # Please triage.
+
[ $compiler == none && $runtime == vm && $system == fuchsia ]
*: Skip # Not yet triaged.
diff --git a/runtime/platform/growable_array.h b/runtime/platform/growable_array.h
index b399cd9..28e04f6 100644
--- a/runtime/platform/growable_array.h
+++ b/runtime/platform/growable_array.h
@@ -59,6 +59,17 @@
return data_[index];
}
+ void FillWith(const T& value, intptr_t start, intptr_t length) {
+ ASSERT(start >= 0);
+ ASSERT(length >= 0);
+ ASSERT(start <= length_);
+
+ Resize(start + length);
+ for (intptr_t i = 0; i < length; ++i) {
+ data_[start + i] = value;
+ }
+ }
+
const T& At(intptr_t index) const { return operator[](index); }
T& Last() const {
diff --git a/runtime/runtime_args.gni b/runtime/runtime_args.gni
index 26213ca..44c705f 100644
--- a/runtime/runtime_args.gni
+++ b/runtime/runtime_args.gni
@@ -47,4 +47,9 @@
# Whether to link the standalone VM against tcmalloc. The standalone build of
# the VM enables this only for Linux builds.
dart_use_tcmalloc = false
+
+ # Controls the kind of core snapshot linked into the standalone VM. Using a
+ # core-jit snapshot breaks the ability to change various flags that affect
+ # code generation.
+ dart_core_snapshot_kind = "core"
}
diff --git a/runtime/tests/vm/vm.status b/runtime/tests/vm/vm.status
index aca128cd..9a6a62e 100644
--- a/runtime/tests/vm/vm.status
+++ b/runtime/tests/vm/vm.status
@@ -122,6 +122,28 @@
cc/Profiler_TrivialRecordAllocation: Skip
cc/Profiler_TypedArrayAllocation: Skip
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $arch == simarm && $compiler == dartk ]
+cc/IsolateReload_ExportedLibModified: Fail # Please triage.
+cc/IsolateReload_ImportedLibModified: Fail # Please triage.
+cc/IsolateReload_ImportedMixinFunction: Fail # Please triage.
+cc/IsolateReload_LibraryHide: Fail # Please triage.
+cc/IsolateReload_LibraryShow: Fail # Please triage.
+cc/IsolateReload_MainLibModified: Fail # Please triage.
+cc/IsolateReload_NoLibsModified: Fail # Please triage.
+cc/IsolateReload_PrefixImportedLibModified: Fail # Please triage.
+
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $arch == simdbc64 && $compiler == dartk ]
+cc/*: Pass, Crash # Please triage (flaky crashes in kernel-isolate?).
+dart/regress29620_test: RuntimeError # Please triage.
+dart/regress30853_test: Crash # Please triage.
+dart/truncating_ints_test: RuntimeError # Please triage.
+
[ $arch == x64 && $system == windows ]
cc/Profiler_BinaryOperatorSourcePositionOptimized: Pass, Fail # Issue 31137
cc/Profiler_ClosureAllocation: Pass, Fail # Issue 31137
@@ -141,6 +163,12 @@
cc/InjectNativeFields3: Crash
cc/Service_TokenStream: Crash
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $compiler == dartk && $mode == debug && ($arch == simarm || $arch == simarm64) ]
+cc/StackTraceMallocHookLengthTest: Fail # Please triage.
+
[ $compiler == dartk && $mode == release && $runtime == vm ]
cc/InjectNativeFields1: Fail
cc/InjectNativeFields3: Fail
@@ -321,6 +349,15 @@
dart/optimized_stacktrace_line_and_column_test: CompileTimeError # Issue 31586
dart/optimized_stacktrace_line_test: CompileTimeError # Issue 31586
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $compiler == dartk && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
+dart/data_uri_spawn_test: Skip # Please triage.
+dart/snapshot_version_test: RuntimeError # Please triage.
+dart/spawn_infinite_loop_test: Crash # Please triage.
+dart/truncating_ints_test: CompileTimeError # Please triage.
+
[ $compiler == dartkp && ($runtime == dart_precompiled || $runtime == vm) ]
dart/data_uri_import_test/base64: CompileTimeError
dart/data_uri_import_test/nocharset: CompileTimeError
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index 50d5082..ef3c299 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -1871,10 +1871,10 @@
objects_.Add(pool);
intptr_t length = pool->ptr()->length_;
-
+ uint8_t* entry_types = pool->ptr()->entry_types();
for (intptr_t i = 0; i < length; i++) {
ObjectPool::EntryType entry_type =
- static_cast<ObjectPool::EntryType>(pool->ptr()->entry_types()[i]);
+ static_cast<ObjectPool::EntryType>(entry_types[i]);
if (entry_type == ObjectPool::kTaggedObject) {
s->Push(pool->ptr()->data()[i].raw_obj_);
}
@@ -1899,9 +1899,10 @@
RawObjectPool* pool = objects_[i];
intptr_t length = pool->ptr()->length_;
s->Write<int32_t>(length);
+ uint8_t* entry_types = pool->ptr()->entry_types();
for (intptr_t j = 0; j < length; j++) {
ObjectPool::EntryType entry_type =
- static_cast<ObjectPool::EntryType>(pool->ptr()->entry_types()[j]);
+ static_cast<ObjectPool::EntryType>(entry_types[j]);
s->Write<int8_t>(entry_type);
RawObjectPool::Entry& entry = pool->ptr()->data()[j];
switch (entry_type) {
diff --git a/runtime/vm/compiler/aot/precompiler.cc b/runtime/vm/compiler/aot/precompiler.cc
index ec9f50a..b07b481 100644
--- a/runtime/vm/compiler/aot/precompiler.cc
+++ b/runtime/vm/compiler/aot/precompiler.cc
@@ -417,6 +417,7 @@
// can be used. Also ensures lookup of entry points won't miss functions
// because their class hasn't been finalized yet.
FinalizeAllClasses();
+ ASSERT(Error::Handle(Z, T->sticky_error()).IsNull());
ClassFinalizer::SortClasses();
TypeRangeCache trc(this, T, I->class_table()->NumCids());
@@ -424,6 +425,7 @@
// Precompile static initializers to compute result type information.
PrecompileStaticInitializers();
+ ASSERT(Error::Handle(Z, T->sticky_error()).IsNull());
// Precompile constructors to compute type information for final fields.
ClassFinalizer::ClearAllCode();
@@ -526,6 +528,9 @@
}
static void CompileStaticInitializerIgnoreErrors(const Field& field) {
+ ASSERT(Error::Handle(Thread::Current()->zone(),
+ Thread::Current()->sticky_error())
+ .IsNull());
LongJumpScope jump;
if (setjmp(*jump.Set()) == 0) {
const Function& initializer =
@@ -538,7 +543,11 @@
} else {
// Ignore compile-time errors here. If the field is actually used,
// the error will be reported later during Iterate().
+ Thread::Current()->clear_sticky_error();
}
+ ASSERT(Error::Handle(Thread::Current()->zone(),
+ Thread::Current()->sticky_error())
+ .IsNull());
}
void Precompiler::PrecompileStaticInitializers() {
@@ -1419,6 +1428,7 @@
Thread* thread = Thread::Current();
StackZone stack_zone(thread);
Zone* zone = stack_zone.GetZone();
+ ASSERT(Error::Handle(zone, thread->sticky_error()).IsNull());
ParsedFunction* parsed_function;
// Check if this field is coming from the Kernel binary.
@@ -1433,7 +1443,12 @@
PrecompileParsedFunctionHelper helper(/* precompiler = */ NULL,
parsed_function,
/* optimized = */ true);
- helper.Compile(&pipeline);
+ if (!helper.Compile(&pipeline)) {
+ Error& error = Error::Handle(zone, thread->sticky_error());
+ ASSERT(!error.IsNull());
+ Jump(error);
+ UNREACHABLE();
+ }
if (compute_type && field.is_final()) {
intptr_t result_cid = pipeline.result_type().ToCid();
@@ -1454,6 +1469,8 @@
Disassembler::DisassembleCode(parsed_function->function(), code,
/* optimized = */ true);
}
+
+ ASSERT(Error::Handle(zone, thread->sticky_error()).IsNull());
return parsed_function->function().raw();
}
diff --git a/runtime/vm/compiler/assembler/assembler_dbc.cc b/runtime/vm/compiler/assembler/assembler_dbc.cc
index 8da5481..e52eaa8 100644
--- a/runtime/vm/compiler/assembler/assembler_dbc.cc
+++ b/runtime/vm/compiler/assembler/assembler_dbc.cc
@@ -35,6 +35,7 @@
#define PARAMS_A_D uintptr_t ra, uintptr_t rd
#define PARAMS_D uintptr_t rd
#define PARAMS_A_B_C uintptr_t ra, uintptr_t rb, uintptr_t rc
+#define PARAMS_A_B_Y uintptr_t ra, uintptr_t rb, intptr_t ry
#define PARAMS_A uintptr_t ra
#define PARAMS_T intptr_t x
#define PARAMS_A_X uintptr_t ra, intptr_t x
@@ -44,6 +45,7 @@
#define ENCODE_A_D , ra, rd
#define ENCODE_D , 0, rd
#define ENCODE_A_B_C , ra, rb, rc
+#define ENCODE_A_B_Y , ra, rb, ry
#define ENCODE_A , ra, 0
#define ENCODE_T , x
#define ENCODE_A_X , ra, x
@@ -53,6 +55,7 @@
#define FENCODE_A_D Encode
#define FENCODE_D Encode
#define FENCODE_A_B_C Encode
+#define FENCODE_A_B_Y Encode
#define FENCODE_A Encode
#define FENCODE_T EncodeSigned
#define FENCODE_A_X EncodeSigned
diff --git a/runtime/vm/compiler/assembler/assembler_dbc.h b/runtime/vm/compiler/assembler/assembler_dbc.h
index 612459c..794ec1b 100644
--- a/runtime/vm/compiler/assembler/assembler_dbc.h
+++ b/runtime/vm/compiler/assembler/assembler_dbc.h
@@ -130,6 +130,7 @@
#define PARAMS_A_D uintptr_t ra, uintptr_t rd
#define PARAMS_D uintptr_t rd
#define PARAMS_A_B_C uintptr_t ra, uintptr_t rb, uintptr_t rc
+#define PARAMS_A_B_Y uintptr_t ra, uintptr_t rb, intptr_t ry
#define PARAMS_A uintptr_t ra
#define PARAMS_X intptr_t x
#define PARAMS_T intptr_t x
@@ -141,6 +142,7 @@
#undef PARAMS_A_D
#undef PARAMS_D
#undef PARAMS_A_B_C
+#undef PARAMS_A_B_Y
#undef PARAMS_A
#undef PARAMS_X
#undef PARAMS_T
diff --git a/runtime/vm/compiler/assembler/assembler_ia32.h b/runtime/vm/compiler/assembler/assembler_ia32.h
index 15be8b8..8af4c60 100644
--- a/runtime/vm/compiler/assembler/assembler_ia32.h
+++ b/runtime/vm/compiler/assembler/assembler_ia32.h
@@ -12,6 +12,7 @@
#include "platform/assert.h"
#include "platform/utils.h"
#include "vm/constants_ia32.h"
+#include "vm/constants_x86.h"
namespace dart {
diff --git a/runtime/vm/compiler/assembler/assembler_ia32_test.cc b/runtime/vm/compiler/assembler/assembler_ia32_test.cc
index bd15c82..b3aac9c 100644
--- a/runtime/vm/compiler/assembler/assembler_ia32_test.cc
+++ b/runtime/vm/compiler/assembler/assembler_ia32_test.cc
@@ -1492,7 +1492,7 @@
"mov eax,0x........\n"
"movd xmm1,eax\n"
"shufps xmm1,xmm1 [0]\n"
- "cmpps xmm0,xmm1 [0]\n"
+ "cmpps xmm0,xmm1 [eq]\n"
"push eax\n"
"movss [esp],xmm0\n"
"fld_s [esp]\n"
@@ -1523,7 +1523,7 @@
"mov eax,0x........\n"
"movd xmm1,eax\n"
"shufps xmm1,xmm1 [0]\n"
- "cmpps xmm0,xmm1 [4]\n"
+ "cmpps xmm0,xmm1 [neq]\n"
"push eax\n"
"movss [esp],xmm0\n"
"fld_s [esp]\n"
@@ -1554,7 +1554,7 @@
"mov eax,0x........\n"
"movd xmm1,eax\n"
"shufps xmm1,xmm1 [0]\n"
- "cmpps xmm0,xmm1 [1]\n"
+ "cmpps xmm0,xmm1 [lt]\n"
"push eax\n"
"movss [esp],xmm0\n"
"fld_s [esp]\n"
@@ -1585,7 +1585,7 @@
"mov eax,0x........\n"
"movd xmm1,eax\n"
"shufps xmm1,xmm1 [0]\n"
- "cmpps xmm0,xmm1 [2]\n"
+ "cmpps xmm0,xmm1 [le]\n"
"push eax\n"
"movss [esp],xmm0\n"
"fld_s [esp]\n"
@@ -1616,7 +1616,7 @@
"mov eax,0x........\n"
"movd xmm1,eax\n"
"shufps xmm1,xmm1 [0]\n"
- "cmpps xmm0,xmm1 [5]\n"
+ "cmpps xmm0,xmm1 [nlt]\n"
"push eax\n"
"movss [esp],xmm0\n"
"fld_s [esp]\n"
@@ -1647,7 +1647,7 @@
"mov eax,0x........\n"
"movd xmm1,eax\n"
"shufps xmm1,xmm1 [0]\n"
- "cmpps xmm0,xmm1 [6]\n"
+ "cmpps xmm0,xmm1 [nle]\n"
"push eax\n"
"movss [esp],xmm0\n"
"fld_s [esp]\n"
@@ -2632,7 +2632,7 @@
EXPECT_FLOAT_EQ(9.0f, res, 0.000001f);
EXPECT_DISASSEMBLY(
"movups xmm1,[rip+0x.......]\n"
- "cvtsd2ss xmm0,xmm1\n"
+ "cvtps2pd xmm0,xmm1\n"
"push eax\n"
"push eax\n"
"movsd [esp],xmm0\n"
@@ -3277,7 +3277,7 @@
"mov eax,0x........\n"
"push eax\n"
"movsd xmm0,[esp]\n"
- "(null) xmm1,xmm0\n"
+ "cvtsd2ss xmm1,xmm0\n"
"movss [esp],xmm1\n"
"fld_s [esp]\n"
"pop eax\n"
@@ -3531,6 +3531,37 @@
"ret\n");
}
+ASSEMBLER_TEST_GENERATE(XmmAlu, assembler) {
+ // Test the disassembler.
+ __ addss(XMM0, XMM0);
+ __ addsd(XMM0, XMM0);
+ __ addps(XMM0, XMM0);
+ __ addpd(XMM0, XMM0);
+ __ cvtss2sd(XMM0, XMM0);
+ __ cvtsd2ss(XMM0, XMM0);
+ __ cvtps2pd(XMM0, XMM0);
+ __ cvtpd2ps(XMM0, XMM0);
+ __ movl(EAX, Immediate(0));
+ __ ret();
+}
+
+ASSEMBLER_TEST_RUN(XmmAlu, test) {
+ typedef intptr_t (*XmmAluTest)();
+ intptr_t res = reinterpret_cast<XmmAluTest>(test->entry())();
+ EXPECT_EQ(res, 0);
+ EXPECT_DISASSEMBLY(
+ "addss xmm0,xmm0\n"
+ "addsd xmm0,xmm0\n"
+ "addps xmm0,xmm0\n"
+ "addpd xmm0,xmm0\n"
+ "cvtss2sd xmm0,xmm0\n"
+ "cvtsd2ss xmm0,xmm0\n"
+ "cvtps2pd xmm0,xmm0\n"
+ "cvtpd2ps xmm0,xmm0\n"
+ "mov eax,0\n"
+ "ret\n");
+}
+
ASSEMBLER_TEST_GENERATE(FloatNegate, assembler) {
__ movss(XMM0, Address(ESP, kWordSize));
__ FloatNegate(XMM0);
@@ -4616,7 +4647,7 @@
"mov esi,[esp+0x10]\n"
"mov edi,[esp+0x14]\n"
"mov ecx,[esp+0x18]\n"
- "rep movs\n"
+ "rep movsb\n"
"pop ecx\n"
"pop edi\n"
"pop esi\n"
diff --git a/runtime/vm/compiler/assembler/assembler_x64.cc b/runtime/vm/compiler/assembler/assembler_x64.cc
index e85cc85..74dae8e 100644
--- a/runtime/vm/compiler/assembler/assembler_x64.cc
+++ b/runtime/vm/compiler/assembler/assembler_x64.cc
@@ -36,21 +36,6 @@
memset(reinterpret_cast<void*>(data), Instr::kBreakPointInstruction, length);
}
-void Assembler::call(Register reg) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(reg);
- EmitOperandREX(2, operand, REX_NONE);
- EmitUint8(0xFF);
- EmitOperand(2, operand);
-}
-
-void Assembler::call(const Address& address) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(2, address, REX_NONE);
- EmitUint8(0xFF);
- EmitOperand(2, address);
-}
-
void Assembler::call(Label* label) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
static const int kSize = 5;
@@ -121,13 +106,6 @@
EmitUint8(0x50 | (reg & 7));
}
-void Assembler::pushq(const Address& address) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(6, address, REX_NONE);
- EmitUint8(0xFF);
- EmitOperand(6, address);
-}
-
void Assembler::pushq(const Immediate& imm) {
if (imm.is_int8()) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
@@ -158,13 +136,6 @@
EmitUint8(0x58 | (reg & 7));
}
-void Assembler::popq(const Address& address) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(0, address, REX_NONE);
- EmitUint8(0x8F);
- EmitOperand(0, address);
-}
-
void Assembler::setcc(Condition condition, ByteRegister dst) {
ASSERT(dst != kNoByteRegister);
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
@@ -176,12 +147,58 @@
EmitUint8(0xC0 + (dst & 0x07));
}
-void Assembler::movl(Register dst, Register src) {
+void Assembler::EmitQ(int reg,
+ const Address& address,
+ int opcode,
+ int prefix2,
+ int prefix1) {
+ ASSERT(reg <= XMM15);
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(src);
- EmitOperandREX(dst, operand, REX_NONE);
- EmitUint8(0x8B);
- EmitOperand(dst & 7, operand);
+ if (prefix1 >= 0) {
+ EmitUint8(prefix1);
+ }
+ EmitOperandREX(reg, address, REX_W);
+ if (prefix2 >= 0) {
+ EmitUint8(prefix2);
+ }
+ EmitUint8(opcode);
+ EmitOperand(reg & 7, address);
+}
+
+void Assembler::EmitL(int reg,
+ const Address& address,
+ int opcode,
+ int prefix2,
+ int prefix1) {
+ ASSERT(reg <= XMM15);
+ AssemblerBuffer::EnsureCapacity ensured(&buffer_);
+ if (prefix1 >= 0) {
+ EmitUint8(prefix1);
+ }
+ EmitOperandREX(reg, address, REX_NONE);
+ if (prefix2 >= 0) {
+ EmitUint8(prefix2);
+ }
+ EmitUint8(opcode);
+ EmitOperand(reg & 7, address);
+}
+
+void Assembler::EmitW(Register reg,
+ const Address& address,
+ int opcode,
+ int prefix2,
+ int prefix1) {
+ AssemblerBuffer::EnsureCapacity ensured(&buffer_);
+ if (prefix1 >= 0) {
+ EmitUint8(prefix1);
+ }
+ EmitOperandSizeOverride();
+ EmitOperandREX(reg, address, REX_NONE);
+ if (prefix2 >= 0) {
+ EmitUint8(prefix2);
+ }
+ EmitUint8(opcode);
+ EmitOperand(reg & 7, address);
}
void Assembler::movl(Register dst, const Immediate& imm) {
@@ -194,66 +211,11 @@
EmitImmediate(imm);
}
-void Assembler::movl(Register dst, const Address& src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(dst, src, REX_NONE);
- EmitUint8(0x8B);
- EmitOperand(dst & 7, src);
-}
-
-void Assembler::movl(const Address& dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(src, dst, REX_NONE);
- EmitUint8(0x89);
- EmitOperand(src & 7, dst);
-}
-
void Assembler::movl(const Address& dst, const Immediate& imm) {
movl(TMP, imm);
movl(dst, TMP);
}
-void Assembler::movzxb(Register dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(src);
- EmitOperandREX(dst, operand, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0xB6);
- EmitOperand(dst & 7, operand);
-}
-
-void Assembler::movzxb(Register dst, const Address& src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(dst, src, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0xB6);
- EmitOperand(dst & 7, src);
-}
-
-void Assembler::movsxb(Register dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(src);
- EmitOperandREX(dst, operand, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0xBE);
- EmitOperand(dst & 7, operand);
-}
-
-void Assembler::movsxb(Register dst, const Address& src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(dst, src, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0xBE);
- EmitOperand(dst & 7, src);
-}
-
-void Assembler::movb(Register dst, const Address& src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(dst, src, REX_NONE);
- EmitUint8(0x8A);
- EmitOperand(dst & 7, src);
-}
-
void Assembler::movb(const Address& dst, const Immediate& imm) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
EmitOperandREX(0, dst, REX_NONE);
@@ -263,59 +225,10 @@
EmitUint8(imm.value() & 0xFF);
}
-void Assembler::movb(const Address& dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(src, dst, REX_NONE);
- EmitUint8(0x88);
- EmitOperand(src & 7, dst);
-}
-
-void Assembler::movzxw(Register dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(src);
- EmitOperandREX(dst, operand, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0xB7);
- EmitOperand(dst & 7, operand);
-}
-
-void Assembler::movzxw(Register dst, const Address& src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(dst, src, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0xB7);
- EmitOperand(dst & 7, src);
-}
-
-void Assembler::movsxw(Register dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(src);
- EmitOperandREX(dst, operand, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0xBF);
- EmitOperand(dst & 7, operand);
-}
-
-void Assembler::movsxw(Register dst, const Address& src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(dst, src, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0xBF);
- EmitOperand(dst & 7, src);
-}
-
void Assembler::movw(Register dst, const Address& src) {
FATAL("Use movzxw or movsxw instead.");
}
-void Assembler::movw(const Address& dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandSizeOverride();
- EmitOperandREX(src, dst, REX_NONE);
- EmitUint8(0x89);
- EmitOperand(src & 7, dst);
-}
-
void Assembler::movw(const Address& dst, const Immediate& imm) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
EmitOperandSizeOverride();
@@ -349,38 +262,12 @@
}
}
-// Use 0x89 encoding (instead of 0x8B encoding), which is expected by gdb64
-// older than 7.3.1-gg5 when disassembling a function's prologue (movq rbp, rsp)
-// for proper unwinding of Dart frames (use --generate_gdb_symbols and -O0).
-void Assembler::movq(Register dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(dst);
- EmitOperandREX(src, operand, REX_W);
- EmitUint8(0x89);
- EmitOperand(src & 7, operand);
-}
-
-void Assembler::movq(Register dst, const Address& src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(dst, src, REX_W);
- EmitUint8(0x8B);
- EmitOperand(dst & 7, src);
-}
-
-void Assembler::movq(const Address& dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(src, dst, REX_W);
- EmitUint8(0x89);
- EmitOperand(src & 7, dst);
-}
-
void Assembler::movq(const Address& dst, const Immediate& imm) {
if (imm.is_int32()) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(dst);
- EmitOperandREX(0, operand, REX_W);
+ EmitOperandREX(0, dst, REX_W);
EmitUint8(0xC7);
- EmitOperand(0, operand);
+ EmitOperand(0, dst);
EmitImmediate(imm);
} else {
movq(TMP, imm);
@@ -388,516 +275,101 @@
}
}
-void Assembler::movsxd(Register dst, Register src) {
+void Assembler::EmitSimple(int opcode, int opcode2) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(src);
- EmitOperandREX(dst, operand, REX_W);
- EmitUint8(0x63);
- EmitOperand(dst & 7, operand);
+ EmitUint8(opcode);
+ if (opcode2 != -1) {
+ EmitUint8(opcode2);
+ }
}
-void Assembler::movsxd(Register dst, const Address& src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(dst, src, REX_W);
- EmitUint8(0x63);
- EmitOperand(dst & 7, src);
-}
-
-void Assembler::rep_movsb() {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF3);
- EmitUint8(0xA4);
-}
-
-void Assembler::leaq(Register dst, const Address& src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(dst, src, REX_W);
- EmitUint8(0x8D);
- EmitOperand(dst & 7, src);
-}
-
-void Assembler::cmovnoq(Register dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(src);
- EmitOperandREX(dst, operand, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0x41);
- EmitOperand(dst & 7, operand);
-}
-
-void Assembler::cmoveq(Register dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(src);
- EmitOperandREX(dst, operand, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0x44);
- EmitOperand(dst & 7, operand);
-}
-
-void Assembler::cmovgeq(Register dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(src);
- EmitOperandREX(dst, operand, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0x4D);
- EmitOperand(dst & 7, operand);
-}
-
-void Assembler::cmovlessq(Register dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(src);
- EmitOperandREX(dst, operand, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0x4C);
- EmitOperand(dst & 7, operand);
-}
-
-void Assembler::movss(XmmRegister dst, const Address& src) {
- ASSERT(dst <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF3);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x10);
- EmitOperand(dst & 7, src);
-}
-
-void Assembler::movss(const Address& dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF3);
- EmitREX_RB(src, dst);
- EmitUint8(0x0F);
- EmitUint8(0x11);
- EmitOperand(src & 7, dst);
-}
-
-void Assembler::movss(XmmRegister dst, XmmRegister src) {
+void Assembler::EmitQ(int dst, int src, int opcode, int prefix2, int prefix1) {
ASSERT(src <= XMM15);
ASSERT(dst <= XMM15);
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF3);
- EmitREX_RB(src, dst);
- EmitUint8(0x0F);
- EmitUint8(0x11);
- EmitXmmRegisterOperand(src & 7, dst);
+ if (prefix1 >= 0) {
+ EmitUint8(prefix1);
+ }
+ EmitRegRegRex(dst, src, REX_W);
+ if (prefix2 >= 0) {
+ EmitUint8(prefix2);
+ }
+ EmitUint8(opcode);
+ EmitRegisterOperand(dst & 7, src);
}
-void Assembler::movd(XmmRegister dst, Register src) {
- ASSERT(dst <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0x66);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x6E);
- EmitOperand(dst & 7, Operand(src));
-}
-
-void Assembler::movd(Register dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0x66);
- EmitREX_RB(src, dst);
- EmitUint8(0x0F);
- EmitUint8(0x7E);
- EmitOperand(src & 7, Operand(dst));
-}
-
-void Assembler::movq(Register dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0x66);
- EmitREX_RB(src, dst, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0x7E);
- EmitOperand(src & 7, Operand(dst));
-}
-
-void Assembler::addss(XmmRegister dst, XmmRegister src) {
+void Assembler::EmitL(int dst, int src, int opcode, int prefix2, int prefix1) {
ASSERT(src <= XMM15);
ASSERT(dst <= XMM15);
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF3);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x58);
- EmitXmmRegisterOperand(dst & 7, src);
+ if (prefix1 >= 0) {
+ EmitUint8(prefix1);
+ }
+ EmitRegRegRex(dst, src);
+ if (prefix2 >= 0) {
+ EmitUint8(prefix2);
+ }
+ EmitUint8(opcode);
+ EmitRegisterOperand(dst & 7, src);
}
-void Assembler::subss(XmmRegister dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
+void Assembler::EmitW(Register dst,
+ Register src,
+ int opcode,
+ int prefix2,
+ int prefix1) {
+ ASSERT(src <= R15);
+ ASSERT(dst <= R15);
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF3);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x5C);
- EmitXmmRegisterOperand(dst & 7, src);
+ if (prefix1 >= 0) {
+ EmitUint8(prefix1);
+ }
+ EmitOperandSizeOverride();
+ EmitRegRegRex(dst, src);
+ if (prefix2 >= 0) {
+ EmitUint8(prefix2);
+ }
+ EmitUint8(opcode);
+ EmitRegisterOperand(dst & 7, src);
}
-void Assembler::mulss(XmmRegister dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
+#define UNARY_XMM_WITH_CONSTANT(name, constant, op) \
+ void Assembler::name(XmmRegister dst, XmmRegister src) { \
+ movq(TMP, Address(THR, Thread::constant##_address_offset())); \
+ if (dst == src) { \
+ op(dst, Address(TMP, 0)); \
+ } else { \
+ movups(dst, Address(TMP, 0)); \
+ op(dst, src); \
+ } \
+ }
+
+// TODO(erikcorry): For the case where dst != src, we could construct these
+// with pcmpeqw xmm0,xmm0 followed by left and right shifts. This would avoid
+// memory traffic.
+// { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
+UNARY_XMM_WITH_CONSTANT(notps, float_not, xorps)
+// { 0x80000000, 0x80000000, 0x80000000, 0x80000000 }
+UNARY_XMM_WITH_CONSTANT(negateps, float_negate, xorps)
+// { 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF }
+UNARY_XMM_WITH_CONSTANT(absps, float_absolute, andps)
+// { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000 }
+UNARY_XMM_WITH_CONSTANT(zerowps, float_zerow, andps)
+// { 0x8000000000000000LL, 0x8000000000000000LL }
+UNARY_XMM_WITH_CONSTANT(negatepd, double_negate, xorpd)
+// { 0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFFLL }
+UNARY_XMM_WITH_CONSTANT(abspd, double_abs, andpd)
+// {0x8000000000000000LL, 0x8000000000000000LL}
+UNARY_XMM_WITH_CONSTANT(DoubleNegate, double_negate, xorpd)
+// {0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFFLL}
+UNARY_XMM_WITH_CONSTANT(DoubleAbs, double_abs, andpd)
+
+#undef UNARY_XMM_WITH_CONSTANT
+
+void Assembler::CmpPS(XmmRegister dst, XmmRegister src, int condition) {
+ EmitL(dst, src, 0xC2, 0x0F);
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF3);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x59);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::divss(XmmRegister dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF3);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x5E);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::movsd(XmmRegister dst, const Address& src) {
- ASSERT(dst <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF2);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x10);
- EmitOperand(dst & 7, src);
-}
-
-void Assembler::movsd(const Address& dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF2);
- EmitREX_RB(src, dst);
- EmitUint8(0x0F);
- EmitUint8(0x11);
- EmitOperand(src & 7, dst);
-}
-
-void Assembler::movsd(XmmRegister dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF2);
- EmitREX_RB(src, dst);
- EmitUint8(0x0F);
- EmitUint8(0x11);
- EmitXmmRegisterOperand(src & 7, dst);
-}
-
-void Assembler::movaps(XmmRegister dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x28);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::movups(XmmRegister dst, const Address& src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x10);
- EmitOperand(dst & 7, src);
-}
-
-void Assembler::movups(const Address& dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(src, dst);
- EmitUint8(0x0F);
- EmitUint8(0x11);
- EmitOperand(src & 7, dst);
-}
-
-void Assembler::addsd(XmmRegister dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF2);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x58);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::subsd(XmmRegister dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF2);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x5C);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::mulsd(XmmRegister dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF2);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x59);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::divsd(XmmRegister dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF2);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x5E);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::addpl(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0x66);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0xFE);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::subpl(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0x66);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0xFA);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::addps(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x58);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::subps(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x5C);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::divps(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x5E);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::mulps(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x59);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::minps(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x5D);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::maxps(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x5F);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::andps(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x54);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::andps(XmmRegister dst, const Address& src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x54);
- EmitOperand(dst & 7, src);
-}
-
-void Assembler::orps(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x56);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::notps(XmmRegister dst) {
- // { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF };
- movq(TMP, Address(THR, Thread::float_not_address_offset()));
- xorps(dst, Address(TMP, 0));
-}
-
-void Assembler::negateps(XmmRegister dst) {
- // { 0x80000000, 0x80000000, 0x80000000, 0x80000000 }
- movq(TMP, Address(THR, Thread::float_negate_address_offset()));
- xorps(dst, Address(TMP, 0));
-}
-
-void Assembler::absps(XmmRegister dst) {
- // { 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF, 0x7FFFFFFF }
- movq(TMP, Address(THR, Thread::float_absolute_address_offset()));
- andps(dst, Address(TMP, 0));
-}
-
-void Assembler::zerowps(XmmRegister dst) {
- // { 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000 }
- movq(TMP, Address(THR, Thread::float_zerow_address_offset()));
- andps(dst, Address(TMP, 0));
-}
-
-void Assembler::cmppseq(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0xC2);
- EmitXmmRegisterOperand(dst & 7, src);
- EmitUint8(0x0);
-}
-
-void Assembler::cmppsneq(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0xC2);
- EmitXmmRegisterOperand(dst & 7, src);
- EmitUint8(0x4);
-}
-
-void Assembler::cmppslt(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0xC2);
- EmitXmmRegisterOperand(dst & 7, src);
- EmitUint8(0x1);
-}
-
-void Assembler::cmppsle(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0xC2);
- EmitXmmRegisterOperand(dst & 7, src);
- EmitUint8(0x2);
-}
-
-void Assembler::cmppsnlt(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0xC2);
- EmitXmmRegisterOperand(dst & 7, src);
- EmitUint8(0x5);
-}
-
-void Assembler::cmppsnle(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0xC2);
- EmitXmmRegisterOperand(dst & 7, src);
- EmitUint8(0x6);
-}
-
-void Assembler::sqrtps(XmmRegister dst) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, dst);
- EmitUint8(0x0F);
- EmitUint8(0x51);
- EmitXmmRegisterOperand(dst & 7, dst);
-}
-
-void Assembler::rsqrtps(XmmRegister dst) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, dst);
- EmitUint8(0x0F);
- EmitUint8(0x52);
- EmitXmmRegisterOperand(dst & 7, dst);
-}
-
-void Assembler::reciprocalps(XmmRegister dst) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, dst);
- EmitUint8(0x0F);
- EmitUint8(0x53);
- EmitXmmRegisterOperand(dst & 7, dst);
-}
-
-void Assembler::movhlps(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x12);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::movlhps(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x16);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::unpcklps(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x14);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::unpckhps(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x15);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::unpcklpd(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0x66);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x14);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::unpckhpd(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0x66);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x15);
- EmitXmmRegisterOperand(dst & 7, src);
+ EmitUint8(condition);
}
void Assembler::set1ps(XmmRegister dst, Register tmp1, const Immediate& imm) {
@@ -910,299 +382,29 @@
}
void Assembler::shufps(XmmRegister dst, XmmRegister src, const Immediate& imm) {
+ EmitL(dst, src, 0xC6, 0x0F);
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0xC6);
- EmitXmmRegisterOperand(dst & 7, src);
ASSERT(imm.is_uint8());
EmitUint8(imm.value());
}
-void Assembler::addpd(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- EmitUint8(0x66);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x58);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::negatepd(XmmRegister dst) {
- // { 0x8000000000000000LL, 0x8000000000000000LL }
- movq(TMP, Address(THR, Thread::double_negate_address_offset()));
- xorpd(dst, Address(TMP, 0));
-}
-
-void Assembler::subpd(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- EmitUint8(0x66);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x5C);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::mulpd(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- EmitUint8(0x66);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x59);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::divpd(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- EmitUint8(0x66);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x5E);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::abspd(XmmRegister dst) {
- // { 0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFFLL }
- movq(TMP, Address(THR, Thread::double_abs_address_offset()));
- andpd(dst, Address(TMP, 0));
-}
-
-void Assembler::minpd(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- EmitUint8(0x66);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x5D);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::maxpd(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- EmitUint8(0x66);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x5F);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::sqrtpd(XmmRegister dst) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- ASSERT(dst <= XMM15);
- EmitUint8(0x66);
- EmitREX_RB(dst, dst);
- EmitUint8(0x0F);
- EmitUint8(0x51);
- EmitXmmRegisterOperand(dst & 7, dst);
-}
-
-void Assembler::cvtps2pd(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x5A);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::cvtpd2ps(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- EmitUint8(0x66);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x5A);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
void Assembler::shufpd(XmmRegister dst, XmmRegister src, const Immediate& imm) {
+ EmitL(dst, src, 0xC6, 0x0F, 0x66);
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0x66);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0xC6);
- EmitXmmRegisterOperand(dst & 7, src);
ASSERT(imm.is_uint8());
EmitUint8(imm.value());
}
-void Assembler::comisd(XmmRegister a, XmmRegister b) {
- ASSERT(a <= XMM15);
- ASSERT(b <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0x66);
- EmitREX_RB(a, b);
- EmitUint8(0x0F);
- EmitUint8(0x2F);
- EmitXmmRegisterOperand(a & 7, b);
-}
-
-void Assembler::movmskpd(Register dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0x66);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x50);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::movmskps(Register dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x50);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::sqrtsd(XmmRegister dst, XmmRegister src) {
- ASSERT(dst <= XMM15);
- ASSERT(src <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF2);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x51);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::xorpd(XmmRegister dst, const Address& src) {
- ASSERT(dst <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0x66);
- EmitOperandREX(dst, src, REX_NONE);
- EmitUint8(0x0F);
- EmitUint8(0x57);
- EmitOperand(dst & 7, src);
-}
-
-void Assembler::xorpd(XmmRegister dst, XmmRegister src) {
- ASSERT(dst <= XMM15);
- ASSERT(src <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0x66);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x57);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::xorps(XmmRegister dst, const Address& src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x57);
- EmitOperand(dst & 7, src);
-}
-
-void Assembler::xorps(XmmRegister dst, XmmRegister src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x57);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::andpd(XmmRegister dst, const Address& src) {
- ASSERT(dst <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0x66);
- EmitOperandREX(dst, src, REX_NONE);
- EmitUint8(0x0F);
- EmitUint8(0x54);
- EmitOperand(dst & 7, src);
-}
-
-void Assembler::cvtsi2sdq(XmmRegister dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- ASSERT(dst <= XMM15);
- Operand operand(src);
- EmitUint8(0xF2);
- EmitOperandREX(dst, operand, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0x2A);
- EmitOperand(dst & 7, operand);
-}
-
-void Assembler::cvtsi2sdl(XmmRegister dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- ASSERT(dst <= XMM15);
- Operand operand(src);
- EmitUint8(0xF2);
- EmitOperandREX(dst, operand, REX_NONE);
- EmitUint8(0x0F);
- EmitUint8(0x2A);
- EmitOperand(dst & 7, operand);
-}
-
-void Assembler::cvttsd2siq(Register dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF2);
- Operand operand(dst);
- EmitREX_RB(dst, src, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0x2C);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::cvtss2sd(XmmRegister dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF3);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x5A);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::cvtsd2ss(XmmRegister dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF2);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0x5A);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
-void Assembler::pxor(XmmRegister dst, XmmRegister src) {
- ASSERT(src <= XMM15);
- ASSERT(dst <= XMM15);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0x66);
- EmitREX_RB(dst, src);
- EmitUint8(0x0F);
- EmitUint8(0xEF);
- EmitXmmRegisterOperand(dst & 7, src);
-}
-
void Assembler::roundsd(XmmRegister dst, XmmRegister src, RoundingMode mode) {
ASSERT(src <= XMM15);
ASSERT(dst <= XMM15);
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
EmitUint8(0x66);
- EmitREX_RB(dst, src);
+ EmitRegRegRex(dst, src);
EmitUint8(0x0F);
EmitUint8(0x3A);
EmitUint8(0x0B);
- EmitXmmRegisterOperand(dst & 7, src);
+ EmitRegisterOperand(dst & 7, src);
// Mask precision exeption.
EmitUint8(static_cast<uint8_t>(mode) | 0x8);
}
@@ -1219,64 +421,9 @@
EmitOperand(3, dst);
}
-void Assembler::fincstp() {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xD9);
- EmitUint8(0xF7);
-}
-
void Assembler::ffree(intptr_t value) {
ASSERT(value < 7);
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xDD);
- EmitUint8(0xC0 + value);
-}
-
-void Assembler::fsin() {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xD9);
- EmitUint8(0xFE);
-}
-
-void Assembler::fcos() {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xD9);
- EmitUint8(0xFF);
-}
-
-void Assembler::xchgl(Register dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(src);
- EmitOperandREX(dst, operand, REX_NONE);
- EmitUint8(0x87);
- EmitOperand(dst & 7, operand);
-}
-
-void Assembler::xchgq(Register dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(src);
- EmitOperandREX(dst, operand, REX_W);
- EmitUint8(0x87);
- EmitOperand(dst & 7, operand);
-}
-
-void Assembler::cmpb(const Address& address, const Immediate& imm) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(7, address, REX_NONE);
- EmitUint8(0x80);
- EmitOperand(7, address);
- ASSERT(imm.is_int8());
- EmitUint8(imm.value() & 0xFF);
-}
-
-void Assembler::cmpw(const Address& address, const Immediate& imm) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandSizeOverride();
- EmitOperandREX(7, address, REX_NONE);
- EmitUint8(0x81);
- EmitOperand(7, address);
- EmitUint8(imm.value() & 0xFF);
- EmitUint8((imm.value() >> 8) & 0xFF);
+ EmitSimple(0xDD, 0xC0 + value);
}
void Assembler::CompareImmediate(Register reg, const Immediate& imm) {
@@ -1298,14 +445,6 @@
}
}
-void Assembler::testl(Register reg1, Register reg2) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(reg2);
- EmitOperandREX(reg1, operand, REX_NONE);
- EmitUint8(0x85);
- EmitOperand(reg1 & 7, operand);
-}
-
void Assembler::testb(const Address& address, const Immediate& imm) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
EmitOperandREX(0, address, REX_NONE);
@@ -1315,14 +454,6 @@
EmitUint8(imm.value() & 0xFF);
}
-void Assembler::testq(Register reg1, Register reg2) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(reg2);
- EmitOperandREX(reg1, operand, REX_W);
- EmitUint8(0x85);
- EmitOperand(reg1 & 7, operand);
-}
-
void Assembler::testq(Register reg, const Immediate& imm) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
if (imm.is_uint8()) {
@@ -1372,50 +503,38 @@
}
}
-void Assembler::Alu(int bytes, uint8_t opcode, Register dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(src);
- if (bytes == 2) {
- EmitOperandSizeOverride();
- }
- EmitOperandREX(dst, operand, bytes == 8 ? REX_W : REX_NONE);
- ASSERT((opcode & 7) == 3);
- EmitUint8(opcode);
- EmitOperand(dst & 7, operand);
-}
-
void Assembler::AluL(uint8_t modrm_opcode, Register dst, const Immediate& imm) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
EmitRegisterREX(dst, REX_NONE);
EmitComplex(modrm_opcode, Operand(dst), imm);
}
-void Assembler::Alu(int bytes,
- uint8_t opcode,
- Register dst,
- const Address& src) {
+void Assembler::AluB(uint8_t modrm_opcode,
+ const Address& dst,
+ const Immediate& imm) {
+ ASSERT(imm.is_uint8() || imm.is_int8());
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- if (bytes == 2) {
- EmitOperandSizeOverride();
- }
- EmitOperandREX(dst, src, bytes == 8 ? REX_W : REX_NONE);
- ASSERT((opcode & 7) == 3);
- EmitUint8(opcode);
- EmitOperand(dst & 7, src);
+ EmitOperandREX(modrm_opcode, dst, REX_NONE);
+ EmitUint8(0x80);
+ EmitOperand(modrm_opcode, dst);
+ EmitUint8(imm.value() & 0xFF);
}
-void Assembler::Alu(int bytes,
- uint8_t opcode,
- const Address& dst,
- Register src) {
+void Assembler::AluW(uint8_t modrm_opcode,
+ const Address& dst,
+ const Immediate& imm) {
+ ASSERT(imm.is_int16() || imm.is_uint16());
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- if (bytes == 2) {
- EmitOperandSizeOverride();
+ EmitOperandSizeOverride();
+ EmitOperandREX(modrm_opcode, dst, REX_NONE);
+ if (imm.is_int8()) {
+ EmitSignExtendedInt8(modrm_opcode, dst, imm);
+ } else {
+ EmitUint8(0x81);
+ EmitOperand(modrm_opcode, dst);
+ EmitUint8(imm.value() & 0xFF);
+ EmitUint8((imm.value() >> 8) & 0xFF);
}
- EmitOperandREX(src, dst, bytes == 8 ? REX_W : REX_NONE);
- ASSERT((opcode & 7) == 1);
- EmitUint8(opcode);
- EmitOperand(src & 7, dst);
}
void Assembler::AluL(uint8_t modrm_opcode,
@@ -1423,15 +542,15 @@
const Immediate& imm) {
ASSERT(imm.is_int32());
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(dst);
- EmitOperandREX(modrm_opcode, operand, REX_NONE);
- EmitComplex(modrm_opcode, operand, imm);
+ EmitOperandREX(modrm_opcode, dst, REX_NONE);
+ EmitComplex(modrm_opcode, dst, imm);
}
void Assembler::AluQ(uint8_t modrm_opcode,
uint8_t opcode,
Register dst,
const Immediate& imm) {
+ Operand operand(dst);
if (modrm_opcode == 4 && imm.is_uint32()) {
// We can use andl for andq.
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
@@ -1439,27 +558,24 @@
// Would like to use EmitComplex here, but it doesn't like uint32
// immediates.
if (imm.is_int8()) {
- // Use sign-extended 8-bit immediate.
- EmitUint8(0x83);
- EmitOperand(modrm_opcode, Operand(dst));
- EmitUint8(imm.value() & 0xFF);
+ EmitSignExtendedInt8(modrm_opcode, operand, imm);
} else {
if (dst == RAX) {
EmitUint8(0x25);
} else {
EmitUint8(0x81);
- EmitOperand(modrm_opcode, Operand(dst));
+ EmitOperand(modrm_opcode, operand);
}
EmitUInt32(imm.value());
}
} else if (imm.is_int32()) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
EmitRegisterREX(dst, REX_W);
- EmitComplex(modrm_opcode, Operand(dst), imm);
+ EmitComplex(modrm_opcode, operand, imm);
} else {
ASSERT(dst != TMP);
movq(TMP, imm);
- Alu(8, opcode, dst, TMP);
+ EmitQ(dst, TMP, opcode);
}
}
@@ -1470,10 +586,10 @@
if (imm.is_int32()) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
EmitOperandREX(modrm_opcode, dst, REX_W);
- EmitComplex(modrm_opcode, Operand(dst), imm);
+ EmitComplex(modrm_opcode, dst, imm);
} else {
movq(TMP, imm);
- Alu(8, opcode, dst, TMP);
+ EmitQ(TMP, dst, opcode);
}
}
@@ -1507,52 +623,40 @@
}
}
-void Assembler::cdq() {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0x99);
-}
-
void Assembler::cqo() {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
EmitRegisterREX(RAX, REX_W);
EmitUint8(0x99);
}
-void Assembler::idivl(Register reg) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitRegisterREX(reg, REX_NONE);
- EmitUint8(0xF7);
- EmitOperand(7, Operand(reg));
-}
-
-void Assembler::divl(Register reg) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitRegisterREX(reg, REX_NONE);
- EmitUint8(0xF7);
- EmitOperand(6, Operand(reg));
-}
-
-void Assembler::idivq(Register reg) {
+void Assembler::EmitUnaryQ(Register reg, int opcode, int modrm_code) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
EmitRegisterREX(reg, REX_W);
- EmitUint8(0xF7);
- EmitOperand(7, Operand(reg));
+ EmitUint8(opcode);
+ EmitOperand(modrm_code, Operand(reg));
}
-void Assembler::divq(Register reg) {
+void Assembler::EmitUnaryL(Register reg, int opcode, int modrm_code) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitRegisterREX(reg, REX_W);
- EmitUint8(0xF7);
- EmitOperand(6, Operand(reg));
+ EmitRegisterREX(reg, REX_NONE);
+ EmitUint8(opcode);
+ EmitOperand(modrm_code, Operand(reg));
}
-void Assembler::imull(Register dst, Register src) {
+void Assembler::EmitUnaryQ(const Address& address, int opcode, int modrm_code) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(src);
- EmitOperandREX(dst, operand, REX_NONE);
- EmitUint8(0x0F);
- EmitUint8(0xAF);
- EmitOperand(dst & 7, Operand(src));
+ Operand operand(address);
+ EmitOperandREX(modrm_code, operand, REX_W);
+ EmitUint8(opcode);
+ EmitOperand(modrm_code, operand);
+}
+
+void Assembler::EmitUnaryL(const Address& address, int opcode, int modrm_code) {
+ AssemblerBuffer::EnsureCapacity ensured(&buffer_);
+ Operand operand(address);
+ EmitOperandREX(modrm_code, operand, REX_NONE);
+ EmitUint8(opcode);
+ EmitOperand(modrm_code, operand);
}
void Assembler::imull(Register reg, const Immediate& imm) {
@@ -1564,22 +668,6 @@
EmitImmediate(imm);
}
-void Assembler::mull(Register reg) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitRegisterREX(reg, REX_NONE);
- EmitUint8(0xF7);
- EmitOperand(4, Operand(reg));
-}
-
-void Assembler::imulq(Register dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(src);
- EmitOperandREX(dst, operand, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0xAF);
- EmitOperand(dst & 7, operand);
-}
-
void Assembler::imulq(Register reg, const Immediate& imm) {
if (imm.is_int32()) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
@@ -1605,21 +693,6 @@
}
}
-void Assembler::imulq(Register dst, const Address& address) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(dst, address, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0xAF);
- EmitOperand(dst & 7, address);
-}
-
-void Assembler::mulq(Register reg) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitRegisterREX(reg, REX_W);
- EmitUint8(0xF7);
- EmitOperand(4, Operand(reg));
-}
-
void Assembler::shll(Register reg, const Immediate& imm) {
EmitGenericShift(false, 4, reg, imm);
}
@@ -1645,13 +718,9 @@
}
void Assembler::shldl(Register dst, Register src, const Immediate& imm) {
+ EmitL(src, dst, 0xA4, 0x0F);
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
ASSERT(imm.is_int8());
- Operand operand(dst);
- EmitOperandREX(src, operand, REX_NONE);
- EmitUint8(0x0F);
- EmitUint8(0xA4);
- EmitOperand(src & 7, operand);
EmitUint8(imm.value() & 0xFF);
}
@@ -1680,130 +749,12 @@
}
void Assembler::shldq(Register dst, Register src, const Immediate& imm) {
+ EmitQ(src, dst, 0xA4, 0x0F);
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
ASSERT(imm.is_int8());
- Operand operand(dst);
- EmitOperandREX(src, operand, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0xA4);
- EmitOperand(src & 7, operand);
EmitUint8(imm.value() & 0xFF);
}
-void Assembler::shldq(Register dst, Register src, Register shifter) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- ASSERT(shifter == RCX);
- Operand operand(dst);
- EmitOperandREX(src, operand, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0xA5);
- EmitOperand(src & 7, operand);
-}
-
-void Assembler::shrdq(Register dst, Register src, Register shifter) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- ASSERT(shifter == RCX);
- Operand operand(dst);
- EmitOperandREX(src, operand, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0xAD);
- EmitOperand(src & 7, operand);
-}
-
-void Assembler::incl(const Address& address) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(address);
- EmitOperandREX(0, operand, REX_NONE);
- EmitUint8(0xFF);
- EmitOperand(0, operand);
-}
-
-void Assembler::decl(const Address& address) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(address);
- EmitOperandREX(1, operand, REX_NONE);
- EmitUint8(0xFF);
- EmitOperand(1, operand);
-}
-
-void Assembler::incq(Register reg) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(reg);
- EmitOperandREX(0, operand, REX_W);
- EmitUint8(0xFF);
- EmitOperand(0, operand);
-}
-
-void Assembler::incq(const Address& address) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(address);
- EmitOperandREX(0, operand, REX_W);
- EmitUint8(0xFF);
- EmitOperand(0, operand);
-}
-
-void Assembler::decq(Register reg) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(reg);
- EmitOperandREX(1, operand, REX_W);
- EmitUint8(0xFF);
- EmitOperand(1, operand);
-}
-
-void Assembler::decq(const Address& address) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(address);
- EmitOperandREX(1, operand, REX_W);
- EmitUint8(0xFF);
- EmitOperand(1, operand);
-}
-
-void Assembler::negl(Register reg) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitRegisterREX(reg, REX_NONE);
- EmitUint8(0xF7);
- EmitOperand(3, Operand(reg));
-}
-
-void Assembler::negq(Register reg) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitRegisterREX(reg, REX_W);
- EmitUint8(0xF7);
- EmitOperand(3, Operand(reg));
-}
-
-void Assembler::notl(Register reg) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitRegisterREX(reg, REX_NONE);
- EmitUint8(0xF7);
- EmitUint8(0xD0 | (reg & 7));
-}
-
-void Assembler::notq(Register reg) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitRegisterREX(reg, REX_W);
- EmitUint8(0xF7);
- EmitUint8(0xD0 | (reg & 7));
-}
-
-void Assembler::bsrq(Register dst, Register src) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(src);
- EmitOperandREX(dst, operand, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0xBD);
- EmitOperand(dst & 7, operand);
-}
-
-void Assembler::btq(Register base, Register offset) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(base);
- EmitOperandREX(offset, operand, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0xA3);
- EmitOperand(offset & 7, operand);
-}
-
void Assembler::btq(Register base, int bit) {
ASSERT(bit >= 0 && bit < 64);
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
@@ -1824,16 +775,6 @@
EmitUint8(0x00);
}
-void Assembler::leave() {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xC9);
-}
-
-void Assembler::ret() {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xC3);
-}
-
void Assembler::nop(int size) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
// There are nops up to size 15, but for now just provide up to size 8.
@@ -1896,16 +837,6 @@
}
}
-void Assembler::int3() {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xCC);
-}
-
-void Assembler::hlt() {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF4);
-}
-
void Assembler::j(Condition condition, Label* label, bool near) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
if (label->IsBound()) {
@@ -1941,21 +872,6 @@
Bind(&no_jump);
}
-void Assembler::jmp(Register reg) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- Operand operand(reg);
- EmitOperandREX(4, operand, REX_NONE);
- EmitUint8(0xFF);
- EmitOperand(4, operand);
-}
-
-void Assembler::jmp(const Address& dst) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(4, dst, REX_NONE);
- EmitUint8(0xFF);
- EmitOperand(4, dst);
-}
-
void Assembler::jmp(Label* label, bool near) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
if (label->IsBound()) {
@@ -2009,33 +925,6 @@
jmp(TMP);
}
-void Assembler::lock() {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0xF0);
-}
-
-void Assembler::cmpxchgl(const Address& address, Register reg) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(reg, address, REX_NONE);
- EmitUint8(0x0F);
- EmitUint8(0xB1);
- EmitOperand(reg & 7, address);
-}
-
-void Assembler::cmpxchgq(const Address& address, Register reg) {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitOperandREX(reg, address, REX_W);
- EmitUint8(0x0F);
- EmitUint8(0xB1);
- EmitOperand(reg & 7, address);
-}
-
-void Assembler::cpuid() {
- AssemblerBuffer::EnsureCapacity ensured(&buffer_);
- EmitUint8(0x0F);
- EmitUint8(0xA2);
-}
-
void Assembler::CompareRegisters(Register a, Register b) {
cmpq(a, b);
}
@@ -2398,18 +1287,6 @@
addq(dest, inc_imm);
}
-void Assembler::DoubleNegate(XmmRegister d) {
- // {0x8000000000000000LL, 0x8000000000000000LL}
- movq(TMP, Address(THR, Thread::double_negate_address_offset()));
- xorpd(d, Address(TMP, 0));
-}
-
-void Assembler::DoubleAbs(XmmRegister reg) {
- // {0x7FFFFFFFFFFFFFFFLL, 0x7FFFFFFFFFFFFFFFLL}
- movq(TMP, Address(THR, Thread::double_abs_address_offset()));
- andpd(reg, Address(TMP, 0));
-}
-
void Assembler::Stop(const char* message, bool fixed_length_encoding) {
int64_t message_address = reinterpret_cast<int64_t>(message);
if (FLAG_print_stop_message) {
@@ -2880,9 +1757,9 @@
}
}
-void Assembler::EmitXmmRegisterOperand(int rm, XmmRegister xmm_reg) {
+void Assembler::EmitRegisterOperand(int rm, int reg) {
Operand operand;
- operand.SetModRM(3, static_cast<Register>(xmm_reg));
+ operand.SetModRM(3, static_cast<Register>(reg));
EmitOperand(rm, operand);
}
@@ -2894,16 +1771,21 @@
}
}
+void Assembler::EmitSignExtendedInt8(int rm,
+ const Operand& operand,
+ const Immediate& immediate) {
+ EmitUint8(0x83);
+ EmitOperand(rm, operand);
+ EmitUint8(immediate.value() & 0xFF);
+}
+
void Assembler::EmitComplex(int rm,
const Operand& operand,
const Immediate& immediate) {
ASSERT(rm >= 0 && rm < 8);
ASSERT(immediate.is_int32());
if (immediate.is_int8()) {
- // Use sign-extended 8-bit immediate.
- EmitUint8(0x83);
- EmitOperand(rm, operand);
- EmitUint8(immediate.value() & 0xFF);
+ EmitSignExtendedInt8(rm, operand, immediate);
} else if (operand.IsRegister(RAX)) {
// Use short form if the destination is rax.
EmitUint8(0x05 + (rm << 3));
@@ -2966,11 +1848,7 @@
Register shifter) {
AssemblerBuffer::EnsureCapacity ensured(&buffer_);
ASSERT(shifter == RCX);
- if (wide) {
- EmitRegisterREX(operand, REX_W);
- } else {
- EmitRegisterREX(operand, REX_NONE);
- }
+ EmitRegisterREX(operand, wide ? REX_W : REX_NONE);
EmitUint8(0xD3);
EmitOperand(rm, Operand(operand));
}
diff --git a/runtime/vm/compiler/assembler/assembler_x64.h b/runtime/vm/compiler/assembler/assembler_x64.h
index 49f51ae..5a9e9b0 100644
--- a/runtime/vm/compiler/assembler/assembler_x64.h
+++ b/runtime/vm/compiler/assembler/assembler_x64.h
@@ -12,6 +12,7 @@
#include "platform/assert.h"
#include "platform/utils.h"
#include "vm/constants_x64.h"
+#include "vm/constants_x86.h"
#include "vm/hash_map.h"
#include "vm/object.h"
@@ -31,6 +32,7 @@
bool is_int8() const { return Utils::IsInt(8, value_); }
bool is_uint8() const { return Utils::IsUint(8, value_); }
+ bool is_int16() const { return Utils::IsInt(16, value_); }
bool is_uint16() const { return Utils::IsUint(16, value_); }
bool is_int32() const { return Utils::IsInt(32, value_); }
bool is_uint32() const { return Utils::IsUint(32, value_); }
@@ -353,147 +355,222 @@
/*
* Emit Machine Instructions.
*/
- void call(Register reg);
- void call(const Address& address);
+ void call(Register reg) { EmitUnaryL(reg, 0xFF, 2); }
+ void call(const Address& address) { EmitUnaryL(address, 0xFF, 2); }
void call(Label* label);
void call(const ExternalLabel* label);
static const intptr_t kCallExternalLabelSize = 15;
void pushq(Register reg);
- void pushq(const Address& address);
+ void pushq(const Address& address) { EmitUnaryL(address, 0xFF, 6); }
void pushq(const Immediate& imm);
void PushImmediate(const Immediate& imm);
void popq(Register reg);
- void popq(const Address& address);
+ void popq(const Address& address) { EmitUnaryL(address, 0x8F, 0); }
void setcc(Condition condition, ByteRegister dst);
- void movl(Register dst, Register src);
+// Register-register, register-address and address-register instructions.
+#define RR(width, name, ...) \
+ void name(Register dst, Register src) { Emit##width(dst, src, __VA_ARGS__); }
+#define RA(width, name, ...) \
+ void name(Register dst, const Address& src) { \
+ Emit##width(dst, src, __VA_ARGS__); \
+ }
+#define AR(width, name, ...) \
+ void name(const Address& dst, Register src) { \
+ Emit##width(src, dst, __VA_ARGS__); \
+ }
+#define REGULAR_INSTRUCTION(name, ...) \
+ RA(W, name##w, __VA_ARGS__) \
+ RA(L, name##l, __VA_ARGS__) \
+ RA(Q, name##q, __VA_ARGS__) \
+ RR(W, name##w, __VA_ARGS__) \
+ RR(L, name##l, __VA_ARGS__) \
+ RR(Q, name##q, __VA_ARGS__)
+ REGULAR_INSTRUCTION(test, 0x85)
+ REGULAR_INSTRUCTION(xchg, 0x87)
+ REGULAR_INSTRUCTION(imul, 0xAF, 0x0F)
+ REGULAR_INSTRUCTION(bsr, 0xBD, 0x0F)
+#undef REGULAR_INSTRUCTION
+ RA(Q, movsxd, 0x63)
+ RR(Q, movsxd, 0x63)
+ AR(L, movb, 0x88)
+ AR(L, movl, 0x89)
+ AR(Q, movq, 0x89)
+ AR(W, movw, 0x89)
+ RA(L, movb, 0x8A)
+ RA(L, movl, 0x8B)
+ RA(Q, movq, 0x8B)
+ RR(L, movl, 0x8B)
+ RA(Q, leaq, 0x8D)
+ AR(L, cmpxchgl, 0xB1, 0x0F)
+ AR(Q, cmpxchgq, 0xB1, 0x0F)
+ RA(L, cmpxchgl, 0xB1, 0x0F)
+ RA(Q, cmpxchgq, 0xB1, 0x0F)
+ RR(L, cmpxchgl, 0xB1, 0x0F)
+ RR(Q, cmpxchgq, 0xB1, 0x0F)
+ RA(Q, movzxb, 0xB6, 0x0F)
+ RR(Q, movzxb, 0xB6, 0x0F)
+ RA(Q, movzxw, 0xB7, 0x0F)
+ RR(Q, movzxw, 0xB7, 0x0F)
+ RA(Q, movsxb, 0xBE, 0x0F)
+ RR(Q, movsxb, 0xBE, 0x0F)
+ RA(Q, movsxw, 0xBF, 0x0F)
+ RR(Q, movsxw, 0xBF, 0x0F)
+#define DECLARE_CMOV(name, code) \
+ RR(Q, cmov##name##q, 0x40 + code, 0x0F) \
+ RR(L, cmov##name##l, 0x40 + code, 0x0F) \
+ RA(Q, cmov##name##q, 0x40 + code, 0x0F) \
+ RA(L, cmov##name##l, 0x40 + code, 0x0F)
+ X86_CONDITIONAL_SUFFIXES(DECLARE_CMOV)
+#undef DECLARE_CMOV
+#undef AA
+#undef RA
+#undef AR
+
+#define SIMPLE(name, ...) \
+ void name() { EmitSimple(__VA_ARGS__); }
+ SIMPLE(cpuid, 0x0F, 0xA2)
+ SIMPLE(fcos, 0xD9, 0xFF)
+ SIMPLE(fincstp, 0xD9, 0xF7)
+ SIMPLE(fsin, 0xD9, 0xFE)
+ SIMPLE(lock, 0xF0)
+ SIMPLE(rep_movsb, 0xF3, 0xA4)
+#undef SIMPLE
+// XmmRegister operations with another register or an address.
+#define XX(width, name, ...) \
+ void name(XmmRegister dst, XmmRegister src) { \
+ Emit##width(dst, src, __VA_ARGS__); \
+ }
+#define XA(width, name, ...) \
+ void name(XmmRegister dst, const Address& src) { \
+ Emit##width(dst, src, __VA_ARGS__); \
+ }
+#define AX(width, name, ...) \
+ void name(const Address& dst, XmmRegister src) { \
+ Emit##width(src, dst, __VA_ARGS__); \
+ }
+ // We could add movupd here, but movups does the same and is shorter.
+ XA(L, movups, 0x10, 0x0F);
+ XA(L, movsd, 0x10, 0x0F, 0xF2)
+ XA(L, movss, 0x10, 0x0F, 0xF3)
+ AX(L, movups, 0x11, 0x0F);
+ AX(L, movsd, 0x11, 0x0F, 0xF2)
+ AX(L, movss, 0x11, 0x0F, 0xF3)
+ XX(L, movhlps, 0x12, 0x0F)
+ XX(L, unpcklps, 0x14, 0x0F)
+ XX(L, unpcklpd, 0x14, 0x0F, 0x66)
+ XX(L, unpckhps, 0x15, 0x0F)
+ XX(L, unpckhpd, 0x15, 0x0F, 0x66)
+ XX(L, movlhps, 0x16, 0x0F)
+ XX(L, movaps, 0x28, 0x0F)
+ XX(L, comisd, 0x2F, 0x0F, 0x66)
+#define DECLARE_XMM(name, code) \
+ XX(L, name##ps, 0x50 + code, 0x0F) \
+ XA(L, name##ps, 0x50 + code, 0x0F) \
+ AX(L, name##ps, 0x50 + code, 0x0F) \
+ XX(L, name##pd, 0x50 + code, 0x0F, 0x66) \
+ XA(L, name##pd, 0x50 + code, 0x0F, 0x66) \
+ AX(L, name##pd, 0x50 + code, 0x0F, 0x66) \
+ XX(L, name##sd, 0x50 + code, 0x0F, 0xF2) \
+ XA(L, name##sd, 0x50 + code, 0x0F, 0xF2) \
+ AX(L, name##sd, 0x50 + code, 0x0F, 0xF2) \
+ XX(L, name##ss, 0x50 + code, 0x0F, 0xF3) \
+ XA(L, name##ss, 0x50 + code, 0x0F, 0xF3) \
+ AX(L, name##ss, 0x50 + code, 0x0F, 0xF3)
+ XMM_ALU_CODES(DECLARE_XMM)
+#undef DECLARE_XMM
+ XX(L, cvtps2pd, 0x5A, 0x0F)
+ XX(L, cvtpd2ps, 0x5A, 0x0F, 0x66)
+ XX(L, cvtsd2ss, 0x5A, 0x0F, 0xF2)
+ XX(L, cvtss2sd, 0x5A, 0x0F, 0xF3)
+ XX(L, pxor, 0xEF, 0x0F, 0x66)
+ XX(L, subpl, 0xFA, 0x0F, 0x66)
+ XX(L, addpl, 0xFE, 0x0F, 0x66)
+#undef XX
+#undef AX
+#undef XA
+
+#define DECLARE_CMPPS(name, code) \
+ void cmpps##name(XmmRegister dst, XmmRegister src) { \
+ EmitL(dst, src, 0xC2, 0x0F); \
+ AssemblerBuffer::EnsureCapacity ensured(&buffer_); \
+ EmitUint8(code); \
+ }
+ XMM_CONDITIONAL_CODES(DECLARE_CMPPS)
+#undef DECLARE_CMPPS
+
+#define DECLARE_SIMPLE(name, opcode) \
+ void name() { EmitSimple(opcode); }
+ X86_ZERO_OPERAND_1_BYTE_INSTRUCTIONS(DECLARE_SIMPLE)
+#undef DECLARE_SIMPLE
+
void movl(Register dst, const Immediate& imm);
- void movl(Register dst, const Address& src);
- void movl(const Address& dst, Register src);
void movl(const Address& dst, const Immediate& imm);
- void movzxb(Register dst, Register src);
- void movzxb(Register dst, const Address& src);
- void movsxb(Register dst, Register src);
- void movsxb(Register dst, const Address& src);
- void movb(Register dst, const Address& src);
- void movb(const Address& dst, Register src);
void movb(const Address& dst, const Immediate& imm);
- void movzxw(Register dst, Register src);
- void movzxw(Register dst, const Address& src);
- void movsxw(Register dst, Register src);
- void movsxw(Register dst, const Address& src);
void movw(Register dst, const Address& src);
- void movw(const Address& dst, Register src);
void movw(const Address& dst, const Immediate& imm);
void movq(Register dst, const Immediate& imm);
- void movq(Register dst, Register src);
- void movq(Register dst, const Address& src);
- void movq(const Address& dst, Register src);
void movq(const Address& dst, const Immediate& imm);
- void movq(Register dst, XmmRegister src);
- void movsxd(Register dst, Register src);
- void movsxd(Register dst, const Address& src);
+ // Destination and source are reversed for some reason.
+ void movq(Register dst, XmmRegister src) {
+ EmitQ(src, dst, 0x7E, 0x0F, 0x66);
+ }
+ void movl(Register dst, XmmRegister src) {
+ EmitL(src, dst, 0x7E, 0x0F, 0x66);
+ }
+ void movss(XmmRegister dst, XmmRegister src) {
+ EmitL(src, dst, 0x11, 0x0F, 0xF3);
+ }
+ void movsd(XmmRegister dst, XmmRegister src) {
+ EmitL(src, dst, 0x11, 0x0F, 0xF2);
+ }
- void rep_movsb();
+ // Use the reversed operand order and the 0x89 bytecode instead of the
+ // obvious 0x88 encoding for this some, because it is expected by gdb64 older
+ // than 7.3.1-gg5 when disassembling a function's prologue (movq rbp, rsp)
+ // for proper unwinding of Dart frames (use --generate_gdb_symbols and -O0).
+ void movq(Register dst, Register src) { EmitQ(src, dst, 0x89); }
- void leaq(Register dst, const Address& src);
+ void movd(XmmRegister dst, Register src) {
+ EmitL(dst, src, 0x6E, 0x0F, 0x66);
+ }
+ void cvtsi2sdq(XmmRegister dst, Register src) {
+ EmitQ(dst, src, 0x2A, 0x0F, 0xF2);
+ }
+ void cvtsi2sdl(XmmRegister dst, Register src) {
+ EmitL(dst, src, 0x2A, 0x0F, 0xF2);
+ }
+ void cvttsd2siq(Register dst, XmmRegister src) {
+ EmitQ(dst, src, 0x2C, 0x0F, 0xF2);
+ }
+ void movmskpd(Register dst, XmmRegister src) {
+ EmitL(dst, src, 0x50, 0x0F, 0x66);
+ }
+ void movmskps(Register dst, XmmRegister src) { EmitL(dst, src, 0x50, 0x0F); }
- void cmovnoq(Register dst, Register src);
- void cmoveq(Register dst, Register src);
- void cmovgeq(Register dst, Register src);
- void cmovlessq(Register dst, Register src);
+ void btl(Register dst, Register src) { EmitL(src, dst, 0xA3, 0x0F); }
+ void btq(Register dst, Register src) { EmitQ(src, dst, 0xA3, 0x0F); }
- void movss(XmmRegister dst, const Address& src);
- void movss(const Address& dst, XmmRegister src);
- void movss(XmmRegister dst, XmmRegister src);
-
- void movd(XmmRegister dst, Register src);
- void movd(Register dst, XmmRegister src);
-
- void addss(XmmRegister dst, XmmRegister src);
- void subss(XmmRegister dst, XmmRegister src);
- void mulss(XmmRegister dst, XmmRegister src);
- void divss(XmmRegister dst, XmmRegister src);
-
- void movsd(XmmRegister dst, const Address& src);
- void movsd(const Address& dst, XmmRegister src);
- void movsd(XmmRegister dst, XmmRegister src);
-
- void movaps(XmmRegister dst, XmmRegister src);
-
- void movups(const Address& dst, XmmRegister src);
- void movups(XmmRegister dst, const Address& src);
-
- void addsd(XmmRegister dst, XmmRegister src);
- void subsd(XmmRegister dst, XmmRegister src);
- void mulsd(XmmRegister dst, XmmRegister src);
- void divsd(XmmRegister dst, XmmRegister src);
-
- void addpl(XmmRegister dst, XmmRegister src);
- void subpl(XmmRegister dst, XmmRegister src);
- void addps(XmmRegister dst, XmmRegister src);
- void subps(XmmRegister dst, XmmRegister src);
- void divps(XmmRegister dst, XmmRegister src);
- void mulps(XmmRegister dst, XmmRegister src);
- void minps(XmmRegister dst, XmmRegister src);
- void maxps(XmmRegister dst, XmmRegister src);
- void andps(XmmRegister dst, XmmRegister src);
- void andps(XmmRegister dst, const Address& src);
- void orps(XmmRegister dst, XmmRegister src);
- void notps(XmmRegister dst);
- void negateps(XmmRegister dst);
- void absps(XmmRegister dst);
- void zerowps(XmmRegister dst);
- void cmppseq(XmmRegister dst, XmmRegister src);
- void cmppsneq(XmmRegister dst, XmmRegister src);
- void cmppslt(XmmRegister dst, XmmRegister src);
- void cmppsle(XmmRegister dst, XmmRegister src);
- void cmppsnlt(XmmRegister dst, XmmRegister src);
- void cmppsnle(XmmRegister dst, XmmRegister src);
- void sqrtps(XmmRegister dst);
- void rsqrtps(XmmRegister dst);
- void reciprocalps(XmmRegister dst);
- void movhlps(XmmRegister dst, XmmRegister src);
- void movlhps(XmmRegister dst, XmmRegister src);
- void unpcklps(XmmRegister dst, XmmRegister src);
- void unpckhps(XmmRegister dst, XmmRegister src);
- void unpcklpd(XmmRegister dst, XmmRegister src);
- void unpckhpd(XmmRegister dst, XmmRegister src);
+ void notps(XmmRegister dst, XmmRegister src);
+ void negateps(XmmRegister dst, XmmRegister src);
+ void absps(XmmRegister dst, XmmRegister src);
+ void zerowps(XmmRegister dst, XmmRegister src);
void set1ps(XmmRegister dst, Register tmp, const Immediate& imm);
void shufps(XmmRegister dst, XmmRegister src, const Immediate& mask);
- void addpd(XmmRegister dst, XmmRegister src);
- void negatepd(XmmRegister dst);
- void subpd(XmmRegister dst, XmmRegister src);
- void mulpd(XmmRegister dst, XmmRegister src);
- void divpd(XmmRegister dst, XmmRegister src);
- void abspd(XmmRegister dst);
- void minpd(XmmRegister dst, XmmRegister src);
- void maxpd(XmmRegister dst, XmmRegister src);
- void sqrtpd(XmmRegister dst);
- void cvtps2pd(XmmRegister dst, XmmRegister src);
- void cvtpd2ps(XmmRegister dst, XmmRegister src);
+ void negatepd(XmmRegister dst, XmmRegister src);
+ void abspd(XmmRegister dst, XmmRegister src);
void shufpd(XmmRegister dst, XmmRegister src, const Immediate& mask);
- void comisd(XmmRegister a, XmmRegister b);
- void cvtsi2sdq(XmmRegister a, Register b);
- void cvtsi2sdl(XmmRegister a, Register b);
- void cvttsd2siq(Register dst, XmmRegister src);
-
- void cvtss2sd(XmmRegister dst, XmmRegister src);
- void cvtsd2ss(XmmRegister dst, XmmRegister src);
-
- void pxor(XmmRegister dst, XmmRegister src);
-
enum RoundingMode {
kRoundToNearest = 0x0,
kRoundDown = 0x1,
@@ -502,20 +579,12 @@
};
void roundsd(XmmRegister dst, XmmRegister src, RoundingMode mode);
- void xchgl(Register dst, Register src);
- void xchgq(Register dst, Register src);
-
- void cmpb(const Address& address, const Immediate& imm);
- void cmpw(const Address& address, const Immediate& imm);
-
void CompareImmediate(Register reg, const Immediate& imm);
void CompareImmediate(const Address& address, const Immediate& imm);
- void testl(Register reg1, Register reg2);
void testl(Register reg, const Immediate& imm) { testq(reg, imm); }
void testb(const Address& address, const Immediate& imm);
- void testq(Register reg1, Register reg2);
void testq(Register reg, const Immediate& imm);
void TestImmediate(Register dst, const Immediate& imm);
@@ -523,66 +592,61 @@
void OrImmediate(Register dst, const Immediate& imm);
void XorImmediate(Register dst, const Immediate& imm);
-// clang-format off
-// Macro for handling common ALU instructions. Arguments to F:
-// name, opcode, reversed opcode, opcode for the reg field of the modrm byte.
-#define ALU_OPS(F) \
- F(and, 0x23, 0x21, 4) \
- F(or, 0x0b, 0x09, 1) \
- F(xor, 0x33, 0x31, 6) \
- F(add, 0x03, 0x01, 0) \
- F(adc, 0x13, 0x11, 2) \
- F(sub, 0x2b, 0x29, 5) \
- F(sbb, 0x1b, 0x19, 3) \
- F(cmp, 0x3b, 0x39, 7)
-// clang-format on
-
-#define DECLARE_ALU(op, opcode, opcode2, modrm_opcode) \
- void op##w(Register dst, Register src) { Alu(2, opcode, dst, src); } \
- void op##l(Register dst, Register src) { Alu(4, opcode, dst, src); } \
- void op##q(Register dst, Register src) { Alu(8, opcode, dst, src); } \
- void op##w(Register dst, const Address& src) { Alu(2, opcode, dst, src); } \
- void op##l(Register dst, const Address& src) { Alu(4, opcode, dst, src); } \
- void op##q(Register dst, const Address& src) { Alu(8, opcode, dst, src); } \
- void op##w(const Address& dst, Register src) { Alu(2, opcode2, dst, src); } \
- void op##l(const Address& dst, Register src) { Alu(4, opcode2, dst, src); } \
- void op##q(const Address& dst, Register src) { Alu(8, opcode2, dst, src); } \
- void op##l(Register dst, const Immediate& imm) { \
- AluL(modrm_opcode, dst, imm); \
- } \
- void op##q(Register dst, const Immediate& imm) { \
- AluQ(modrm_opcode, opcode, dst, imm); \
- } \
- void op##l(const Address& dst, const Immediate& imm) { \
- AluL(modrm_opcode, dst, imm); \
- } \
- void op##q(const Address& dst, const Immediate& imm) { \
- AluQ(modrm_opcode, opcode, dst, imm); \
+ void shldq(Register dst, Register src, Register shifter) {
+ ASSERT(shifter == RCX);
+ EmitQ(src, dst, 0xA5, 0x0F);
+ }
+ void shrdq(Register dst, Register src, Register shifter) {
+ ASSERT(shifter == RCX);
+ EmitQ(src, dst, 0xAD, 0x0F);
}
- ALU_OPS(DECLARE_ALU);
+#define DECLARE_ALU(op, c) \
+ void op##w(Register dst, Register src) { EmitW(dst, src, c * 8 + 3); } \
+ void op##l(Register dst, Register src) { EmitL(dst, src, c * 8 + 3); } \
+ void op##q(Register dst, Register src) { EmitQ(dst, src, c * 8 + 3); } \
+ void op##w(Register dst, const Address& src) { EmitW(dst, src, c * 8 + 3); } \
+ void op##l(Register dst, const Address& src) { EmitL(dst, src, c * 8 + 3); } \
+ void op##q(Register dst, const Address& src) { EmitQ(dst, src, c * 8 + 3); } \
+ void op##w(const Address& dst, Register src) { EmitW(src, dst, c * 8 + 1); } \
+ void op##l(const Address& dst, Register src) { EmitL(src, dst, c * 8 + 1); } \
+ void op##q(const Address& dst, Register src) { EmitQ(src, dst, c * 8 + 1); } \
+ void op##l(Register dst, const Immediate& imm) { AluL(c, dst, imm); } \
+ void op##q(Register dst, const Immediate& imm) { \
+ AluQ(c, c * 8 + 3, dst, imm); \
+ } \
+ void op##b(const Address& dst, const Immediate& imm) { AluB(c, dst, imm); } \
+ void op##w(const Address& dst, const Immediate& imm) { AluW(c, dst, imm); } \
+ void op##l(const Address& dst, const Immediate& imm) { AluL(c, dst, imm); } \
+ void op##q(const Address& dst, const Immediate& imm) { \
+ AluQ(c, c * 8 + 3, dst, imm); \
+ }
+
+ X86_ALU_CODES(DECLARE_ALU)
#undef DECLARE_ALU
#undef ALU_OPS
- void cdq();
void cqo();
- void idivl(Register reg);
- void divl(Register reg);
+#define REGULAR_UNARY(name, opcode, modrm) \
+ void name##q(Register reg) { EmitUnaryQ(reg, opcode, modrm); } \
+ void name##l(Register reg) { EmitUnaryL(reg, opcode, modrm); } \
+ void name##q(const Address& address) { EmitUnaryQ(address, opcode, modrm); } \
+ void name##l(const Address& address) { EmitUnaryL(address, opcode, modrm); }
+ REGULAR_UNARY(not, 0xF7, 2)
+ REGULAR_UNARY(neg, 0xF7, 3)
+ REGULAR_UNARY(mul, 0xF7, 4)
+ REGULAR_UNARY(div, 0xF7, 6)
+ REGULAR_UNARY(idiv, 0xF7, 7)
+ REGULAR_UNARY(inc, 0xFF, 0)
+ REGULAR_UNARY(dec, 0xFF, 1)
+#undef REGULAR_UNARY
- void idivq(Register reg);
- void divq(Register reg);
-
- void imull(Register dst, Register src);
void imull(Register reg, const Immediate& imm);
- void mull(Register reg);
- void imulq(Register dst, Register src);
- void imulq(Register dst, const Address& address);
void imulq(Register dst, const Immediate& imm);
void MulImmediate(Register reg, const Immediate& imm);
- void mulq(Register reg);
void shll(Register reg, const Immediate& imm);
void shll(Register operand, Register shifter);
@@ -599,75 +663,28 @@
void sarq(Register reg, const Immediate& imm);
void sarq(Register operand, Register shifter);
void shldq(Register dst, Register src, const Immediate& imm);
- void shldq(Register dst, Register src, Register shifter);
- void shrdq(Register dst, Register src, Register shifter);
- void incl(const Address& address);
- void decl(const Address& address);
-
- void incq(Register reg);
- void incq(const Address& address);
- void decq(Register reg);
- void decq(const Address& address);
-
- void negl(Register reg);
- void negq(Register reg);
- void notl(Register reg);
- void notq(Register reg);
-
- void bsrq(Register dst, Register src);
-
- void btq(Register base, Register offset);
void btq(Register base, int bit);
void enter(const Immediate& imm);
- void leave();
- void ret();
-
- void movmskpd(Register dst, XmmRegister src);
- void movmskps(Register dst, XmmRegister src);
-
- void sqrtsd(XmmRegister dst, XmmRegister src);
-
- void xorpd(XmmRegister dst, const Address& src);
- void xorpd(XmmRegister dst, XmmRegister src);
-
- void xorps(XmmRegister dst, const Address& src);
- void xorps(XmmRegister dst, XmmRegister src);
-
- void andpd(XmmRegister dst, const Address& src);
void fldl(const Address& src);
void fstpl(const Address& dst);
- void fincstp();
void ffree(intptr_t value);
- void fsin();
- void fcos();
-
// 'size' indicates size in bytes and must be in the range 1..8.
void nop(int size = 1);
- void int3();
- void hlt();
static uword GetBreakInstructionFiller() { return 0xCCCCCCCCCCCCCCCC; }
void j(Condition condition, Label* label, bool near = kFarJump);
-
- void jmp(Register reg);
- void jmp(const Address& address);
+ void jmp(Register reg) { EmitUnaryL(reg, 0xFF, 4); }
+ void jmp(const Address& address) { EmitUnaryL(address, 0xFF, 4); }
void jmp(Label* label, bool near = kFarJump);
void jmp(const ExternalLabel* label);
void jmp(const StubEntry& stub_entry);
- void lock();
- void cmpxchgl(const Address& address, Register reg);
-
- void cmpxchgq(const Address& address, Register reg);
-
- void cpuid();
-
// Issue memory to memory move through a TMP register.
// TODO(koda): Assert that these are not used for heap objects.
void MoveMemoryToMemory(const Address& dst, const Address& src) {
@@ -688,10 +705,7 @@
xorq(mem2, TMP);
}
- /*
- * Macros for High-level operations and implemented on all architectures.
- */
-
+ // Methods for High-level operations and implemented on all architectures.
void CompareRegisters(Register a, Register b);
void BranchIf(Condition condition, Label* label) { j(condition, label); }
@@ -700,7 +714,7 @@
void PushRegister(Register r);
void PopRegister(Register r);
- // Macros for adding/subtracting an immediate value that may be loaded from
+ // Methods for adding/subtracting an immediate value that may be loaded from
// the constant pool.
// TODO(koda): Assert that these are not used for heap objects.
void AddImmediate(Register reg, const Immediate& imm);
@@ -760,10 +774,8 @@
// Increments a Smi field. Leaves flags in same state as an 'addq'.
void IncrementSmiField(const Address& dest, int64_t increment);
- void DoubleNegate(XmmRegister d);
- void FloatNegate(XmmRegister f);
-
- void DoubleAbs(XmmRegister reg);
+ void DoubleNegate(XmmRegister dst, XmmRegister src);
+ void DoubleAbs(XmmRegister dst, XmmRegister src);
void LockCmpxchgq(const Address& address, Register reg) {
lock();
@@ -796,9 +808,7 @@
// if platform ABI requires that. Does not restore RSP after the call itself.
void CallCFunction(Register reg);
- /*
- * Loading and comparing classes of objects.
- */
+ // Loading and comparing classes of objects.
void LoadClassId(Register result, Register object);
void LoadClassById(Register result, Register class_id);
@@ -816,9 +826,7 @@
// Value in the register object is untagged optimistically.
void SmiUntagOrCheckClass(Register object, intptr_t class_id, Label* smi);
- /*
- * Misc. functionality.
- */
+ // Misc. functionality.
void SmiTag(Register reg) { addq(reg, reg); }
void SmiUntag(Register reg) { sarq(reg, Immediate(kSmiTagSize)); }
@@ -1010,10 +1018,9 @@
void LoadObjectHelper(Register dst, const Object& obj, bool is_unique);
void LoadWordFromPoolOffset(Register dst, int32_t offset);
- void Alu(int bytes, uint8_t opcode, Register dst, Register src);
- void Alu(int bytes, uint8_t opcode, Register dst, const Address& src);
- void Alu(int bytes, uint8_t opcode, const Address& dst, Register src);
void AluL(uint8_t modrm_opcode, Register dst, const Immediate& imm);
+ void AluB(uint8_t modrm_opcode, const Address& dst, const Immediate& imm);
+ void AluW(uint8_t modrm_opcode, const Address& dst, const Immediate& imm);
void AluL(uint8_t modrm_opcode, const Address& dst, const Immediate& imm);
void AluQ(uint8_t modrm_opcode,
uint8_t opcode,
@@ -1024,6 +1031,37 @@
const Address& dst,
const Immediate& imm);
+ void EmitSimple(int opcode, int opcode2 = -1);
+ void EmitUnaryQ(Register reg, int opcode, int modrm_code);
+ void EmitUnaryL(Register reg, int opcode, int modrm_code);
+ void EmitUnaryQ(const Address& address, int opcode, int modrm_code);
+ void EmitUnaryL(const Address& address, int opcode, int modrm_code);
+ // The prefixes are in reverse order due to the rules of default arguments in
+ // C++.
+ void EmitQ(int reg,
+ const Address& address,
+ int opcode,
+ int prefix2 = -1,
+ int prefix1 = -1);
+ void EmitL(int reg,
+ const Address& address,
+ int opcode,
+ int prefix2 = -1,
+ int prefix1 = -1);
+ void EmitW(Register reg,
+ const Address& address,
+ int opcode,
+ int prefix2 = -1,
+ int prefix1 = -1);
+ void EmitQ(int dst, int src, int opcode, int prefix2 = -1, int prefix1 = -1);
+ void EmitL(int dst, int src, int opcode, int prefix2 = -1, int prefix1 = -1);
+ void EmitW(Register dst,
+ Register src,
+ int opcode,
+ int prefix2 = -1,
+ int prefix1 = -1);
+ void CmpPS(XmmRegister dst, XmmRegister src, int condition);
+
inline void EmitUint8(uint8_t value);
inline void EmitInt32(int32_t value);
inline void EmitUInt32(uint32_t value);
@@ -1033,24 +1071,16 @@
uint8_t rex,
bool force_emit = false);
inline void EmitOperandREX(int rm, const Operand& operand, uint8_t rex);
- inline void EmitXmmRegisterOperand(int rm, XmmRegister reg);
+ inline void EmitRegisterOperand(int rm, int reg);
inline void EmitFixup(AssemblerFixup* fixup);
inline void EmitOperandSizeOverride();
- inline void EmitREX_RB(XmmRegister reg,
- XmmRegister base,
- uint8_t rex = REX_NONE);
- inline void EmitREX_RB(XmmRegister reg,
- const Operand& operand,
- uint8_t rex = REX_NONE);
- inline void EmitREX_RB(XmmRegister reg,
- Register base,
- uint8_t rex = REX_NONE);
- inline void EmitREX_RB(Register reg,
- XmmRegister base,
- uint8_t rex = REX_NONE);
+ inline void EmitRegRegRex(int reg, int base, uint8_t rex = REX_NONE);
void EmitOperand(int rm, const Operand& operand);
void EmitImmediate(const Immediate& imm);
void EmitComplex(int rm, const Operand& operand, const Immediate& immediate);
+ void EmitSignExtendedInt8(int rm,
+ const Operand& operand,
+ const Immediate& immediate);
void EmitLabel(Label* label, intptr_t instruction_size);
void EmitLabelLink(Label* label);
void EmitNearLabelLink(Label* label);
@@ -1092,7 +1122,8 @@
}
inline void Assembler::EmitRegisterREX(Register reg, uint8_t rex, bool force) {
- ASSERT(reg != kNoRegister);
+ ASSERT(reg != kNoRegister && reg <= R15);
+ ASSERT(rex == REX_NONE || rex == REX_W);
rex |= (reg > 7 ? REX_B : REX_NONE);
if (rex != REX_NONE || force) EmitUint8(REX_PREFIX | rex);
}
@@ -1104,29 +1135,10 @@
if (rex != REX_NONE) EmitUint8(REX_PREFIX | rex);
}
-inline void Assembler::EmitREX_RB(XmmRegister reg,
- XmmRegister base,
- uint8_t rex) {
- if (reg > 7) rex |= REX_R;
- if (base > 7) rex |= REX_B;
- if (rex != REX_NONE) EmitUint8(REX_PREFIX | rex);
-}
-
-inline void Assembler::EmitREX_RB(XmmRegister reg,
- const Operand& operand,
- uint8_t rex) {
- if (reg > 7) rex |= REX_R;
- rex |= operand.rex();
- if (rex != REX_NONE) EmitUint8(REX_PREFIX | rex);
-}
-
-inline void Assembler::EmitREX_RB(XmmRegister reg, Register base, uint8_t rex) {
- if (reg > 7) rex |= REX_R;
- if (base > 7) rex |= REX_B;
- if (rex != REX_NONE) EmitUint8(REX_PREFIX | rex);
-}
-
-inline void Assembler::EmitREX_RB(Register reg, XmmRegister base, uint8_t rex) {
+inline void Assembler::EmitRegRegRex(int reg, int base, uint8_t rex) {
+ ASSERT(reg != kNoRegister && reg <= R15);
+ ASSERT(base != kNoRegister && base <= R15);
+ ASSERT(rex == REX_NONE || rex == REX_W);
if (reg > 7) rex |= REX_R;
if (base > 7) rex |= REX_B;
if (rex != REX_NONE) EmitUint8(REX_PREFIX | rex);
diff --git a/runtime/vm/compiler/assembler/assembler_x64_test.cc b/runtime/vm/compiler/assembler/assembler_x64_test.cc
index b8109d3..73ec3b7 100644
--- a/runtime/vm/compiler/assembler/assembler_x64_test.cc
+++ b/runtime/vm/compiler/assembler/assembler_x64_test.cc
@@ -959,7 +959,7 @@
EXPECT_DISASSEMBLY(
"movl rax,-0x........\n"
"movl rdx,0x7b\n"
- "cdql\n"
+ "cdq\n"
"movl rcx,0x2a\n"
"idivl (rax,rdx),rcx\n"
"ret\n");
@@ -1004,7 +1004,7 @@
EXPECT_DISASSEMBLY(
"movq rax,0x................\n"
"movl rdx,0x7b\n"
- "cdqq\n"
+ "cqo\n"
"movl rcx,0x2a\n"
"idivq (rax,rdx),rcx\n"
"ret\n");
@@ -1204,6 +1204,60 @@
"ret\n");
}
+ASSEMBLER_TEST_GENERATE(WordOps, assembler) {
+ __ movq(RAX, Immediate(0x0102030405060708));
+ __ pushq(RAX);
+ __ addw(Address(RSP, 0), Immediate(-0x201));
+ __ subw(Address(RSP, 2), Immediate(0x201));
+ __ xorw(Address(RSP, 4), Immediate(0x201));
+ __ andw(Address(RSP, 6), Immediate(0x301));
+ __ andw(Address(RSP, 0), Immediate(-1));
+ __ popq(RAX);
+ __ ret();
+}
+
+ASSEMBLER_TEST_RUN(WordOps, test) {
+ typedef int64_t (*WordOps)();
+ EXPECT_EQ(0x0100010503050507, reinterpret_cast<WordOps>(test->entry())());
+ EXPECT_DISASSEMBLY(
+ "movq rax,0x................\n"
+ "push rax\n"
+ "addw [rsp],0x....\n"
+ "subw [rsp+0x2],0x...\n"
+ "xorw [rsp+0x4],0x...\n"
+ "andw [rsp+0x6],0x...\n"
+ "andw [rsp],-1\n"
+ "pop rax\n"
+ "ret\n");
+}
+
+ASSEMBLER_TEST_GENERATE(ByteOps, assembler) {
+ __ movq(RAX, Immediate(0x0102030405060708));
+ __ pushq(RAX);
+ __ addb(Address(RSP, 0), Immediate(0xff));
+ __ subb(Address(RSP, 2), Immediate(1));
+ __ xorb(Address(RSP, 4), Immediate(1));
+ __ andb(Address(RSP, 6), Immediate(1));
+ __ andb(Address(RSP, 0), Immediate(-1));
+ __ popq(RAX);
+ __ ret();
+}
+
+ASSEMBLER_TEST_RUN(ByteOps, test) {
+ typedef int64_t (*ByteOps)();
+ EXPECT_EQ(0x0100030505050707, reinterpret_cast<ByteOps>(test->entry())());
+ EXPECT_DISASSEMBLY(
+ "movq rax,0x................\n"
+ "push rax\n"
+ "addb [rsp],-1\n"
+ "subb [rsp+0x2],1\n"
+ "xorb [rsp+0x4],1\n"
+ "andb [rsp+0x6],1\n"
+ "andb [rsp],-1\n"
+ "pop rax\n"
+ "ret\n");
+}
+
ASSEMBLER_TEST_GENERATE(MoveWordRex, assembler) {
__ pushq(Immediate(0));
__ movq(R8, RSP);
@@ -3161,7 +3215,7 @@
EnterTestFrame(assembler);
__ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0)));
__ movups(XMM10, Address(RAX, 0));
- __ negatepd(XMM10);
+ __ negatepd(XMM10, XMM10);
__ movaps(XMM0, XMM10);
LeaveTestFrame(assembler);
__ ret();
@@ -3191,8 +3245,7 @@
EnterTestFrame(assembler);
__ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0)));
__ movups(XMM10, Address(RAX, 0));
- __ abspd(XMM10);
- __ movaps(XMM0, XMM10);
+ __ abspd(XMM0, XMM10);
LeaveTestFrame(assembler);
__ ret();
}
@@ -3203,8 +3256,8 @@
EXPECT_DISASSEMBLY_NOT_WINDOWS_ENDS_WITH(
"movups xmm10,[rax]\n"
"movq r11,[thr+0x...]\n"
- "andpd xmm10,[r11]\n"
- "movaps xmm0,xmm10\n"
+ "movups xmm0,[r11]\n"
+ "andpd xmm0,xmm10\n"
"pop thr\n"
"pop pp\n"
"pop r12\n"
@@ -3278,7 +3331,7 @@
} constant0 = {16.0, 2.0};
__ movq(RAX, Immediate(reinterpret_cast<uword>(&constant0)));
__ movups(XMM10, Address(RAX, 0));
- __ sqrtpd(XMM10);
+ __ sqrtpd(XMM10, XMM10);
__ movaps(XMM0, XMM10);
__ ret();
}
@@ -3423,7 +3476,7 @@
EXPECT_FLOAT_EQ(9.0f, res, 0.000001f);
EXPECT_DISASSEMBLY_ENDS_WITH(
"movups xmm11,[rax]\n"
- "cvtsd2ss xmm10,xmm11\n"
+ "cvtps2pd xmm10,xmm11\n"
"movaps xmm0,xmm10\n"
"ret\n");
}
@@ -3604,9 +3657,9 @@
__ shufps(XMM0, XMM0, Immediate(0x0));
__ movaps(XMM11, XMM0); // Copy XMM0
- __ reciprocalps(XMM11); // 0.25
- __ sqrtps(XMM11); // 0.5
- __ rsqrtps(XMM0); // ~0.5
+ __ rcpps(XMM11, XMM11); // 0.25
+ __ sqrtps(XMM11, XMM11); // 0.5
+ __ rsqrtps(XMM0, XMM0); // ~0.5
__ subps(XMM0, XMM11); // ~0.0
__ shufps(XMM0, XMM0, Immediate(0x00)); // Copy second lane into all 4 lanes.
__ ret();
@@ -3650,13 +3703,44 @@
"movl rax,0x........\n"
"movd xmm1,rax\n"
"shufps xmm1,xmm1 [0]\n"
- "cmpps xmm0,xmm1 [0]\n"
+ "cmpps xmm0,xmm1 [eq]\n"
"push rax\n"
"movss [rsp],xmm0\n"
"pop rax\n"
"ret\n");
}
+ASSEMBLER_TEST_GENERATE(XmmAlu, assembler) {
+ // Test the disassembler.
+ __ addss(XMM0, XMM0);
+ __ addsd(XMM0, XMM0);
+ __ addps(XMM0, XMM0);
+ __ addpd(XMM0, XMM0);
+ __ cvtss2sd(XMM0, XMM0);
+ __ cvtsd2ss(XMM0, XMM0);
+ __ cvtps2pd(XMM0, XMM0);
+ __ cvtpd2ps(XMM0, XMM0);
+ __ movl(RAX, Immediate(0));
+ __ ret();
+}
+
+ASSEMBLER_TEST_RUN(XmmAlu, test) {
+ typedef intptr_t (*XmmAluTest)();
+ intptr_t res = reinterpret_cast<XmmAluTest>(test->entry())();
+ EXPECT_EQ(res, 0);
+ EXPECT_DISASSEMBLY(
+ "addss xmm0,xmm0\n"
+ "addsd xmm0,xmm0\n"
+ "addps xmm0,xmm0\n"
+ "addpd xmm0,xmm0\n"
+ "cvtss2sd xmm0,xmm0\n"
+ "cvtsd2ss xmm0,xmm0\n"
+ "cvtps2pd xmm0,xmm0\n"
+ "cvtpd2ps xmm0,xmm0\n"
+ "movl rax,0\n"
+ "ret\n");
+}
+
ASSEMBLER_TEST_GENERATE(PackedCompareNEQ, assembler) {
__ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(2.0f)));
__ set1ps(XMM1, RAX, Immediate(bit_cast<int32_t, float>(4.0f)));
@@ -3678,7 +3762,7 @@
"movl rax,0x........\n"
"movd xmm1,rax\n"
"shufps xmm1,xmm1 [0]\n"
- "cmpps xmm0,xmm1 [4]\n"
+ "cmpps xmm0,xmm1 [neq]\n"
"push rax\n"
"movss [rsp],xmm0\n"
"pop rax\n"
@@ -3706,7 +3790,7 @@
"movl rax,0x........\n"
"movd xmm1,rax\n"
"shufps xmm1,xmm1 [0]\n"
- "cmpps xmm0,xmm1 [1]\n"
+ "cmpps xmm0,xmm1 [lt]\n"
"push rax\n"
"movss [rsp],xmm0\n"
"pop rax\n"
@@ -3734,7 +3818,7 @@
"movl rax,0x........\n"
"movd xmm1,rax\n"
"shufps xmm1,xmm1 [0]\n"
- "cmpps xmm0,xmm1 [2]\n"
+ "cmpps xmm0,xmm1 [le]\n"
"push rax\n"
"movss [rsp],xmm0\n"
"pop rax\n"
@@ -3762,7 +3846,7 @@
"movl rax,0x........\n"
"movd xmm1,rax\n"
"shufps xmm1,xmm1 [0]\n"
- "cmpps xmm0,xmm1 [5]\n"
+ "cmpps xmm0,xmm1 [nlt]\n"
"push rax\n"
"movss [rsp],xmm0\n"
"pop rax\n"
@@ -3790,7 +3874,7 @@
"movl rax,0x........\n"
"movd xmm1,rax\n"
"shufps xmm1,xmm1 [0]\n"
- "cmpps xmm0,xmm1 [6]\n"
+ "cmpps xmm0,xmm1 [nle]\n"
"push rax\n"
"movss [rsp],xmm0\n"
"pop rax\n"
@@ -3802,7 +3886,7 @@
__ movl(RAX, Immediate(bit_cast<int32_t, float>(12.3f)));
__ movd(XMM0, RAX);
__ shufps(XMM0, XMM0, Immediate(0x0));
- __ negateps(XMM0);
+ __ negateps(XMM0, XMM0);
__ shufps(XMM0, XMM0, Immediate(0xAA)); // Copy third lane into all 4 lanes.
LeaveTestFrame(assembler);
__ ret();
@@ -3839,7 +3923,7 @@
__ movl(RAX, Immediate(bit_cast<int32_t, float>(-15.3f)));
__ movd(XMM0, RAX);
__ shufps(XMM0, XMM0, Immediate(0x0));
- __ absps(XMM0);
+ __ absps(XMM0, XMM0);
__ shufps(XMM0, XMM0, Immediate(0xAA)); // Copy third lane into all 4 lanes.
LeaveTestFrame(assembler);
__ ret();
@@ -3874,7 +3958,7 @@
ASSEMBLER_TEST_GENERATE(PackedSetWZero, assembler) {
EnterTestFrame(assembler);
__ set1ps(XMM0, RAX, Immediate(bit_cast<int32_t, float>(12.3f)));
- __ zerowps(XMM0);
+ __ zerowps(XMM0, XMM0);
__ shufps(XMM0, XMM0, Immediate(0xFF)); // Copy the W lane which is now 0.0.
LeaveTestFrame(assembler);
__ ret();
@@ -4032,8 +4116,7 @@
EnterTestFrame(assembler);
__ LoadImmediate(RAX, Immediate(reinterpret_cast<intptr_t>(&constant1)));
__ movups(XMM9, Address(RAX, 0));
- __ notps(XMM9);
- __ movaps(XMM0, XMM9);
+ __ notps(XMM0, XMM9);
__ pushq(RAX);
__ movss(Address(RSP, 0), XMM0);
__ popq(RAX);
@@ -4047,8 +4130,8 @@
EXPECT_DISASSEMBLY_NOT_WINDOWS_ENDS_WITH(
"movups xmm9,[rax]\n"
"movq r11,[thr+0x...]\n"
- "xorps xmm9,[r11]\n"
- "movaps xmm0,xmm9\n"
+ "movups xmm0,[r11]\n"
+ "xorps xmm0,xmm9\n"
"push rax\n"
"movss [rsp],xmm0\n"
"pop rax\n"
@@ -5036,12 +5119,11 @@
#if defined(HOST_OS_WINDOWS)
// First argument is code object, second argument is thread. MSVC passes
// third argument in XMM2.
- __ DoubleAbs(XMM2);
- __ movaps(XMM0, XMM2);
+ __ DoubleAbs(XMM0, XMM2);
#else
// SysV ABI allocates integral and double registers for arguments
// independently.
- __ DoubleAbs(XMM0);
+ __ DoubleAbs(XMM0, XMM0);
#endif
LeaveTestFrame(assembler);
__ ret();
@@ -5221,7 +5303,7 @@
"movq rsi,[rsp+0x10]\n"
"movq rdi,[rsp+0x8]\n"
"movq rcx,[rsp]\n"
- "rep movsl\n"
+ "rep movsb\n"
"pop rax\n"
"pop rax\n"
"pop rax\n"
@@ -5234,7 +5316,7 @@
__ cmpq(CallingConventions::kArg1Reg, CallingConventions::kArg2Reg);
__ movq(RDX, Immediate(1)); // Greater equal.
__ movq(RCX, Immediate(-1)); // Less
- __ cmovlessq(RAX, RCX);
+ __ cmovlq(RAX, RCX);
__ cmovgeq(RAX, RDX);
__ ret();
}
diff --git a/runtime/vm/compiler/assembler/disassembler_dbc.cc b/runtime/vm/compiler/assembler/disassembler_dbc.cc
index 1047cc0..7947d9f 100644
--- a/runtime/vm/compiler/assembler/disassembler_dbc.cc
+++ b/runtime/vm/compiler/assembler/disassembler_dbc.cc
@@ -178,6 +178,21 @@
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); \
diff --git a/runtime/vm/compiler/assembler/disassembler_x86.cc b/runtime/vm/compiler/assembler/disassembler_x86.cc
index 0ad5603..459eb4c 100644
--- a/runtime/vm/compiler/assembler/disassembler_x86.cc
+++ b/runtime/vm/compiler/assembler/disassembler_x86.cc
@@ -41,40 +41,13 @@
const char* mnem;
};
+#define ALU_ENTRY(name, code) \
+ {code * 8 + 0, BYTE_OPER_REG_OP_ORDER, #name}, \
+ {code * 8 + 1, OPER_REG_OP_ORDER, #name}, \
+ {code * 8 + 2, BYTE_REG_OPER_OP_ORDER, #name}, \
+ {code * 8 + 3, REG_OPER_OP_ORDER, #name},
static const ByteMnemonic two_operands_instr[] = {
- {0x00, BYTE_OPER_REG_OP_ORDER, "add"},
- {0x01, OPER_REG_OP_ORDER, "add"},
- {0x02, BYTE_REG_OPER_OP_ORDER, "add"},
- {0x03, REG_OPER_OP_ORDER, "add"},
- {0x08, BYTE_OPER_REG_OP_ORDER, "or"},
- {0x09, OPER_REG_OP_ORDER, "or"},
- {0x0A, BYTE_REG_OPER_OP_ORDER, "or"},
- {0x0B, REG_OPER_OP_ORDER, "or"},
- {0x10, BYTE_OPER_REG_OP_ORDER, "adc"},
- {0x11, OPER_REG_OP_ORDER, "adc"},
- {0x12, BYTE_REG_OPER_OP_ORDER, "adc"},
- {0x13, REG_OPER_OP_ORDER, "adc"},
- {0x18, BYTE_OPER_REG_OP_ORDER, "sbb"},
- {0x19, OPER_REG_OP_ORDER, "sbb"},
- {0x1A, BYTE_REG_OPER_OP_ORDER, "sbb"},
- {0x1B, REG_OPER_OP_ORDER, "sbb"},
- {0x20, BYTE_OPER_REG_OP_ORDER, "and"},
- {0x21, OPER_REG_OP_ORDER, "and"},
- {0x22, BYTE_REG_OPER_OP_ORDER, "and"},
- {0x23, REG_OPER_OP_ORDER, "and"},
- {0x28, BYTE_OPER_REG_OP_ORDER, "sub"},
- {0x29, OPER_REG_OP_ORDER, "sub"},
- {0x2A, BYTE_REG_OPER_OP_ORDER, "sub"},
- {0x2B, REG_OPER_OP_ORDER, "sub"},
- {0x30, BYTE_OPER_REG_OP_ORDER, "xor"},
- {0x31, OPER_REG_OP_ORDER, "xor"},
- {0x32, BYTE_REG_OPER_OP_ORDER, "xor"},
- {0x33, REG_OPER_OP_ORDER, "xor"},
- {0x38, BYTE_OPER_REG_OP_ORDER, "cmp"},
- {0x39, OPER_REG_OP_ORDER, "cmp"},
- {0x3A, BYTE_REG_OPER_OP_ORDER, "cmp"},
- {0x3B, REG_OPER_OP_ORDER, "cmp"},
- {0x63, REG_OPER_OP_ORDER, "movsxd"},
+ X86_ALU_CODES(ALU_ENTRY){0x63, REG_OPER_OP_ORDER, "movsxd"},
{0x84, BYTE_REG_OPER_OP_ORDER, "test"},
{0x85, REG_OPER_OP_ORDER, "test"},
{0x86, BYTE_REG_OPER_OP_ORDER, "xchg"},
@@ -86,31 +59,29 @@
{0x8D, REG_OPER_OP_ORDER, "lea"},
{-1, UNSET_OP_ORDER, ""}};
+#define ZERO_OPERAND_ENTRY(name, opcode) {opcode, UNSET_OP_ORDER, #name},
static const ByteMnemonic zero_operands_instr[] = {
- {0xC3, UNSET_OP_ORDER, "ret"}, {0xC9, UNSET_OP_ORDER, "leave"},
- {0xF4, UNSET_OP_ORDER, "hlt"}, {0xFC, UNSET_OP_ORDER, "cld"},
- {0xCC, UNSET_OP_ORDER, "int3"}, {0x60, UNSET_OP_ORDER, "pushad"},
- {0x61, UNSET_OP_ORDER, "popad"}, {0x9C, UNSET_OP_ORDER, "pushfd"},
- {0x9D, UNSET_OP_ORDER, "popfd"}, {0x9E, UNSET_OP_ORDER, "sahf"},
- {0x99, UNSET_OP_ORDER, "cdq"}, {0x9B, UNSET_OP_ORDER, "fwait"},
- {0xA4, UNSET_OP_ORDER, "movs"}, {0xA5, UNSET_OP_ORDER, "movs"},
- {0xA6, UNSET_OP_ORDER, "cmps"}, {0xA7, UNSET_OP_ORDER, "cmps"},
- {-1, UNSET_OP_ORDER, ""}};
+ X86_ZERO_OPERAND_1_BYTE_INSTRUCTIONS(ZERO_OPERAND_ENTRY){-1, UNSET_OP_ORDER,
+ ""}};
static const ByteMnemonic call_jump_instr[] = {{0xE8, UNSET_OP_ORDER, "call"},
{0xE9, UNSET_OP_ORDER, "jmp"},
{-1, UNSET_OP_ORDER, ""}};
+#define SHORT_IMMEDIATE_ENTRY(name, code) {code * 8 + 5, UNSET_OP_ORDER, #name},
static const ByteMnemonic short_immediate_instr[] = {
- {0x05, UNSET_OP_ORDER, "add"}, {0x0D, UNSET_OP_ORDER, "or"},
- {0x15, UNSET_OP_ORDER, "adc"}, {0x1D, UNSET_OP_ORDER, "sbb"},
- {0x25, UNSET_OP_ORDER, "and"}, {0x2D, UNSET_OP_ORDER, "sub"},
- {0x35, UNSET_OP_ORDER, "xor"}, {0x3D, UNSET_OP_ORDER, "cmp"},
- {-1, UNSET_OP_ORDER, ""}};
+ X86_ALU_CODES(SHORT_IMMEDIATE_ENTRY){-1, UNSET_OP_ORDER, ""}};
static const char* const conditional_code_suffix[] = {
- "o", "no", "c", "nc", "z", "nz", "na", "a",
- "s", "ns", "pe", "po", "l", "ge", "le", "g"};
+#define STRINGIFY(name, number) #name,
+ X86_CONDITIONAL_SUFFIXES(STRINGIFY)
+#undef STRINGIFY
+};
+
+#define STRINGIFY_NAME(name, code) #name,
+static const char* const xmm_conditional_code_suffix[] = {
+ XMM_CONDITIONAL_CODES(STRINGIFY_NAME)};
+#undef STRINGIFY_NAME
enum InstructionType {
NO_INSTR,
@@ -133,6 +104,18 @@
REPEQ_PREFIX = REP_PREFIX
};
+struct XmmMnemonic {
+ const char* ps_name;
+ const char* pd_name;
+ const char* ss_name;
+ const char* sd_name;
+};
+
+#define XMM_INSTRUCTION_ENTRY(name, code) \
+ {#name "ps", #name "pd", #name "ss", #name "sd"},
+static const XmmMnemonic xmm_instructions[] = {
+ XMM_ALU_CODES(XMM_INSTRUCTION_ENTRY)};
+
struct InstructionDesc {
const char* mnem;
InstructionType type;
@@ -605,7 +588,7 @@
// Returns number of bytes used by machine instruction, including *data byte.
// Writes immediate instructions to 'tmp_buffer_'.
int DisassemblerX64::PrintImmediateOp(uint8_t* data) {
- bool byte_size_immediate = (*data & 0x02) != 0;
+ bool byte_size_immediate = (*data & 0x03) != 1;
uint8_t modrm = *(data + 1);
int mod, regop, rm;
get_modrm(modrm, &mod, ®op, &rm);
@@ -1153,13 +1136,11 @@
// REP.
Print("rep ");
}
- // TODO(srdjan): Should we enable printing of REX.W?
- // if (rex_w()) Print("REX.W ");
- Print("%s%s", idesc.mnem, operand_size_code());
- } else if (current == 0xC3 || current == 0xCC) {
- Print("%s", idesc.mnem); // ret and int3 don't need a size specifier.
+ Print("%s", idesc.mnem);
+ } else if (current == 0x99 && rex_w()) {
+ Print("cqo"); // Cdql is called cdq and cdqq is called cqo.
} else {
- Print("%s%s", idesc.mnem, operand_size_code());
+ Print("%s", idesc.mnem);
}
(*data)++;
break;
@@ -1347,16 +1328,14 @@
current += PrintRightXMMOperand(current);
} else {
const char* mnemonic = "?";
- if (opcode == 0x14) {
+ if (opcode == 0x5A) {
+ mnemonic = "cvtpd2ps";
+ } else if (0x51 <= opcode && opcode <= 0x5F) {
+ mnemonic = xmm_instructions[opcode & 0xF].pd_name;
+ } else if (opcode == 0x14) {
mnemonic = "unpcklpd";
} else if (opcode == 0x15) {
mnemonic = "unpckhpd";
- } else if (opcode == 0x54) {
- mnemonic = "andpd";
- } else if (opcode == 0x56) {
- mnemonic = "orpd";
- } else if (opcode == 0x57) {
- mnemonic = "xorpd";
} else if (opcode == 0x2E) {
mnemonic = "ucomisd";
} else if (opcode == 0x2F) {
@@ -1365,22 +1344,6 @@
mnemonic = "paddd";
} else if (opcode == 0xFA) {
mnemonic = "psubd";
- } else if (opcode == 0x58) {
- mnemonic = "addpd";
- } else if (opcode == 0x5C) {
- mnemonic = "subpd";
- } else if (opcode == 0x59) {
- mnemonic = "mulpd";
- } else if (opcode == 0x5E) {
- mnemonic = "divpd";
- } else if (opcode == 0x5D) {
- mnemonic = "minpd";
- } else if (opcode == 0x5F) {
- mnemonic = "maxpd";
- } else if (opcode == 0x51) {
- mnemonic = "sqrtpd";
- } else if (opcode == 0x5A) {
- mnemonic = "cvtpd2ps";
} else if (opcode == 0xEF) {
mnemonic = "pxor";
} else {
@@ -1424,10 +1387,12 @@
get_modrm(*current, &mod, ®op, &rm);
Print("cvtsd2si%s %s,", operand_size_code(), NameOfCPURegister(regop));
current += PrintRightXMMOperand(current);
- } else if ((opcode & 0xF8) == 0x58 || opcode == 0x51) {
- // XMM arithmetic. Mnemonic was retrieved at the start of this function.
+ } else if (0x51 <= opcode && opcode <= 0x5F) {
+ // XMM arithmetic. Get the F2 0F prefix version of the mnemonic.
int mod, regop, rm;
get_modrm(*current, &mod, ®op, &rm);
+ const char* mnemonic =
+ opcode == 0x5A ? "cvtsd2ss" : xmm_instructions[opcode & 0xF].sd_name;
Print("%s %s,", mnemonic, NameOfXMMRegister(regop));
current += PrintRightXMMOperand(current);
} else {
@@ -1463,17 +1428,10 @@
NameOfCPURegister(regop));
current += PrintRightXMMOperand(current);
} else if (0x51 <= opcode && opcode <= 0x5F) {
- static const char* mnemonics[] = {"sqrtss", "rsqrtss", "rcpss", NULL,
- NULL, NULL, NULL, "addss",
- "mulss", "cvtss2sd", NULL, "subss",
- "minss", "divss", "maxss"};
int mod, regop, rm;
get_modrm(*current, &mod, ®op, &rm);
- const char* mnemonic = mnemonics[opcode - 0x51];
- if (mnemonic == NULL) {
- UnimplementedInstruction();
- mnemonic = "UNIMPLEMENTED";
- }
+ const char* mnemonic =
+ opcode == 0x5A ? "cvtss2sd" : xmm_instructions[opcode & 0xF].ss_name;
Print("%s %s,", mnemonic, NameOfXMMRegister(regop));
current += PrintRightXMMOperand(current);
} else if (opcode == 0x7E) {
@@ -1553,18 +1511,10 @@
Print("%s %s,", mnemonic, NameOfXMMRegister(regop));
current += PrintRightXMMOperand(current);
} else if (0x51 <= opcode && opcode <= 0x5F) {
- // ...ps xmm, xmm/m128
- static const char* mnemonics[] = {"sqrtps", "rsqrtps", "rcpps", "andps",
- NULL, "orps", "xorps", "addps",
- "mulps", "cvtsd2ss", NULL, "subps",
- "minps", "divps", "maxps"};
- const char* mnemonic = mnemonics[opcode - 0x51];
- if (mnemonic == NULL) {
- UnimplementedInstruction();
- mnemonic = "???";
- }
int mod, regop, rm;
get_modrm(*current, &mod, ®op, &rm);
+ const char* mnemonic =
+ opcode == 0x5A ? "cvtps2pd" : xmm_instructions[opcode & 0xF].ps_name;
Print("%s %s,", mnemonic, NameOfXMMRegister(regop));
current += PrintRightXMMOperand(current);
} else if (opcode == 0xC2 || opcode == 0xC6) {
@@ -1572,12 +1522,14 @@
get_modrm(*current, &mod, ®op, &rm);
if (opcode == 0xC2) {
Print("cmpps %s,", NameOfXMMRegister(regop));
+ current += PrintRightXMMOperand(current);
+ Print(" [%s]", xmm_conditional_code_suffix[*current]);
} else {
ASSERT(opcode == 0xC6);
Print("shufps %s,", NameOfXMMRegister(regop));
+ current += PrintRightXMMOperand(current);
+ Print(" [%x]", *current);
}
- current += PrintRightXMMOperand(current);
- Print(" [%x]", *current);
current++;
} else if ((opcode & 0xF0) == 0x80) {
// Jcc: Conditional jump (branch).
@@ -1625,12 +1577,10 @@
// The argument is the second byte of the two-byte opcode.
// Returns NULL if the instruction is not handled here.
const char* DisassemblerX64::TwoByteMnemonic(uint8_t opcode) {
- if (0x51 <= opcode && opcode <= 0x5F) {
- static const char* mnemonics[] = {"sqrtsd", "rsqrtsd", "rcpsd", NULL,
- NULL, NULL, NULL, "addsd",
- "mulsd", NULL, NULL, "subsd",
- "minsd", "divsd", "maxsd"};
- return mnemonics[opcode - 0x51];
+ if (opcode == 0x5A) {
+ return "cvtps2pd";
+ } else if (0x51 <= opcode && opcode <= 0x5F) {
+ return xmm_instructions[opcode & 0xF].ps_name;
}
if (0xA2 <= opcode && opcode <= 0xBF) {
static const char* mnemonics[] = {
@@ -1759,11 +1709,8 @@
} break;
case 0x80: {
- data++;
- Print("cmpb ");
- data += PrintRightByteOperand(data);
- Print(",");
- data += PrintImmediate(data, BYTE_SIZE);
+ byte_size_operand_ = true;
+ data += PrintImmediateOp(data);
} break;
case 0x88: // 8bit, fall through
diff --git a/runtime/vm/compiler/backend/constant_propagator.cc b/runtime/vm/compiler/backend/constant_propagator.cc
index 5b3efa4..5195eba 100644
--- a/runtime/vm/compiler/backend/constant_propagator.cc
+++ b/runtime/vm/compiler/backend/constant_propagator.cc
@@ -229,6 +229,8 @@
void ConstantPropagator::VisitCheckSmi(CheckSmiInstr* instr) {}
+void ConstantPropagator::VisitTailCall(TailCallInstr* instr) {}
+
void ConstantPropagator::VisitCheckNull(CheckNullInstr* instr) {}
void ConstantPropagator::VisitGenericCheckBound(GenericCheckBoundInstr* instr) {
@@ -630,6 +632,15 @@
SetValue(instr, non_constant_);
}
+void ConstantPropagator::VisitLoadIndexedUnsafe(LoadIndexedUnsafeInstr* instr) {
+ SetValue(instr, non_constant_);
+}
+
+void ConstantPropagator::VisitStoreIndexedUnsafe(
+ StoreIndexedUnsafeInstr* instr) {
+ SetValue(instr, non_constant_);
+}
+
void ConstantPropagator::VisitStoreIndexed(StoreIndexedInstr* instr) {
SetValue(instr, instr->value()->definition()->constant_value());
}
diff --git a/runtime/vm/compiler/backend/flow_graph.cc b/runtime/vm/compiler/backend/flow_graph.cc
index d532101..b718238 100644
--- a/runtime/vm/compiler/backend/flow_graph.cc
+++ b/runtime/vm/compiler/backend/flow_graph.cc
@@ -33,8 +33,9 @@
current_ssa_temp_index_(0),
max_block_id_(max_block_id),
parsed_function_(parsed_function),
- num_copied_params_(parsed_function.num_copied_params()),
- num_non_copied_params_(parsed_function.num_non_copied_params()),
+ num_direct_parameters_(parsed_function.function().HasOptionalParameters()
+ ? 0
+ : parsed_function.function().NumParameters()),
graph_entry_(graph_entry),
preorder_(),
postorder_(),
@@ -42,7 +43,6 @@
optimized_block_order_(),
constant_null_(NULL),
constant_dead_(NULL),
- constant_empty_context_(NULL),
licm_allowed_(true),
prologue_info_(prologue_info),
loop_headers_(NULL),
@@ -611,7 +611,7 @@
explicit VariableLivenessAnalysis(FlowGraph* flow_graph)
: LivenessAnalysis(flow_graph->variable_count(), flow_graph->postorder()),
flow_graph_(flow_graph),
- num_non_copied_params_(flow_graph->num_non_copied_params()),
+ num_direct_parameters_(flow_graph->num_direct_parameters()),
assigned_vars_() {}
// For every block (in preorder) compute and return set of variables that
@@ -656,7 +656,7 @@
return false;
}
if (store->is_last()) {
- const intptr_t index = store->local().BitIndexIn(num_non_copied_params_);
+ const intptr_t index = store->local().BitIndexIn(num_direct_parameters_);
return GetLiveOutSet(block)->Contains(index);
}
@@ -669,7 +669,7 @@
if (load->local().Equals(*flow_graph_->CurrentContextVar())) {
return false;
}
- const intptr_t index = load->local().BitIndexIn(num_non_copied_params_);
+ const intptr_t index = load->local().BitIndexIn(num_direct_parameters_);
return load->is_last() && !GetLiveOutSet(block)->Contains(index);
}
@@ -677,7 +677,7 @@
virtual void ComputeInitialSets();
const FlowGraph* flow_graph_;
- const intptr_t num_non_copied_params_;
+ const intptr_t num_direct_parameters_;
GrowableArray<BitVector*> assigned_vars_;
};
@@ -709,7 +709,7 @@
LoadLocalInstr* load = current->AsLoadLocal();
if (load != NULL) {
- const intptr_t index = load->local().BitIndexIn(num_non_copied_params_);
+ const intptr_t index = load->local().BitIndexIn(num_direct_parameters_);
if (index >= live_in->length()) continue; // Skip tmp_locals.
live_in->Add(index);
if (!last_loads->Contains(index)) {
@@ -722,7 +722,7 @@
StoreLocalInstr* store = current->AsStoreLocal();
if (store != NULL) {
const intptr_t index =
- store->local().BitIndexIn(num_non_copied_params_);
+ store->local().BitIndexIn(num_direct_parameters_);
if (index >= live_in->length()) continue; // Skip tmp_locals.
if (kill->Contains(index)) {
if (!live_in->Contains(index)) {
@@ -946,13 +946,9 @@
ZoneGrowableArray<Definition*>* inlining_parameters) {
GraphEntryInstr* entry = graph_entry();
- // Initial renaming environment.
- GrowableArray<Definition*> env(variable_count());
-
// Add global constants to the initial definitions.
constant_null_ = GetConstant(Object::ZoneHandle());
constant_dead_ = GetConstant(Symbols::OptimizedOut());
- constant_empty_context_ = GetConstant(Object::empty_context());
// Check if inlining_parameters include a type argument vector parameter.
const intptr_t inlined_type_args_param =
@@ -961,66 +957,73 @@
? 1
: 0;
- // Add parameters to the initial definitions and renaming environment.
- if (inlining_parameters != NULL) {
- // Use known parameters.
- ASSERT(inlined_type_args_param + parameter_count() ==
- inlining_parameters->length());
- for (intptr_t i = 0; i < parameter_count(); ++i) {
- // If inlined_type_args_param == 1, then (*inlining_parameters)[0]
- // is the passed-in type args. We do not add it to env[0] but to
- // env[parameter_count()] below.
- Definition* defn = (*inlining_parameters)[inlined_type_args_param + i];
- AllocateSSAIndexes(defn);
- AddToInitialDefinitions(defn);
- env.Add(defn);
- }
- } else {
- // Create new parameters. For functions compiled for OSR, the locals
- // are unknown and so treated like parameters.
- intptr_t count = IsCompiledForOsr() ? variable_count() : parameter_count();
- for (intptr_t i = 0; i < count; ++i) {
+ // Initial renaming environment.
+ GrowableArray<Definition*> env(variable_count());
+ {
+ const intptr_t parameter_count =
+ IsCompiledForOsr() ? variable_count() : num_direct_parameters_;
+ for (intptr_t i = 0; i < parameter_count; i++) {
ParameterInstr* param = new (zone()) ParameterInstr(i, entry);
- param->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp.
+ param->set_ssa_temp_index(alloc_ssa_temp_index());
AddToInitialDefinitions(param);
env.Add(param);
}
+ ASSERT(env.length() == parameter_count);
+
+ // Fill in all local variables with `null` (for osr the stack locals have
+ // already been been handled above).
+ if (!IsCompiledForOsr()) {
+ ASSERT(env.length() == num_direct_parameters_);
+ env.FillWith(constant_null(), num_direct_parameters_, num_stack_locals());
+ }
}
- // Initialize all locals in the renaming environment For OSR, the locals have
- // already been handled as parameters.
- if (!IsCompiledForOsr()) {
- intptr_t i = parameter_count();
- if (isolate()->reify_generic_functions() && function().IsGeneric()) {
- // The first local is the slot holding the copied passed-in type args.
- // TODO(regis): Do we need the SpecialParameterInstr if the type_args_var
- // is not needed? Add an assert for now:
- ASSERT(parsed_function().function_type_arguments() != NULL);
- Definition* defn;
- if (inlining_parameters == NULL) {
- defn = new SpecialParameterInstr(SpecialParameterInstr::kTypeArgs,
- Thread::kNoDeoptId);
- } else {
- defn = (*inlining_parameters)[0];
+ // Override the entries in the renaming environment which are special (i.e.
+ // inlining arguments, type parameter, args descriptor, context, ...)
+ {
+ // Replace parameter slots with inlining definitions coming in.
+ if (inlining_parameters != NULL) {
+ for (intptr_t i = 0; i < function().NumParameters(); ++i) {
+ Definition* defn = (*inlining_parameters)[inlined_type_args_param + i];
+ AllocateSSAIndexes(defn);
+ AddToInitialDefinitions(defn);
+
+ intptr_t index = parsed_function_.RawParameterVariable(i)->BitIndexIn(
+ num_direct_parameters_);
+ env[index] = defn;
}
- AllocateSSAIndexes(defn);
- AddToInitialDefinitions(defn);
- env.Add(defn);
- ++i;
}
- for (; i < variable_count(); ++i) {
- if (i == CurrentContextEnvIndex()) {
- if (function().IsClosureFunction()) {
- SpecialParameterInstr* context = new SpecialParameterInstr(
- SpecialParameterInstr::kContext, Thread::kNoDeoptId);
- context->set_ssa_temp_index(alloc_ssa_temp_index()); // New SSA temp.
- AddToInitialDefinitions(context);
- env.Add(context);
+
+ if (!IsCompiledForOsr()) {
+ const bool reify_generic_argument =
+ function().IsGeneric() && isolate()->reify_generic_functions();
+
+ // Replace the type arguments slot with a special parameter.
+ if (reify_generic_argument) {
+ ASSERT(parsed_function().function_type_arguments() != NULL);
+
+ Definition* defn;
+ if (inlining_parameters == NULL) {
+ // Note: If we are not inlining, then the prologue builder will
+ // take care of checking that we got the correct reified type
+ // arguments. This includes checking the argument descriptor in order
+ // to even find out if the parameter was passed or not.
+ defn = constant_dead();
} else {
- env.Add(constant_empty_context());
+ defn = (*inlining_parameters)[0];
}
- } else {
- env.Add(constant_null());
+ AllocateSSAIndexes(defn);
+ AddToInitialDefinitions(defn);
+ env[RawTypeArgumentEnvIndex()] = defn;
+ }
+
+ // Replace the argument descriptor slot with a special parameter.
+ if (parsed_function().has_arg_desc_var()) {
+ Definition* defn = new SpecialParameterInstr(
+ SpecialParameterInstr::kArgDescriptor, Thread::kNoDeoptId);
+ AllocateSSAIndexes(defn);
+ AddToInitialDefinitions(defn);
+ env[ArgumentDescriptorEnvIndex()] = defn;
}
}
}
@@ -1029,7 +1032,7 @@
// Functions with try-catch have a fixed area of stack slots reserved
// so that all local variables are stored at a known location when
// on entry to the catch.
- entry->set_fixed_slot_count(num_stack_locals() + num_copied_params());
+ entry->set_fixed_slot_count(num_stack_locals());
}
RenameRecursive(entry, &env, live_phis, variable_liveness);
}
@@ -1037,7 +1040,7 @@
void FlowGraph::AttachEnvironment(Instruction* instr,
GrowableArray<Definition*>* env) {
Environment* deopt_env =
- Environment::From(zone(), *env, num_non_copied_params_, parsed_function_);
+ Environment::From(zone(), *env, num_direct_parameters_, parsed_function_);
if (instr->IsClosureCall()) {
deopt_env =
deopt_env->DeepCopy(zone(), deopt_env->Length() - instr->InputCount());
@@ -1151,7 +1154,7 @@
Definition* result = NULL;
if (store != NULL) {
// Update renaming environment.
- intptr_t index = store->local().BitIndexIn(num_non_copied_params_);
+ intptr_t index = store->local().BitIndexIn(num_direct_parameters_);
result = store->value()->definition();
if (!FLAG_prune_dead_locals ||
@@ -1164,7 +1167,7 @@
// The graph construction ensures we do not have an unused LoadLocal
// computation.
ASSERT(definition->HasTemp());
- intptr_t index = load->local().BitIndexIn(num_non_copied_params_);
+ intptr_t index = load->local().BitIndexIn(num_direct_parameters_);
result = (*env)[index];
PhiInstr* phi = result->AsPhi();
@@ -1181,7 +1184,7 @@
// Record captured parameters so that they can be skipped when
// emitting sync code inside optimized try-blocks.
if (load->local().is_captured_parameter()) {
- intptr_t index = load->local().BitIndexIn(num_non_copied_params_);
+ intptr_t index = load->local().BitIndexIn(num_direct_parameters_);
captured_parameters_->Add(index);
}
diff --git a/runtime/vm/compiler/backend/flow_graph.h b/runtime/vm/compiler/backend/flow_graph.h
index c32baaa..a98c65c 100644
--- a/runtime/vm/compiler/backend/flow_graph.h
+++ b/runtime/vm/compiler/backend/flow_graph.h
@@ -77,12 +77,12 @@
// The first blockid used for prologue building. This information can be used
// by the inliner for budget calculations: The prologue code falls away when
// inlining, so we should not include it in the budget.
- const intptr_t min_block_id;
+ intptr_t min_block_id;
// The last blockid used for prologue building. This information can be used
// by the inliner for budget calculations: The prologue code falls away when
// inlining, so we should not include it in the budget.
- const intptr_t max_block_id;
+ intptr_t max_block_id;
PrologueInfo(intptr_t min, intptr_t max)
: min_block_id(min), max_block_id(max) {}
@@ -103,17 +103,26 @@
// Function properties.
const ParsedFunction& parsed_function() const { return parsed_function_; }
const Function& function() const { return parsed_function_.function(); }
- intptr_t parameter_count() const {
- return num_copied_params_ + num_non_copied_params_;
- }
+
+ // The number of directly accessable parameters (above the frame pointer).
+ // All other parameters can only be indirectly loaded via metadata found in
+ // the arguments descriptor.
+ intptr_t num_direct_parameters() const { return num_direct_parameters_; }
+
+ // The number of variables (or boxes) which code can load from / store to.
+ // The SSA renaming will insert phi's for them (and only them - i.e. there
+ // will be no phi insertion for [LocalVariable]s pointing to the expression
+ // stack!).
intptr_t variable_count() const {
- return parameter_count() + parsed_function_.num_stack_locals();
+ return num_direct_parameters_ + parsed_function_.num_stack_locals();
}
+
+ // The number of variables (or boxes) inside the functions frame - meaning
+ // below the frame pointer. This does not include the expression stack.
intptr_t num_stack_locals() const {
return parsed_function_.num_stack_locals();
}
- intptr_t num_copied_params() const { return num_copied_params_; }
- intptr_t num_non_copied_params() const { return num_non_copied_params_; }
+
bool IsIrregexpFunction() const { return function().IsIrregexpFunction(); }
LocalVariable* CurrentContextVar() const {
@@ -122,7 +131,16 @@
intptr_t CurrentContextEnvIndex() const {
return parsed_function().current_context_var()->BitIndexIn(
- num_non_copied_params_);
+ num_direct_parameters_);
+ }
+
+ intptr_t RawTypeArgumentEnvIndex() const {
+ return parsed_function().RawTypeArgumentsVariable()->BitIndexIn(
+ num_direct_parameters_);
+ }
+
+ intptr_t ArgumentDescriptorEnvIndex() const {
+ return parsed_function().arg_desc_var()->BitIndexIn(num_direct_parameters_);
}
// Flow graph orders.
@@ -181,10 +199,6 @@
ConstantInstr* constant_dead() const { return constant_dead_; }
- ConstantInstr* constant_empty_context() const {
- return constant_empty_context_;
- }
-
intptr_t alloc_ssa_temp_index() { return current_ssa_temp_index_++; }
void AllocateSSAIndexes(Definition* def) {
@@ -410,8 +424,7 @@
// Flow graph fields.
const ParsedFunction& parsed_function_;
- const intptr_t num_copied_params_;
- const intptr_t num_non_copied_params_;
+ intptr_t num_direct_parameters_;
GraphEntryInstr* graph_entry_;
GrowableArray<BlockEntryInstr*> preorder_;
GrowableArray<BlockEntryInstr*> postorder_;
@@ -419,7 +432,6 @@
GrowableArray<BlockEntryInstr*> optimized_block_order_;
ConstantInstr* constant_null_;
ConstantInstr* constant_dead_;
- ConstantInstr* constant_empty_context_;
bool licm_allowed_;
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler.cc b/runtime/vm/compiler/backend/flow_graph_compiler.cc
index dd82dd7..94bd1ae 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler.cc
@@ -212,6 +212,7 @@
}
}
}
+
if (!is_optimizing()) {
// Initialize edge counter array.
const intptr_t num_counters = flow_graph_.preorder().length();
@@ -337,13 +338,14 @@
catch_entry_state_maps_builder_->NewMapping(assembler()->CodeSize());
// Parameters first.
intptr_t i = 0;
- const intptr_t num_non_copied_params = flow_graph().num_non_copied_params();
- for (; i < num_non_copied_params; ++i) {
+
+ const intptr_t num_direct_parameters = flow_graph().num_direct_parameters();
+ for (; i < num_direct_parameters; ++i) {
// Don't sync captured parameters. They are not in the environment.
if (flow_graph().captured_parameters()->Contains(i)) continue;
if ((*idefs)[i]->IsConstant()) continue; // Common constants.
Location src = env->LocationAt(i);
- intptr_t dest_index = i - num_non_copied_params;
+ intptr_t dest_index = i - num_direct_parameters;
if (!src.IsStackSlot()) {
ASSERT(src.IsConstant());
// Skip dead locations.
@@ -362,7 +364,7 @@
}
// Process locals. Skip exception_var and stacktrace_var.
- intptr_t local_base = kFirstLocalSlotFromFp + num_non_copied_params;
+ intptr_t local_base = kFirstLocalSlotFromFp + num_direct_parameters;
intptr_t ex_idx = local_base - catch_block->exception_var().index();
intptr_t st_idx = local_base - catch_block->stacktrace_var().index();
for (; i < flow_graph().variable_count(); ++i) {
@@ -372,7 +374,7 @@
if ((*idefs)[i]->IsConstant()) continue; // Common constants.
Location src = env->LocationAt(i);
if (src.IsInvalid()) continue;
- intptr_t dest_index = i - num_non_copied_params;
+ intptr_t dest_index = i - num_direct_parameters;
if (!src.IsStackSlot()) {
ASSERT(src.IsConstant());
// Skip dead locations.
@@ -542,8 +544,7 @@
if (is_optimizing_) {
return flow_graph_.graph_entry()->spill_slot_count();
} else {
- return parsed_function_.num_stack_locals() +
- parsed_function_.num_copied_params();
+ return parsed_function_.num_stack_locals();
}
}
@@ -1269,20 +1270,24 @@
Register reg = kNoRegister;
if (loc.IsRegister()) {
reg = loc.reg();
- } else if (loc.IsUnallocated() || loc.IsConstant()) {
- ASSERT(loc.IsConstant() ||
- ((loc.policy() == Location::kRequiresRegister) ||
- (loc.policy() == Location::kWritableRegister) ||
- (loc.policy() == Location::kAny)));
+ } else if (loc.IsUnallocated()) {
+ ASSERT((loc.policy() == Location::kRequiresRegister) ||
+ (loc.policy() == Location::kWritableRegister) ||
+ (loc.policy() == Location::kPrefersRegister) ||
+ (loc.policy() == Location::kAny));
reg = AllocateFreeRegister(blocked_registers);
locs->set_in(i, Location::RegisterLocation(reg));
}
- ASSERT(reg != kNoRegister);
+ ASSERT(reg != kNoRegister || loc.IsConstant());
// Inputs are consumed from the simulated frame. In case of a call argument
// we leave it until the call instruction.
if (should_pop) {
- assembler()->PopRegister(reg);
+ if (loc.IsConstant()) {
+ assembler()->Drop(1);
+ } else {
+ assembler()->PopRegister(reg);
+ }
}
}
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler.h b/runtime/vm/compiler/backend/flow_graph_compiler.h
index e2370c0..ecc8c5e 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler.h
+++ b/runtime/vm/compiler/backend/flow_graph_compiler.h
@@ -717,9 +717,6 @@
Label* is_not_instance_lbl);
void GenerateBoolToJump(Register bool_reg, Label* is_true, Label* is_false);
-
- void CheckTypeArgsLen(bool expect_type_args, Label* wrong_num_arguments);
- void CopyParameters(bool expect_type_args, bool check_arguments);
#endif // !defined(TARGET_ARCH_DBC)
void GenerateInlinedGetter(intptr_t offset);
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler_arm.cc b/runtime/vm/compiler/backend/flow_graph_compiler_arm.cc
index 324b9ca..234e125 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler_arm.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler_arm.cc
@@ -701,253 +701,6 @@
}
}
-// Input parameters:
-// R4: arguments descriptor array.
-void FlowGraphCompiler::CheckTypeArgsLen(bool expect_type_args,
- Label* wrong_num_arguments) {
- __ Comment("Check type args len");
- const Function& function = parsed_function().function();
- Label correct_type_args_len;
- // Type args are always optional, so length can always be zero.
- // If expect_type_args, a non-zero length must match the declaration length.
- __ ldr(R6, FieldAddress(R4, ArgumentsDescriptor::type_args_len_offset()));
- if (isolate()->strong()) {
- __ AndImmediate(
- R6, R6,
- Smi::RawValue(ArgumentsDescriptor::TypeArgsLenField::mask_in_place()));
- }
- __ CompareImmediate(R6, Smi::RawValue(0));
- if (expect_type_args) {
- __ CompareImmediate(R6, Smi::RawValue(function.NumTypeParameters()), NE);
- }
- __ b(wrong_num_arguments, NE);
- __ Bind(&correct_type_args_len);
-}
-
-// Input parameters:
-// R4: arguments descriptor array.
-void FlowGraphCompiler::CopyParameters(bool expect_type_args,
- bool check_arguments) {
- Label wrong_num_arguments;
- if (check_arguments) {
- CheckTypeArgsLen(expect_type_args, &wrong_num_arguments);
- }
- __ Comment("Copy parameters");
- const Function& function = parsed_function().function();
- LocalScope* scope = parsed_function().node_sequence()->scope();
- const int num_fixed_params = function.num_fixed_parameters();
- const int num_opt_pos_params = function.NumOptionalPositionalParameters();
- const int num_opt_named_params = function.NumOptionalNamedParameters();
- const int num_params =
- num_fixed_params + num_opt_pos_params + num_opt_named_params;
- ASSERT(function.NumParameters() == num_params);
- ASSERT(parsed_function().first_parameter_index() == kFirstLocalSlotFromFp);
-
- // Check that min_num_pos_args <= num_pos_args <= max_num_pos_args,
- // where num_pos_args is the number of positional arguments passed in.
- const int min_num_pos_args = num_fixed_params;
- const int max_num_pos_args = num_fixed_params + num_opt_pos_params;
-
- __ ldr(R6, FieldAddress(R4, ArgumentsDescriptor::positional_count_offset()));
-
- if (isolate()->strong()) {
- __ AndImmediate(
- R6, R6,
- Smi::RawValue(
- ArgumentsDescriptor::PositionalCountField::mask_in_place()));
- }
-
- // Check that min_num_pos_args <= num_pos_args.
- __ CompareImmediate(R6, Smi::RawValue(min_num_pos_args));
- __ b(&wrong_num_arguments, LT);
- // Check that num_pos_args <= max_num_pos_args.
- __ CompareImmediate(R6, Smi::RawValue(max_num_pos_args));
- __ b(&wrong_num_arguments, GT);
-
- // Copy positional arguments.
- // Argument i passed at fp[kParamEndSlotFromFp + num_args - i] is copied
- // to fp[kFirstLocalSlotFromFp - i].
-
- __ ldr(NOTFP, FieldAddress(R4, ArgumentsDescriptor::count_offset()));
- // Since NOTFP and R6 are Smi, use LSL 1 instead of LSL 2.
- // Let NOTFP point to the last passed positional argument, i.e. to
- // fp[kParamEndSlotFromFp + num_args - (num_pos_args - 1)].
- __ sub(NOTFP, NOTFP, Operand(R6));
- __ add(NOTFP, FP, Operand(NOTFP, LSL, 1));
- __ add(NOTFP, NOTFP, Operand((kParamEndSlotFromFp + 1) * kWordSize));
-
- // Let R8 point to the last copied positional argument, i.e. to
- // fp[kFirstLocalSlotFromFp - (num_pos_args - 1)].
- __ AddImmediate(R8, FP, (kFirstLocalSlotFromFp + 1) * kWordSize);
- __ sub(R8, R8, Operand(R6, LSL, 1)); // R6 is a Smi.
- __ SmiUntag(R6);
- Label loop, loop_condition;
- __ b(&loop_condition);
- // We do not use the final allocation index of the variable here, i.e.
- // scope->VariableAt(i)->index(), because captured variables still need
- // to be copied to the context that is not yet allocated.
- const Address argument_addr(NOTFP, R6, LSL, 2);
- const Address copy_addr(R8, R6, LSL, 2);
- __ Bind(&loop);
- __ ldr(IP, argument_addr);
- __ str(IP, copy_addr);
- __ Bind(&loop_condition);
- __ subs(R6, R6, Operand(1));
- __ b(&loop, PL);
-
- // Copy or initialize optional named arguments.
- Label all_arguments_processed;
-#ifdef DEBUG
- const bool check_correct_named_args = true;
-#else
- const bool check_correct_named_args = check_arguments;
-#endif
- if (num_opt_named_params > 0) {
- // Start by alphabetically sorting the names of the optional parameters.
- LocalVariable** opt_param = new LocalVariable*[num_opt_named_params];
- int* opt_param_position = new int[num_opt_named_params];
- for (int pos = num_fixed_params; pos < num_params; pos++) {
- LocalVariable* parameter = scope->VariableAt(pos);
- const String& opt_param_name = parameter->name();
- int i = pos - num_fixed_params;
- while (--i >= 0) {
- LocalVariable* param_i = opt_param[i];
- const intptr_t result = opt_param_name.CompareTo(param_i->name());
- ASSERT(result != 0);
- if (result > 0) break;
- opt_param[i + 1] = opt_param[i];
- opt_param_position[i + 1] = opt_param_position[i];
- }
- opt_param[i + 1] = parameter;
- opt_param_position[i + 1] = pos;
- }
- // Generate code handling each optional parameter in alphabetical order.
- __ ldr(NOTFP, FieldAddress(R4, ArgumentsDescriptor::count_offset()));
- // Let NOTFP point to the first passed argument, i.e. to
- // fp[kParamEndSlotFromFp + num_args - 0]; num_args (NOTFP) is Smi.
- __ add(NOTFP, FP, Operand(NOTFP, LSL, 1));
- __ AddImmediate(NOTFP, NOTFP, kParamEndSlotFromFp * kWordSize);
- // Let R8 point to the entry of the first named argument.
- __ add(R8, R4,
- Operand(ArgumentsDescriptor::first_named_entry_offset() -
- kHeapObjectTag));
- for (int i = 0; i < num_opt_named_params; i++) {
- Label load_default_value, assign_optional_parameter;
- const int param_pos = opt_param_position[i];
- // Check if this named parameter was passed in.
- // Load R9 with the name of the argument.
- __ ldr(R9, Address(R8, ArgumentsDescriptor::name_offset()));
- ASSERT(opt_param[i]->name().IsSymbol());
- __ CompareObject(R9, opt_param[i]->name());
- __ b(&load_default_value, NE);
- // Load R9 with passed-in argument at provided arg_pos, i.e. at
- // fp[kParamEndSlotFromFp + num_args - arg_pos].
- __ ldr(R9, Address(R8, ArgumentsDescriptor::position_offset()));
- if (isolate()->strong()) {
- __ AndImmediate(
- R9, R9,
- Smi::RawValue(
- ArgumentsDescriptor::PositionalCountField::mask_in_place()));
- }
- // R9 is arg_pos as Smi.
- // Point to next named entry.
- __ add(R8, R8, Operand(ArgumentsDescriptor::named_entry_size()));
- __ rsb(R9, R9, Operand(0));
- Address argument_addr(NOTFP, R9, LSL, 1); // R9 is a negative Smi.
- __ ldr(R9, argument_addr);
- __ b(&assign_optional_parameter);
- __ Bind(&load_default_value);
- // Load R9 with default argument.
- const Instance& value = parsed_function().DefaultParameterValueAt(
- param_pos - num_fixed_params);
- __ LoadObject(R9, value);
- __ Bind(&assign_optional_parameter);
- // Assign R9 to fp[kFirstLocalSlotFromFp - param_pos].
- // We do not use the final allocation index of the variable here, i.e.
- // scope->VariableAt(i)->index(), because captured variables still need
- // to be copied to the context that is not yet allocated.
- const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos;
- const Address param_addr(FP, computed_param_pos * kWordSize);
- __ str(R9, param_addr);
- }
- delete[] opt_param;
- delete[] opt_param_position;
- if (check_correct_named_args) {
- // Check that R8 now points to the null terminator in the arguments
- // descriptor.
- __ ldr(R9, Address(R8, 0));
- __ CompareObject(R9, Object::null_object());
- __ b(&all_arguments_processed, EQ);
- }
- } else {
- ASSERT(num_opt_pos_params > 0);
- __ ldr(R6,
- FieldAddress(R4, ArgumentsDescriptor::positional_count_offset()));
- __ SmiUntag(R6);
- if (isolate()->strong()) {
- __ AndImmediate(
- R6, R6, ArgumentsDescriptor::PositionalCountField::mask_in_place());
- }
- for (int i = 0; i < num_opt_pos_params; i++) {
- Label next_parameter;
- // Handle this optional positional parameter only if k or fewer positional
- // arguments have been passed, where k is param_pos, the position of this
- // optional parameter in the formal parameter list.
- const int param_pos = num_fixed_params + i;
- __ CompareImmediate(R6, param_pos);
- __ b(&next_parameter, GT);
- // Load R9 with default argument.
- const Object& value = parsed_function().DefaultParameterValueAt(i);
- __ LoadObject(R9, value);
- // Assign R9 to fp[kFirstLocalSlotFromFp - param_pos].
- // We do not use the final allocation index of the variable here, i.e.
- // scope->VariableAt(i)->index(), because captured variables still need
- // to be copied to the context that is not yet allocated.
- const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos;
- const Address param_addr(FP, computed_param_pos * kWordSize);
- __ str(R9, param_addr);
- __ Bind(&next_parameter);
- }
- if (check_correct_named_args) {
- __ ldr(NOTFP, FieldAddress(R4, ArgumentsDescriptor::count_offset()));
- __ SmiUntag(NOTFP);
- // Check that R6 equals NOTFP, i.e. no named arguments passed.
- __ cmp(R6, Operand(NOTFP));
- __ b(&all_arguments_processed, EQ);
- }
- }
-
- __ Bind(&wrong_num_arguments);
- if (check_arguments) {
- __ LeaveDartFrame(kKeepCalleePP); // The arguments are still on the stack.
- __ Branch(*StubCode::CallClosureNoSuchMethod_entry());
- // The noSuchMethod call may return to the caller, but not here.
- } else if (check_correct_named_args) {
- __ Stop("Wrong arguments");
- }
-
- __ Bind(&all_arguments_processed);
- // Nullify originally passed arguments only after they have been copied and
- // checked, otherwise noSuchMethod would not see their original values.
- // This step can be skipped in case we decide that formal parameters are
- // implicitly final, since garbage collecting the unmodified value is not
- // an issue anymore.
-
- // R4 : arguments descriptor array.
- __ ldr(R6, FieldAddress(R4, ArgumentsDescriptor::count_offset()));
- __ SmiUntag(R6);
- __ add(NOTFP, FP, Operand((kParamEndSlotFromFp + 1) * kWordSize));
- const Address original_argument_addr(NOTFP, R6, LSL, 2);
- __ LoadObject(IP, Object::null_object());
- Label null_args_loop, null_args_loop_condition;
- __ b(&null_args_loop_condition);
- __ Bind(&null_args_loop);
- __ str(IP, original_argument_addr);
- __ Bind(&null_args_loop_condition);
- __ subs(R6, R6, Operand(1));
- __ b(&null_args_loop, PL);
-}
-
void FlowGraphCompiler::GenerateInlinedGetter(intptr_t offset) {
// LR: return address.
// SP: receiver.
@@ -998,8 +751,7 @@
}
__ Comment("Enter frame");
if (flow_graph().IsCompiledForOsr()) {
- intptr_t extra_slots = StackSize() - flow_graph().num_stack_locals() -
- flow_graph().num_copied_params();
+ intptr_t extra_slots = StackSize() - flow_graph().num_stack_locals();
ASSERT(extra_slots >= 0);
__ EnterOsrFrame(extra_slots * kWordSize);
} else {
@@ -1017,9 +769,8 @@
// R4: arguments descriptor array.
void FlowGraphCompiler::CompileGraph() {
InitCompiler();
- const Function& function = parsed_function().function();
-
#ifdef DART_PRECOMPILER
+ const Function& function = parsed_function().function();
if (function.IsDynamicFunction()) {
__ MonomorphicCheckedEntry();
}
@@ -1033,117 +784,27 @@
EmitFrameEntry();
ASSERT(assembler()->constant_pool_allowed());
- const int num_fixed_params = function.num_fixed_parameters();
- const int num_copied_params = parsed_function().num_copied_params();
- const int num_locals = parsed_function().num_stack_locals();
-
- // The prolog of OSR functions is never executed, hence greatly simplified.
- const bool expect_type_args = isolate()->reify_generic_functions() &&
- function.IsGeneric() &&
- !flow_graph().IsCompiledForOsr();
-
- const bool check_arguments =
- (function.IsClosureFunction() || function.IsConvertedClosureFunction()) &&
- !flow_graph().IsCompiledForOsr();
-
- // We check the number of passed arguments when we have to copy them due to
- // the presence of optional parameters.
- // No such checking code is generated if only fixed parameters are declared,
- // unless we are in debug mode or unless we are compiling a closure.
- if (num_copied_params == 0) {
- if (check_arguments) {
- Label correct_num_arguments, wrong_num_arguments;
- CheckTypeArgsLen(expect_type_args, &wrong_num_arguments);
- __ Comment("Check argument count");
- // Check that exactly num_fixed arguments are passed in.
- __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::count_offset()));
- __ CompareImmediate(R0, Smi::RawValue(num_fixed_params));
- __ b(&wrong_num_arguments, NE);
- __ ldr(R1,
- FieldAddress(R4, ArgumentsDescriptor::positional_count_offset()));
- if (isolate()->strong()) {
- __ AndImmediate(
- R1, R1,
- Smi::RawValue(
- ArgumentsDescriptor::PositionalCountField::mask_in_place()));
- }
- __ cmp(R0, Operand(R1));
- __ b(&correct_num_arguments, EQ);
- __ Bind(&wrong_num_arguments);
- ASSERT(assembler()->constant_pool_allowed());
- __ LeaveDartFrame(kKeepCalleePP); // Arguments are still on the stack.
- __ Branch(*StubCode::CallClosureNoSuchMethod_entry());
- // The noSuchMethod call may return to the caller, but not here.
- __ Bind(&correct_num_arguments);
- }
- } else if (!flow_graph().IsCompiledForOsr()) {
- CopyParameters(expect_type_args, check_arguments);
- }
-
- if (function.IsClosureFunction() && !flow_graph().IsCompiledForOsr()) {
- // Load context from the closure object (first argument).
- LocalScope* scope = parsed_function().node_sequence()->scope();
- LocalVariable* closure_parameter = scope->VariableAt(0);
- __ ldr(CTX, Address(FP, closure_parameter->index() * kWordSize));
- __ ldr(CTX, FieldAddress(CTX, Closure::context_offset()));
- }
-
- // In unoptimized code, initialize (non-argument) stack allocated slots to
- // null.
+ // In unoptimized code, initialize (non-argument) stack allocated slots.
if (!is_optimizing()) {
- ASSERT(num_locals > 0); // There is always at least context_var.
+ const int num_locals = parsed_function().num_stack_locals();
+
+ intptr_t args_desc_index = -1;
+ if (parsed_function().has_arg_desc_var()) {
+ args_desc_index =
+ -(parsed_function().arg_desc_var()->index() - kFirstLocalSlotFromFp);
+ }
+
__ Comment("Initialize spill slots");
- const intptr_t slot_base = parsed_function().first_stack_local_index();
- const intptr_t context_index =
- parsed_function().current_context_var()->index();
- if (num_locals > 1) {
+ if (num_locals > 1 || (num_locals == 1 && args_desc_index == -1)) {
__ LoadObject(R0, Object::null_object());
}
for (intptr_t i = 0; i < num_locals; ++i) {
- // Subtract index i (locals lie at lower addresses than FP).
- if (((slot_base - i) == context_index)) {
- if (function.IsClosureFunction()) {
- __ StoreToOffset(kWord, CTX, FP, (slot_base - i) * kWordSize);
- } else {
- __ LoadObject(R1, Object::empty_context());
- __ StoreToOffset(kWord, R1, FP, (slot_base - i) * kWordSize);
- }
- } else {
- ASSERT(num_locals > 1);
- __ StoreToOffset(kWord, R0, FP, (slot_base - i) * kWordSize);
- }
+ Register value_reg = i == args_desc_index ? ARGS_DESC_REG : R0;
+ __ StoreToOffset(kWord, value_reg, FP,
+ (kFirstLocalSlotFromFp - i) * kWordSize);
}
}
- // Copy passed-in type argument vector if the function is generic.
- if (expect_type_args) {
- __ Comment("Copy passed-in type args");
- Label store_type_args, ok;
- __ ldr(R0, FieldAddress(R4, ArgumentsDescriptor::type_args_len_offset()));
- __ CompareImmediate(R0, Smi::RawValue(0));
- if (is_optimizing()) {
- // Initialize type_args to null if none passed in.
- __ LoadObject(R0, Object::null_object(), EQ);
- __ b(&store_type_args, EQ);
- } else {
- __ b(&ok, EQ); // Already initialized to null.
- }
- // Load the passed type args vector in R0 from
- // fp[kParamEndSlotFromFp + num_args + 1]; num_args (R1) is Smi.
- __ ldr(R1, FieldAddress(R4, ArgumentsDescriptor::count_offset()));
- __ add(R1, FP, Operand(R1, LSL, 1));
- __ ldr(R0, Address(R1, (kParamEndSlotFromFp + 1) * kWordSize));
- // Store R0 into the stack slot reserved for the function type arguments.
- // If the function type arguments variable is captured, a copy will happen
- // after the context is allocated.
- const intptr_t slot_base = parsed_function().first_stack_local_index();
- ASSERT(parsed_function().function_type_arguments()->is_captured() ||
- parsed_function().function_type_arguments()->index() == slot_base);
- __ Bind(&store_type_args);
- __ str(R0, Address(FP, slot_base * kWordSize));
- __ Bind(&ok);
- }
-
EndCodeSourceRange(TokenPosition::kDartCodePrologue);
VisitBlocks();
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc b/runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc
index 552e3e0..1bbed6c 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler_arm64.cc
@@ -678,254 +678,6 @@
}
}
-// Input parameters:
-// R4: arguments descriptor array.
-void FlowGraphCompiler::CheckTypeArgsLen(bool expect_type_args,
- Label* wrong_num_arguments) {
- __ Comment("Check type args len");
- const Function& function = parsed_function().function();
- Label correct_type_args_len;
- // Type args are always optional, so length can always be zero.
- // If expect_type_args, a non-zero length must match the declaration length.
- __ LoadFieldFromOffset(R8, R4, ArgumentsDescriptor::type_args_len_offset());
- if (isolate()->strong()) {
- __ AndImmediate(
- R8, R8,
- Smi::RawValue(ArgumentsDescriptor::TypeArgsLenField::mask_in_place()));
- }
- __ CompareImmediate(R8, Smi::RawValue(0));
- if (expect_type_args) {
- __ b(&correct_type_args_len, EQ);
- __ CompareImmediate(R8, Smi::RawValue(function.NumTypeParameters()));
- }
- __ b(wrong_num_arguments, NE);
- __ Bind(&correct_type_args_len);
-}
-
-// Input parameters:
-// R4: arguments descriptor array.
-void FlowGraphCompiler::CopyParameters(bool expect_type_args,
- bool check_arguments) {
- Label wrong_num_arguments;
- if (check_arguments) {
- CheckTypeArgsLen(expect_type_args, &wrong_num_arguments);
- }
- __ Comment("Copy parameters");
- const Function& function = parsed_function().function();
- LocalScope* scope = parsed_function().node_sequence()->scope();
- const int num_fixed_params = function.num_fixed_parameters();
- const int num_opt_pos_params = function.NumOptionalPositionalParameters();
- const int num_opt_named_params = function.NumOptionalNamedParameters();
- const int num_params =
- num_fixed_params + num_opt_pos_params + num_opt_named_params;
- ASSERT(function.NumParameters() == num_params);
- ASSERT(parsed_function().first_parameter_index() == kFirstLocalSlotFromFp);
-
- // Check that min_num_pos_args <= num_pos_args <= max_num_pos_args,
- // where num_pos_args is the number of positional arguments passed in.
- const int min_num_pos_args = num_fixed_params;
- const int max_num_pos_args = num_fixed_params + num_opt_pos_params;
-
- __ LoadFieldFromOffset(R8, R4,
- ArgumentsDescriptor::positional_count_offset());
-
- if (isolate()->strong()) {
- __ AndImmediate(
- R8, R8,
- Smi::RawValue(
- ArgumentsDescriptor::PositionalCountField::mask_in_place()));
- }
-
- // Check that min_num_pos_args <= num_pos_args.
- __ CompareImmediate(R8, Smi::RawValue(min_num_pos_args));
- __ b(&wrong_num_arguments, LT);
- // Check that num_pos_args <= max_num_pos_args.
- __ CompareImmediate(R8, Smi::RawValue(max_num_pos_args));
- __ b(&wrong_num_arguments, GT);
-
- // Copy positional arguments.
- // Argument i passed at fp[kParamEndSlotFromFp + num_args - i] is copied
- // to fp[kFirstLocalSlotFromFp - i].
-
- __ LoadFieldFromOffset(R7, R4, ArgumentsDescriptor::count_offset());
- // Since R7 and R8 are Smi, use LSL 2 instead of LSL 3.
- // Let R7 point to the last passed positional argument, i.e. to
- // fp[kParamEndSlotFromFp + num_args - (num_pos_args - 1)].
- __ sub(R7, R7, Operand(R8));
- __ add(R7, FP, Operand(R7, LSL, 2));
- __ add(R7, R7, Operand((kParamEndSlotFromFp + 1) * kWordSize));
-
- // Let R6 point to the last copied positional argument, i.e. to
- // fp[kFirstLocalSlotFromFp - (num_pos_args - 1)].
- __ AddImmediate(R6, FP, (kFirstLocalSlotFromFp + 1) * kWordSize);
- __ sub(R6, R6, Operand(R8, LSL, 2)); // R8 is a Smi.
- __ SmiUntag(R8);
- Label loop, loop_condition;
- __ b(&loop_condition);
- // We do not use the final allocation index of the variable here, i.e.
- // scope->VariableAt(i)->index(), because captured variables still need
- // to be copied to the context that is not yet allocated.
- const Address argument_addr(R7, R8, UXTX, Address::Scaled);
- const Address copy_addr(R6, R8, UXTX, Address::Scaled);
- __ Bind(&loop);
- __ ldr(TMP, argument_addr);
- __ str(TMP, copy_addr);
- __ Bind(&loop_condition);
- __ subs(R8, R8, Operand(1));
- __ b(&loop, PL);
-
- // Copy or initialize optional named arguments.
- Label all_arguments_processed;
-#ifdef DEBUG
- const bool check_correct_named_args = true;
-#else
- const bool check_correct_named_args = check_arguments;
-#endif
- if (num_opt_named_params > 0) {
- // Start by alphabetically sorting the names of the optional parameters.
- LocalVariable** opt_param = new LocalVariable*[num_opt_named_params];
- int* opt_param_position = new int[num_opt_named_params];
- for (int pos = num_fixed_params; pos < num_params; pos++) {
- LocalVariable* parameter = scope->VariableAt(pos);
- const String& opt_param_name = parameter->name();
- int i = pos - num_fixed_params;
- while (--i >= 0) {
- LocalVariable* param_i = opt_param[i];
- const intptr_t result = opt_param_name.CompareTo(param_i->name());
- ASSERT(result != 0);
- if (result > 0) break;
- opt_param[i + 1] = opt_param[i];
- opt_param_position[i + 1] = opt_param_position[i];
- }
- opt_param[i + 1] = parameter;
- opt_param_position[i + 1] = pos;
- }
- // Generate code handling each optional parameter in alphabetical order.
- __ LoadFieldFromOffset(R7, R4, ArgumentsDescriptor::count_offset());
- // Let R7 point to the first passed argument, i.e. to
- // fp[kParamEndSlotFromFp + num_args - 0]; num_args (R7) is Smi.
- __ add(R7, FP, Operand(R7, LSL, 2));
- __ AddImmediate(R7, kParamEndSlotFromFp * kWordSize);
- // Let R6 point to the entry of the first named argument.
- __ add(R6, R4,
- Operand(ArgumentsDescriptor::first_named_entry_offset() -
- kHeapObjectTag));
- for (int i = 0; i < num_opt_named_params; i++) {
- Label load_default_value, assign_optional_parameter;
- const int param_pos = opt_param_position[i];
- // Check if this named parameter was passed in.
- // Load R5 with the name of the argument.
- __ LoadFromOffset(R5, R6, ArgumentsDescriptor::name_offset());
- ASSERT(opt_param[i]->name().IsSymbol());
- __ CompareObject(R5, opt_param[i]->name());
- __ b(&load_default_value, NE);
- // Load R5 with passed-in argument at provided arg_pos, i.e. at
- // fp[kParamEndSlotFromFp + num_args - arg_pos].
- __ LoadFromOffset(R5, R6, ArgumentsDescriptor::position_offset());
- if (isolate()->strong()) {
- __ AndImmediate(
- R5, R5,
- Smi::RawValue(
- ArgumentsDescriptor::PositionalCountField::mask_in_place()));
- }
- // R5 is arg_pos as Smi.
- // Point to next named entry.
- __ add(R6, R6, Operand(ArgumentsDescriptor::named_entry_size()));
- // Negate and untag R5 so we can use in scaled address mode.
- __ subs(R5, ZR, Operand(R5, ASR, 1));
- Address argument_addr(R7, R5, UXTX, Address::Scaled); // R5 is untagged.
- __ ldr(R5, argument_addr);
- __ b(&assign_optional_parameter);
- __ Bind(&load_default_value);
- // Load R5 with default argument.
- const Instance& value = parsed_function().DefaultParameterValueAt(
- param_pos - num_fixed_params);
- __ LoadObject(R5, value);
- __ Bind(&assign_optional_parameter);
- // Assign R5 to fp[kFirstLocalSlotFromFp - param_pos].
- // We do not use the final allocation index of the variable here, i.e.
- // scope->VariableAt(i)->index(), because captured variables still need
- // to be copied to the context that is not yet allocated.
- const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos;
- __ StoreToOffset(R5, FP, computed_param_pos * kWordSize);
- }
- delete[] opt_param;
- delete[] opt_param_position;
- if (check_correct_named_args) {
- // Check that R6 now points to the null terminator in the arguments
- // descriptor.
- __ ldr(R5, Address(R6));
- __ CompareObject(R5, Object::null_object());
- __ b(&all_arguments_processed, EQ);
- }
- } else {
- ASSERT(num_opt_pos_params > 0);
- __ LoadFieldFromOffset(R8, R4,
- ArgumentsDescriptor::positional_count_offset());
- __ SmiUntag(R8);
- if (isolate()->strong()) {
- __ AndImmediate(
- R8, R8, ArgumentsDescriptor::PositionalCountField::mask_in_place());
- }
- for (int i = 0; i < num_opt_pos_params; i++) {
- Label next_parameter;
- // Handle this optional positional parameter only if k or fewer positional
- // arguments have been passed, where k is param_pos, the position of this
- // optional parameter in the formal parameter list.
- const int param_pos = num_fixed_params + i;
- __ CompareImmediate(R8, param_pos);
- __ b(&next_parameter, GT);
- // Load R5 with default argument.
- const Object& value = parsed_function().DefaultParameterValueAt(i);
- __ LoadObject(R5, value);
- // Assign R5 to fp[kFirstLocalSlotFromFp - param_pos].
- // We do not use the final allocation index of the variable here, i.e.
- // scope->VariableAt(i)->index(), because captured variables still need
- // to be copied to the context that is not yet allocated.
- const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos;
- __ StoreToOffset(R5, FP, computed_param_pos * kWordSize);
- __ Bind(&next_parameter);
- }
- if (check_correct_named_args) {
- __ LoadFieldFromOffset(R7, R4, ArgumentsDescriptor::count_offset());
- __ SmiUntag(R7);
- // Check that R8 equals R7, i.e. no named arguments passed.
- __ CompareRegisters(R8, R7);
- __ b(&all_arguments_processed, EQ);
- }
- }
-
- __ Bind(&wrong_num_arguments);
- if (check_arguments) {
- __ LeaveDartFrame(kKeepCalleePP); // The arguments are still on the stack.
- __ BranchPatchable(*StubCode::CallClosureNoSuchMethod_entry());
- // The noSuchMethod call may return to the caller, but not here.
- } else if (check_correct_named_args) {
- __ Stop("Wrong arguments");
- }
-
- __ Bind(&all_arguments_processed);
- // Nullify originally passed arguments only after they have been copied and
- // checked, otherwise noSuchMethod would not see their original values.
- // This step can be skipped in case we decide that formal parameters are
- // implicitly final, since garbage collecting the unmodified value is not
- // an issue anymore.
-
- // R4 : arguments descriptor array.
- __ LoadFieldFromOffset(R8, R4, ArgumentsDescriptor::count_offset());
- __ SmiUntag(R8);
- __ add(R7, FP, Operand((kParamEndSlotFromFp + 1) * kWordSize));
- const Address original_argument_addr(R7, R8, UXTX, Address::Scaled);
- __ LoadObject(TMP, Object::null_object());
- Label null_args_loop, null_args_loop_condition;
- __ b(&null_args_loop_condition);
- __ Bind(&null_args_loop);
- __ str(TMP, original_argument_addr);
- __ Bind(&null_args_loop_condition);
- __ subs(R8, R8, Operand(1));
- __ b(&null_args_loop, PL);
-}
-
void FlowGraphCompiler::GenerateInlinedGetter(intptr_t offset) {
// LR: return address.
// SP: receiver.
@@ -982,8 +734,7 @@
}
__ Comment("Enter frame");
if (flow_graph().IsCompiledForOsr()) {
- intptr_t extra_slots = StackSize() - flow_graph().num_stack_locals() -
- flow_graph().num_copied_params();
+ intptr_t extra_slots = StackSize() - flow_graph().num_stack_locals();
ASSERT(extra_slots >= 0);
__ EnterOsrFrame(extra_slots * kWordSize, new_pp);
} else {
@@ -1001,9 +752,8 @@
// R4: arguments descriptor array.
void FlowGraphCompiler::CompileGraph() {
InitCompiler();
- const Function& function = parsed_function().function();
-
#ifdef DART_PRECOMPILER
+ const Function& function = parsed_function().function();
if (function.IsDynamicFunction()) {
__ MonomorphicCheckedEntry();
}
@@ -1017,116 +767,26 @@
EmitFrameEntry();
ASSERT(assembler()->constant_pool_allowed());
- const int num_fixed_params = function.num_fixed_parameters();
- const int num_copied_params = parsed_function().num_copied_params();
- const int num_locals = parsed_function().num_stack_locals();
-
- // The prolog of OSR functions is never executed, hence greatly simplified.
- const bool expect_type_args = isolate()->reify_generic_functions() &&
- function.IsGeneric() &&
- !flow_graph().IsCompiledForOsr();
-
- const bool check_arguments =
- (function.IsClosureFunction() || function.IsConvertedClosureFunction()) &&
- !flow_graph().IsCompiledForOsr();
-
- // We check the number of passed arguments when we have to copy them due to
- // the presence of optional parameters.
- // No such checking code is generated if only fixed parameters are declared,
- // unless we are in debug mode or unless we are compiling a closure.
- if (num_copied_params == 0) {
- if (check_arguments) {
- Label correct_num_arguments, wrong_num_arguments;
- CheckTypeArgsLen(expect_type_args, &wrong_num_arguments);
- __ Comment("Check argument count");
- // Check that exactly num_fixed arguments are passed in.
- __ LoadFieldFromOffset(R0, R4, ArgumentsDescriptor::count_offset());
- __ CompareImmediate(R0, Smi::RawValue(num_fixed_params));
- __ b(&wrong_num_arguments, NE);
- __ LoadFieldFromOffset(R1, R4,
- ArgumentsDescriptor::positional_count_offset());
- if (isolate()->strong()) {
- __ AndImmediate(
- R1, R1,
- Smi::RawValue(
- ArgumentsDescriptor::PositionalCountField::mask_in_place()));
- }
- __ CompareRegisters(R0, R1);
- __ b(&correct_num_arguments, EQ);
- __ Bind(&wrong_num_arguments);
- __ LeaveDartFrame(kKeepCalleePP); // Arguments are still on the stack.
- __ BranchPatchable(*StubCode::CallClosureNoSuchMethod_entry());
- // The noSuchMethod call may return to the caller, but not here.
- __ Bind(&correct_num_arguments);
- }
- } else if (!flow_graph().IsCompiledForOsr()) {
- CopyParameters(expect_type_args, check_arguments);
- }
-
- if (function.IsClosureFunction() && !flow_graph().IsCompiledForOsr()) {
- // Load context from the closure object (first argument).
- LocalScope* scope = parsed_function().node_sequence()->scope();
- LocalVariable* closure_parameter = scope->VariableAt(0);
- __ ldr(CTX, Address(FP, closure_parameter->index() * kWordSize));
- __ ldr(CTX, FieldAddress(CTX, Closure::context_offset()));
- }
-
- // In unoptimized code, initialize (non-argument) stack allocated slots to
- // null.
+ // In unoptimized code, initialize (non-argument) stack allocated slots.
if (!is_optimizing()) {
- ASSERT(num_locals > 0); // There is always at least context_var.
+ const int num_locals = parsed_function().num_stack_locals();
+
+ intptr_t args_desc_index = -1;
+ if (parsed_function().has_arg_desc_var()) {
+ args_desc_index =
+ -(parsed_function().arg_desc_var()->index() - kFirstLocalSlotFromFp);
+ }
+
__ Comment("Initialize spill slots");
- const intptr_t slot_base = parsed_function().first_stack_local_index();
- const intptr_t context_index =
- parsed_function().current_context_var()->index();
- if (num_locals > 1) {
+ if (num_locals > 1 || (num_locals == 1 && args_desc_index == -1)) {
__ LoadObject(R0, Object::null_object());
}
for (intptr_t i = 0; i < num_locals; ++i) {
- // Subtract index i (locals lie at lower addresses than FP).
- if (((slot_base - i) == context_index)) {
- if (function.IsClosureFunction()) {
- __ StoreToOffset(CTX, FP, (slot_base - i) * kWordSize);
- } else {
- __ LoadObject(R1, Object::empty_context());
- __ StoreToOffset(R1, FP, (slot_base - i) * kWordSize);
- }
- } else {
- ASSERT(num_locals > 1);
- __ StoreToOffset(R0, FP, (slot_base - i) * kWordSize);
- }
+ Register value_reg = i == args_desc_index ? ARGS_DESC_REG : R0;
+ __ StoreToOffset(value_reg, FP, (kFirstLocalSlotFromFp - i) * kWordSize);
}
}
- // Copy passed-in type argument vector if the function is generic.
- if (expect_type_args) {
- __ Comment("Copy passed-in type args");
- Label store_type_args, ok;
- __ LoadFieldFromOffset(R0, R4, ArgumentsDescriptor::type_args_len_offset());
- __ CompareImmediate(R0, Smi::RawValue(0));
- if (is_optimizing()) {
- // Initialize type_args to null if none passed in.
- __ LoadObject(R0, Object::null_object());
- __ b(&store_type_args, EQ);
- } else {
- __ b(&ok, EQ); // Already initialized to null.
- }
- // Load the passed type args vector in R0 from
- // fp[kParamEndSlotFromFp + num_args + 1]; num_args (R1) is Smi.
- __ LoadFieldFromOffset(R1, R4, ArgumentsDescriptor::count_offset());
- __ add(R1, FP, Operand(R1, LSL, 2));
- __ LoadFromOffset(R0, R1, (kParamEndSlotFromFp + 1) * kWordSize);
- // Store R0 into the stack slot reserved for the function type arguments.
- // If the function type arguments variable is captured, a copy will happen
- // after the context is allocated.
- const intptr_t slot_base = parsed_function().first_stack_local_index();
- ASSERT(parsed_function().function_type_arguments()->is_captured() ||
- parsed_function().function_type_arguments()->index() == slot_base);
- __ Bind(&store_type_args);
- __ StoreToOffset(R0, FP, slot_base * kWordSize);
- __ Bind(&ok);
- }
-
EndCodeSourceRange(TokenPosition::kDartCodePrologue);
VisitBlocks();
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler_dbc.cc b/runtime/vm/compiler/backend/flow_graph_compiler_dbc.cc
index ed8e75d..e11a330 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler_dbc.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler_dbc.cc
@@ -308,122 +308,29 @@
void FlowGraphCompiler::EmitFrameEntry() {
const Function& function = parsed_function().function();
const intptr_t num_fixed_params = function.num_fixed_parameters();
- const int num_opt_pos_params = function.NumOptionalPositionalParameters();
- const int num_opt_named_params = function.NumOptionalNamedParameters();
- const int num_params =
- num_fixed_params + num_opt_pos_params + num_opt_named_params;
- const bool has_optional_params =
- (num_opt_pos_params != 0) || (num_opt_named_params != 0);
const int num_locals = parsed_function().num_stack_locals();
- const intptr_t context_index =
- -parsed_function().current_context_var()->index() - 1;
if (CanOptimizeFunction() && function.IsOptimizable() &&
(!is_optimizing() || may_reoptimize())) {
__ HotCheck(!is_optimizing(), GetOptimizationThreshold());
}
- if (has_optional_params) {
- __ EntryOptional(num_fixed_params, num_opt_pos_params,
- num_opt_named_params);
- } else if (!is_optimizing()) {
- __ Entry(num_fixed_params, num_locals, context_index);
- } else {
+ if (is_optimizing()) {
__ EntryOptimized(num_fixed_params,
flow_graph_.graph_entry()->spill_slot_count());
+ } else {
+ __ Entry(num_locals);
}
- if (num_opt_named_params != 0) {
- LocalScope* scope = parsed_function().node_sequence()->scope();
-
- // Start by alphabetically sorting the names of the optional parameters.
- LocalVariable** opt_param =
- zone()->Alloc<LocalVariable*>(num_opt_named_params);
- int* opt_param_position = zone()->Alloc<int>(num_opt_named_params);
- for (int pos = num_fixed_params; pos < num_params; pos++) {
- LocalVariable* parameter = scope->VariableAt(pos);
- const String& opt_param_name = parameter->name();
- int i = pos - num_fixed_params;
- while (--i >= 0) {
- LocalVariable* param_i = opt_param[i];
- const intptr_t result = opt_param_name.CompareTo(param_i->name());
- ASSERT(result != 0);
- if (result > 0) break;
- opt_param[i + 1] = opt_param[i];
- opt_param_position[i + 1] = opt_param_position[i];
- }
- opt_param[i + 1] = parameter;
- opt_param_position[i + 1] = pos;
- }
-
- for (intptr_t i = 0; i < num_opt_named_params; i++) {
- const int param_pos = opt_param_position[i];
- const Instance& value = parsed_function().DefaultParameterValueAt(
- param_pos - num_fixed_params);
- __ LoadConstant(param_pos, opt_param[i]->name());
- __ LoadConstant(param_pos, value);
- }
- } else if (num_opt_pos_params != 0) {
- for (intptr_t i = 0; i < num_opt_pos_params; i++) {
- const Object& value = parsed_function().DefaultParameterValueAt(i);
- __ LoadConstant(num_fixed_params + i, value);
- }
- }
-
- if (has_optional_params) {
- if (!is_optimizing()) {
- ASSERT(num_locals > 0); // There is always at least context_var.
- __ Frame(num_locals); // Reserve space for locals.
- } else if (flow_graph_.graph_entry()->spill_slot_count() >
- flow_graph_.num_copied_params()) {
- __ Frame(flow_graph_.graph_entry()->spill_slot_count() -
- flow_graph_.num_copied_params());
- }
- }
-
- const bool expect_type_arguments =
- isolate()->reify_generic_functions() && function.IsGeneric();
- if (function.IsClosureFunction()) {
- // In optimized mode the register allocator expects CurrentContext in the
- // flow_graph_.num_copied_params() register at function entry, unless that
- // register is used for function type arguments, either as their
- // permanent location or as their temporary location when captured.
- // In that case, the next register holds CurrentContext.
- // (see FlowGraphAllocator::ProcessInitialDefinition)
- Register context_reg =
- is_optimizing()
- ? (expect_type_arguments ? flow_graph_.num_copied_params() + 1
- : flow_graph_.num_copied_params())
- : context_index;
- LocalScope* scope = parsed_function().node_sequence()->scope();
- LocalVariable* local = scope->VariableAt(0); // Closure instance receiver.
-
- Register closure_reg;
- if (local->index() > 0) {
- __ Move(context_reg, -local->index());
- closure_reg = context_reg;
- } else {
- closure_reg = -local->index() - 1;
- }
- __ LoadField(context_reg, closure_reg,
- Closure::context_offset() / kWordSize);
- } else if (has_optional_params && !is_optimizing()) {
- __ LoadConstant(context_index, Object::empty_context());
- }
-
- if (isolate()->reify_generic_functions()) {
- // Check for a passed type argument vector if the function is generic, or
- // check that none is passed if not generic and not already checked during
- // resolution.
- const bool check_arguments =
- (function.IsClosureFunction() || function.IsConvertedClosureFunction());
- if ((expect_type_arguments || check_arguments) &&
- !flow_graph().IsCompiledForOsr()) {
- ASSERT(!expect_type_arguments ||
- (-parsed_function().first_stack_local_index() - 1 ==
- flow_graph_.num_copied_params()));
- __ CheckFunctionTypeArgs(function.NumTypeParameters(),
- flow_graph_.num_copied_params());
+ if (!is_optimizing()) {
+ if (parsed_function().has_arg_desc_var()) {
+ // TODO(kustermann): If dbc simulator put the args_desc_ into the
+ // _special_regs, we could replace these 3 with the MoveSpecial bytecode.
+ const intptr_t args_desc_index =
+ -(parsed_function().arg_desc_var()->index() - kFirstLocalSlotFromFp);
+ __ LoadArgDescriptor();
+ __ StoreLocal(args_desc_index);
+ __ Drop(1);
}
}
}
@@ -450,10 +357,13 @@
}
intptr_t FlowGraphCompiler::CatchEntryRegForVariable(const LocalVariable& var) {
+ const Function& function = parsed_function().function();
+ const intptr_t num_non_copied_params =
+ function.HasOptionalParameters() ? 0 : function.NumParameters();
+
ASSERT(is_optimizing());
ASSERT(var.index() <= 0);
- return kNumberOfCpuRegisters -
- (flow_graph().num_non_copied_params() - var.index());
+ return kNumberOfCpuRegisters - (num_non_copied_params - var.index());
}
#undef __
@@ -470,6 +380,9 @@
__ Move(destination.reg(), -kParamEndSlotFromFp + source.stack_index());
} else if (source.IsRegister() && destination.IsRegister()) {
__ Move(destination.reg(), source.reg());
+ } else if (source.IsArgsDescRegister()) {
+ ASSERT(destination.IsRegister());
+ __ LoadArgDescriptorOpt(destination.reg());
} else if (source.IsConstant() && destination.IsRegister()) {
if (source.constant_instruction()->representation() == kUnboxedDouble) {
const Register result = destination.reg();
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler_ia32.cc b/runtime/vm/compiler/backend/flow_graph_compiler_ia32.cc
index 358c587..56c93d4 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler_ia32.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler_ia32.cc
@@ -713,258 +713,6 @@
}
}
-// Input parameters:
-// EDX: arguments descriptor array.
-void FlowGraphCompiler::CheckTypeArgsLen(bool expect_type_args,
- Label* wrong_num_arguments) {
- __ Comment("Check type args len");
- const Function& function = parsed_function().function();
- Label correct_type_args_len;
- if (expect_type_args) {
- // Type args are always optional, so length can always be zero.
- // If expect_type_args, a non-zero length must match the declaration length.
- __ movl(EAX,
- FieldAddress(EDX, ArgumentsDescriptor::type_args_len_offset()));
- if (isolate()->strong()) {
- __ andl(EAX,
- Immediate(Smi::RawValue(
- ArgumentsDescriptor::TypeArgsLenField::mask_in_place())));
- }
- __ cmpl(EAX, Immediate(Smi::RawValue(0)));
- __ j(EQUAL, &correct_type_args_len, Assembler::kNearJump);
- __ cmpl(EAX, Immediate(Smi::RawValue(function.NumTypeParameters())));
- } else {
- __ cmpl(FieldAddress(EDX, ArgumentsDescriptor::type_args_len_offset()),
- Immediate(Smi::RawValue(0)));
- }
- __ j(NOT_EQUAL, wrong_num_arguments);
- __ Bind(&correct_type_args_len);
-}
-
-// Input parameters:
-// EDX: arguments descriptor array.
-void FlowGraphCompiler::CopyParameters(bool expect_type_args,
- bool check_arguments) {
- Label wrong_num_arguments;
- if (check_arguments) {
- CheckTypeArgsLen(expect_type_args, &wrong_num_arguments);
- }
- __ Comment("Copy parameters");
- const Function& function = parsed_function().function();
- LocalScope* scope = parsed_function().node_sequence()->scope();
- const int num_fixed_params = function.num_fixed_parameters();
- const int num_opt_pos_params = function.NumOptionalPositionalParameters();
- const int num_opt_named_params = function.NumOptionalNamedParameters();
- const int num_params =
- num_fixed_params + num_opt_pos_params + num_opt_named_params;
- ASSERT(function.NumParameters() == num_params);
- ASSERT(parsed_function().first_parameter_index() == kFirstLocalSlotFromFp);
-
- // Check that min_num_pos_args <= num_pos_args <= max_num_pos_args,
- // where num_pos_args is the number of positional arguments passed in.
- const int min_num_pos_args = num_fixed_params;
- const int max_num_pos_args = num_fixed_params + num_opt_pos_params;
-
- __ movl(ECX,
- FieldAddress(EDX, ArgumentsDescriptor::positional_count_offset()));
-
- if (isolate()->strong()) {
- __ andl(ECX,
- Immediate(Smi::RawValue(
- ArgumentsDescriptor::PositionalCountField::mask_in_place())));
- }
-
- // Check that min_num_pos_args <= num_pos_args.
- __ cmpl(ECX, Immediate(Smi::RawValue(min_num_pos_args)));
- __ j(LESS, &wrong_num_arguments);
- // Check that num_pos_args <= max_num_pos_args.
- __ cmpl(ECX, Immediate(Smi::RawValue(max_num_pos_args)));
- __ j(GREATER, &wrong_num_arguments);
-
- // Copy positional arguments.
- // Argument i passed at fp[kParamEndSlotFromFp + num_args - i] is copied
- // to fp[kFirstLocalSlotFromFp - i].
-
- __ movl(EBX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
- // Since EBX and ECX are Smi, use TIMES_2 instead of TIMES_4.
- // Let EBX point to the last passed positional argument, i.e. to
- // fp[kParamEndSlotFromFp + num_args - (num_pos_args - 1)].
- __ subl(EBX, ECX);
- __ leal(EBX,
- Address(EBP, EBX, TIMES_2, (kParamEndSlotFromFp + 1) * kWordSize));
-
- // Let EDI point to the last copied positional argument, i.e. to
- // fp[kFirstLocalSlotFromFp - (num_pos_args - 1)].
- __ leal(EDI, Address(EBP, (kFirstLocalSlotFromFp + 1) * kWordSize));
- __ subl(EDI, ECX); // ECX is a Smi, subtract twice for TIMES_4 scaling.
- __ subl(EDI, ECX);
- __ SmiUntag(ECX);
- Label loop, loop_condition;
- __ jmp(&loop_condition, Assembler::kNearJump);
- // We do not use the final allocation index of the variable here, i.e.
- // scope->VariableAt(i)->index(), because captured variables still need
- // to be copied to the context that is not yet allocated.
- const Address argument_addr(EBX, ECX, TIMES_4, 0);
- const Address copy_addr(EDI, ECX, TIMES_4, 0);
- __ Bind(&loop);
- __ movl(EAX, argument_addr);
- __ movl(copy_addr, EAX);
- __ Bind(&loop_condition);
- __ decl(ECX);
- __ j(POSITIVE, &loop, Assembler::kNearJump);
-
- // Copy or initialize optional named arguments.
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
- Label all_arguments_processed;
-#ifdef DEBUG
- const bool check_correct_named_args = true;
-#else
- const bool check_correct_named_args = check_arguments;
-#endif
- if (num_opt_named_params > 0) {
- // Start by alphabetically sorting the names of the optional parameters.
- LocalVariable** opt_param = new LocalVariable*[num_opt_named_params];
- int* opt_param_position = new int[num_opt_named_params];
- for (int pos = num_fixed_params; pos < num_params; pos++) {
- LocalVariable* parameter = scope->VariableAt(pos);
- const String& opt_param_name = parameter->name();
- int i = pos - num_fixed_params;
- while (--i >= 0) {
- LocalVariable* param_i = opt_param[i];
- const intptr_t result = opt_param_name.CompareTo(param_i->name());
- ASSERT(result != 0);
- if (result > 0) break;
- opt_param[i + 1] = opt_param[i];
- opt_param_position[i + 1] = opt_param_position[i];
- }
- opt_param[i + 1] = parameter;
- opt_param_position[i + 1] = pos;
- }
- // Generate code handling each optional parameter in alphabetical order.
- __ movl(EBX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
- // Let EBX point to the first passed argument, i.e. to
- // fp[kParamEndSlotFromFp + num_args - 0]; num_args (EBX) is Smi.
- __ leal(EBX, Address(EBP, EBX, TIMES_2, kParamEndSlotFromFp * kWordSize));
- // Let EDI point to the entry of the first named argument.
- __ leal(EDI,
- FieldAddress(EDX, ArgumentsDescriptor::first_named_entry_offset()));
- for (int i = 0; i < num_opt_named_params; i++) {
- Label load_default_value, assign_optional_parameter;
- const int param_pos = opt_param_position[i];
- // Check if this named parameter was passed in.
- // Load EAX with the name of the argument.
- __ movl(EAX, Address(EDI, ArgumentsDescriptor::name_offset()));
- ASSERT(opt_param[i]->name().IsSymbol());
- __ CompareObject(EAX, opt_param[i]->name());
- __ j(NOT_EQUAL, &load_default_value, Assembler::kNearJump);
- // Load EAX with passed-in argument at provided arg_pos, i.e. at
- // fp[kParamEndSlotFromFp + num_args - arg_pos].
- __ movl(EAX, Address(EDI, ArgumentsDescriptor::position_offset()));
- if (isolate()->strong()) {
- __ andl(
- EAX,
- Immediate(Smi::RawValue(
- ArgumentsDescriptor::PositionalCountField::mask_in_place())));
- }
- // EAX is arg_pos as Smi.
- // Point to next named entry.
- __ addl(EDI, Immediate(ArgumentsDescriptor::named_entry_size()));
- __ negl(EAX);
- Address argument_addr(EBX, EAX, TIMES_2, 0); // EAX is a negative Smi.
- __ movl(EAX, argument_addr);
- __ jmp(&assign_optional_parameter, Assembler::kNearJump);
- __ Bind(&load_default_value);
- // Load EAX with default argument.
- const Instance& value = parsed_function().DefaultParameterValueAt(
- param_pos - num_fixed_params);
- __ LoadObject(EAX, value);
- __ Bind(&assign_optional_parameter);
- // Assign EAX to fp[kFirstLocalSlotFromFp - param_pos].
- // We do not use the final allocation index of the variable here, i.e.
- // scope->VariableAt(i)->index(), because captured variables still need
- // to be copied to the context that is not yet allocated.
- const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos;
- const Address param_addr(EBP, computed_param_pos * kWordSize);
- __ movl(param_addr, EAX);
- }
- delete[] opt_param;
- delete[] opt_param_position;
- if (check_correct_named_args) {
- // Check that EDI now points to the null terminator in the arguments
- // descriptor.
- __ cmpl(Address(EDI, 0), raw_null);
- __ j(EQUAL, &all_arguments_processed, Assembler::kNearJump);
- }
- } else {
- ASSERT(num_opt_pos_params > 0);
- __ movl(ECX,
- FieldAddress(EDX, ArgumentsDescriptor::positional_count_offset()));
- __ SmiUntag(ECX);
- if (isolate()->strong()) {
- __ andl(ECX,
- Immediate(
- ArgumentsDescriptor::PositionalCountField::mask_in_place()));
- }
- for (int i = 0; i < num_opt_pos_params; i++) {
- Label next_parameter;
- // Handle this optional positional parameter only if k or fewer positional
- // arguments have been passed, where k is param_pos, the position of this
- // optional parameter in the formal parameter list.
- const int param_pos = num_fixed_params + i;
- __ cmpl(ECX, Immediate(param_pos));
- __ j(GREATER, &next_parameter, Assembler::kNearJump);
- // Load EAX with default argument.
- const Object& value = parsed_function().DefaultParameterValueAt(i);
- __ LoadObject(EAX, value);
- // Assign EAX to fp[kFirstLocalSlotFromFp - param_pos].
- // We do not use the final allocation index of the variable here, i.e.
- // scope->VariableAt(i)->index(), because captured variables still need
- // to be copied to the context that is not yet allocated.
- const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos;
- const Address param_addr(EBP, computed_param_pos * kWordSize);
- __ movl(param_addr, EAX);
- __ Bind(&next_parameter);
- }
- if (check_correct_named_args) {
- __ movl(EBX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
- __ SmiUntag(EBX);
- // Check that ECX equals EBX, i.e. no named arguments passed.
- __ cmpl(ECX, EBX);
- __ j(EQUAL, &all_arguments_processed, Assembler::kNearJump);
- }
- }
-
- __ Bind(&wrong_num_arguments);
- if (check_arguments) {
- __ LeaveFrame(); // The arguments are still on the stack.
- __ Jmp(*StubCode::CallClosureNoSuchMethod_entry());
- // The noSuchMethod call may return to the caller, but not here.
- } else if (check_correct_named_args) {
- __ Stop("Wrong arguments");
- }
-
- __ Bind(&all_arguments_processed);
- // Nullify originally passed arguments only after they have been copied and
- // checked, otherwise noSuchMethod would not see their original values.
- // This step can be skipped in case we decide that formal parameters are
- // implicitly final, since garbage collecting the unmodified value is not
- // an issue anymore.
-
- // EDX : arguments descriptor array.
- __ movl(ECX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
- __ SmiUntag(ECX);
- Label null_args_loop, null_args_loop_condition;
- __ jmp(&null_args_loop_condition, Assembler::kNearJump);
- const Address original_argument_addr(EBP, ECX, TIMES_4,
- (kParamEndSlotFromFp + 1) * kWordSize);
- __ Bind(&null_args_loop);
- __ movl(original_argument_addr, raw_null);
- __ Bind(&null_args_loop_condition);
- __ decl(ECX);
- __ j(POSITIVE, &null_args_loop, Assembler::kNearJump);
-}
-
void FlowGraphCompiler::GenerateInlinedGetter(intptr_t offset) {
// TOS: return address.
// +1 : receiver.
@@ -1012,8 +760,7 @@
}
__ Comment("Enter frame");
if (flow_graph().IsCompiledForOsr()) {
- intptr_t extra_slots = StackSize() - flow_graph().num_stack_locals() -
- flow_graph().num_copied_params();
+ intptr_t extra_slots = StackSize() - flow_graph().num_stack_locals();
ASSERT(extra_slots >= 0);
__ EnterOsrFrame(extra_slots * kWordSize);
} else {
@@ -1032,139 +779,28 @@
EmitFrameEntry();
- const Function& function = parsed_function().function();
-
- const int num_fixed_params = function.num_fixed_parameters();
- const int num_copied_params = parsed_function().num_copied_params();
- const int num_locals = parsed_function().num_stack_locals();
-
- // The prolog of OSR functions is never executed, hence greatly simplified.
- const bool expect_type_args = isolate()->reify_generic_functions() &&
- function.IsGeneric() &&
- !flow_graph().IsCompiledForOsr();
-
- const bool check_arguments =
- (function.IsClosureFunction() || function.IsConvertedClosureFunction()) &&
- !flow_graph().IsCompiledForOsr();
-
- // We check the number of passed arguments when we have to copy them due to
- // the presence of optional parameters.
- // No such checking code is generated if only fixed parameters are declared,
- // unless we are in debug mode or unless we are compiling a closure.
- if (num_copied_params == 0) {
- if (check_arguments) {
- Label correct_num_arguments, wrong_num_arguments;
- CheckTypeArgsLen(expect_type_args, &wrong_num_arguments);
- __ Comment("Check argument count");
- // Check that exactly num_fixed arguments are passed in.
- __ movl(EAX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
- __ cmpl(EAX, Immediate(Smi::RawValue(num_fixed_params)));
- __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump);
-
- if (isolate()->strong()) {
- __ movl(ECX, FieldAddress(
- EDX, ArgumentsDescriptor::positional_count_offset()));
- __ andl(
- ECX,
- Immediate(Smi::RawValue(
- ArgumentsDescriptor::PositionalCountField::mask_in_place())));
- __ cmpl(EAX, ECX);
- } else {
- __ cmpl(EAX, FieldAddress(
- EDX, ArgumentsDescriptor::positional_count_offset()));
- }
-
- __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump);
-
- __ Bind(&wrong_num_arguments);
- __ LeaveFrame(); // The arguments are still on the stack.
- __ Jmp(*StubCode::CallClosureNoSuchMethod_entry());
- // The noSuchMethod call may return to the caller, but not here.
- __ Bind(&correct_num_arguments);
- }
- } else if (!flow_graph().IsCompiledForOsr()) {
- CopyParameters(expect_type_args, check_arguments);
- }
-
- if (function.IsClosureFunction() && !flow_graph().IsCompiledForOsr()) {
- // Load context from the closure object (first argument).
- LocalScope* scope = parsed_function().node_sequence()->scope();
- LocalVariable* closure_parameter = scope->VariableAt(0);
- // TODO(fschneider): Don't load context for optimized functions that
- // don't use it.
- __ movl(CTX, Address(EBP, closure_parameter->index() * kWordSize));
- __ movl(CTX, FieldAddress(CTX, Closure::context_offset()));
-#ifdef DEBUG
- Label ok;
- __ LoadClassId(EBX, CTX);
- __ cmpl(EBX, Immediate(kContextCid));
- __ j(EQUAL, &ok, Assembler::kNearJump);
- __ Stop("Incorrect context at entry");
- __ Bind(&ok);
-#endif
- }
-
- // In unoptimized code, initialize (non-argument) stack allocated slots to
- // null.
+ // In unoptimized code, initialize (non-argument) stack allocated slots.
if (!is_optimizing()) {
- ASSERT(num_locals > 0); // There is always at least context_var.
+ const int num_locals = parsed_function().num_stack_locals();
+
+ intptr_t args_desc_index = -1;
+ if (parsed_function().has_arg_desc_var()) {
+ args_desc_index =
+ -(parsed_function().arg_desc_var()->index() - kFirstLocalSlotFromFp);
+ }
+
__ Comment("Initialize spill slots");
- const intptr_t slot_base = parsed_function().first_stack_local_index();
- const intptr_t context_index =
- parsed_function().current_context_var()->index();
- if (num_locals > 1) {
+ if (num_locals > 1 || args_desc_index != 0) {
const Immediate& raw_null =
Immediate(reinterpret_cast<intptr_t>(Object::null()));
__ movl(EAX, raw_null);
}
for (intptr_t i = 0; i < num_locals; ++i) {
- // Subtract index i (locals lie at lower addresses than EBP).
- if (((slot_base - i) == context_index)) {
- if (function.IsClosureFunction()) {
- __ movl(Address(EBP, (slot_base - i) * kWordSize), CTX);
- } else {
- const Immediate& raw_empty_context = Immediate(
- reinterpret_cast<intptr_t>(Object::empty_context().raw()));
- __ movl(Address(EBP, (slot_base - i) * kWordSize), raw_empty_context);
- }
- } else {
- ASSERT(num_locals > 1);
- __ movl(Address(EBP, (slot_base - i) * kWordSize), EAX);
- }
+ Register value_reg = i == args_desc_index ? ARGS_DESC_REG : EAX;
+ __ movl(Address(EBP, (kFirstLocalSlotFromFp - i) * kWordSize), value_reg);
}
}
- // Copy passed-in type argument vector if the function is generic.
- if (expect_type_args) {
- __ Comment("Copy passed-in type args");
- Label store_type_args, ok;
- __ cmpl(FieldAddress(EDX, ArgumentsDescriptor::type_args_len_offset()),
- Immediate(Smi::RawValue(0)));
- if (is_optimizing()) {
- // Initialize type_args to null if none passed in.
- const Immediate& raw_null =
- Immediate(reinterpret_cast<intptr_t>(Object::null()));
- __ movl(EAX, raw_null);
- __ j(EQUAL, &store_type_args, Assembler::kNearJump);
- } else {
- __ j(EQUAL, &ok, Assembler::kNearJump); // Already initialized to null.
- }
- // Load the passed type args vector in EAX from
- // fp[kParamEndSlotFromFp + num_args + 1]; num_args (EBX) is Smi.
- __ movl(EBX, FieldAddress(EDX, ArgumentsDescriptor::count_offset()));
- __ movl(EAX,
- Address(EBP, EBX, TIMES_2, (kParamEndSlotFromFp + 1) * kWordSize));
- // Store EAX into the stack slot reserved for the function type arguments.
- // If the function type arguments variable is captured, a copy will happen
- // after the context is allocated.
- const intptr_t slot_base = parsed_function().first_stack_local_index();
- ASSERT(parsed_function().function_type_arguments()->is_captured() ||
- parsed_function().function_type_arguments()->index() == slot_base);
- __ Bind(&store_type_args);
- __ movl(Address(EBP, slot_base * kWordSize), EAX);
- __ Bind(&ok);
- }
-
EndCodeSourceRange(TokenPosition::kDartCodePrologue);
ASSERT(!block_order().is_empty());
VisitBlocks();
diff --git a/runtime/vm/compiler/backend/flow_graph_compiler_x64.cc b/runtime/vm/compiler/backend/flow_graph_compiler_x64.cc
index 76a51aa..ffa97bd 100644
--- a/runtime/vm/compiler/backend/flow_graph_compiler_x64.cc
+++ b/runtime/vm/compiler/backend/flow_graph_compiler_x64.cc
@@ -704,264 +704,6 @@
}
}
-// Input parameters:
-// R10: arguments descriptor array.
-void FlowGraphCompiler::CheckTypeArgsLen(bool expect_type_args,
- Label* wrong_num_arguments) {
- __ Comment("Check type args len");
- const Function& function = parsed_function().function();
- Label correct_type_args_len;
- if (expect_type_args) {
- // Type args are always optional, so length can always be zero.
- // If expect_type_args, a non-zero length must match the declaration length.
- __ movq(RAX,
- FieldAddress(R10, ArgumentsDescriptor::type_args_len_offset()));
- if (isolate()->strong()) {
- __ andq(RAX,
- Immediate(Smi::RawValue(
- ArgumentsDescriptor::TypeArgsLenField::mask_in_place())));
- }
- __ CompareImmediate(RAX, Immediate(Smi::RawValue(0)));
- __ j(EQUAL, &correct_type_args_len, Assembler::kNearJump);
- __ CompareImmediate(RAX,
- Immediate(Smi::RawValue(function.NumTypeParameters())));
- } else {
- __ cmpq(FieldAddress(R10, ArgumentsDescriptor::type_args_len_offset()),
- Immediate(Smi::RawValue(0)));
- }
- __ j(NOT_EQUAL, wrong_num_arguments);
- __ Bind(&correct_type_args_len);
-}
-
-// Input parameters:
-// R10: arguments descriptor array.
-void FlowGraphCompiler::CopyParameters(bool expect_type_args,
- bool check_arguments) {
- Label wrong_num_arguments;
- if (check_arguments) {
- CheckTypeArgsLen(expect_type_args, &wrong_num_arguments);
- }
- __ Comment("Copy parameters");
- const Function& function = parsed_function().function();
- LocalScope* scope = parsed_function().node_sequence()->scope();
- const int num_fixed_params = function.num_fixed_parameters();
- const int num_opt_pos_params = function.NumOptionalPositionalParameters();
- const int num_opt_named_params = function.NumOptionalNamedParameters();
- const int num_params =
- num_fixed_params + num_opt_pos_params + num_opt_named_params;
- ASSERT(function.NumParameters() == num_params);
- ASSERT(parsed_function().first_parameter_index() == kFirstLocalSlotFromFp);
-
- // Check that min_num_pos_args <= num_pos_args <= max_num_pos_args,
- // where num_pos_args is the number of positional arguments passed in.
- const int min_num_pos_args = num_fixed_params;
- const int max_num_pos_args = num_fixed_params + num_opt_pos_params;
-
- __ movq(RCX,
- FieldAddress(R10, ArgumentsDescriptor::positional_count_offset()));
-
- if (isolate()->strong()) {
- __ andq(RCX,
- Immediate(Smi::RawValue(
- ArgumentsDescriptor::PositionalCountField::mask_in_place())));
- }
-
- // Check that min_num_pos_args <= num_pos_args.
- __ CompareImmediate(RCX, Immediate(Smi::RawValue(min_num_pos_args)));
- __ j(LESS, &wrong_num_arguments);
- // Check that num_pos_args <= max_num_pos_args.
- __ CompareImmediate(RCX, Immediate(Smi::RawValue(max_num_pos_args)));
- __ j(GREATER, &wrong_num_arguments);
-
- // Copy positional arguments.
- // Argument i passed at fp[kParamEndSlotFromFp + num_args - i] is copied
- // to fp[kFirstLocalSlotFromFp - i].
-
- __ movq(RBX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
- // Since RBX and RCX are Smi, use TIMES_4 instead of TIMES_8.
- // Let RBX point to the last passed positional argument, i.e. to
- // fp[kParamEndSlotFromFp + num_args - (num_pos_args - 1)].
- __ subq(RBX, RCX);
- __ leaq(RBX,
- Address(RBP, RBX, TIMES_4, (kParamEndSlotFromFp + 1) * kWordSize));
-
- // Let RDI point to the last copied positional argument, i.e. to
- // fp[kFirstLocalSlotFromFp - (num_pos_args - 1)].
- __ SmiUntag(RCX);
- __ movq(RAX, RCX);
- __ negq(RAX);
- // -num_pos_args is in RAX.
- __ leaq(RDI,
- Address(RBP, RAX, TIMES_8, (kFirstLocalSlotFromFp + 1) * kWordSize));
- Label loop, loop_condition;
- __ jmp(&loop_condition, Assembler::kNearJump);
- // We do not use the final allocation index of the variable here, i.e.
- // scope->VariableAt(i)->index(), because captured variables still need
- // to be copied to the context that is not yet allocated.
- const Address argument_addr(RBX, RCX, TIMES_8, 0);
- const Address copy_addr(RDI, RCX, TIMES_8, 0);
- __ Bind(&loop);
- __ movq(RAX, argument_addr);
- __ movq(copy_addr, RAX);
- __ Bind(&loop_condition);
- __ decq(RCX);
- __ j(POSITIVE, &loop, Assembler::kNearJump);
-
- // Copy or initialize optional named arguments.
- Label all_arguments_processed;
-#ifdef DEBUG
- const bool check_correct_named_args = true;
-#else
- const bool check_correct_named_args = check_arguments;
-#endif
- if (num_opt_named_params > 0) {
- // Start by alphabetically sorting the names of the optional parameters.
- LocalVariable** opt_param = new LocalVariable*[num_opt_named_params];
- int* opt_param_position = new int[num_opt_named_params];
- for (int pos = num_fixed_params; pos < num_params; pos++) {
- LocalVariable* parameter = scope->VariableAt(pos);
- const String& opt_param_name = parameter->name();
- int i = pos - num_fixed_params;
- while (--i >= 0) {
- LocalVariable* param_i = opt_param[i];
- const intptr_t result = opt_param_name.CompareTo(param_i->name());
- ASSERT(result != 0);
- if (result > 0) break;
- opt_param[i + 1] = opt_param[i];
- opt_param_position[i + 1] = opt_param_position[i];
- }
- opt_param[i + 1] = parameter;
- opt_param_position[i + 1] = pos;
- }
- // Generate code handling each optional parameter in alphabetical order.
- __ movq(RBX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
- // Let RBX point to the first passed argument, i.e. to
- // fp[kParamEndSlotFromFp + num_args]; num_args (RBX) is Smi.
- __ leaq(RBX, Address(RBP, RBX, TIMES_4, kParamEndSlotFromFp * kWordSize));
- // Let RDI point to the entry of the first named argument.
- __ leaq(RDI,
- FieldAddress(R10, ArgumentsDescriptor::first_named_entry_offset()));
- for (int i = 0; i < num_opt_named_params; i++) {
- Label load_default_value, assign_optional_parameter;
- const int param_pos = opt_param_position[i];
- // Check if this named parameter was passed in.
- // Load RAX with the name of the argument.
- __ movq(RAX, Address(RDI, ArgumentsDescriptor::name_offset()));
- ASSERT(opt_param[i]->name().IsSymbol());
- __ CompareObject(RAX, opt_param[i]->name());
- __ j(NOT_EQUAL, &load_default_value, Assembler::kNearJump);
- // Load RAX with passed-in argument at provided arg_pos, i.e. at
- // fp[kParamEndSlotFromFp + num_args - arg_pos].
- __ movq(RAX, Address(RDI, ArgumentsDescriptor::position_offset()));
- if (isolate()->strong()) {
- __ andq(
- RAX,
- Immediate(Smi::RawValue(
- ArgumentsDescriptor::PositionalCountField::mask_in_place())));
- }
- // RAX is arg_pos as Smi.
- // Point to next named entry.
- __ AddImmediate(RDI, Immediate(ArgumentsDescriptor::named_entry_size()));
- __ negq(RAX);
- Address argument_addr(RBX, RAX, TIMES_4, 0); // RAX is a negative Smi.
- __ movq(RAX, argument_addr);
- __ jmp(&assign_optional_parameter, Assembler::kNearJump);
- __ Bind(&load_default_value);
- // Load RAX with default argument.
- const Instance& value = parsed_function().DefaultParameterValueAt(
- param_pos - num_fixed_params);
- __ LoadObject(RAX, value);
- __ Bind(&assign_optional_parameter);
- // Assign RAX to fp[kFirstLocalSlotFromFp - param_pos].
- // We do not use the final allocation index of the variable here, i.e.
- // scope->VariableAt(i)->index(), because captured variables still need
- // to be copied to the context that is not yet allocated.
- const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos;
- const Address param_addr(RBP, computed_param_pos * kWordSize);
- __ movq(param_addr, RAX);
- }
- delete[] opt_param;
- delete[] opt_param_position;
- if (check_correct_named_args) {
- // Check that RDI now points to the null terminator in the arguments
- // descriptor.
- __ LoadObject(TMP, Object::null_object());
- __ cmpq(Address(RDI, 0), TMP);
- __ j(EQUAL, &all_arguments_processed, Assembler::kNearJump);
- }
- } else {
- ASSERT(num_opt_pos_params > 0);
- __ movq(RCX,
- FieldAddress(R10, ArgumentsDescriptor::positional_count_offset()));
-
- __ SmiUntag(RCX);
-
- if (isolate()->strong()) {
- __ andq(RCX,
- Immediate(
- ArgumentsDescriptor::PositionalCountField::mask_in_place()));
- }
-
- for (int i = 0; i < num_opt_pos_params; i++) {
- Label next_parameter;
- // Handle this optional positional parameter only if k or fewer positional
- // arguments have been passed, where k is param_pos, the position of this
- // optional parameter in the formal parameter list.
- const int param_pos = num_fixed_params + i;
- __ CompareImmediate(RCX, Immediate(param_pos));
- __ j(GREATER, &next_parameter, Assembler::kNearJump);
- // Load RAX with default argument.
- const Object& value = parsed_function().DefaultParameterValueAt(i);
- __ LoadObject(RAX, value);
- // Assign RAX to fp[kFirstLocalSlotFromFp - param_pos].
- // We do not use the final allocation index of the variable here, i.e.
- // scope->VariableAt(i)->index(), because captured variables still need
- // to be copied to the context that is not yet allocated.
- const intptr_t computed_param_pos = kFirstLocalSlotFromFp - param_pos;
- const Address param_addr(RBP, computed_param_pos * kWordSize);
- __ movq(param_addr, RAX);
- __ Bind(&next_parameter);
- }
- if (check_correct_named_args) {
- __ movq(RBX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
- __ SmiUntag(RBX);
- // Check that RCX equals RBX, i.e. no named arguments passed.
- __ cmpq(RCX, RBX);
- __ j(EQUAL, &all_arguments_processed, Assembler::kNearJump);
- }
- }
-
- __ Bind(&wrong_num_arguments);
- if (check_arguments) {
- __ LeaveDartFrame(kKeepCalleePP); // The arguments are still on the stack.
- __ Jmp(*StubCode::CallClosureNoSuchMethod_entry());
- // The noSuchMethod call may return to the caller, but not here.
- } else if (check_correct_named_args) {
- __ Stop("Wrong arguments");
- }
-
- __ Bind(&all_arguments_processed);
- // Nullify originally passed arguments only after they have been copied and
- // checked, otherwise noSuchMethod would not see their original values.
- // This step can be skipped in case we decide that formal parameters are
- // implicitly final, since garbage collecting the unmodified value is not
- // an issue anymore.
-
- // R10 : arguments descriptor array.
- __ movq(RCX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
- __ SmiUntag(RCX);
- __ LoadObject(R12, Object::null_object());
- Label null_args_loop, null_args_loop_condition;
- __ jmp(&null_args_loop_condition, Assembler::kNearJump);
- const Address original_argument_addr(RBP, RCX, TIMES_8,
- (kParamEndSlotFromFp + 1) * kWordSize);
- __ Bind(&null_args_loop);
- __ movq(original_argument_addr, R12);
- __ Bind(&null_args_loop_condition);
- __ decq(RCX);
- __ j(POSITIVE, &null_args_loop, Assembler::kNearJump);
-}
-
void FlowGraphCompiler::GenerateInlinedGetter(intptr_t offset) {
// TOS: return address.
// +1 : receiver.
@@ -989,8 +731,7 @@
// needs to be updated to match.
void FlowGraphCompiler::EmitFrameEntry() {
if (flow_graph().IsCompiledForOsr()) {
- intptr_t extra_slots = StackSize() - flow_graph().num_stack_locals() -
- flow_graph().num_copied_params();
+ intptr_t extra_slots = StackSize() - flow_graph().num_stack_locals();
ASSERT(extra_slots >= 0);
__ EnterOsrFrame(extra_slots * kWordSize);
} else {
@@ -1023,9 +764,8 @@
void FlowGraphCompiler::CompileGraph() {
InitCompiler();
- const Function& function = parsed_function().function();
-
#ifdef DART_PRECOMPILER
+ const Function& function = parsed_function().function();
if (function.IsDynamicFunction()) {
__ MonomorphicCheckedEntry();
}
@@ -1039,130 +779,26 @@
EmitFrameEntry();
ASSERT(assembler()->constant_pool_allowed());
- const int num_fixed_params = function.num_fixed_parameters();
- const int num_copied_params = parsed_function().num_copied_params();
- const int num_locals = parsed_function().num_stack_locals();
-
- // The prolog of OSR functions is never executed, hence greatly simplified.
- const bool expect_type_args = isolate()->reify_generic_functions() &&
- function.IsGeneric() &&
- !flow_graph().IsCompiledForOsr();
-
- const bool check_arguments =
- (function.IsClosureFunction() || function.IsConvertedClosureFunction()) &&
- !flow_graph().IsCompiledForOsr();
-
- // We check the number of passed arguments when we have to copy them due to
- // the presence of optional parameters.
- // No such checking code is generated if only fixed parameters are declared,
- // unless we are in debug mode or unless we are compiling a closure.
- if (num_copied_params == 0) {
- if (check_arguments) {
- Label correct_num_arguments, wrong_num_arguments;
- CheckTypeArgsLen(expect_type_args, &wrong_num_arguments);
- __ Comment("Check argument count");
- // Check that exactly num_fixed arguments are passed in.
- __ movq(RAX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
- __ CompareImmediate(RAX, Immediate(Smi::RawValue(num_fixed_params)));
- __ j(NOT_EQUAL, &wrong_num_arguments, Assembler::kNearJump);
-
- if (isolate()->strong()) {
- __ movq(RCX, FieldAddress(
- R10, ArgumentsDescriptor::positional_count_offset()));
- __ andq(
- RCX,
- Immediate(Smi::RawValue(
- ArgumentsDescriptor::PositionalCountField::mask_in_place())));
- __ cmpq(RAX, RCX);
- } else {
- __ cmpq(RAX, FieldAddress(
- R10, ArgumentsDescriptor::positional_count_offset()));
- }
-
- __ j(EQUAL, &correct_num_arguments, Assembler::kNearJump);
-
- __ Bind(&wrong_num_arguments);
- __ LeaveDartFrame(kKeepCalleePP); // Leave arguments on the stack.
- __ Jmp(*StubCode::CallClosureNoSuchMethod_entry());
- // The noSuchMethod call may return to the caller, but not here.
- __ Bind(&correct_num_arguments);
- }
- } else if (!flow_graph().IsCompiledForOsr()) {
- CopyParameters(expect_type_args, check_arguments);
- }
-
- if (function.IsClosureFunction() && !flow_graph().IsCompiledForOsr()) {
- // Load context from the closure object (first argument).
- LocalScope* scope = parsed_function().node_sequence()->scope();
- LocalVariable* closure_parameter = scope->VariableAt(0);
- __ movq(CTX, Address(RBP, closure_parameter->index() * kWordSize));
- __ movq(CTX, FieldAddress(CTX, Closure::context_offset()));
-#ifdef DEBUG
- Label ok;
- __ LoadClassId(RAX, CTX);
- __ cmpq(RAX, Immediate(kContextCid));
- __ j(EQUAL, &ok, Assembler::kNearJump);
- __ Stop("Incorrect context at entry");
- __ Bind(&ok);
-#endif
- }
-
- // In unoptimized code, initialize (non-argument) stack allocated slots to
- // null.
+ // In unoptimized code, initialize (non-argument) stack allocated slots.
if (!is_optimizing()) {
- ASSERT(num_locals > 0); // There is always at least context_var.
+ const int num_locals = parsed_function().num_stack_locals();
+
+ intptr_t args_desc_index = -1;
+ if (parsed_function().has_arg_desc_var()) {
+ args_desc_index =
+ -(parsed_function().arg_desc_var()->index() - kFirstLocalSlotFromFp);
+ }
+
__ Comment("Initialize spill slots");
- const intptr_t slot_base = parsed_function().first_stack_local_index();
- const intptr_t context_index =
- parsed_function().current_context_var()->index();
- if (num_locals > 1) {
+ if (num_locals > 1 || (num_locals == 1 && args_desc_index == -1)) {
__ LoadObject(RAX, Object::null_object());
}
for (intptr_t i = 0; i < num_locals; ++i) {
- // Subtract index i (locals lie at lower addresses than RBP).
- if (((slot_base - i) == context_index)) {
- if (function.IsClosureFunction()) {
- __ movq(Address(RBP, (slot_base - i) * kWordSize), CTX);
- } else {
- __ StoreObject(Address(RBP, (slot_base - i) * kWordSize),
- Object::empty_context());
- }
- } else {
- ASSERT(num_locals > 1);
- __ movq(Address(RBP, (slot_base - i) * kWordSize), RAX);
- }
+ Register value_reg = i == args_desc_index ? ARGS_DESC_REG : RAX;
+ __ movq(Address(RBP, (kFirstLocalSlotFromFp - i) * kWordSize), value_reg);
}
}
- // Copy passed-in type argument vector if the function is generic.
- if (expect_type_args) {
- __ Comment("Copy passed-in type args");
- Label store_type_args, ok;
- __ cmpq(FieldAddress(R10, ArgumentsDescriptor::type_args_len_offset()),
- Immediate(Smi::RawValue(0)));
- if (is_optimizing()) {
- // Initialize type_args to null if none passed in.
- __ LoadObject(RAX, Object::null_object());
- __ j(EQUAL, &store_type_args, Assembler::kNearJump);
- } else {
- __ j(EQUAL, &ok, Assembler::kNearJump); // Already initialized to null.
- }
- // Load the passed type args vector in RAX from
- // fp[kParamEndSlotFromFp + num_args + 1]; num_args (RBX) is Smi.
- __ movq(RBX, FieldAddress(R10, ArgumentsDescriptor::count_offset()));
- __ movq(RAX,
- Address(RBP, RBX, TIMES_4, (kParamEndSlotFromFp + 1) * kWordSize));
- // Store RAX into the stack slot reserved for the function type arguments.
- // If the function type arguments variable is captured, a copy will happen
- // after the context is allocated.
- const intptr_t slot_base = parsed_function().first_stack_local_index();
- ASSERT(parsed_function().function_type_arguments()->is_captured() ||
- parsed_function().function_type_arguments()->index() == slot_base);
- __ Bind(&store_type_args);
- __ movq(Address(RBP, slot_base * kWordSize), RAX);
- __ Bind(&ok);
- }
-
EndCodeSourceRange(TokenPosition::kDartCodePrologue);
ASSERT(!block_order().is_empty());
VisitBlocks();
diff --git a/runtime/vm/compiler/backend/il.h b/runtime/vm/compiler/backend/il.h
index 7fd0104..8fc4b58 100644
--- a/runtime/vm/compiler/backend/il.h
+++ b/runtime/vm/compiler/backend/il.h
@@ -372,6 +372,9 @@
M(Phi) \
M(Redefinition) \
M(Parameter) \
+ M(LoadIndexedUnsafe) \
+ M(StoreIndexedUnsafe) \
+ M(TailCall) \
M(ParallelMove) \
M(PushArgument) \
M(Return) \
@@ -2031,6 +2034,148 @@
DISALLOW_COPY_AND_ASSIGN(ParameterInstr);
};
+// Stores a tagged pointer to a slot accessable from a fixed register. It has
+// the form:
+//
+// base_reg[index + #constant] = value
+//
+// Input 0: A tagged Smi [index]
+// Input 1: A tagged pointer [value]
+// offset: A signed constant offset which fits into 8 bits
+//
+// Currently this instruction uses pinpoints the register to be FP.
+//
+// This lowlevel instruction is non-inlinable since it makes assumptons about
+// the frame. This is asserted via `inliner.cc::CalleeGraphValidator`.
+class StoreIndexedUnsafeInstr : public TemplateDefinition<2, NoThrow> {
+ public:
+ StoreIndexedUnsafeInstr(Value* index, Value* value, intptr_t offset)
+ : offset_(offset) {
+ SetInputAt(kIndexPos, index);
+ SetInputAt(kValuePos, value);
+ }
+
+ enum { kIndexPos = 0, kValuePos = 1 };
+
+ DECLARE_INSTRUCTION(StoreIndexedUnsafe)
+
+ virtual Representation RequiredInputRepresentation(intptr_t index) const {
+ ASSERT(index == kIndexPos || index == kValuePos);
+ return kTagged;
+ }
+ virtual bool ComputeCanDeoptimize() const { return false; }
+ virtual bool HasUnknownSideEffects() const { return false; }
+
+ virtual bool AttributesEqual(Instruction* other) const {
+ return other->AsStoreIndexedUnsafe()->offset() == offset();
+ }
+
+ Value* index() const { return inputs_[kIndexPos]; }
+ Value* value() const { return inputs_[kValuePos]; }
+ Register base_reg() const { return FPREG; }
+ intptr_t offset() const { return offset_; }
+
+ PRINT_OPERANDS_TO_SUPPORT
+
+ private:
+ const intptr_t offset_;
+
+ DISALLOW_COPY_AND_ASSIGN(StoreIndexedUnsafeInstr);
+};
+
+// Loads a tagged pointer from slot accessable from a fixed register. It has
+// the form:
+//
+// base_reg[index + #constant]
+//
+// Input 0: A tagged Smi [index]
+// offset: A signed constant offset which fits into 8 bits
+//
+// Currently this instruction uses pinpoints the register to be FP.
+//
+// This lowlevel instruction is non-inlinable since it makes assumptons about
+// the frame. This is asserted via `inliner.cc::CalleeGraphValidator`.
+class LoadIndexedUnsafeInstr : public TemplateDefinition<1, NoThrow> {
+ public:
+ LoadIndexedUnsafeInstr(Value* index, intptr_t offset) : offset_(offset) {
+ SetInputAt(0, index);
+ }
+
+ DECLARE_INSTRUCTION(LoadIndexedUnsafe)
+
+ virtual Representation RequiredInputRepresentation(intptr_t index) const {
+ ASSERT(index == 0);
+ return kTagged;
+ }
+ virtual Representation representation() const { return kTagged; }
+ virtual bool ComputeCanDeoptimize() const { return false; }
+ virtual bool HasUnknownSideEffects() const { return false; }
+
+ virtual bool AttributesEqual(Instruction* other) const {
+ return other->AsLoadIndexedUnsafe()->offset() == offset();
+ }
+
+ Value* index() const { return InputAt(0); }
+ Register base_reg() const { return FPREG; }
+ intptr_t offset() const { return offset_; }
+
+ PRINT_OPERANDS_TO_SUPPORT
+
+ private:
+ const intptr_t offset_;
+
+ DISALLOW_COPY_AND_ASSIGN(LoadIndexedUnsafeInstr);
+};
+
+// Unwinds the current frame and taill calls a target.
+//
+// The return address saved by the original caller of this frame will be in it's
+// usual location (stack or LR). The arguments descriptor supplied by the
+// original caller will be put into ARGS_DESC_REG.
+//
+// This lowlevel instruction is non-inlinable since it makes assumptons about
+// the frame. This is asserted via `inliner.cc::CalleeGraphValidator`.
+class TailCallInstr : public Instruction {
+ public:
+ TailCallInstr(const Code& code, Value* arg_desc)
+ : code_(code), arg_desc_(NULL) {
+ SetInputAt(0, arg_desc);
+ }
+
+ DECLARE_INSTRUCTION(TailCall)
+
+ const Code& code() const { return code_; }
+
+ virtual intptr_t InputCount() const { return 1; }
+ virtual Value* InputAt(intptr_t i) const {
+ ASSERT(i == 0);
+ return arg_desc_;
+ }
+ virtual void RawSetInputAt(intptr_t i, Value* value) {
+ ASSERT(i == 0);
+ arg_desc_ = value;
+ }
+
+ // Two tailcalls can be canonicalized into one instruction if both have the
+ // same destination.
+ virtual bool AllowsCSE() const { return true; }
+ virtual bool AttributesEqual(Instruction* other) const {
+ return &other->AsTailCall()->code() == &code();
+ }
+
+ // Since no code after this instruction will be executed, there will be no
+ // side-effects for the following code.
+ virtual bool HasUnknownSideEffects() const { return false; }
+ virtual bool MayThrow() const { return true; }
+ virtual bool ComputeCanDeoptimize() const { return false; }
+
+ PRINT_OPERANDS_TO_SUPPORT
+
+ private:
+ const Code& code_;
+ Value* arg_desc_;
+};
+
class PushArgumentInstr : public TemplateDefinition<1, NoThrow> {
public:
explicit PushArgumentInstr(Value* value) { SetInputAt(0, value); }
@@ -2745,11 +2890,12 @@
DISALLOW_COPY_AND_ASSIGN(AssertBooleanInstr);
};
-// Denotes a special parameter, currently either the context of a closure
-// or the type arguments of a generic function.
+// Denotes a special parameter, currently either the context of a closure,
+// the type arguments of a generic function or an arguments descriptor.
class SpecialParameterInstr : public TemplateDefinition<0, NoThrow> {
public:
- enum SpecialParameterKind { kContext, kTypeArgs };
+ enum SpecialParameterKind { kContext, kTypeArgs, kArgDescriptor };
+
SpecialParameterInstr(SpecialParameterKind kind, intptr_t deopt_id)
: TemplateDefinition(deopt_id), kind_(kind) {}
@@ -2765,6 +2911,23 @@
}
SpecialParameterKind kind() const { return kind_; }
+ const char* ToCString() const;
+
+ PRINT_OPERANDS_TO_SUPPORT
+
+ static const char* KindToCString(SpecialParameterKind kind) {
+ switch (kind) {
+ case kContext:
+ return "kContext";
+ case kTypeArgs:
+ return "kTypeArgs";
+ case kArgDescriptor:
+ return "kArgDescriptor";
+ }
+ UNREACHABLE();
+ return NULL;
+ }
+
private:
const SpecialParameterKind kind_;
DISALLOW_COPY_AND_ASSIGN(SpecialParameterInstr);
diff --git a/runtime/vm/compiler/backend/il_arm.cc b/runtime/vm/compiler/backend/il_arm.cc
index f8312ed..4b77db1 100644
--- a/runtime/vm/compiler/backend/il_arm.cc
+++ b/runtime/vm/compiler/backend/il_arm.cc
@@ -37,6 +37,42 @@
return result;
}
+DEFINE_BACKEND(LoadIndexedUnsafe, (Register out, Register index)) {
+ ASSERT(instr->RequiredInputRepresentation(0) == kTagged); // It is a Smi.
+ __ add(out, instr->base_reg(), Operand(index, LSL, 1));
+ __ ldr(out, Address(out, instr->offset()));
+
+ ASSERT(kSmiTag == 0);
+ ASSERT(kSmiTagSize == 1);
+}
+
+DEFINE_BACKEND(StoreIndexedUnsafe,
+ (NoLocation, Register index, Register value)) {
+ ASSERT(instr->RequiredInputRepresentation(
+ StoreIndexedUnsafeInstr::kIndexPos) == kTagged); // It is a Smi.
+ __ add(TMP, instr->base_reg(), Operand(index, LSL, 1));
+ __ str(value, Address(TMP, instr->offset()));
+
+ ASSERT(kSmiTag == 0);
+ ASSERT(kSmiTagSize == 1);
+}
+
+DEFINE_BACKEND(TailCall,
+ (NoLocation,
+ Fixed<Register, ARGS_DESC_REG>,
+ Temp<Register> temp)) {
+ __ LoadObject(CODE_REG, instr->code());
+ __ LeaveDartFrame(); // The arguments are still on the stack.
+ __ ldr(temp, FieldAddress(CODE_REG, Code::entry_point_offset()));
+ __ bx(temp);
+
+ // Even though the TailCallInstr will be the last instruction in a basic
+ // block, the flow graph compiler will emit native code for other blocks after
+ // the one containing this instruction and needs to be able to use the pool.
+ // (The `LeaveDartFrame` above disables usages of the pool.)
+ __ set_constant_pool_allowed(true);
+}
+
LocationSummary* PushArgumentInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
const intptr_t kNumInputs = 1;
diff --git a/runtime/vm/compiler/backend/il_arm64.cc b/runtime/vm/compiler/backend/il_arm64.cc
index 2a4e365..15d8cf1 100644
--- a/runtime/vm/compiler/backend/il_arm64.cc
+++ b/runtime/vm/compiler/backend/il_arm64.cc
@@ -36,6 +36,42 @@
return result;
}
+DEFINE_BACKEND(LoadIndexedUnsafe, (Register out, Register index)) {
+ ASSERT(instr->RequiredInputRepresentation(0) == kTagged); // It is a Smi.
+ __ add(out, instr->base_reg(), Operand(index, LSL, 2));
+ __ ldr(out, Address(out, instr->offset()));
+
+ ASSERT(kSmiTag == 0);
+ ASSERT(kSmiTagSize == 1);
+}
+
+DEFINE_BACKEND(StoreIndexedUnsafe,
+ (NoLocation, Register index, Register value)) {
+ ASSERT(instr->RequiredInputRepresentation(
+ StoreIndexedUnsafeInstr::kIndexPos) == kTagged); // It is a Smi.
+ __ add(TMP, instr->base_reg(), Operand(index, LSL, 2));
+ __ ldr(value, Address(TMP, instr->offset()));
+
+ ASSERT(kSmiTag == 0);
+ ASSERT(kSmiTagSize == 1);
+}
+
+DEFINE_BACKEND(TailCall,
+ (NoLocation,
+ Fixed<Register, ARGS_DESC_REG>,
+ Temp<Register> temp)) {
+ __ LoadObject(CODE_REG, instr->code());
+ __ LeaveDartFrame(); // The arguments are still on the stack.
+ __ ldr(temp, FieldAddress(CODE_REG, Code::entry_point_offset()));
+ __ br(temp);
+
+ // Even though the TailCallInstr will be the last instruction in a basic
+ // block, the flow graph compiler will emit native code for other blocks after
+ // the one containing this instruction and needs to be able to use the pool.
+ // (The `LeaveDartFrame` above disables usages of the pool.)
+ __ set_constant_pool_allowed(true);
+}
+
LocationSummary* PushArgumentInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
const intptr_t kNumInputs = 1;
diff --git a/runtime/vm/compiler/backend/il_dbc.cc b/runtime/vm/compiler/backend/il_dbc.cc
index 6e8d459..68024e0 100644
--- a/runtime/vm/compiler/backend/il_dbc.cc
+++ b/runtime/vm/compiler/backend/il_dbc.cc
@@ -253,6 +253,52 @@
__ PopLocal(locs()->out(0).reg());
}
+EMIT_NATIVE_CODE(LoadIndexedUnsafe, 1, Location::RegisterLocation(0)) {
+ ASSERT(base_reg() == FPREG);
+ ASSERT(Utils::IsInt(8, offset_));
+
+ ASSERT(offset_ % kWordSize == 0);
+ const intptr_t slot_offset = offset_ / kWordSize;
+ ASSERT(-128 <= slot_offset && slot_offset < 128);
+
+ if (compiler->is_optimizing()) {
+ const Register index = locs()->in(0).reg();
+ const Register result = locs()->out(0).reg();
+ __ LoadFpRelativeSlotOpt(result, index, slot_offset);
+ } else {
+ __ LoadFpRelativeSlot(slot_offset);
+ }
+}
+
+EMIT_NATIVE_CODE(StoreIndexedUnsafe, 2, Location::RegisterLocation(0)) {
+ ASSERT(base_reg() == FPREG);
+ ASSERT(Utils::IsInt(8, offset_));
+
+ if (compiler->is_optimizing()) {
+ const Register index = locs()->in(kIndexPos).reg();
+ const Register value = locs()->in(kValuePos).reg();
+ __ StoreFpRelativeSlotOpt(value, index, offset_ / kWordSize);
+ } else {
+ __ StoreFpRelativeSlot(offset_ / kWordSize);
+ }
+}
+
+EMIT_NATIVE_CODE(TailCall,
+ 1,
+ Location::NoLocation(),
+ LocationSummary::kNoCall,
+ 1) {
+ if (compiler->is_optimizing()) {
+ const Register arg_desc = locs()->in(0).reg();
+ const Register temp = locs()->temp(0).reg();
+ __ LoadConstant(temp, code());
+ __ TailCallOpt(arg_desc, temp);
+ } else {
+ __ PushConstant(code());
+ __ TailCall();
+ }
+}
+
EMIT_NATIVE_CODE(Stop, 0) {
__ Stop(message());
}
@@ -751,110 +797,123 @@
Location::RequiresRegister(),
LocationSummary::kNoCall,
1) {
- ASSERT(compiler->is_optimizing());
- const Register array = locs()->in(0).reg();
- const Register index = locs()->in(1).reg();
- const Register temp = locs()->temp(0).reg();
- const Register result = locs()->out(0).reg();
- switch (class_id()) {
- case kArrayCid:
- case kImmutableArrayCid:
- __ LoadIndexed(result, array, index);
- break;
- case kTypedDataUint8ArrayCid:
- case kTypedDataUint8ClampedArrayCid:
- case kExternalOneByteStringCid:
- case kExternalTypedDataUint8ArrayCid:
- case kExternalTypedDataUint8ClampedArrayCid:
- ASSERT(index_scale() == 1);
- if (IsExternal()) {
- __ LoadIndexedExternalUint8(result, array, index);
- } else {
- __ LoadIndexedUint8(result, array, index);
- }
- break;
- case kTypedDataInt8ArrayCid:
- ASSERT(index_scale() == 1);
- if (IsExternal()) {
- __ LoadIndexedExternalInt8(result, array, index);
- } else {
- __ LoadIndexedInt8(result, array, index);
- }
- break;
- case kOneByteStringCid:
- ASSERT(index_scale() == 1);
- __ LoadIndexedOneByteString(result, array, index);
- break;
- case kTwoByteStringCid:
- if (index_scale() != 2) {
- // TODO(zra): Fix-up index.
+ if (compiler->is_optimizing()) {
+ ASSERT(compiler->is_optimizing());
+ const Register array = locs()->in(0).reg();
+ const Register index = locs()->in(1).reg();
+ const Register temp = locs()->temp(0).reg();
+ const Register result = locs()->out(0).reg();
+ switch (class_id()) {
+ case kArrayCid:
+ case kImmutableArrayCid:
+ __ LoadIndexed(result, array, index);
+ break;
+ case kTypedDataUint8ArrayCid:
+ case kTypedDataUint8ClampedArrayCid:
+ case kExternalOneByteStringCid:
+ case kExternalTypedDataUint8ArrayCid:
+ case kExternalTypedDataUint8ClampedArrayCid:
+ ASSERT(index_scale() == 1);
+ if (IsExternal()) {
+ __ LoadIndexedExternalUint8(result, array, index);
+ } else {
+ __ LoadIndexedUint8(result, array, index);
+ }
+ break;
+ case kTypedDataInt8ArrayCid:
+ ASSERT(index_scale() == 1);
+ if (IsExternal()) {
+ __ LoadIndexedExternalInt8(result, array, index);
+ } else {
+ __ LoadIndexedInt8(result, array, index);
+ }
+ break;
+ case kOneByteStringCid:
+ ASSERT(index_scale() == 1);
+ __ LoadIndexedOneByteString(result, array, index);
+ break;
+ case kTwoByteStringCid:
+ if (index_scale() != 2) {
+ // TODO(zra): Fix-up index.
+ Unsupported(compiler);
+ UNREACHABLE();
+ }
+ if (IsExternal()) {
+ Unsupported(compiler);
+ UNREACHABLE();
+ }
+ __ LoadIndexedTwoByteString(result, array, index);
+ break;
+ case kTypedDataInt32ArrayCid:
+ ASSERT(representation() == kUnboxedInt32);
+ if (IsExternal()) {
+ Unsupported(compiler);
+ UNREACHABLE();
+ }
+ if (index_scale() == 1) {
+ __ LoadIndexedInt32(result, array, index);
+ } else {
+ __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale()));
+ __ LoadIndexedInt32(result, array, temp);
+ }
+ break;
+ case kTypedDataUint32ArrayCid:
+ ASSERT(representation() == kUnboxedUint32);
+ if (IsExternal()) {
+ Unsupported(compiler);
+ UNREACHABLE();
+ }
+ if (index_scale() == 1) {
+ __ LoadIndexedUint32(result, array, index);
+ } else {
+ __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale()));
+ __ LoadIndexedUint32(result, array, temp);
+ }
+ break;
+ case kTypedDataFloat32ArrayCid:
+ if (IsExternal()) {
+ Unsupported(compiler);
+ UNREACHABLE();
+ }
+ if (index_scale() == 1) {
+ __ LoadIndexedFloat32(result, array, index);
+ } else if (index_scale() == 4) {
+ __ LoadIndexed4Float32(result, array, index);
+ } else {
+ __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale()));
+ __ LoadIndexedFloat32(result, array, temp);
+ }
+ break;
+ case kTypedDataFloat64ArrayCid:
+ if (IsExternal()) {
+ Unsupported(compiler);
+ UNREACHABLE();
+ }
+ if (index_scale() == 1) {
+ __ LoadIndexedFloat64(result, array, index);
+ } else if (index_scale() == 8) {
+ __ LoadIndexed8Float64(result, array, index);
+ } else {
+ __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale()));
+ __ LoadIndexedFloat64(result, array, temp);
+ }
+ break;
+ default:
Unsupported(compiler);
UNREACHABLE();
- }
- if (IsExternal()) {
+ break;
+ }
+ } else {
+ switch (class_id()) {
+ case kArrayCid:
+ case kImmutableArrayCid:
+ __ LoadIndexedTOS();
+ break;
+ default:
Unsupported(compiler);
UNREACHABLE();
- }
- __ LoadIndexedTwoByteString(result, array, index);
- break;
- case kTypedDataInt32ArrayCid:
- ASSERT(representation() == kUnboxedInt32);
- if (IsExternal()) {
- Unsupported(compiler);
- UNREACHABLE();
- }
- if (index_scale() == 1) {
- __ LoadIndexedInt32(result, array, index);
- } else {
- __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale()));
- __ LoadIndexedInt32(result, array, temp);
- }
- break;
- case kTypedDataUint32ArrayCid:
- ASSERT(representation() == kUnboxedUint32);
- if (IsExternal()) {
- Unsupported(compiler);
- UNREACHABLE();
- }
- if (index_scale() == 1) {
- __ LoadIndexedUint32(result, array, index);
- } else {
- __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale()));
- __ LoadIndexedUint32(result, array, temp);
- }
- break;
- case kTypedDataFloat32ArrayCid:
- if (IsExternal()) {
- Unsupported(compiler);
- UNREACHABLE();
- }
- if (index_scale() == 1) {
- __ LoadIndexedFloat32(result, array, index);
- } else if (index_scale() == 4) {
- __ LoadIndexed4Float32(result, array, index);
- } else {
- __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale()));
- __ LoadIndexedFloat32(result, array, temp);
- }
- break;
- case kTypedDataFloat64ArrayCid:
- if (IsExternal()) {
- Unsupported(compiler);
- UNREACHABLE();
- }
- if (index_scale() == 1) {
- __ LoadIndexedFloat64(result, array, index);
- } else if (index_scale() == 8) {
- __ LoadIndexed8Float64(result, array, index);
- } else {
- __ ShlImm(temp, index, Utils::ShiftForPowerOfTwo(index_scale()));
- __ LoadIndexedFloat64(result, array, temp);
- }
- break;
- default:
- Unsupported(compiler);
- UNREACHABLE();
- break;
+ break;
+ }
}
}
@@ -1481,59 +1540,75 @@
}
EMIT_NATIVE_CODE(BinarySmiOp, 2, Location::RequiresRegister()) {
- const Register left = locs()->in(0).reg();
- const Register right = locs()->in(1).reg();
- const Register out = locs()->out(0).reg();
- const bool can_deopt = CanDeoptimize();
- bool needs_nop = false;
- switch (op_kind()) {
- case Token::kADD:
- __ Add(out, left, right);
- needs_nop = true;
- break;
- case Token::kSUB:
- __ Sub(out, left, right);
- needs_nop = true;
- break;
- case Token::kMUL:
- __ Mul(out, left, right);
- needs_nop = true;
- break;
- case Token::kTRUNCDIV:
- ASSERT(can_deopt);
- __ Div(out, left, right);
- break;
- case Token::kBIT_AND:
- ASSERT(!can_deopt);
- __ BitAnd(out, left, right);
- break;
- case Token::kBIT_OR:
- ASSERT(!can_deopt);
- __ BitOr(out, left, right);
- break;
- case Token::kBIT_XOR:
- ASSERT(!can_deopt);
- __ BitXor(out, left, right);
- break;
- case Token::kMOD:
- __ Mod(out, left, right);
- needs_nop = true;
- break;
- case Token::kSHR:
- __ Shr(out, left, right);
- needs_nop = true;
- break;
- case Token::kSHL:
- __ Shl(out, left, right);
- needs_nop = true;
- break;
- default:
- UNREACHABLE();
- }
- if (can_deopt) {
- compiler->EmitDeopt(deopt_id(), ICData::kDeoptBinarySmiOp);
- } else if (needs_nop) {
- __ Nop(0);
+ if (compiler->is_optimizing()) {
+ const Register left = locs()->in(0).reg();
+ const Register right = locs()->in(1).reg();
+ const Register out = locs()->out(0).reg();
+ const bool can_deopt = CanDeoptimize();
+ bool needs_nop = false;
+ switch (op_kind()) {
+ case Token::kADD:
+ __ Add(out, left, right);
+ needs_nop = true;
+ break;
+ case Token::kSUB:
+ __ Sub(out, left, right);
+ needs_nop = true;
+ break;
+ case Token::kMUL:
+ __ Mul(out, left, right);
+ needs_nop = true;
+ break;
+ case Token::kTRUNCDIV:
+ ASSERT(can_deopt);
+ __ Div(out, left, right);
+ break;
+ case Token::kBIT_AND:
+ ASSERT(!can_deopt);
+ __ BitAnd(out, left, right);
+ break;
+ case Token::kBIT_OR:
+ ASSERT(!can_deopt);
+ __ BitOr(out, left, right);
+ break;
+ case Token::kBIT_XOR:
+ ASSERT(!can_deopt);
+ __ BitXor(out, left, right);
+ break;
+ case Token::kMOD:
+ __ Mod(out, left, right);
+ needs_nop = true;
+ break;
+ case Token::kSHR:
+ __ Shr(out, left, right);
+ needs_nop = true;
+ break;
+ case Token::kSHL:
+ __ Shl(out, left, right);
+ needs_nop = true;
+ break;
+ default:
+ UNREACHABLE();
+ }
+ if (can_deopt) {
+ compiler->EmitDeopt(deopt_id(), ICData::kDeoptBinarySmiOp);
+ } else if (needs_nop) {
+ __ Nop(0);
+ }
+ } else {
+ switch (op_kind()) {
+ case Token::kADD:
+ __ SmiAddTOS();
+ break;
+ case Token::kSUB:
+ __ SmiSubTOS();
+ break;
+ case Token::kMUL:
+ __ SmiMulTOS();
+ break;
+ default:
+ UNIMPLEMENTED();
+ }
}
}
@@ -1851,8 +1926,6 @@
LocationSummary* locs,
Token::Kind kind,
BranchLabels labels) {
- const Register left = locs->in(0).reg();
- const Register right = locs->in(1).reg();
Token::Kind comparison = kind;
Condition condition = NEXT_IS_TRUE;
if (labels.fall_through != labels.false_label) {
@@ -1864,8 +1937,36 @@
condition = NEXT_IS_FALSE;
comparison = FlipCondition(kind);
}
- __ Emit(Bytecode::Encode(OpcodeForSmiCondition(comparison), left, right));
- return condition;
+ if (compiler->is_optimizing()) {
+ const Register left = locs->in(0).reg();
+ const Register right = locs->in(1).reg();
+ __ Emit(Bytecode::Encode(OpcodeForSmiCondition(comparison), left, right));
+ return condition;
+ } else {
+ switch (kind) {
+ case Token::kEQ:
+ __ IfEqStrictTOS();
+ break;
+ case Token::kNE:
+ __ IfNeStrictTOS();
+ break;
+ case Token::kLT:
+ __ IfSmiLtTOS();
+ break;
+ case Token::kLTE:
+ __ IfSmiLeTOS();
+ break;
+ case Token::kGT:
+ __ IfSmiGtTOS();
+ break;
+ case Token::kGTE:
+ __ IfSmiGeTOS();
+ break;
+ default:
+ UNIMPLEMENTED();
+ }
+ return condition;
+ }
}
static Condition EmitDoubleComparisonOp(FlowGraphCompiler* compiler,
diff --git a/runtime/vm/compiler/backend/il_ia32.cc b/runtime/vm/compiler/backend/il_ia32.cc
index 2514db4..b839563 100644
--- a/runtime/vm/compiler/backend/il_ia32.cc
+++ b/runtime/vm/compiler/backend/il_ia32.cc
@@ -37,6 +37,34 @@
return result;
}
+DEFINE_BACKEND(LoadIndexedUnsafe, (Register out, Register index)) {
+ ASSERT(instr->RequiredInputRepresentation(0) == kTagged); // It is a Smi.
+ __ movl(out, Address(instr->base_reg(), index, TIMES_2, instr->offset()));
+
+ ASSERT(kSmiTag == 0);
+ ASSERT(kSmiTagSize == 1);
+}
+
+DEFINE_BACKEND(StoreIndexedUnsafe,
+ (NoLocation, Register index, Register value)) {
+ ASSERT(instr->RequiredInputRepresentation(
+ StoreIndexedUnsafeInstr::kIndexPos) == kTagged); // It is a Smi.
+ __ movl(Address(instr->base_reg(), index, TIMES_2, instr->offset()), value);
+
+ ASSERT(kSmiTag == 0);
+ ASSERT(kSmiTagSize == 1);
+}
+
+DEFINE_BACKEND(TailCall,
+ (NoLocation,
+ Fixed<Register, ARGS_DESC_REG>,
+ Temp<Register> temp)) {
+ __ LoadObject(CODE_REG, instr->code());
+ __ LeaveFrame(); // The arguments are still on the stack.
+ __ movl(temp, FieldAddress(CODE_REG, Code::entry_point_offset()));
+ __ jmp(temp);
+}
+
LocationSummary* PushArgumentInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
const intptr_t kNumInputs = 1;
diff --git a/runtime/vm/compiler/backend/il_printer.cc b/runtime/vm/compiler/backend/il_printer.cc
index c6b06ba..a17f9ea 100644
--- a/runtime/vm/compiler/backend/il_printer.cc
+++ b/runtime/vm/compiler/backend/il_printer.cc
@@ -957,6 +957,17 @@
f->Print("%" Pd, index());
}
+void SpecialParameterInstr::PrintOperandsTo(BufferFormatter* f) const {
+ f->Print("%s", KindToCString(kind()));
+}
+
+const char* SpecialParameterInstr::ToCString() const {
+ char buffer[1024];
+ BufferFormatter bf(buffer, 1024);
+ PrintTo(&bf);
+ return Thread::Current()->zone()->MakeCopyOfString(buffer);
+}
+
void CheckStackOverflowInstr::PrintOperandsTo(BufferFormatter* f) const {
if (in_loop()) f->Print("depth %" Pd, loop_depth());
}
@@ -994,6 +1005,33 @@
}
}
+void LoadIndexedUnsafeInstr::PrintOperandsTo(BufferFormatter* f) const {
+ f->Print("%s[", Assembler::RegisterName(base_reg()));
+ index()->PrintTo(f);
+ f->Print(" + %" Pd "]", offset());
+}
+
+void StoreIndexedUnsafeInstr::PrintOperandsTo(BufferFormatter* f) const {
+ f->Print("%s[", Assembler::RegisterName(base_reg()));
+ index()->PrintTo(f);
+ f->Print(" + %" Pd "], ", offset());
+ value()->PrintTo(f);
+}
+
+void TailCallInstr::PrintOperandsTo(BufferFormatter* f) const {
+ const char* name = "<unknown code>";
+ if (code_.IsStubCode()) {
+ name = StubCode::NameOfStub(code_.UncheckedEntryPoint());
+ } else {
+ const Object& owner = Object::Handle(code_.owner());
+ if (owner.IsFunction()) {
+ name = Function::Handle(Function::RawCast(owner.raw()))
+ .ToFullyQualifiedCString();
+ }
+ }
+ f->Print("%s", name);
+}
+
void PushArgumentInstr::PrintOperandsTo(BufferFormatter* f) const {
value()->PrintTo(f);
}
diff --git a/runtime/vm/compiler/backend/il_x64.cc b/runtime/vm/compiler/backend/il_x64.cc
index d21ef72..3f4b9f4 100644
--- a/runtime/vm/compiler/backend/il_x64.cc
+++ b/runtime/vm/compiler/backend/il_x64.cc
@@ -35,6 +35,36 @@
return result;
}
+DEFINE_BACKEND(LoadIndexedUnsafe, (Register out, Register index)) {
+ ASSERT(instr->RequiredInputRepresentation(0) == kTagged); // It is a Smi.
+ __ movq(out, Address(instr->base_reg(), index, TIMES_4, instr->offset()));
+
+ ASSERT(kSmiTag == 0);
+ ASSERT(kSmiTagSize == 1);
+}
+
+DEFINE_BACKEND(StoreIndexedUnsafe,
+ (NoLocation, Register index, Register value)) {
+ ASSERT(instr->RequiredInputRepresentation(
+ StoreIndexedUnsafeInstr::kIndexPos) == kTagged); // It is a Smi.
+ __ movq(Address(instr->base_reg(), index, TIMES_4, instr->offset()), value);
+
+ ASSERT(kSmiTag == 0);
+ ASSERT(kSmiTagSize == 1);
+}
+
+DEFINE_BACKEND(TailCall, (NoLocation, Fixed<Register, ARGS_DESC_REG>)) {
+ __ LoadObject(CODE_REG, instr->code());
+ __ LeaveDartFrame(); // The arguments are still on the stack.
+ __ jmp(FieldAddress(CODE_REG, Code::entry_point_offset()));
+
+ // Even though the TailCallInstr will be the last instruction in a basic
+ // block, the flow graph compiler will emit native code for other blocks after
+ // the one containing this instruction and needs to be able to use the pool.
+ // (The `LeaveDartFrame` above disables usages of the pool.)
+ __ set_constant_pool_allowed(true);
+}
+
LocationSummary* PushArgumentInstr::MakeLocationSummary(Zone* zone,
bool opt) const {
const intptr_t kNumInputs = 1;
@@ -3855,17 +3885,16 @@
SIMD_OP_FLOAT_ARITH(V, Sqrt, sqrt) \
SIMD_OP_FLOAT_ARITH(V, Negate, negate) \
SIMD_OP_FLOAT_ARITH(V, Abs, abs) \
- V(Float32x4Reciprocal, reciprocalps) \
+ V(Float32x4Reciprocal, rcpps) \
V(Float32x4ReciprocalSqrt, rsqrtps)
DEFINE_EMIT(SimdUnaryOp, (SameAsFirstInput, XmmRegister value)) {
// TODO(dartbug.com/30949) select better register constraints to avoid
- // redundant move of input into a different register because all instructions
- // below support two operand forms.
+ // redundant move of input into a different register.
switch (instr->kind()) {
#define EMIT(Name, op) \
case SimdOpInstr::k##Name: \
- __ op(value); \
+ __ op(value, value); \
break;
SIMD_OP_SIMPLE_UNARY(EMIT)
#undef EMIT
@@ -4060,7 +4089,7 @@
// Copy mask.
__ movaps(temp, mask);
// Invert it.
- __ notps(temp);
+ __ notps(temp, temp);
// mask = mask & trueValue.
__ andps(mask, trueValue);
// temp = temp & falseValue.
@@ -4263,7 +4292,7 @@
void UnaryDoubleOpInstr::EmitNativeCode(FlowGraphCompiler* compiler) {
XmmRegister value = locs()->in(0).fpu_reg();
ASSERT(locs()->out(0).fpu_reg() == value);
- __ DoubleNegate(value);
+ __ DoubleNegate(value, value);
}
LocationSummary* MathMinMaxInstr::MakeLocationSummary(Zone* zone,
@@ -4350,7 +4379,7 @@
if (is_min) {
__ cmovgeq(result, right);
} else {
- __ cmovlessq(result, right);
+ __ cmovlq(result, right);
}
}
diff --git a/runtime/vm/compiler/backend/inliner.cc b/runtime/vm/compiler/backend/inliner.cc
index faf2759..0e4cb55 100644
--- a/runtime/vm/compiler/backend/inliner.cc
+++ b/runtime/vm/compiler/backend/inliner.cc
@@ -141,6 +141,33 @@
NamedArgument(String* name, Value* value) : name(name), value(value) {}
};
+// Ensures we only inline callee graphs which are safe. There are certain
+// instructions which cannot be inlined and we ensure here that we don't do
+// that.
+class CalleeGraphValidator : public AllStatic {
+ public:
+ static void Validate(FlowGraph* callee_graph) {
+#ifdef DEBUG
+ for (BlockIterator block_it = callee_graph->reverse_postorder_iterator();
+ !block_it.Done(); block_it.Advance()) {
+ BlockEntryInstr* entry = block_it.Current();
+
+ for (ForwardInstructionIterator it(entry); !it.Done(); it.Advance()) {
+ Instruction* current = it.Current();
+ if (current->IsBranch()) {
+ current = current->AsBranch()->comparison();
+ }
+ // The following instructions are not safe to inline, since they make
+ // assumptions about the frame layout.
+ ASSERT(!current->IsTailCall());
+ ASSERT(!current->IsLoadIndexedUnsafe());
+ ASSERT(!current->IsStoreIndexedUnsafe());
+ }
+ }
+#endif // DEBUG
+ }
+};
+
// Helper to collect information about a callee graph when considering it for
// inlining.
class GraphInfoCollector : public ValueObject {
@@ -431,11 +458,13 @@
struct InlinedCallData {
InlinedCallData(Definition* call,
+ const Array& arguments_descriptor,
intptr_t first_arg_index, // 1 if type args are passed.
GrowableArray<Value*>* arguments,
const Function& caller,
intptr_t caller_inlining_id)
: call(call),
+ arguments_descriptor(arguments_descriptor),
first_arg_index(first_arg_index),
arguments(arguments),
callee_graph(NULL),
@@ -445,6 +474,7 @@
caller_inlining_id(caller_inlining_id) {}
Definition* call;
+ const Array& arguments_descriptor;
const intptr_t first_arg_index;
GrowableArray<Value*>* arguments;
FlowGraph* callee_graph;
@@ -571,29 +601,42 @@
}
SpecialParameterInstr* param = (*defns)[i]->AsSpecialParameter();
if ((param != NULL) && param->HasUses()) {
- if (param->kind() == SpecialParameterInstr::kContext) {
- ASSERT(!is_polymorphic);
- // We do not support polymorphic inlining of closure calls (we did when
- // there was a class per closure).
- ASSERT(call_data->call->IsClosureCall());
- LoadFieldInstr* context_load = new (zone) LoadFieldInstr(
- new Value((*arguments)[first_arg_index]->definition()),
- Closure::context_offset(),
- AbstractType::ZoneHandle(zone, AbstractType::null()),
- call_data->call->token_pos());
- context_load->set_is_immutable(true);
- context_load->set_ssa_temp_index(caller_graph->alloc_ssa_temp_index());
- context_load->InsertBefore(callee_entry->next());
- param->ReplaceUsesWith(context_load);
- } else {
- ASSERT(param->kind() == SpecialParameterInstr::kTypeArgs);
- Definition* type_args;
- if (first_arg_index > 0) {
- type_args = (*arguments)[0]->definition();
- } else {
- type_args = callee_graph->constant_null();
+ switch (param->kind()) {
+ case SpecialParameterInstr::kContext: {
+ ASSERT(!is_polymorphic);
+ // We do not support polymorphic inlining of closure calls.
+ ASSERT(call_data->call->IsClosureCall());
+ LoadFieldInstr* context_load = new (zone) LoadFieldInstr(
+ new Value((*arguments)[first_arg_index]->definition()),
+ Closure::context_offset(),
+ AbstractType::ZoneHandle(zone, AbstractType::null()),
+ call_data->call->token_pos());
+ context_load->set_is_immutable(true);
+ context_load->set_ssa_temp_index(
+ caller_graph->alloc_ssa_temp_index());
+ context_load->InsertBefore(callee_entry->next());
+ param->ReplaceUsesWith(context_load);
+ break;
}
- param->ReplaceUsesWith(type_args);
+ case SpecialParameterInstr::kTypeArgs: {
+ Definition* type_args;
+ if (first_arg_index > 0) {
+ type_args = (*arguments)[0]->definition();
+ } else {
+ type_args = caller_graph->constant_null();
+ }
+ param->ReplaceUsesWith(type_args);
+ break;
+ }
+ case SpecialParameterInstr::kArgDescriptor: {
+ param->ReplaceUsesWith(
+ caller_graph->GetConstant(call_data->arguments_descriptor));
+ break;
+ }
+ default: {
+ UNREACHABLE();
+ break;
+ }
}
}
}
@@ -918,6 +961,8 @@
{
CSTAT_TIMER_SCOPE(thread(), graphinliner_build_timer);
callee_graph = builder.BuildGraph();
+
+ CalleeGraphValidator::Validate(callee_graph);
}
} else {
FlowGraphBuilder builder(*parsed_function, *ic_data_array,
@@ -927,6 +972,8 @@
{
CSTAT_TIMER_SCOPE(thread(), graphinliner_build_timer);
callee_graph = builder.BuildGraph();
+
+ CalleeGraphValidator::Validate(callee_graph);
}
}
#ifdef DART_PRECOMPILER
@@ -989,8 +1036,6 @@
// match.
ASSERT(arguments->length() ==
first_actual_param_index + function.NumParameters());
- ASSERT(param_stubs->length() ==
- inlined_type_args_param + callee_graph->parameter_count());
// Update try-index of the callee graph.
BlockEntryInstr* call_block = call_data->call->GetBlock();
@@ -1332,7 +1377,8 @@
arguments.Add(call->PushArgumentAt(i)->value());
}
InlinedCallData call_data(
- call, call->FirstArgIndex(), &arguments, call_info[call_idx].caller(),
+ call, Array::ZoneHandle(Z, call->GetArgumentsDescriptor()),
+ call->FirstArgIndex(), &arguments, call_info[call_idx].caller(),
call_info[call_idx].caller_graph->inlining_id());
if (TryInlining(call->function(), call->argument_names(), &call_data)) {
InlineCall(&call_data);
@@ -1380,8 +1426,11 @@
for (int i = 0; i < call->ArgumentCount(); ++i) {
arguments.Add(call->PushArgumentAt(i)->value());
}
+ const Array& arguments_descriptor =
+ Array::ZoneHandle(Z, call->GetArgumentsDescriptor());
InlinedCallData call_data(
- call, call->FirstArgIndex(), &arguments, call_info[call_idx].caller(),
+ call, arguments_descriptor, call->FirstArgIndex(), &arguments,
+ call_info[call_idx].caller(),
call_info[call_idx].caller_graph->inlining_id());
if (TryInlining(target, call->argument_names(), &call_data)) {
InlineCall(&call_data);
@@ -1637,8 +1686,11 @@
for (int i = 0; i < call_->ArgumentCount(); ++i) {
arguments.Add(call_->PushArgumentAt(i)->value());
}
- InlinedCallData call_data(call_, call_->instance_call()->FirstArgIndex(),
- &arguments, caller_function_, caller_inlining_id_);
+ const Array& arguments_descriptor =
+ Array::ZoneHandle(Z, call_->instance_call()->GetArgumentsDescriptor());
+ InlinedCallData call_data(call_, arguments_descriptor,
+ call_->instance_call()->FirstArgIndex(), &arguments,
+ caller_function_, caller_inlining_id_);
Function& target = Function::ZoneHandle(zone(), target_info.target->raw());
if (!owner_->TryInlining(target, call_->instance_call()->argument_names(),
&call_data)) {
diff --git a/runtime/vm/compiler/backend/linearscan.cc b/runtime/vm/compiler/backend/linearscan.cc
index 357ae25..9abd019 100644
--- a/runtime/vm/compiler/backend/linearscan.cc
+++ b/runtime/vm/compiler/backend/linearscan.cc
@@ -103,7 +103,10 @@
// TODO(fschneider): Handle saving and restoring these registers when
// generating intrinsic code.
if (intrinsic_mode) {
+#if !defined(TARGET_ARCH_DBC)
blocked_cpu_registers_[ARGS_DESC_REG] = true;
+#endif
+
#if !defined(TARGET_ARCH_IA32)
// Need to preserve CODE_REG to be able to store the PC marker
// and load the pool pointer.
@@ -674,17 +677,12 @@
intptr_t range_end = range->End();
if (defn->IsParameter()) {
ParameterInstr* param = defn->AsParameter();
- // Assert that copied and non-copied parameters are mutually exclusive.
- // This might change in the future and, if so, the index will be wrong.
- ASSERT((flow_graph_.num_copied_params() == 0) ||
- (flow_graph_.num_non_copied_params() == 0));
intptr_t slot_index = param->index();
ASSERT(slot_index >= 0);
ASSERT((param->base_reg() == FPREG) || (param->base_reg() == SPREG));
if (param->base_reg() == FPREG) {
- // Slot index for the leftmost copied parameter is 0.
// Slot index for the rightmost fixed parameter is -1.
- slot_index -= flow_graph_.num_non_copied_params();
+ slot_index -= flow_graph_.num_direct_parameters();
}
#if defined(TARGET_ARCH_DBC)
@@ -701,36 +699,19 @@
range->set_assigned_location(
Location::StackSlot(slot_index, param->base_reg()));
range->set_spill_slot(Location::StackSlot(slot_index, param->base_reg()));
-
} else if (defn->IsSpecialParameter()) {
SpecialParameterInstr* param = defn->AsSpecialParameter();
+ ASSERT(param->kind() == SpecialParameterInstr::kArgDescriptor);
Location loc;
#if defined(TARGET_ARCH_DBC)
- intptr_t slot_index = flow_graph_.num_copied_params();
- if ((param->kind() == SpecialParameterInstr::kContext) &&
- flow_graph_.isolate()->reify_generic_functions() &&
- flow_graph_.function().IsGeneric()) {
- // The first slot is used for function type arguments, either as their
- // permanent location or as their temporary location when captured.
- // So use the next one for the context.
- // (see FlowGraphCompiler::EmitFrameEntry)
- slot_index++;
- }
- loc = Location::RegisterLocation(slot_index);
+ loc = Location::ArgumentsDescriptorLocation();
+ range->set_assigned_location(loc);
#else
- if (param->kind() == SpecialParameterInstr::kContext) {
- loc = Location::RegisterLocation(CTX);
- } else {
- ASSERT(param->kind() == SpecialParameterInstr::kTypeArgs);
- loc = Location::StackSlot(flow_graph_.num_copied_params(), FPREG);
- range->set_assigned_location(loc);
- range->set_spill_slot(loc);
- }
+ loc = Location::RegisterLocation(ARGS_DESC_REG);
+ range->set_assigned_location(loc);
#endif // defined(TARGET_ARCH_DBC)
-
if (loc.IsRegister()) {
AssignSafepoints(defn, range);
- range->set_assigned_location(loc);
if (range->End() > kNormalEntryPos) {
LiveRange* tail = range->SplitAt(kNormalEntryPos);
CompleteRange(tail, Location::kRegister);
@@ -3002,9 +2983,8 @@
// introducing a separate field. It has roughly the same meaning:
// number of used registers determines how big of a frame to reserve for
// this function on DBC stack.
- entry->set_spill_slot_count(Utils::Maximum(
- (last_used_cpu_register + 1) + (last_used_fpu_register + 1),
- flow_graph_.num_copied_params()));
+ entry->set_spill_slot_count((last_used_cpu_register + 1) +
+ (last_used_fpu_register + 1));
#endif
if (FLAG_print_ssa_liveranges) {
diff --git a/runtime/vm/compiler/backend/locations.cc b/runtime/vm/compiler/backend/locations.cc
index 8c5b869..a01abb2 100644
--- a/runtime/vm/compiler/backend/locations.cc
+++ b/runtime/vm/compiler/backend/locations.cc
@@ -179,6 +179,10 @@
return "0";
}
UNREACHABLE();
+#if TARGET_ARCH_DBC
+ case kArgsDescRegister:
+ return "ArgDesc";
+#endif
default:
if (IsConstant()) {
return "C";
diff --git a/runtime/vm/compiler/backend/locations.h b/runtime/vm/compiler/backend/locations.h
index 9f5c203..2cf9a45 100644
--- a/runtime/vm/compiler/backend/locations.h
+++ b/runtime/vm/compiler/backend/locations.h
@@ -51,8 +51,11 @@
private:
enum {
// Number of bits required to encode Kind value.
- kBitsForKind = 4,
- kBitsForPayload = kWordSize * kBitsPerByte - kBitsForKind,
+ kKindBitsPos = 0,
+ kKindBitsSize = 5,
+
+ kPayloadBitsPos = kKindBitsPos + kKindBitsSize,
+ kPayloadBitsSize = kBitsPerWord - kPayloadBitsPos,
};
static const uword kInvalidLocation = 0;
@@ -94,6 +97,12 @@
// FpuRegister location represents a fixed fpu register. Payload contains
// its code.
kFpuRegister = 12,
+
+#ifdef TARGET_ARCH_DBC
+ // We use this to signify a special `Location` where the arguments
+ // descriptor can be found on DBC.
+ kArgsDescRegister = 15,
+#endif
};
Location() : value_(kInvalidLocation) {
@@ -120,6 +129,11 @@
COMPILE_ASSERT((kFpuRegister & kLocationTagMask) != kConstantTag);
COMPILE_ASSERT((kFpuRegister & kLocationTagMask) != kPairLocationTag);
+#ifdef TARGET_ARCH_DBC
+ COMPILE_ASSERT((kArgsDescRegister & kLocationTagMask) != kConstantTag);
+ COMPILE_ASSERT((kArgsDescRegister & kLocationTagMask) != kPairLocationTag);
+#endif
+
// Verify tags and tagmask.
COMPILE_ASSERT((kConstantTag & kLocationTagMask) == kConstantTag);
@@ -233,6 +247,14 @@
bool IsFpuRegister() const { return kind() == kFpuRegister; }
+#ifdef TARGET_ARCH_DBC
+ static Location ArgumentsDescriptorLocation() {
+ return Location(kArgsDescRegister, 0);
+ }
+
+ bool IsArgsDescRegister() const { return kind() == kArgsDescRegister; }
+#endif
+
FpuRegister fpu_reg() const {
ASSERT(IsFpuRegister());
return static_cast<FpuRegister>(payload());
@@ -356,9 +378,10 @@
uword payload() const { return PayloadField::decode(value_); }
- class KindField : public BitField<uword, Kind, 0, kBitsForKind> {};
+ class KindField : public BitField<uword, Kind, kKindBitsPos, kKindBitsSize> {
+ };
class PayloadField
- : public BitField<uword, uword, kBitsForKind, kBitsForPayload> {};
+ : public BitField<uword, uword, kPayloadBitsPos, kPayloadBitsSize> {};
// Layout for kUnallocated locations payload.
typedef BitField<uword, Policy, 0, 3> PolicyField;
@@ -369,7 +392,7 @@
#else
static const intptr_t kBitsForBaseReg = 5;
#endif
- static const intptr_t kBitsForStackIndex = kBitsForPayload - kBitsForBaseReg;
+ static const intptr_t kBitsForStackIndex = kPayloadBitsSize - kBitsForBaseReg;
class StackSlotBaseField
: public BitField<uword, Register, 0, kBitsForBaseReg> {};
class StackIndexField
diff --git a/runtime/vm/compiler/backend/locations_helpers.h b/runtime/vm/compiler/backend/locations_helpers.h
index b61abb6..481fbdb 100644
--- a/runtime/vm/compiler/backend/locations_helpers.h
+++ b/runtime/vm/compiler/backend/locations_helpers.h
@@ -78,6 +78,10 @@
// register and the instruction will produce output in the same register.
struct SameAsFirstInput {};
+// Marker type used to signal that output has NoLocation register
+// constraint.
+struct NoLocation {};
+
// Marker type used to signal that this input, output or temp needs to
// be in a fixed register `reg` of type `R` (either Register or FpuRegister).
template <typename R, R reg>
@@ -211,6 +215,15 @@
static Location ToConstraint() { return Location::SameAsFirstInput(); }
};
+template <>
+struct LocationTrait<NoLocation> {
+ static const bool kIsTemp = false; // This is not a temporary.
+
+ static NoLocation Unwrap(const Location& loc) { return NoLocation(); }
+
+ static Location ToConstraint() { return Location::NoLocation(); }
+};
+
// Auxiliary types and macro helpers to construct lists of types.
// TODO(vegorov) rewrite this using variadic templates when we enable C++11
diff --git a/runtime/vm/compiler/backend/redundancy_elimination.cc b/runtime/vm/compiler/backend/redundancy_elimination.cc
index bc4c019..41ad3f9 100644
--- a/runtime/vm/compiler/backend/redundancy_elimination.cc
+++ b/runtime/vm/compiler/backend/redundancy_elimination.cc
@@ -3152,7 +3152,7 @@
// at the catch-entry with this constant.
const GrowableArray<CatchBlockEntryInstr*>& catch_entries =
flow_graph->graph_entry()->catch_entries();
- intptr_t base = kFirstLocalSlotFromFp + flow_graph->num_non_copied_params();
+
for (intptr_t catch_idx = 0; catch_idx < catch_entries.length();
++catch_idx) {
CatchBlockEntryInstr* catch_entry = catch_entries[catch_idx];
@@ -3169,11 +3169,13 @@
// exception_var and stacktrace_var are never constant. In asynchronous or
// generator functions they may be context-allocated in which case they are
// not tracked in the environment anyway.
+
+ const intptr_t parameter_count = flow_graph->num_direct_parameters();
if (!catch_entry->exception_var().is_captured()) {
- cdefs[base - catch_entry->exception_var().index()] = NULL;
+ cdefs[catch_entry->exception_var().BitIndexIn(parameter_count)] = NULL;
}
if (!catch_entry->stacktrace_var().is_captured()) {
- cdefs[base - catch_entry->stacktrace_var().index()] = NULL;
+ cdefs[catch_entry->stacktrace_var().BitIndexIn(parameter_count)] = NULL;
}
for (BlockIterator block_it = flow_graph->reverse_postorder_iterator();
diff --git a/runtime/vm/compiler/backend/type_propagator.cc b/runtime/vm/compiler/backend/type_propagator.cc
index 940bf22..18cdd45 100644
--- a/runtime/vm/compiler/backend/type_propagator.cc
+++ b/runtime/vm/compiler/backend/type_propagator.cc
@@ -1021,6 +1021,8 @@
return CompileType::FromCid(kContextCid);
case kTypeArgs:
return CompileType::FromCid(kTypeArgumentsCid);
+ case kArgDescriptor:
+ return CompileType::FromCid(kImmutableArrayCid);
}
UNREACHABLE();
return CompileType::Dynamic();
diff --git a/runtime/vm/compiler/compiler_sources.gni b/runtime/vm/compiler/compiler_sources.gni
index 3000057..3fc13ce 100644
--- a/runtime/vm/compiler/compiler_sources.gni
+++ b/runtime/vm/compiler/compiler_sources.gni
@@ -75,6 +75,8 @@
"frontend/kernel_binary_flowgraph.h",
"frontend/kernel_to_il.cc",
"frontend/kernel_to_il.h",
+ "frontend/prologue_builder.cc",
+ "frontend/prologue_builder.h",
"intrinsifier.cc",
"intrinsifier.h",
"intrinsifier_arm.cc",
diff --git a/runtime/vm/compiler/frontend/flow_graph_builder.cc b/runtime/vm/compiler/frontend/flow_graph_builder.cc
index 73fad65..0b92e55 100644
--- a/runtime/vm/compiler/frontend/flow_graph_builder.cc
+++ b/runtime/vm/compiler/frontend/flow_graph_builder.cc
@@ -14,6 +14,8 @@
#include "vm/compiler/backend/flow_graph_compiler.h"
#include "vm/compiler/backend/il.h"
#include "vm/compiler/backend/il_printer.h"
+#include "vm/compiler/frontend/kernel_to_il.h"
+#include "vm/compiler/frontend/prologue_builder.h"
#include "vm/compiler/jit/compiler.h"
#include "vm/exceptions.h"
#include "vm/flags.h"
@@ -302,12 +304,6 @@
: parsed_function_(parsed_function),
ic_data_array_(ic_data_array),
context_level_array_(context_level_array),
- num_copied_params_(parsed_function.num_copied_params()),
- // All parameters are copied if any parameter is.
- num_non_copied_params_(
- (num_copied_params_ == 0)
- ? parsed_function.function().num_fixed_parameters()
- : 0),
num_stack_locals_(parsed_function.num_stack_locals()),
exit_collector_(exit_collector),
last_used_block_id_(0), // 0 is used for the graph entry.
@@ -2109,8 +2105,7 @@
intptr_t EffectGraphVisitor::GetCurrentTempLocalIndex() const {
return kFirstLocalSlotFromFp - owner()->num_stack_locals() -
- owner()->num_copied_params() - owner()->args_pushed() -
- owner()->temp_count() + 1;
+ owner()->args_pushed() - owner()->temp_count() + 1;
}
LocalVariable* EffectGraphVisitor::EnterTempLocalScope(Value* value) {
@@ -3326,7 +3321,7 @@
ZoneGrowableArray<PushArgumentInstr*>& args =
*new (Z) ZoneGrowableArray<PushArgumentInstr*>(function.NumParameters());
for (intptr_t i = 0; i < function.NumParameters(); ++i) {
- LocalVariable* parameter = pf.node_sequence()->scope()->VariableAt(i);
+ LocalVariable* parameter = pf.RawParameterVariable(i);
Value* value = Bind(new (Z) LoadLocalInstr(*parameter, node->token_pos()));
args.Add(PushArgument(value));
}
@@ -3736,37 +3731,26 @@
if (is_top_level_sequence) {
ASSERT(scope->context_level() == 1);
const int num_params = function.NumParameters();
- int param_frame_index = (num_params == function.num_fixed_parameters())
- ? (kParamEndSlotFromFp + num_params)
- : kFirstLocalSlotFromFp;
- for (int pos = 0; pos < num_params; param_frame_index--, pos++) {
+ for (int pos = 0; pos < num_params; pos++) {
const LocalVariable& parameter = *scope->VariableAt(pos);
ASSERT(parameter.owner() == scope);
if (parameter.is_captured()) {
- // Create a temporary local describing the original position.
- const String& temp_name = Symbols::TempParam();
- LocalVariable* temp_local =
- new (Z) LocalVariable(TokenPosition::kNoSource, // Token index.
- TokenPosition::kNoSource, // Token index.
- temp_name,
- Object::dynamic_type()); // Type.
- temp_local->set_index(param_frame_index);
-
- // Mark this local as captured parameter so that the optimizer
- // correctly handles these when compiling try-catch: Captured
- // parameters are not in the stack environment, therefore they
- // must be skipped when emitting sync-code in try-blocks.
- temp_local->set_is_captured_parameter(true);
-
+ LocalVariable& raw_parameter =
+ *owner_->parsed_function().RawParameterVariable(pos);
+ ASSERT((function.HasOptionalParameters() &&
+ raw_parameter.owner() == scope) ||
+ !(function.HasOptionalParameters() &&
+ raw_parameter.owner() == NULL));
+ ASSERT(!raw_parameter.is_captured());
// Copy parameter from local frame to current context.
- Value* load = Bind(BuildLoadLocal(*temp_local, node->token_pos()));
+ Value* load = Bind(BuildLoadLocal(raw_parameter, node->token_pos()));
Do(BuildStoreLocal(parameter, load, ST(node->token_pos())));
// Write NULL to the source location to detect buggy accesses and
// allow GC of passed value if it gets overwritten by a new value in
// the function.
Value* null_constant = Bind(
new (Z) ConstantInstr(Object::ZoneHandle(Z, Object::null())));
- Do(BuildStoreLocal(*temp_local, null_constant,
+ Do(BuildStoreLocal(raw_parameter, null_constant,
ST(node->token_pos())));
}
}
@@ -3784,23 +3768,9 @@
LocalVariable* parent_type_args_var =
parsed_function.parent_type_arguments();
if (type_args_var->is_captured() || (parent_type_args_var != NULL)) {
- // Create a temporary local describing the original position.
- const String& temp_name = Symbols::TempParam();
- LocalVariable* temp_local =
- new (Z) LocalVariable(TokenPosition::kNoSource, // Token index.
- TokenPosition::kNoSource, // Token index.
- temp_name,
- Object::dynamic_type()); // Type.
- temp_local->set_index(parsed_function.first_stack_local_index());
-
- // Mark this local as captured parameter so that the optimizer
- // correctly handles these when compiling try-catch: Captured
- // parameters are not in the stack environment, therefore they
- // must be skipped when emitting sync-code in try-blocks.
- temp_local->set_is_captured_parameter(true); // TODO(regis): Correct?
-
+ LocalVariable* raw_type_args = parsed_function.RawTypeArgumentsVariable();
Value* type_args_val =
- Bind(BuildLoadLocal(*temp_local, node->token_pos()));
+ Bind(BuildLoadLocal(*raw_type_args, node->token_pos()));
if (parent_type_args_var != NULL) {
ASSERT(parent_type_args_var->owner() != scope);
// Call the runtime to concatenate both vectors.
@@ -3828,21 +3798,6 @@
ICData::kStatic));
}
Do(BuildStoreLocal(*type_args_var, type_args_val, ST(node->token_pos())));
- if (type_args_var->is_captured()) {
- // Write NULL to the source location to detect buggy accesses and
- // allow GC of passed value if it gets overwritten by a new value in
- // the function.
- Value* null_constant =
- Bind(new (Z) ConstantInstr(Object::ZoneHandle(Z, Object::null())));
- Do(BuildStoreLocal(*temp_local, null_constant, ST(node->token_pos())));
- } else {
- // Do not write NULL, since the temp is also the final location.
- ASSERT(temp_local->index() == type_args_var->index());
- }
- } else {
- // The type args slot is the final location. No copy needed.
- ASSERT(type_args_var->index() ==
- parsed_function.first_stack_local_index());
}
}
@@ -4412,11 +4367,22 @@
}
TargetEntryInstr* normal_entry = new (Z) TargetEntryInstr(
AllocateBlockId(), CatchClauseNode::kInvalidTryIndex, GetNextDeoptId());
+
+ // Generate optional positional/named argument copying!
+ const bool compiling_for_osr = osr_id_ != Compiler::kNoOSRDeoptId;
+
+ kernel::PrologueBuilder prologue_builder(
+ &parsed_function_, last_used_block_id_, compiling_for_osr, IsInlining());
+ PrologueInfo prologue_info(-1, -1);
+ BlockEntryInstr* instruction_cursor =
+ prologue_builder.BuildPrologue(normal_entry, &prologue_info);
+ last_used_block_id_ = prologue_builder.last_used_block_id();
+
graph_entry_ =
new (Z) GraphEntryInstr(parsed_function(), normal_entry, osr_id_);
EffectGraphVisitor for_effect(this);
parsed_function().node_sequence()->Visit(&for_effect);
- AppendFragment(normal_entry, for_effect);
+ AppendFragment(instruction_cursor, for_effect);
// Check that the graph is properly terminated.
ASSERT(!for_effect.is_open());
@@ -4428,7 +4394,6 @@
graph_entry_->RelinkToOsrEntry(Z, last_used_block_id_);
}
- PrologueInfo prologue_info(-1, -1);
FlowGraph* graph = new (Z) FlowGraph(parsed_function(), graph_entry_,
last_used_block_id_, prologue_info);
graph->set_await_token_positions(await_token_positions_);
diff --git a/runtime/vm/compiler/frontend/flow_graph_builder.h b/runtime/vm/compiler/frontend/flow_graph_builder.h
index 5f5f72d..f737103 100644
--- a/runtime/vm/compiler/frontend/flow_graph_builder.h
+++ b/runtime/vm/compiler/frontend/flow_graph_builder.h
@@ -140,8 +140,6 @@
GraphEntryInstr* graph_entry() const { return graph_entry_; }
- intptr_t num_copied_params() const { return num_copied_params_; }
- intptr_t num_non_copied_params() const { return num_non_copied_params_; }
intptr_t num_stack_locals() const { return num_stack_locals_; }
bool IsInlining() const { return (exit_collector_ != NULL); }
@@ -187,10 +185,7 @@
friend class Intrinsifier;
intptr_t parameter_count() const {
- return num_copied_params_ + num_non_copied_params_;
- }
- intptr_t variable_count() const {
- return parameter_count() + num_stack_locals_;
+ return parsed_function_.function().NumParameters();
}
const ParsedFunction& parsed_function_;
@@ -198,9 +193,7 @@
// Contains (deopt_id, context_level) pairs.
ZoneGrowableArray<intptr_t>* context_level_array_;
- const intptr_t num_copied_params_;
- const intptr_t num_non_copied_params_;
- const intptr_t num_stack_locals_; // Does not include any parameters.
+ const intptr_t num_stack_locals_;
InlineExitCollector* const exit_collector_;
intptr_t last_used_block_id_;
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
index 979efd0..86cf18f 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.cc
@@ -261,6 +261,12 @@
case kName:
builder_->SkipName(); // read name.
if (++next_read_ == field) return;
+ case kSourceUriIndex:
+ source_uri_index_ = builder_->ReadUInt(); // read source_uri_index.
+ builder_->current_script_id_ = source_uri_index_;
+ builder_->record_token_position(position_);
+ builder_->record_token_position(end_position_);
+ if (++next_read_ == field) return;
case kAnnotations: {
annotation_count_ = builder_->ReadListLength(); // read list length.
for (intptr_t i = 0; i < annotation_count_; ++i) {
@@ -777,6 +783,11 @@
parsed_function_->set_function_type_arguments(type_args_var);
}
+ if (parsed_function_->has_arg_desc_var()) {
+ needs_expr_temp_ = true;
+ scope_->AddVariable(parsed_function_->arg_desc_var());
+ }
+
LocalVariable* context_var = parsed_function_->current_context_var();
context_var->set_is_forced_stack();
scope_->AddVariable(context_var);
@@ -2517,6 +2528,7 @@
Instance& StreamingConstantEvaluator::EvaluateExpression(intptr_t offset,
bool reset_position) {
+ ASSERT(Error::Handle(Z, H.thread()->sticky_error()).IsNull());
if (!GetCachedConstant(offset, &result_)) {
ASSERT(IsAllowedToEvaluate());
intptr_t original_offset = builder_->ReaderOffset();
@@ -2784,12 +2796,16 @@
NameIndex target =
builder_->ReadCanonicalNameReference(); // read target_reference.
+ ASSERT(Error::Handle(Z, H.thread()->sticky_error()).IsNull());
+
if (H.IsField(target)) {
const Field& field = Field::Handle(Z, H.LookupFieldByKernelField(target));
if (!field.is_const()) {
H.ReportError(script_, position, "Not a constant field.");
}
if (field.StaticValue() == Object::transition_sentinel().raw()) {
+ builder_->InlineBailout(
+ "kernel::StreamingConstantEvaluator::EvaluateStaticGet::Cyclic");
H.ReportError(script_, position, "Not a constant expression.");
} else if (field.StaticValue() == Object::sentinel().raw()) {
field.SetStaticValue(Object::transition_sentinel());
@@ -3634,6 +3650,7 @@
Fragment StreamingFlowGraphBuilder::BuildFieldInitializer(
NameIndex canonical_name) {
+ ASSERT(Error::Handle(Z, H.thread()->sticky_error()).IsNull());
Field& field =
Field::ZoneHandle(Z, H.LookupFieldByKernelField(canonical_name));
if (PeekTag() == kNullLiteral) {
@@ -3651,6 +3668,7 @@
Fragment StreamingFlowGraphBuilder::BuildInitializers(
const Class& parent_class) {
+ ASSERT(Error::Handle(Z, H.thread()->sticky_error()).IsNull());
Fragment instructions;
// Start by getting the position of the constructors initializer.
@@ -3831,14 +3849,20 @@
FlowGraph* StreamingFlowGraphBuilder::BuildGraphOfImplicitClosureFunction(
const Function& function) {
+ // The prologue builder needs the default parameter values.
+ SetupDefaultParameterValues();
+
const Function& target = Function::ZoneHandle(Z, function.parent_function());
TargetEntryInstr* normal_entry = flow_graph_builder_->BuildTargetEntry();
+ PrologueInfo prologue_info(-1, -1);
+ BlockEntryInstr* instruction_cursor =
+ flow_graph_builder_->BuildPrologue(normal_entry, &prologue_info);
+
flow_graph_builder_->graph_entry_ = new (Z) GraphEntryInstr(
*parsed_function(), normal_entry, Compiler::kNoOSRDeoptId);
- SetupDefaultParameterValues();
- Fragment body(normal_entry);
+ Fragment body(instruction_cursor);
body += flow_graph_builder_->CheckStackOverflowInPrologue();
intptr_t type_args_len = 0;
@@ -3898,32 +3922,24 @@
// Return the result.
body += Return(function_node_helper.end_position_);
- PrologueInfo prologue_info(-1, -1);
return new (Z)
FlowGraph(*parsed_function(), flow_graph_builder_->graph_entry_,
flow_graph_builder_->last_used_block_id_, prologue_info);
}
-LocalVariable* StreamingFlowGraphBuilder::LookupParameterDirect(
- intptr_t kernel_offset,
- intptr_t parameter_index) {
- LocalVariable* var = LookupVariable(kernel_offset);
- LocalVariable* parameter =
- new (Z) LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
- Symbols::TempParam(), var->type());
- parameter->set_index(parameter_index);
- if (var->is_captured()) parameter->set_is_captured_parameter(true);
- return parameter;
-}
-
FlowGraph* StreamingFlowGraphBuilder::BuildGraphOfFunction(bool constructor) {
+ // The prologue builder needs the default parameter values.
+ SetupDefaultParameterValues();
+
const Function& dart_function = parsed_function()->function();
TargetEntryInstr* normal_entry = flow_graph_builder_->BuildTargetEntry();
+ PrologueInfo prologue_info(-1, -1);
+ BlockEntryInstr* instruction_cursor =
+ flow_graph_builder_->BuildPrologue(normal_entry, &prologue_info);
+
flow_graph_builder_->graph_entry_ = new (Z) GraphEntryInstr(
*parsed_function(), normal_entry, flow_graph_builder_->osr_id_);
- SetupDefaultParameterValues();
-
Fragment body;
if (dart_function.IsConvertedClosureFunction()) {
@@ -3991,29 +4007,29 @@
intptr_t parameter_count = dart_function.NumParameters();
intptr_t parameter_index = parsed_function()->first_parameter_index();
+ const ParsedFunction& pf = *flow_graph_builder_->parsed_function_;
+ const Function& function = pf.function();
+
for (intptr_t i = 0; i < parameter_count; ++i, --parameter_index) {
LocalVariable* variable = scope->VariableAt(i);
if (variable->is_captured()) {
- // There is no LocalVariable describing the on-stack parameter so
- // create one directly and use the same type.
- LocalVariable* parameter = new (Z)
- LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
- Symbols::TempParam(), variable->type());
- parameter->set_index(parameter_index);
- // Mark the stack variable so it will be ignored by the code for
- // try/catch.
- parameter->set_is_captured_parameter(true);
+ LocalVariable& raw_parameter = *pf.RawParameterVariable(i);
+ ASSERT((function.HasOptionalParameters() &&
+ raw_parameter.owner() == scope) ||
+ (!function.HasOptionalParameters() &&
+ raw_parameter.owner() == NULL));
+ ASSERT(!raw_parameter.is_captured());
// Copy the parameter from the stack to the context. Overwrite it
// with a null constant on the stack so the original value is
// eligible for garbage collection.
body += LoadLocal(context);
- body += LoadLocal(parameter);
+ body += LoadLocal(&raw_parameter);
body += flow_graph_builder_->StoreInstanceField(
TokenPosition::kNoSource,
Context::variable_offset(variable->index()));
body += NullConstant();
- body += StoreLocal(TokenPosition::kNoSource, parameter);
+ body += StoreLocal(TokenPosition::kNoSource, &raw_parameter);
body += Drop();
}
}
@@ -4280,7 +4296,7 @@
flow_graph_builder_->context_depth_ = current_context_depth;
}
- normal_entry->LinkTo(body.entry);
+ instruction_cursor->LinkTo(body.entry);
GraphEntryInstr* graph_entry = flow_graph_builder_->graph_entry_;
// When compiling for OSR, use a depth first search to find the OSR
@@ -4291,13 +4307,13 @@
graph_entry->RelinkToOsrEntry(Z,
flow_graph_builder_->last_used_block_id_ + 1);
}
- PrologueInfo prologue_info(-1, -1);
return new (Z)
FlowGraph(*parsed_function(), graph_entry,
flow_graph_builder_->last_used_block_id_, prologue_info);
}
FlowGraph* StreamingFlowGraphBuilder::BuildGraph(intptr_t kernel_offset) {
+ ASSERT(Error::Handle(Z, H.thread()->sticky_error()).IsNull());
const Function& function = parsed_function()->function();
// Setup a [ActiveClassScope] and a [ActiveMemberScope] which will be used
@@ -6010,9 +6026,7 @@
intptr_t argument_check_bits = 0;
if (I->strong()) {
argument_check_bits = ArgumentCheckBitsForSetter(
- // TODO(sjindel): Change 'Function::null_function()' to
- // '*interface_target' and fix breakages.
- Function::null_function(), static_cast<DispatchCategory>(flags & 3));
+ *interface_target, static_cast<DispatchCategory>(flags & 3));
}
if (direct_call.check_receiver_for_null_) {
@@ -6339,6 +6353,7 @@
}
Fragment StreamingFlowGraphBuilder::BuildStaticGet(TokenPosition* p) {
+ ASSERT(Error::Handle(Z, H.thread()->sticky_error()).IsNull());
intptr_t offset = ReaderOffset() - 1; // Include the tag.
TokenPosition position = ReadPosition(); // read position.
@@ -6509,9 +6524,7 @@
Utils::SignedNBitMask(strong_checked_type_arguments);
break;
case Interface: {
- // TODO(sjindel): Restore this assertion once '*interface_target'
- // is passed to this function instead of 'Function::null_function()'.
- // ASSERT(!interface_target.IsNull() || !I->strong());
+ ASSERT(!interface_target.IsNull() || !I->strong());
if (interface_target.IsNull()) {
argument_check_bits =
Utils::SignedNBitMask(strong_checked_arguments + 1);
@@ -6547,6 +6560,7 @@
}
}
+ fn_helper.SetJustRead(FunctionNodeHelper::kTypeParameters);
fn_helper.ReadUntilExcluding(FunctionNodeHelper::kPositionalParameters);
intptr_t num_interface_pos_params = ReadListLength();
ASSERT(num_interface_pos_params >= positional_argument_count);
@@ -6744,11 +6758,9 @@
if (I->strong()) {
ArgumentCheckBitsForInvocation(
argument_count - 1, type_args_len, positional_argument_count,
- argument_names,
- // TODO(sjindel): Change 'Function::null_function()' to
- // '*interface_target' and fix breakages.
- Function::null_function(), static_cast<DispatchCategory>(flags & 3),
- &argument_check_bits, &type_argument_check_bits);
+ argument_names, *interface_target,
+ static_cast<DispatchCategory>(flags & 3), &argument_check_bits,
+ &type_argument_check_bits);
}
if (!direct_call.target_.IsNull()) {
diff --git a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
index 5ca0340..3035c75 100644
--- a/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
+++ b/runtime/vm/compiler/frontend/kernel_binary_flowgraph.h
@@ -312,6 +312,7 @@
kEndPosition,
kFlags,
kName,
+ kSourceUriIndex,
kAnnotations,
kFunction,
kInitializers,
@@ -344,6 +345,7 @@
TokenPosition position_;
TokenPosition end_position_;
uint8_t flags_;
+ intptr_t source_uri_index_;
intptr_t annotation_count_;
private:
@@ -1033,8 +1035,6 @@
const TypeArguments& PeekArgumentsInstantiatedType(const Class& klass);
intptr_t PeekArgumentsCount();
- LocalVariable* LookupParameterDirect(intptr_t kernel_offset,
- intptr_t parameter_index);
LocalVariable* LookupVariable(intptr_t kernel_offset);
LocalVariable* MakeTemporary();
RawFunction* LookupMethodByMember(NameIndex target,
diff --git a/runtime/vm/compiler/frontend/kernel_to_il.cc b/runtime/vm/compiler/frontend/kernel_to_il.cc
index 7f446dd..def0b90 100644
--- a/runtime/vm/compiler/frontend/kernel_to_il.cc
+++ b/runtime/vm/compiler/frontend/kernel_to_il.cc
@@ -7,7 +7,9 @@
#include "vm/compiler/frontend/kernel_to_il.h"
#include "vm/compiler/backend/il.h"
+#include "vm/compiler/backend/il_printer.h"
#include "vm/compiler/frontend/kernel_binary_flowgraph.h"
+#include "vm/compiler/frontend/prologue_builder.h"
#include "vm/compiler/jit/compiler.h"
#include "vm/kernel_loader.h"
#include "vm/longjump.h"
@@ -1272,6 +1274,12 @@
return instructions;
}
+Fragment BaseFlowGraphBuilder::TailCall(const Code& code) {
+ Fragment instructions;
+ Value* arg_desc = Pop();
+ return Fragment(new (Z) TailCallInstr(code, arg_desc));
+}
+
Fragment FlowGraphBuilder::RethrowException(TokenPosition position,
int catch_try_index) {
Fragment instructions;
@@ -1755,7 +1763,7 @@
symbol_name, Object::dynamic_type());
// Set the index relative to the base of the expression stack including
// outgoing arguments.
- variable->set_index(parsed_function_->first_stack_local_index() -
+ variable->set_index(kFirstLocalSlotFromFp -
parsed_function_->num_stack_locals() -
pending_argument_count_ - index);
@@ -2008,8 +2016,7 @@
default: {
String& name = String::ZoneHandle(Z, function.native_name());
for (intptr_t i = 0; i < function.NumParameters(); ++i) {
- body += LoadLocal(
- parsed_function_->node_sequence()->scope()->VariableAt(i));
+ body += LoadLocal(parsed_function_->RawParameterVariable(i));
body += PushArgument();
}
body += NativeCall(&name, &function);
@@ -2217,6 +2224,20 @@
return instructions;
}
+BlockEntryInstr* FlowGraphBuilder::BuildPrologue(TargetEntryInstr* normal_entry,
+ PrologueInfo* prologue_info) {
+ const bool compiling_for_osr = IsCompiledForOsr();
+
+ kernel::PrologueBuilder prologue_builder(
+ parsed_function_, last_used_block_id_, compiling_for_osr, IsInlining());
+ BlockEntryInstr* instruction_cursor =
+ prologue_builder.BuildPrologue(normal_entry, prologue_info);
+
+ last_used_block_id_ = prologue_builder.last_used_block_id();
+
+ return instruction_cursor;
+}
+
FlowGraph* FlowGraphBuilder::BuildGraphOfMethodExtractor(
const Function& method) {
// A method extractor is the implicit getter for a method.
@@ -2243,6 +2264,9 @@
// the arguments descriptor at a call site.
TargetEntryInstr* normal_entry = BuildTargetEntry();
+ PrologueInfo prologue_info(-1, -1);
+ BlockEntryInstr* instruction_cursor =
+ BuildPrologue(normal_entry, &prologue_info);
graph_entry_ = new (Z)
GraphEntryInstr(*parsed_function_, normal_entry, Compiler::kNoOSRDeoptId);
@@ -2260,7 +2284,7 @@
}
parsed_function_->set_default_parameter_values(default_values);
- Fragment body(normal_entry);
+ Fragment body(instruction_cursor);
body += CheckStackOverflowInPrologue();
// The receiver is the first argument to noSuchMethod, and it is the first
@@ -2347,7 +2371,6 @@
/* argument_count = */ 2, ICData::kNSMDispatch);
body += Return(TokenPosition::kNoSource);
- PrologueInfo prologue_info(-1, -1);
return new (Z) FlowGraph(*parsed_function_, graph_entry_, last_used_block_id_,
prologue_info);
}
@@ -2390,10 +2413,13 @@
parsed_function_->set_default_parameter_values(default_values);
TargetEntryInstr* normal_entry = BuildTargetEntry();
+ PrologueInfo prologue_info(-1, -1);
+ BlockEntryInstr* instruction_cursor =
+ BuildPrologue(normal_entry, &prologue_info);
graph_entry_ = new (Z)
GraphEntryInstr(*parsed_function_, normal_entry, Compiler::kNoOSRDeoptId);
- Fragment body(normal_entry);
+ Fragment body(instruction_cursor);
body += CheckStackOverflowInPrologue();
LocalScope* scope = parsed_function_->node_sequence()->scope();
@@ -2448,7 +2474,6 @@
body += Return(TokenPosition::kNoSource);
- PrologueInfo prologue_info(-1, -1);
return new (Z) FlowGraph(*parsed_function_, graph_entry_, last_used_block_id_,
prologue_info);
}
@@ -2482,6 +2507,43 @@
return arguments;
}
+Fragment BaseFlowGraphBuilder::SmiRelationalOp(Token::Kind kind) {
+ Value* right = Pop();
+ Value* left = Pop();
+ RelationalOpInstr* instr = new (Z) RelationalOpInstr(
+ TokenPosition::kNoSource, kind, left, right, kSmiCid, GetNextDeoptId());
+ Push(instr);
+ return Fragment(instr);
+}
+
+Fragment BaseFlowGraphBuilder::SmiBinaryOp(Token::Kind kind,
+ bool is_truncating) {
+ Value* right = Pop();
+ Value* left = Pop();
+ BinarySmiOpInstr* instr =
+ new (Z) BinarySmiOpInstr(kind, left, right, GetNextDeoptId());
+ if (is_truncating) {
+ instr->mark_truncating();
+ }
+ Push(instr);
+ return Fragment(instr);
+}
+
+Fragment BaseFlowGraphBuilder::LoadFpRelativeSlot(intptr_t offset) {
+ LoadIndexedUnsafeInstr* instr = new (Z) LoadIndexedUnsafeInstr(Pop(), offset);
+ Push(instr);
+ return Fragment(instr);
+}
+
+Fragment BaseFlowGraphBuilder::StoreFpRelativeSlot(intptr_t offset) {
+ Value* value = Pop();
+ Value* index = Pop();
+ StoreIndexedUnsafeInstr* instr =
+ new (Z) StoreIndexedUnsafeInstr(index, value, offset);
+ Push(instr);
+ return Fragment(instr);
+}
+
RawObject* EvaluateMetadata(const Field& metadata_field) {
LongJumpScope jump;
if (setjmp(*jump.Set()) == 0) {
diff --git a/runtime/vm/compiler/frontend/kernel_to_il.h b/runtime/vm/compiler/frontend/kernel_to_il.h
index c3dfe4a..10d4733 100644
--- a/runtime/vm/compiler/frontend/kernel_to_il.h
+++ b/runtime/vm/compiler/frontend/kernel_to_il.h
@@ -568,7 +568,10 @@
Fragment IntConstant(int64_t value);
Fragment Constant(const Object& value);
Fragment NullConstant();
+ Fragment SmiRelationalOp(Token::Kind kind);
+ Fragment SmiBinaryOp(Token::Kind op, bool is_truncating = false);
Fragment LoadFpRelativeSlot(intptr_t offset);
+ Fragment StoreFpRelativeSlot(intptr_t offset);
Fragment BranchIfTrue(TargetEntryInstr** then_entry,
TargetEntryInstr** otherwise_entry,
bool negate = false);
@@ -620,6 +623,7 @@
friend class TryCatchBlock;
friend class StreamingFlowGraphBuilder;
friend class FlowGraphBuilder;
+ friend class PrologueBuilder;
};
class FlowGraphBuilder : public BaseFlowGraphBuilder {
@@ -638,8 +642,7 @@
private:
BlockEntryInstr* BuildPrologue(TargetEntryInstr* normal_entry,
- intptr_t* min_prologue_block_id,
- intptr_t* max_prologue_block_id);
+ PrologueInfo* prologue_info);
FlowGraph* BuildGraphOfMethodExtractor(const Function& method);
FlowGraph* BuildGraphOfNoSuchMethodDispatcher(const Function& function);
diff --git a/runtime/vm/compiler/frontend/prologue_builder.cc b/runtime/vm/compiler/frontend/prologue_builder.cc
new file mode 100644
index 0000000..38e2f9c
--- /dev/null
+++ b/runtime/vm/compiler/frontend/prologue_builder.cc
@@ -0,0 +1,483 @@
+// 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.
+
+#include "vm/compiler/frontend/prologue_builder.h"
+
+#include "vm/compiler/backend/il.h"
+#include "vm/compiler/backend/il_printer.h"
+#include "vm/compiler/frontend/kernel_binary_flowgraph.h"
+#include "vm/compiler/jit/compiler.h"
+#include "vm/kernel_loader.h"
+#include "vm/longjump.h"
+#include "vm/object_store.h"
+#include "vm/report.h"
+#include "vm/resolver.h"
+#include "vm/stack_frame.h"
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
+namespace dart {
+namespace kernel {
+
+#define Z (zone_)
+
+BlockEntryInstr* PrologueBuilder::BuildPrologue(BlockEntryInstr* entry,
+ PrologueInfo* prologue_info) {
+ Isolate* isolate = Isolate::Current();
+ const bool strong = isolate->strong();
+
+ // We always have to build the graph, but we only link it sometimes.
+ const bool link = !is_inlining_ && !compiling_for_osr_;
+
+ const intptr_t previous_block_id = last_used_block_id_;
+
+ const bool load_optional_arguments = function_.HasOptionalParameters();
+ const bool expect_type_args =
+ function_.IsGeneric() && isolate->reify_generic_functions();
+ const bool check_arguments =
+ (function_.IsClosureFunction() || function_.IsConvertedClosureFunction());
+
+ Fragment prologue = Fragment(entry);
+ JoinEntryInstr* nsm = NULL;
+ if (load_optional_arguments || check_arguments || expect_type_args) {
+ nsm = BuildThrowNoSuchMethod();
+ }
+ if (check_arguments) {
+ Fragment f = BuildTypeArgumentsLengthCheck(strong, nsm, expect_type_args);
+ if (link) prologue += f;
+ }
+ if (load_optional_arguments) {
+ Fragment f = BuildOptionalParameterHandling(strong, nsm);
+ if (link) prologue += f;
+ } else if (check_arguments) {
+ Fragment f = BuildFixedParameterLengthChecks(strong, nsm);
+ if (link) prologue += f;
+ }
+ if (function_.IsClosureFunction()) {
+ Fragment f = BuildClosureContextHandling();
+ if (!compiling_for_osr_) prologue += f;
+ }
+ if (expect_type_args) {
+ Fragment f = BuildTypeArgumentsHandling(strong);
+ if (link) prologue += f;
+ }
+
+ const bool is_empty_prologue = prologue.entry == prologue.current;
+
+ // Always do this to preserve deoptid numbering.
+ JoinEntryInstr* normal_code = BuildJoinEntry();
+ prologue += Goto(normal_code);
+
+ if (is_empty_prologue) {
+ *prologue_info = PrologueInfo(-1, -1);
+ return entry;
+ } else {
+ *prologue_info =
+ PrologueInfo(previous_block_id, normal_code->block_id() - 1);
+ return normal_code;
+ }
+}
+
+JoinEntryInstr* PrologueBuilder::BuildThrowNoSuchMethod() {
+ JoinEntryInstr* nsm = BuildJoinEntry();
+
+ Fragment failing(nsm);
+ const Code& nsm_handler =
+ Code::ZoneHandle(StubCode::CallClosureNoSuchMethod_entry()->code());
+ failing += LoadArgDescriptor();
+ failing += TailCall(nsm_handler);
+
+ return nsm;
+}
+
+Fragment PrologueBuilder::BuildTypeArgumentsLengthCheck(bool strong,
+ JoinEntryInstr* nsm,
+ bool expect_type_args) {
+ Fragment check_type_args;
+ JoinEntryInstr* done = BuildJoinEntry();
+
+ // Type args are always optional, so length can always be zero.
+ // If expect_type_args, a non-zero length must match the declaration length.
+ TargetEntryInstr *then, *fail;
+ check_type_args += LoadArgDescriptor();
+ check_type_args += LoadField(ArgumentsDescriptor::type_args_len_offset());
+ if (strong) {
+ check_type_args +=
+ IntConstant(ArgumentsDescriptor::TypeArgsLenField::mask());
+ check_type_args += SmiBinaryOp(Token::kBIT_AND, /* truncate= */ true);
+ }
+ if (expect_type_args) {
+ JoinEntryInstr* join2 = BuildJoinEntry();
+
+ LocalVariable* len = MakeTemporary();
+
+ TargetEntryInstr* otherwise;
+ check_type_args += LoadLocal(len);
+ check_type_args += IntConstant(0);
+ check_type_args += BranchIfEqual(&then, &otherwise);
+
+ TargetEntryInstr* then2;
+ Fragment check_len(otherwise);
+ check_len += LoadLocal(len);
+ check_len += IntConstant(function_.NumTypeParameters());
+ check_len += BranchIfEqual(&then2, &fail);
+
+ Fragment(then) + Goto(join2);
+ Fragment(then2) + Goto(join2);
+
+ Fragment(join2) + Drop() + Goto(done);
+ Fragment(fail) + Goto(nsm);
+ } else {
+ check_type_args += IntConstant(0);
+ check_type_args += BranchIfEqual(&then, &fail);
+ Fragment(then) + Goto(done);
+ Fragment(fail) + Goto(nsm);
+ }
+
+ return Fragment(check_type_args.entry, done);
+}
+
+Fragment PrologueBuilder::BuildOptionalParameterHandling(bool strong,
+ JoinEntryInstr* nsm) {
+ Fragment copy_args_prologue;
+ const int num_fixed_params = function_.num_fixed_parameters();
+ const int num_opt_pos_params = function_.NumOptionalPositionalParameters();
+ const int num_opt_named_params = function_.NumOptionalNamedParameters();
+ const int num_params =
+ num_fixed_params + num_opt_pos_params + num_opt_named_params;
+ ASSERT(function_.NumParameters() == num_params);
+
+ // Check that min_num_pos_args <= num_pos_args <= max_num_pos_args,
+ // where num_pos_args is the number of positional arguments passed in.
+ const int min_num_pos_args = num_fixed_params;
+ const int max_num_pos_args = num_fixed_params + num_opt_pos_params;
+
+ copy_args_prologue += LoadArgDescriptor();
+ copy_args_prologue +=
+ LoadField(ArgumentsDescriptor::positional_count_offset());
+ if (strong) {
+ copy_args_prologue +=
+ IntConstant(ArgumentsDescriptor::PositionalCountField::mask());
+ copy_args_prologue += SmiBinaryOp(Token::kBIT_AND, /* truncate= */ true);
+ }
+
+ LocalVariable* positional_count_var = MakeTemporary();
+
+ copy_args_prologue += LoadArgDescriptor();
+ copy_args_prologue += LoadField(ArgumentsDescriptor::count_offset());
+ LocalVariable* count_var = MakeTemporary();
+
+ // Ensure the caller provided at least [min_num_pos_args] arguments.
+ copy_args_prologue += IntConstant(min_num_pos_args);
+ copy_args_prologue += LoadLocal(positional_count_var);
+ copy_args_prologue += SmiRelationalOp(Token::kLTE);
+ TargetEntryInstr *success1, *fail1;
+ copy_args_prologue += BranchIfTrue(&success1, &fail1);
+ copy_args_prologue = Fragment(copy_args_prologue.entry, success1);
+
+ // Ensure the caller provided at most [max_num_pos_args] arguments.
+ copy_args_prologue += LoadLocal(positional_count_var);
+ copy_args_prologue += IntConstant(max_num_pos_args);
+ copy_args_prologue += SmiRelationalOp(Token::kLTE);
+ TargetEntryInstr *success2, *fail2;
+ copy_args_prologue += BranchIfTrue(&success2, &fail2);
+ copy_args_prologue = Fragment(copy_args_prologue.entry, success2);
+
+ // Link up the argument check failing code.
+ Fragment(fail1) + Goto(nsm);
+ Fragment(fail2) + Goto(nsm);
+
+ copy_args_prologue += LoadLocal(count_var);
+ copy_args_prologue += IntConstant(min_num_pos_args);
+ copy_args_prologue += SmiBinaryOp(Token::kSUB, /* truncate= */ true);
+ LocalVariable* optional_count_var = MakeTemporary();
+
+ // Copy mandatory parameters down.
+ intptr_t param = 0;
+ for (; param < num_fixed_params; ++param) {
+ copy_args_prologue += LoadLocal(optional_count_var);
+ copy_args_prologue += LoadFpRelativeSlot(
+ kWordSize * (kParamEndSlotFromFp + num_fixed_params - param));
+ copy_args_prologue +=
+ StoreLocalRaw(TokenPosition::kNoSource, ParameterVariable(param));
+ copy_args_prologue += Drop();
+ }
+
+ // Copy optional parameters down.
+ if (num_opt_pos_params > 0) {
+ JoinEntryInstr* next_missing = NULL;
+ for (intptr_t opt_param = 1; param < num_params; ++param, ++opt_param) {
+ TargetEntryInstr *supplied, *missing;
+ copy_args_prologue += IntConstant(opt_param);
+ copy_args_prologue += LoadLocal(optional_count_var);
+ copy_args_prologue += SmiRelationalOp(Token::kLTE);
+ copy_args_prologue += BranchIfTrue(&supplied, &missing);
+
+ Fragment good(supplied);
+ good += LoadLocal(optional_count_var);
+ good += LoadFpRelativeSlot(
+ kWordSize * (kParamEndSlotFromFp + num_fixed_params - param));
+ good += StoreLocalRaw(TokenPosition::kNoSource, ParameterVariable(param));
+ good += Drop();
+
+ Fragment not_good(missing);
+ if (next_missing != NULL) {
+ not_good += Goto(next_missing);
+ not_good.current = next_missing;
+ }
+ next_missing = BuildJoinEntry();
+ not_good += Constant(DefaultParameterValueAt(opt_param - 1));
+ not_good +=
+ StoreLocalRaw(TokenPosition::kNoSource, ParameterVariable(param));
+ not_good += Drop();
+ not_good += Goto(next_missing);
+
+ copy_args_prologue.current = good.current;
+ }
+ copy_args_prologue += Goto(next_missing /* join good/not_good flows */);
+ copy_args_prologue.current = next_missing;
+
+ // If there are more arguments from the caller we haven't processed, go
+ // NSM.
+ TargetEntryInstr *done, *unknown_named_arg_passed;
+ copy_args_prologue += LoadLocal(positional_count_var);
+ copy_args_prologue += LoadLocal(count_var);
+ copy_args_prologue += BranchIfEqual(&done, &unknown_named_arg_passed);
+ copy_args_prologue.current = done;
+ {
+ Fragment f(unknown_named_arg_passed);
+ f += Goto(nsm);
+ }
+ } else {
+ ASSERT(num_opt_named_params > 0);
+
+ const intptr_t first_name_offset =
+ ArgumentsDescriptor::first_named_entry_offset() - Array::data_offset();
+
+ // Start by alphabetically sorting the names of the optional parameters.
+ LocalVariable** opt_param = new LocalVariable*[num_opt_named_params];
+ int* opt_param_position = new int[num_opt_named_params];
+ SortOptionalNamedParametersInto(opt_param, opt_param_position,
+ num_fixed_params, num_params);
+
+ LocalVariable* optional_count_vars_processed =
+ parsed_function_->expression_temp_var();
+ copy_args_prologue += IntConstant(0);
+ copy_args_prologue +=
+ StoreLocalRaw(TokenPosition::kNoSource, optional_count_vars_processed);
+ copy_args_prologue += Drop();
+
+ for (intptr_t i = 0; param < num_params; ++param, ++i) {
+ JoinEntryInstr* join = BuildJoinEntry();
+
+ copy_args_prologue +=
+ IntConstant(ArgumentsDescriptor::named_entry_size() / kWordSize);
+ copy_args_prologue += LoadLocal(optional_count_vars_processed);
+ copy_args_prologue += SmiBinaryOp(Token::kMUL, /* truncate= */ true);
+ LocalVariable* tuple_diff = MakeTemporary();
+
+ // name = arg_desc[names_offset + arg_desc_name_index + nameOffset]
+ copy_args_prologue += LoadArgDescriptor();
+ copy_args_prologue += IntConstant(
+ (first_name_offset + ArgumentsDescriptor::name_offset()) / kWordSize);
+ copy_args_prologue += LoadLocal(tuple_diff);
+ copy_args_prologue += SmiBinaryOp(Token::kADD, /* truncate= */ true);
+ copy_args_prologue += LoadIndexed(/* index_scale = */ kWordSize);
+
+ // first name in sorted list of all names
+ ASSERT(opt_param[i]->name().IsSymbol());
+ copy_args_prologue += Constant(opt_param[i]->name());
+
+ // Compare the two names: Note that the ArgumentDescriptor array always
+ // terminates with a "null" name (i.e. kNullCid), which will prevent us
+ // from running out-of-bounds.
+ TargetEntryInstr *supplied, *missing;
+ copy_args_prologue += BranchIfStrictEqual(&supplied, &missing);
+
+ // Let's load position from arg descriptor (to see which parameter is the
+ // name) and move kEntrySize forward in ArgDescriptopr names array.
+ Fragment good(supplied);
+
+ {
+ // fp[kParamEndSlotFromFp + (count_var - pos)]
+ good += LoadLocal(count_var);
+ {
+ // pos = arg_desc[names_offset + arg_desc_name_index + positionOffset]
+ good += LoadArgDescriptor();
+ good += IntConstant(
+ (first_name_offset + ArgumentsDescriptor::position_offset()) /
+ kWordSize);
+ good += LoadLocal(tuple_diff);
+ good += SmiBinaryOp(Token::kADD, /* truncate= */ true);
+ good += LoadIndexed(/* index_scale = */ kWordSize);
+ }
+ good += SmiBinaryOp(Token::kSUB, /* truncate= */ true);
+ good += LoadFpRelativeSlot(kWordSize * kParamEndSlotFromFp);
+
+ // Copy down.
+ good += StoreLocalRaw(TokenPosition::kNoSource,
+ ParameterVariable(opt_param_position[i]));
+ good += Drop();
+
+ // Increase processed optional variable count.
+ good += LoadLocal(optional_count_vars_processed);
+ good += IntConstant(1);
+ good += SmiBinaryOp(Token::kADD, /* truncate= */ true);
+ good += StoreLocalRaw(TokenPosition::kNoSource,
+ optional_count_vars_processed);
+ good += Drop();
+
+ good += Goto(join);
+ }
+
+ // We had no match, let's just load the default constant.
+ Fragment not_good(missing);
+ {
+ not_good += Constant(
+ DefaultParameterValueAt(opt_param_position[i] - num_fixed_params));
+
+ // Copy down with default value.
+ not_good += StoreLocalRaw(TokenPosition::kNoSource,
+ ParameterVariable(opt_param_position[i]));
+ not_good += Drop();
+ not_good += Goto(join);
+ }
+
+ copy_args_prologue.current = join;
+ copy_args_prologue += Drop(); // tuple_diff
+ }
+
+ delete[] opt_param;
+ delete[] opt_param_position;
+
+ // If there are more arguments from the caller we haven't processed, go
+ // NSM.
+ TargetEntryInstr *done, *unknown_named_arg_passed;
+ copy_args_prologue += LoadLocal(optional_count_var);
+ copy_args_prologue += LoadLocal(optional_count_vars_processed);
+ copy_args_prologue += BranchIfEqual(&done, &unknown_named_arg_passed);
+ copy_args_prologue.current = done;
+
+ {
+ Fragment f(unknown_named_arg_passed);
+ f += Goto(nsm);
+ }
+ }
+
+ copy_args_prologue += Drop(); // optional_count_var
+ copy_args_prologue += Drop(); // count_var
+ copy_args_prologue += Drop(); // positional_count_var
+
+ return copy_args_prologue;
+}
+
+Fragment PrologueBuilder::BuildFixedParameterLengthChecks(bool strong,
+ JoinEntryInstr* nsm) {
+ Fragment check_args;
+ JoinEntryInstr* done = BuildJoinEntry();
+
+ check_args += LoadArgDescriptor();
+ check_args += LoadField(ArgumentsDescriptor::count_offset());
+ LocalVariable* count = MakeTemporary();
+
+ TargetEntryInstr *then, *fail;
+ check_args += LoadLocal(count);
+ check_args += IntConstant(function_.num_fixed_parameters());
+ check_args += BranchIfEqual(&then, &fail);
+
+ TargetEntryInstr *then2, *fail2;
+ Fragment check_len(then);
+ check_len += LoadArgDescriptor();
+ check_len += LoadField(ArgumentsDescriptor::positional_count_offset());
+ if (strong) {
+ check_len += IntConstant(ArgumentsDescriptor::PositionalCountField::mask());
+ check_len += SmiBinaryOp(Token::kBIT_AND, /* truncate= */ true);
+ }
+ check_len += BranchIfEqual(&then2, &fail2);
+
+ Fragment(fail) + Goto(nsm);
+ Fragment(fail2) + Goto(nsm);
+ Fragment(then2) + Goto(done);
+
+ return Fragment(check_args.entry, done);
+}
+
+Fragment PrologueBuilder::BuildClosureContextHandling() {
+ LocalScope* scope = parsed_function_->node_sequence()->scope();
+ LocalVariable* closure_parameter = scope->VariableAt(0);
+
+ LocalVariable* context = parsed_function_->current_context_var();
+
+ // Load closure.context & store it into the context variable.
+ // (both load/store happen on the copyied-down places).
+ Fragment populate_context;
+ populate_context += LoadLocal(closure_parameter);
+ populate_context += LoadField(Closure::context_offset());
+ populate_context += StoreLocal(TokenPosition::kNoSource, context);
+ populate_context += Drop();
+ return populate_context;
+}
+
+Fragment PrologueBuilder::BuildTypeArgumentsHandling(bool strong) {
+ Fragment populate_args_desc;
+
+ LocalVariable* type_args_var = parsed_function_->RawTypeArgumentsVariable();
+
+ TargetEntryInstr *passed, *not_passed;
+ populate_args_desc += LoadArgDescriptor();
+ populate_args_desc += LoadField(ArgumentsDescriptor::type_args_len_offset());
+ if (strong) {
+ populate_args_desc +=
+ IntConstant(ArgumentsDescriptor::TypeArgsLenField::mask());
+ populate_args_desc += SmiBinaryOp(Token::kBIT_AND, /* truncate= */ true);
+ }
+ populate_args_desc += IntConstant(0);
+ populate_args_desc += BranchIfEqual(¬_passed, &passed);
+
+ JoinEntryInstr* join = BuildJoinEntry();
+
+ Fragment store_type_args(passed);
+ store_type_args += LoadArgDescriptor();
+ store_type_args += LoadField(ArgumentsDescriptor::count_offset());
+ store_type_args += LoadFpRelativeSlot(kWordSize * (1 + kParamEndSlotFromFp));
+ store_type_args += StoreLocal(TokenPosition::kNoSource, type_args_var);
+ store_type_args += Drop();
+ store_type_args += Goto(join);
+
+ Fragment store_null(not_passed);
+ store_null += NullConstant();
+ store_null += StoreLocal(TokenPosition::kNoSource, type_args_var);
+ store_null += Drop();
+ store_null += Goto(join);
+
+ populate_args_desc = Fragment(populate_args_desc.entry, join);
+
+ return populate_args_desc;
+}
+
+void PrologueBuilder::SortOptionalNamedParametersInto(LocalVariable** opt_param,
+ int* opt_param_position,
+ int num_fixed_params,
+ int num_params) {
+ LocalScope* scope = parsed_function_->node_sequence()->scope();
+ for (int pos = num_fixed_params; pos < num_params; pos++) {
+ LocalVariable* parameter = scope->VariableAt(pos);
+ const String& opt_param_name = parameter->name();
+ int i = pos - num_fixed_params;
+ while (--i >= 0) {
+ LocalVariable* param_i = opt_param[i];
+ const intptr_t result = opt_param_name.CompareTo(param_i->name());
+ ASSERT(result != 0);
+ if (result > 0) break;
+ opt_param[i + 1] = opt_param[i];
+ opt_param_position[i + 1] = opt_param_position[i];
+ }
+ opt_param[i + 1] = parameter;
+ opt_param_position[i + 1] = pos;
+ }
+}
+
+} // namespace kernel
+} // namespace dart
+
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
diff --git a/runtime/vm/compiler/frontend/prologue_builder.h b/runtime/vm/compiler/frontend/prologue_builder.h
new file mode 100644
index 0000000..a77767e
--- /dev/null
+++ b/runtime/vm/compiler/frontend/prologue_builder.h
@@ -0,0 +1,99 @@
+// 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.
+
+#ifndef RUNTIME_VM_COMPILER_FRONTEND_PROLOGUE_BUILDER_H_
+#define RUNTIME_VM_COMPILER_FRONTEND_PROLOGUE_BUILDER_H_
+
+#if !defined(DART_PRECOMPILED_RUNTIME)
+
+#include "vm/compiler/frontend/kernel_to_il.h"
+
+namespace dart {
+namespace kernel {
+
+// Responsible for building IR code for prologues of functions.
+//
+// This code handles initialization of local variables which the
+// prologue needs to setup, including initialization of the:
+//
+// * current context variable, from the passed closure object
+// * function_type_arguments variable, from the stack above fp
+// * raw parameter variables, from the stack above fp
+//
+// if needed.
+//
+// Furthermore it performs all necessary checks which could lead into a
+// no-such-method bailout, including check that:
+//
+// * the number of passed positional arguments is correct
+// * the names of passed named arguments are correct
+// * the number of function type arguments is correct
+//
+// if needed.
+//
+// Most of these things are done by interpreting the caller-supplied arguments
+// descriptor.
+class PrologueBuilder : public BaseFlowGraphBuilder {
+ public:
+ PrologueBuilder(const ParsedFunction* parsed_function,
+ intptr_t last_used_id,
+ bool compiling_for_osr,
+ bool is_inlining)
+ : BaseFlowGraphBuilder(parsed_function, last_used_id),
+ compiling_for_osr_(compiling_for_osr),
+ is_inlining_(is_inlining) {}
+
+ BlockEntryInstr* BuildPrologue(BlockEntryInstr* entry,
+ PrologueInfo* prologue_info);
+
+ intptr_t last_used_block_id() const { return last_used_block_id_; }
+
+ private:
+ JoinEntryInstr* BuildThrowNoSuchMethod();
+
+ Fragment BuildTypeArgumentsLengthCheck(bool strong,
+ JoinEntryInstr* nsm,
+ bool expect_type_args);
+
+ Fragment BuildOptionalParameterHandling(bool strong, JoinEntryInstr* nsm);
+
+ Fragment BuildFixedParameterLengthChecks(bool strong, JoinEntryInstr* nsm);
+
+ Fragment BuildClosureContextHandling();
+
+ Fragment BuildTypeArgumentsHandling(bool strong);
+
+ LocalVariable* ParameterVariable(intptr_t index) {
+ return parsed_function_->RawParameterVariable(index);
+ }
+
+ Fragment LoadArgDescriptor() {
+ ASSERT(parsed_function_->has_arg_desc_var());
+ return LoadLocal(parsed_function_->arg_desc_var());
+ }
+
+ const Instance& DefaultParameterValueAt(intptr_t i) {
+ if (parsed_function_->default_parameter_values() != NULL) {
+ return parsed_function_->DefaultParameterValueAt(i);
+ }
+
+ ASSERT(parsed_function_->function().kind() ==
+ RawFunction::kNoSuchMethodDispatcher);
+ return Instance::null_instance();
+ }
+
+ void SortOptionalNamedParametersInto(LocalVariable** opt_param,
+ int* opt_param_position,
+ int num_fixed_params,
+ int num_params);
+
+ bool compiling_for_osr_;
+ bool is_inlining_;
+};
+
+} // namespace kernel
+} // namespace dart
+
+#endif // !defined(DART_PRECOMPILED_RUNTIME)
+#endif // RUNTIME_VM_COMPILER_FRONTEND_PROLOGUE_BUILDER_H_
diff --git a/runtime/vm/compiler/intrinsifier.cc b/runtime/vm/compiler/intrinsifier.cc
index 43d52fb..a74987c 100644
--- a/runtime/vm/compiler/intrinsifier.cc
+++ b/runtime/vm/compiler/intrinsifier.cc
@@ -166,6 +166,8 @@
FlowGraphCompiler* compiler) {
#if !defined(TARGET_ARCH_DBC)
ASSERT(!parsed_function.function().HasOptionalParameters());
+ PrologueInfo prologue_info(-1, -1);
+
ZoneGrowableArray<const ICData*>* ic_data_array =
new ZoneGrowableArray<const ICData*>();
FlowGraphBuilder builder(parsed_function, *ic_data_array,
@@ -178,7 +180,6 @@
Thread::Current()->GetNextDeoptId());
GraphEntryInstr* graph_entry = new GraphEntryInstr(
parsed_function, normal_entry, Compiler::kNoOSRDeoptId);
- PrologueInfo prologue_info(-1, -1);
FlowGraph* graph =
new FlowGraph(parsed_function, graph_entry, block_id, prologue_info);
const Function& function = parsed_function.function();
diff --git a/runtime/vm/constants_dbc.h b/runtime/vm/constants_dbc.h
index d3ab486..4ad1020 100644
--- a/runtime/vm/constants_dbc.h
+++ b/runtime/vm/constants_dbc.h
@@ -73,6 +73,10 @@
// +--------+--------+--------+--------+
//
// +--------+--------+--------+--------+
+// | opcode | A | B | Y | A_B_Y: 2 unsigned 8-bit operands
+// +--------+--------+--------+--------+ 1 signed 8-bit operand
+//
+// +--------+--------+--------+--------+
// | opcode | T | T: signed 24-bit operand
// +--------+--------+--------+--------+
//
@@ -210,6 +214,11 @@
// 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
@@ -338,6 +347,12 @@
// 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].
@@ -395,6 +410,55 @@
//
// 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
@@ -460,42 +524,15 @@
// Throw (Rethrow if A != 0) exception. Exception object and stack object
// are taken from TOS.
//
-// - Entry A, B, rC
+// - Entry rD
//
-// Function prologue for the function with no optional or named arguments:
-// A - expected number of positional arguments;
-// B - number of local slots to reserve;
-// rC - specifies context register to initialize with empty context.
+// Function prologue for the function
+// rD - number of local slots to reserve;
//
-// - EntryOptional A, B, C
+// - EntryOptimized rD
//
-// 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 A, D
-//
-// Function prologue for optimized functions with no optional or named
-// arguments.
-// A - expected number of positional arguments;
-// D - number of local slots to reserve for registers;
+// 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.
@@ -730,6 +767,9 @@
V(EqualTOS, 0, ___, ___, ___) \
V(LessThanTOS, 0, ___, ___, ___) \
V(GreaterThanTOS, 0, ___, ___, ___) \
+ V(SmiAddTOS, 0, ___, ___, ___) \
+ V(SmiSubTOS, 0, ___, ___, ___) \
+ V(SmiMulTOS, 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) \
@@ -779,6 +819,10 @@
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, ___) \
@@ -815,6 +859,16 @@
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) \
@@ -838,8 +892,7 @@
V(BooleanNegateTOS, 0, ___, ___, ___) \
V(BooleanNegate, A_D, reg, reg, ___) \
V(Throw, A, num, ___, ___) \
- V(Entry, A_B_C, num, num, num) \
- V(EntryOptional, A_B_C, num, num, num) \
+ V(Entry, D, num, ___, ___) \
V(EntryOptimized, A_D, num, num, ___) \
V(Frame, D, num, ___, ___) \
V(SetFrame, A, num, ___, num) \
@@ -882,6 +935,15 @@
#undef DECLARE_BYTECODE
};
+ static const char* NameOf(Instr instr) {
+ const char* names[] = {
+#define NAME(name, encoding, op1, op2, op3) #name,
+ BYTECODES_LIST(NAME)
+#undef DECLARE_BYTECODE
+ };
+ return names[DecodeOpcode(instr)];
+ }
+
static const intptr_t kOpShift = 0;
static const intptr_t kAShift = 8;
static const intptr_t kAMask = 0xFF;
@@ -891,6 +953,8 @@
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 Instr Encode(Opcode op, uintptr_t a, uintptr_t b, uintptr_t c) {
ASSERT((a & kAMask) == a);
@@ -930,6 +994,10 @@
return static_cast<Opcode>(bc & 0xFF);
}
+ DART_FORCE_INLINE static bool IsTrap(Instr instr) {
+ return DecodeOpcode(instr) == Bytecode::kTrap;
+ }
+
DART_FORCE_INLINE static bool IsCallOpcode(Instr instr) {
switch (DecodeOpcode(instr)) {
case Bytecode::kStaticCall:
diff --git a/runtime/vm/constants_ia32.h b/runtime/vm/constants_ia32.h
index 0b95f0c..7b4dd5c 100644
--- a/runtime/vm/constants_ia32.h
+++ b/runtime/vm/constants_ia32.h
@@ -92,46 +92,6 @@
TIMES_HALF_WORD_SIZE = kWordSizeLog2 - 1
};
-enum Condition {
- OVERFLOW = 0,
- NO_OVERFLOW = 1,
- BELOW = 2,
- ABOVE_EQUAL = 3,
- EQUAL = 4,
- NOT_EQUAL = 5,
- BELOW_EQUAL = 6,
- ABOVE = 7,
- SIGN = 8,
- NOT_SIGN = 9,
- PARITY_EVEN = 10,
- PARITY_ODD = 11,
- LESS = 12,
- GREATER_EQUAL = 13,
- LESS_EQUAL = 14,
- GREATER = 15,
-
- ZERO = EQUAL,
- NOT_ZERO = NOT_EQUAL,
- NEGATIVE = SIGN,
- POSITIVE = NOT_SIGN,
- CARRY = BELOW,
- NOT_CARRY = ABOVE_EQUAL,
-
- // Platform-independent variants declared for all platforms
- // EQUAL,
- // NOT_EQUAL,
- // LESS,
- // LESS_EQUAL,
- // GREATER_EQUAL,
- // GREATER,
- UNSIGNED_LESS = BELOW,
- UNSIGNED_LESS_EQUAL = BELOW_EQUAL,
- UNSIGNED_GREATER = ABOVE,
- UNSIGNED_GREATER_EQUAL = ABOVE_EQUAL,
-
- INVALID_CONDITION = 16
-};
-
class Instr {
public:
static const uint8_t kHltInstruction = 0xF4;
diff --git a/runtime/vm/constants_x64.h b/runtime/vm/constants_x64.h
index 4c7327f..9f9168f 100644
--- a/runtime/vm/constants_x64.h
+++ b/runtime/vm/constants_x64.h
@@ -136,46 +136,6 @@
TIMES_HALF_WORD_SIZE = kWordSizeLog2 - 1
};
-enum Condition {
- OVERFLOW = 0,
- NO_OVERFLOW = 1,
- BELOW = 2,
- ABOVE_EQUAL = 3,
- EQUAL = 4,
- NOT_EQUAL = 5,
- BELOW_EQUAL = 6,
- ABOVE = 7,
- SIGN = 8,
- NOT_SIGN = 9,
- PARITY_EVEN = 10,
- PARITY_ODD = 11,
- LESS = 12,
- GREATER_EQUAL = 13,
- LESS_EQUAL = 14,
- GREATER = 15,
-
- ZERO = EQUAL,
- NOT_ZERO = NOT_EQUAL,
- NEGATIVE = SIGN,
- POSITIVE = NOT_SIGN,
- CARRY = BELOW,
- NOT_CARRY = ABOVE_EQUAL,
-
- // Platform-independent variants declared for all platforms
- // EQUAL,
- // NOT_EQUAL,
- // LESS,
- // LESS_EQUAL,
- // GREATER_EQUAL,
- // GREATER,
- UNSIGNED_LESS = BELOW,
- UNSIGNED_LESS_EQUAL = BELOW_EQUAL,
- UNSIGNED_GREATER = ABOVE,
- UNSIGNED_GREATER_EQUAL = ABOVE_EQUAL,
-
- INVALID_CONDITION = 16
-};
-
#define R(reg) (1 << (reg))
#if defined(_WIN64)
diff --git a/runtime/vm/constants_x86.h b/runtime/vm/constants_x86.h
new file mode 100644
index 0000000..917c41b
--- /dev/null
+++ b/runtime/vm/constants_x86.h
@@ -0,0 +1,132 @@
+// 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.
+
+#ifndef RUNTIME_VM_CONSTANTS_X86_H_
+#define RUNTIME_VM_CONSTANTS_X86_H_
+
+namespace dart {
+
+enum Condition {
+ OVERFLOW = 0,
+ NO_OVERFLOW = 1,
+ BELOW = 2,
+ ABOVE_EQUAL = 3,
+ EQUAL = 4,
+ NOT_EQUAL = 5,
+ BELOW_EQUAL = 6,
+ ABOVE = 7,
+ SIGN = 8,
+ NOT_SIGN = 9,
+ PARITY_EVEN = 10,
+ PARITY_ODD = 11,
+ LESS = 12,
+ GREATER_EQUAL = 13,
+ LESS_EQUAL = 14,
+ GREATER = 15,
+
+ ZERO = EQUAL,
+ NOT_ZERO = NOT_EQUAL,
+ NEGATIVE = SIGN,
+ POSITIVE = NOT_SIGN,
+ CARRY = BELOW,
+ NOT_CARRY = ABOVE_EQUAL,
+
+ // Platform-independent variants declared for all platforms
+ // EQUAL,
+ // NOT_EQUAL,
+ // LESS,
+ // LESS_EQUAL,
+ // GREATER_EQUAL,
+ // GREATER,
+ UNSIGNED_LESS = BELOW,
+ UNSIGNED_LESS_EQUAL = BELOW_EQUAL,
+ UNSIGNED_GREATER = ABOVE,
+ UNSIGNED_GREATER_EQUAL = ABOVE_EQUAL,
+
+ INVALID_CONDITION = 16
+};
+
+#define X86_ZERO_OPERAND_1_BYTE_INSTRUCTIONS(F) \
+ F(ret, 0xC3) \
+ F(leave, 0xC9) \
+ F(hlt, 0xF4) \
+ F(cld, 0xFC) \
+ F(int3, 0xCC) \
+ F(pushad, 0x60) \
+ F(popad, 0x61) \
+ F(pushfd, 0x9C) \
+ F(popfd, 0x9D) \
+ F(sahf, 0x9E) \
+ F(cdq, 0x99) \
+ F(fwait, 0x9B) \
+ F(movsb, 0xA4) \
+ F(movsl, 0xA5) \
+ F(cmpsb, 0xA6) \
+ F(cmpsl, 0xA7)
+
+// clang-format off
+#define X86_ALU_CODES(F) \
+ F(and, 4) \
+ F(or, 1) \
+ F(xor, 6) \
+ F(add, 0) \
+ F(adc, 2) \
+ F(sub, 5) \
+ F(sbb, 3) \
+ F(cmp, 7)
+
+#define XMM_ALU_CODES(F) \
+ F(bad0, 0) \
+ F(sqrt, 1) \
+ F(rsqrt, 2) \
+ F(rcp, 3) \
+ F(and, 4) \
+ F(bad1, 5) \
+ F(or, 6) \
+ F(xor, 7) \
+ F(add, 8) \
+ F(mul, 9) \
+ F(bad2, 0xA) \
+ F(bad3, 0xB) \
+ F(sub, 0xC) \
+ F(min, 0xD) \
+ F(div, 0xE) \
+ F(max, 0xF)
+// clang-format on
+
+// Table 3-1, first part
+#define XMM_CONDITIONAL_CODES(F) \
+ F(eq, 0) \
+ F(lt, 1) \
+ F(le, 2) \
+ F(unord, 3) \
+ F(neq, 4) \
+ F(nlt, 5) \
+ F(nle, 6) \
+ F(ord, 7)
+
+#define X86_CONDITIONAL_SUFFIXES(F) \
+ F(o, OVERFLOW) \
+ F(no, NO_OVERFLOW) \
+ F(c, CARRY) \
+ F(nc, NOT_CARRY) \
+ F(z, ZERO) \
+ F(nz, NOT_ZERO) \
+ F(na, BELOW_EQUAL) \
+ F(a, ABOVE) \
+ F(s, SIGN) \
+ F(ns, NOT_SIGN) \
+ F(pe, PARITY_EVEN) \
+ F(po, PARITY_ODD) \
+ F(l, LESS) \
+ F(ge, GREATER_EQUAL) \
+ F(le, LESS_EQUAL) \
+ F(g, GREATER) \
+ /* Some alternative names */ \
+ F(e, EQUAL) \
+ F(ne, NOT_EQUAL)
+
+} // namespace dart
+
+#endif // RUNTIME_VM_CONSTANTS_X86_H_
diff --git a/runtime/vm/flag_list.h b/runtime/vm/flag_list.h
index 03bbfba..1f164e7 100644
--- a/runtime/vm/flag_list.h
+++ b/runtime/vm/flag_list.h
@@ -56,6 +56,8 @@
P(collect_code, bool, true, "Attempt to GC infrequently used code.") \
P(collect_dynamic_function_names, bool, true, \
"Collects all dynamic function names to identify unique targets") \
+ P(compactor_tasks, int, 2, \
+ "The number of tasks to use for parallel compaction.") \
P(concurrent_sweep, bool, USING_MULTICORE, \
"Concurrent sweep for old generation.") \
R(dedup_instructions, true, bool, false, \
diff --git a/runtime/vm/gc_compactor.cc b/runtime/vm/gc_compactor.cc
index 4622d39..c35f86c 100644
--- a/runtime/vm/gc_compactor.cc
+++ b/runtime/vm/gc_compactor.cc
@@ -8,6 +8,7 @@
#include "vm/globals.h"
#include "vm/heap.h"
#include "vm/pages.h"
+#include "vm/thread_barrier.h"
#include "vm/timeline.h"
namespace dart {
@@ -31,7 +32,7 @@
public:
ForwardingBlock() : new_address_(0), live_bitvector_(0) {}
- uword Lookup(uword old_addr) {
+ uword Lookup(uword old_addr) const {
uword block_offset = old_addr & ~kBlockMask;
intptr_t first_unit_position = block_offset >> kObjectAlignmentLog2;
ASSERT(first_unit_position < kBitsPerWord);
@@ -60,6 +61,14 @@
<< first_unit_position;
}
+ bool IsLive(uword old_addr) const {
+ uword block_offset = old_addr & ~kBlockMask;
+ intptr_t first_unit_position = block_offset >> kObjectAlignmentLog2;
+ ASSERT(first_unit_position < kBitsPerWord);
+ return (live_bitvector_ & (static_cast<uword>(1) << first_unit_position)) !=
+ 0;
+ }
+
// Marks all bits after a given address. This is used to ensure that some
// objects do not move (classes).
void MarkAllFrom(uword start_addr) {
@@ -69,6 +78,7 @@
live_bitvector_ = static_cast<uword>(-1) << first_unit_position;
}
+ uword new_address() const { return new_address_; }
void set_new_address(uword value) { new_address_ = value; }
private:
@@ -111,65 +121,151 @@
forwarding_page_ = NULL;
}
+class CompactorTask : public ThreadPool::Task {
+ public:
+ CompactorTask(Isolate* isolate,
+ GCCompactor* compactor,
+ ThreadBarrier* barrier,
+ intptr_t* next_forwarding_task,
+ HeapPage* head,
+ HeapPage** tail,
+ FreeList* freelist)
+ : isolate_(isolate),
+ compactor_(compactor),
+ barrier_(barrier),
+ next_forwarding_task_(next_forwarding_task),
+ head_(head),
+ tail_(tail),
+ freelist_(freelist),
+ free_page_(NULL),
+ free_current_(0),
+ free_end_(0) {}
+
+ private:
+ void Run();
+ void PlanPage(HeapPage* page);
+ void SlidePage(HeapPage* page);
+ uword PlanBlock(uword first_object, ForwardingPage* forwarding_page);
+ uword SlideBlock(uword first_object, ForwardingPage* forwarding_page);
+ void PlanMoveToExactAddress(uword addr);
+ void PlanMoveToContiguousSize(intptr_t size);
+ void SlideFreeUpTo(uword addr);
+
+ Isolate* isolate_;
+ GCCompactor* compactor_;
+ ThreadBarrier* barrier_;
+ intptr_t* next_forwarding_task_;
+ HeapPage* head_;
+ HeapPage** tail_;
+ FreeList* freelist_;
+ HeapPage* free_page_;
+ uword free_current_;
+ uword free_end_;
+
+ DISALLOW_COPY_AND_ASSIGN(CompactorTask);
+};
+
// Slides live objects down past free gaps, updates pointers and frees empty
// pages. Keeps cursors pointing to the next free and next live chunks, and
// repeatedly moves the next live chunk to the next free chunk, one block at a
// time, keeping blocks from spanning page boundries (see ForwardingBlock). Free
// space at the end of a page that is too small for the next block is added to
// the freelist.
-void GCCompactor::CompactBySliding(HeapPage* pages,
- FreeList* freelist,
- Mutex* pages_lock) {
+void GCCompactor::Compact(HeapPage* pages,
+ FreeList* freelist,
+ Mutex* pages_lock) {
+ SetupImagePageBoundaries();
+
+ // Divide the heap.
+ // TODO(30978): Try to divide based on live bytes or with work stealing.
+ intptr_t num_pages = 0;
+ for (HeapPage* page = pages; page != NULL; page = page->next()) {
+ num_pages++;
+ }
+
+ intptr_t num_tasks = FLAG_compactor_tasks;
+ RELEASE_ASSERT(num_tasks >= 1);
+ if (num_pages < num_tasks) {
+ num_tasks = num_pages;
+ }
+ HeapPage** heads = new HeapPage*[num_tasks];
+ HeapPage** tails = new HeapPage*[num_tasks];
+
{
- TIMELINE_FUNCTION_GC_DURATION(thread(), "SlideObjects");
- MutexLocker ml(pages_lock);
-
- free_page_ = pages;
- free_current_ = free_page_->object_start();
- free_end_ = free_page_->object_end();
- freelist_ = freelist;
-
- HeapPage* live_page = pages;
- while (live_page != NULL) {
- SlidePage(live_page);
- live_page = live_page->next();
+ const intptr_t pages_per_task = num_pages / num_tasks;
+ intptr_t task_index = 0;
+ intptr_t page_index = 0;
+ HeapPage* page = pages;
+ HeapPage* prev = NULL;
+ while (task_index < num_tasks) {
+ if (page_index % pages_per_task == 0) {
+ heads[task_index] = page;
+ tails[task_index] = NULL;
+ if (prev != NULL) {
+ prev->set_next(NULL);
+ }
+ task_index++;
+ }
+ prev = page;
+ page = page->next();
+ page_index++;
}
-
- // Add any leftover in the last used page to the freelist. This is required
- // to make the page walkable during forwarding, etc.
- intptr_t free_remaining = free_end_ - free_current_;
- if (free_remaining != 0) {
- ASSERT(free_remaining >= kObjectAlignment);
- freelist->FreeLocked(free_current_, free_remaining);
- }
-
- // Unlink empty pages so they will not be visited during forwarding.
- // We cannot deallocate them until forwarding is complete.
- HeapPage* tail = free_page_;
- HeapPage* first_unused_page = tail->next();
- tail->set_next(NULL);
- heap_->old_space()->pages_tail_ = tail;
- free_page_ = first_unused_page;
+ ASSERT(page_index <= num_pages);
+ ASSERT(task_index == num_tasks);
}
{
- TIMELINE_FUNCTION_GC_DURATION(thread(), "ForwardPointers");
- ForwardPointersForSliding();
+ ThreadBarrier barrier(num_tasks + 1, heap_->barrier(),
+ heap_->barrier_done());
+ intptr_t next_forwarding_task = 0;
+
+ for (intptr_t task_index = 0; task_index < num_tasks; task_index++) {
+ Dart::thread_pool()->Run(new CompactorTask(
+ thread()->isolate(), this, &barrier, &next_forwarding_task,
+ heads[task_index], &tails[task_index], freelist));
+ }
+
+ // Plan pages.
+ barrier.Sync();
+ // Slides pages. Forward large pages, new space, etc.
+ barrier.Sync();
+ barrier.Exit();
+ }
+
+ for (intptr_t task_index = 0; task_index < num_tasks; task_index++) {
+ ASSERT(tails[task_index] != NULL);
+ }
+
+ {
+ TIMELINE_FUNCTION_GC_DURATION(thread(), "ForwardStackPointers");
+ ForwardStackPointers();
}
{
MutexLocker ml(pages_lock);
// Free empty pages.
- HeapPage* page = free_page_;
- while (page != NULL) {
- HeapPage* next = page->next();
- heap_->old_space()->IncreaseCapacityInWordsLocked(
- -(page->memory_->size() >> kWordSizeLog2));
- page->FreeForwardingPage();
- page->Deallocate();
- page = next;
+ for (intptr_t task_index = 0; task_index < num_tasks; task_index++) {
+ HeapPage* page = tails[task_index]->next();
+ while (page != NULL) {
+ HeapPage* next = page->next();
+ heap_->old_space()->IncreaseCapacityInWordsLocked(
+ -(page->memory_->size() >> kWordSizeLog2));
+ page->FreeForwardingPage();
+ page->Deallocate();
+ page = next;
+ }
}
+
+ // Re-join the heap.
+ for (intptr_t task_index = 0; task_index < num_tasks - 1; task_index++) {
+ tails[task_index]->set_next(heads[task_index + 1]);
+ }
+ tails[num_tasks - 1]->set_next(NULL);
+ heap_->old_space()->pages_tail_ = tails[num_tasks - 1];
+
+ delete[] heads;
+ delete[] tails;
}
// Free forwarding information from the suriving pages.
@@ -178,27 +274,137 @@
}
}
-void GCCompactor::SlidePage(HeapPage* page) {
+void CompactorTask::Run() {
+ bool result =
+ Thread::EnterIsolateAsHelper(isolate_, Thread::kCompactorTask, true);
+ ASSERT(result);
+ NOT_IN_PRODUCT(Thread* thread = Thread::Current());
+ {
+ {
+ TIMELINE_FUNCTION_GC_DURATION(thread, "Plan");
+ free_page_ = head_;
+ free_current_ = free_page_->object_start();
+ free_end_ = free_page_->object_end();
+
+ for (HeapPage* page = head_; page != NULL; page = page->next()) {
+ PlanPage(page);
+ }
+ }
+
+ barrier_->Sync();
+
+ {
+ TIMELINE_FUNCTION_GC_DURATION(thread, "Slide");
+ free_page_ = head_;
+ free_current_ = free_page_->object_start();
+ free_end_ = free_page_->object_end();
+
+ for (HeapPage* page = head_; page != NULL; page = page->next()) {
+ SlidePage(page);
+ }
+
+ // Add any leftover in the last used page to the freelist. This is
+ // required to make the page walkable during forwarding, etc.
+ intptr_t free_remaining = free_end_ - free_current_;
+ if (free_remaining != 0) {
+ freelist_->Free(free_current_, free_remaining);
+ }
+
+ ASSERT(free_page_ != NULL);
+ *tail_ = free_page_; // Last live page.
+ }
+
+ // Heap: Regular pages already visited during sliding. Code and image pages
+ // have no pointers to forward. Visit large pages and new-space.
+
+ bool more_forwarding_tasks = true;
+ while (more_forwarding_tasks) {
+ intptr_t forwarding_task =
+ AtomicOperations::FetchAndIncrement(next_forwarding_task_);
+ switch (forwarding_task) {
+ case 0: {
+ TIMELINE_FUNCTION_GC_DURATION(thread, "ForwardLargePages");
+ for (HeapPage* large_page =
+ isolate_->heap()->old_space()->large_pages_;
+ large_page != NULL; large_page = large_page->next()) {
+ large_page->VisitObjectPointers(compactor_);
+ }
+ break;
+ }
+ case 1: {
+ TIMELINE_FUNCTION_GC_DURATION(thread, "ForwardNewSpace");
+ isolate_->heap()->new_space()->VisitObjectPointers(compactor_);
+ break;
+ }
+ case 2: {
+ TIMELINE_FUNCTION_GC_DURATION(thread, "ForwardRememberedSet");
+ isolate_->store_buffer()->VisitObjectPointers(compactor_);
+ break;
+ }
+ case 3: {
+ TIMELINE_FUNCTION_GC_DURATION(thread, "ForwardWeakTables");
+ isolate_->heap()->ForwardWeakTables(compactor_);
+ break;
+ }
+ case 4: {
+ TIMELINE_FUNCTION_GC_DURATION(thread, "ForwardWeakHandles");
+ isolate_->VisitWeakPersistentHandles(compactor_);
+ break;
+ }
+#ifndef PRODUCT
+ case 5: {
+ if (FLAG_support_service) {
+ TIMELINE_FUNCTION_GC_DURATION(thread, "ForwardObjectIdRing");
+ isolate_->object_id_ring()->VisitPointers(compactor_);
+ }
+ break;
+ }
+#endif // !PRODUCT
+ default:
+ more_forwarding_tasks = false;
+ }
+ }
+
+ barrier_->Sync();
+ }
+ Thread::ExitIsolateAsHelper(true);
+
+ // This task is done. Notify the original thread.
+ barrier_->Exit();
+}
+
+void CompactorTask::PlanPage(HeapPage* page) {
uword current = page->object_start();
uword end = page->object_end();
ForwardingPage* forwarding_page = page->AllocateForwardingPage();
while (current < end) {
+ current = PlanBlock(current, forwarding_page);
+ }
+}
+
+void CompactorTask::SlidePage(HeapPage* page) {
+ uword current = page->object_start();
+ uword end = page->object_end();
+
+ ForwardingPage* forwarding_page = page->forwarding_page();
+ while (current < end) {
current = SlideBlock(current, forwarding_page);
}
}
-uword GCCompactor::SlideBlock(uword first_object,
- ForwardingPage* forwarding_page) {
- uword start = first_object & kBlockMask;
- uword end = start + kBlockSize;
+uword CompactorTask::PlanBlock(uword first_object,
+ ForwardingPage* forwarding_page) {
+ uword block_start = first_object & kBlockMask;
+ uword block_end = block_start + kBlockSize;
ForwardingBlock* forwarding_block = forwarding_page->BlockFor(first_object);
// 1. Compute bitvector of surviving allocation units in the block.
bool has_class = false;
intptr_t block_live_size = 0;
+ intptr_t block_dead_size = 0;
uword current = first_object;
- while (current < end) {
+ while (current < block_end) {
RawObject* obj = RawObject::FromAddr(current);
intptr_t size = obj->Size();
if (obj->IsMarked()) {
@@ -209,6 +415,8 @@
ASSERT(static_cast<intptr_t>(forwarding_block->Lookup(current)) ==
block_live_size);
block_live_size += size;
+ } else {
+ block_dead_size += size;
}
current += size;
}
@@ -217,7 +425,7 @@
if (has_class) {
// This will waste the space used by dead objects that are before the class
// object.
- MoveToExactAddress(first_object);
+ PlanMoveToExactAddress(first_object);
ASSERT(free_current_ == first_object);
// This is not MarkAll because the first part of a block might
@@ -225,28 +433,36 @@
// or the page header.
forwarding_block->MarkAllFrom(first_object);
ASSERT(forwarding_block->Lookup(first_object) == 0);
- } else {
- MoveToContiguousSize(block_live_size);
- }
- forwarding_block->set_new_address(free_current_);
- // 3. Move objects in the block.
+ forwarding_block->set_new_address(free_current_);
+ free_current_ += block_live_size + block_dead_size;
+ } else {
+ PlanMoveToContiguousSize(block_live_size);
+ forwarding_block->set_new_address(free_current_);
+ free_current_ += block_live_size;
+ }
+
+ return current; // First object in the next block
+}
+
+uword CompactorTask::SlideBlock(uword first_object,
+ ForwardingPage* forwarding_page) {
+ uword block_start = first_object & kBlockMask;
+ uword block_end = block_start + kBlockSize;
+ ForwardingBlock* forwarding_block = forwarding_page->BlockFor(first_object);
+
+ // Add any space wasted at the end of a page or due to class pinning to the
+ // free list.
+ SlideFreeUpTo(forwarding_block->new_address());
+
uword old_addr = first_object;
- while (old_addr < end) {
+ while (old_addr < block_end) {
RawObject* old_obj = RawObject::FromAddr(old_addr);
intptr_t size = old_obj->Size();
if (old_obj->IsMarked()) {
- // Assert the current free page has enough space. This we hold because we
- // grabbed space for the whole block up front.
- intptr_t free_remaining = free_end_ - free_current_;
- ASSERT(free_remaining >= size);
-
- uword new_addr = free_current_;
- free_current_ += size;
+ uword new_addr = forwarding_block->Lookup(old_addr);
RawObject* new_obj = RawObject::FromAddr(new_addr);
- ASSERT(forwarding_page->Lookup(old_addr) == new_addr);
-
// Fast path for no movement. There's often a large block of objects at
// the beginning that don't move.
if (new_addr != old_addr) {
@@ -257,12 +473,15 @@
reinterpret_cast<void*>(old_addr), size);
}
new_obj->ClearMarkBit();
- } else {
- if (has_class) {
- // Add to free list; note we're not bothering to coalesce here.
- freelist_->FreeLocked(old_addr, size);
- free_current_ += size;
- }
+ new_obj->VisitPointers(compactor_);
+
+ ASSERT(free_current_ == new_addr);
+ free_current_ += size;
+ } else if (forwarding_block->IsLive(old_addr)) {
+ // Gap we're keeping to prevent class movement.
+ ASSERT(free_current_ == old_addr);
+ freelist_->Free(old_addr, size);
+ free_current_ += size;
}
old_addr += size;
}
@@ -270,19 +489,16 @@
return old_addr; // First object in the next block.
}
-void GCCompactor::MoveToExactAddress(uword addr) {
- // Skip space to ensure class objects do not move. Computing the size
- // of larger objects requires consulting their class, whose old body
- // might be overwritten during the sliding.
- // TODO(rmacnak): Keep class sizes off heap or class objects in
- // non-moving pages.
+void CompactorTask::SlideFreeUpTo(uword addr) {
+ if (free_current_ == addr) return;
// Skip pages until class's page.
+ ASSERT(free_page_ != NULL);
while (!free_page_->Contains(addr)) {
intptr_t free_remaining = free_end_ - free_current_;
if (free_remaining != 0) {
// Note we aren't bothering to check for a whole page to release.
- freelist_->FreeLocked(free_current_, free_remaining);
+ freelist_->Free(free_current_, free_remaining);
}
// And advance to the next free page.
free_page_ = free_page_->next();
@@ -290,12 +506,11 @@
free_current_ = free_page_->object_start();
free_end_ = free_page_->object_end();
}
- ASSERT(free_page_ != NULL);
// Skip within page until class's address.
intptr_t free_skip = addr - free_current_;
if (free_skip != 0) {
- freelist_->FreeLocked(free_current_, free_skip);
+ freelist_->Free(free_current_, free_skip);
free_current_ += free_skip;
}
@@ -303,17 +518,35 @@
ASSERT(free_current_ == addr);
}
-void GCCompactor::MoveToContiguousSize(intptr_t size) {
+void CompactorTask::PlanMoveToExactAddress(uword addr) {
+ // Skip space to ensure class objects do not move. Computing the size
+ // of larger objects requires consulting their class, whose old body
+ // might be overwritten during the sliding.
+ // TODO(rmacnak): Keep class sizes off heap or class objects in
+ // non-moving pages.
+
+ // Skip pages until class's page.
+ ASSERT(free_page_ != NULL);
+ while (!free_page_->Contains(addr)) {
+ // And advance to the next free page.
+ free_page_ = free_page_->next();
+ ASSERT(free_page_ != NULL);
+ free_current_ = free_page_->object_start();
+ free_end_ = free_page_->object_end();
+ }
+
+ // Skip within page until class's address.
+ free_current_ = addr;
+}
+
+void CompactorTask::PlanMoveToContiguousSize(intptr_t size) {
// Move the free cursor to ensure 'size' bytes of contiguous space.
ASSERT(size <= kPageSize);
// Check if the current free page has enough space.
intptr_t free_remaining = free_end_ - free_current_;
if (free_remaining < size) {
- if (free_remaining != 0) {
- freelist_->FreeLocked(free_current_, free_remaining);
- }
- // And advance to the next free page.
+ // Not enough; advance to the next free page.
free_page_ = free_page_->next();
ASSERT(free_page_ != NULL);
free_current_ = free_page_->object_start();
@@ -323,48 +556,7 @@
}
}
-DART_FORCE_INLINE
-void GCCompactor::ForwardPointerForSliding(RawObject** ptr) {
- RawObject* old_target = *ptr;
- if (old_target->IsSmiOrNewObject()) {
- return; // Not moved.
- }
-
- uword old_addr = RawObject::ToAddr(old_target);
- for (intptr_t i = 0; i < kMaxImagePages; i++) {
- if ((old_addr - image_page_ranges_[i].base) < image_page_ranges_[i].size) {
- return; // Not moved (unaligned image page).
- }
- }
-
- HeapPage* page = HeapPage::Of(old_target);
- ForwardingPage* forwarding_page = page->forwarding_page();
- if (forwarding_page == NULL) {
- return; // Not moved (VM isolate, large page, code page).
- }
-
- RawObject* new_target =
- RawObject::FromAddr(forwarding_page->Lookup(old_addr));
- *ptr = new_target;
-}
-
-void GCCompactor::VisitPointers(RawObject** first, RawObject** last) {
- for (RawObject** ptr = first; ptr <= last; ptr++) {
- ForwardPointerForSliding(ptr);
- }
-}
-
-void GCCompactor::VisitHandle(uword addr) {
- FinalizablePersistentHandle* handle =
- reinterpret_cast<FinalizablePersistentHandle*>(addr);
- ForwardPointerForSliding(handle->raw_addr());
-}
-
-void GCCompactor::ForwardPointersForSliding() {
- // N.B.: This pointer visitor is not idempotent. We must take care to visit
- // each pointer exactly once.
-
- // Collect image page boundaries.
+void GCCompactor::SetupImagePageBoundaries() {
for (intptr_t i = 0; i < kMaxImagePages; i++) {
image_page_ranges_[i].base = 0;
image_page_ranges_[i].size = 0;
@@ -388,30 +580,52 @@
image_page = image_page->next();
next_offset++;
}
+}
- // Heap pointers.
- // N.B.: We forward the heap before forwarding the stack. This limits the
- // amount of following of forwarding pointers needed to get at stack maps.
- heap_->VisitObjectPointers(this);
-
- // C++ pointers.
- isolate()->VisitObjectPointers(this, StackFrameIterator::kDontValidateFrames);
-#ifndef PRODUCT
- if (FLAG_support_service) {
- ObjectIdRing* ring = isolate()->object_id_ring();
- ASSERT(ring != NULL);
- ring->VisitPointers(this);
+DART_FORCE_INLINE
+void GCCompactor::ForwardPointer(RawObject** ptr) {
+ RawObject* old_target = *ptr;
+ if (old_target->IsSmiOrNewObject()) {
+ return; // Not moved.
}
-#endif // !PRODUCT
- // Weak persistent handles.
- isolate()->VisitWeakPersistentHandles(this);
+ uword old_addr = RawObject::ToAddr(old_target);
+ for (intptr_t i = 0; i < kMaxImagePages; i++) {
+ if ((old_addr - image_page_ranges_[i].base) < image_page_ranges_[i].size) {
+ return; // Not moved (unaligned image page).
+ }
+ }
- // Remembered set.
- isolate()->store_buffer()->VisitObjectPointers(this);
+ HeapPage* page = HeapPage::Of(old_target);
+ ForwardingPage* forwarding_page = page->forwarding_page();
+ if (forwarding_page == NULL) {
+ return; // Not moved (VM isolate, large page, code page).
+ }
- // Weak tables.
- heap_->ForwardWeakTables(this);
+ RawObject* new_target =
+ RawObject::FromAddr(forwarding_page->Lookup(old_addr));
+ *ptr = new_target;
+}
+
+// N.B.: This pointer visitor is not idempotent. We must take care to visit
+// each pointer exactly once.
+void GCCompactor::VisitPointers(RawObject** first, RawObject** last) {
+ for (RawObject** ptr = first; ptr <= last; ptr++) {
+ ForwardPointer(ptr);
+ }
+}
+
+void GCCompactor::VisitHandle(uword addr) {
+ FinalizablePersistentHandle* handle =
+ reinterpret_cast<FinalizablePersistentHandle*>(addr);
+ ForwardPointer(handle->raw_addr());
+}
+
+void GCCompactor::ForwardStackPointers() {
+ // N.B.: Heap pointers have already been forwarded. We forward the heap before
+ // forwarding the stack to limit the number of places that need to be aware of
+ // forwarding when reading stack maps.
+ isolate()->VisitObjectPointers(this, StackFrameIterator::kDontValidateFrames);
}
} // namespace dart
diff --git a/runtime/vm/gc_compactor.h b/runtime/vm/gc_compactor.h
index ef2a6b0..6fe1f1c 100644
--- a/runtime/vm/gc_compactor.h
+++ b/runtime/vm/gc_compactor.h
@@ -20,8 +20,8 @@
// Implements a sliding compactor.
class GCCompactor : public ValueObject,
- private HandleVisitor,
- private ObjectPointerVisitor {
+ public HandleVisitor,
+ public ObjectPointerVisitor {
public:
GCCompactor(Thread* thread, Heap* heap)
: HandleVisitor(thread),
@@ -29,26 +29,17 @@
heap_(heap) {}
~GCCompactor() {}
- void CompactBySliding(HeapPage* pages, FreeList* freelist, Mutex* mutex);
+ void Compact(HeapPage* pages, FreeList* freelist, Mutex* mutex);
private:
- void SlidePage(HeapPage* page);
- uword SlideBlock(uword first_object, ForwardingPage* forwarding_page);
- void MoveToExactAddress(uword addr);
- void MoveToContiguousSize(intptr_t size);
-
- void ForwardPointersForSliding();
- void ForwardPointerForSliding(RawObject** ptr);
+ void SetupImagePageBoundaries();
+ void ForwardStackPointers();
+ void ForwardPointer(RawObject** ptr);
void VisitPointers(RawObject** first, RawObject** last);
void VisitHandle(uword addr);
Heap* heap_;
- HeapPage* free_page_;
- uword free_current_;
- uword free_end_;
- FreeList* freelist_;
-
struct ImagePageRange {
uword base;
uword size;
diff --git a/runtime/vm/kernel_binary.h b/runtime/vm/kernel_binary.h
index edc7192..6a1d898 100644
--- a/runtime/vm/kernel_binary.h
+++ b/runtime/vm/kernel_binary.h
@@ -19,7 +19,7 @@
// Keep in sync with package:kernel/lib/binary/tag.dart.
static const uint32_t kMagicProgramFile = 0x90ABCDEFu;
-static const uint32_t kBinaryFormatVersion = 2;
+static const uint32_t kBinaryFormatVersion = 3;
// Keep in sync with package:kernel/lib/binary/tag.dart
enum Tag {
@@ -79,6 +79,7 @@
kAwaitExpression = 51,
kFunctionExpression = 52,
kLet = 53,
+ kInstantiation = 54,
kPositiveIntLiteral = 55,
kNegativeIntLiteral = 56,
diff --git a/runtime/vm/kernel_loader.cc b/runtime/vm/kernel_loader.cc
index 6f453cd..50fa689 100644
--- a/runtime/vm/kernel_loader.cc
+++ b/runtime/vm/kernel_loader.cc
@@ -1334,9 +1334,10 @@
functions_.Add(&getter);
getter.set_end_token_pos(field_helper->end_position_);
getter.set_kernel_offset(field.kernel_offset());
- getter.set_result_type(AbstractType::Handle(Z, field.type()));
+ const AbstractType& field_type = AbstractType::Handle(Z, field.type());
+ getter.set_result_type(field_type);
getter.set_is_debuggable(false);
- SetupFieldAccessorFunction(klass, getter);
+ SetupFieldAccessorFunction(klass, getter, field_type);
if (!field_helper->IsStatic() && !field_helper->IsFinal()) {
// Only static fields can be const.
@@ -1355,12 +1356,13 @@
setter.set_kernel_offset(field.kernel_offset());
setter.set_result_type(Object::void_type());
setter.set_is_debuggable(false);
- SetupFieldAccessorFunction(klass, setter);
+ SetupFieldAccessorFunction(klass, setter, field_type);
}
}
void KernelLoader::SetupFieldAccessorFunction(const Class& klass,
- const Function& function) {
+ const Function& function,
+ const AbstractType& field_type) {
bool is_setter = function.IsImplicitSetterFunction();
bool is_method = !function.IsStaticFunction();
intptr_t parameter_count = (is_method ? 1 : 0) + (is_setter ? 1 : 0);
@@ -1379,7 +1381,7 @@
pos++;
}
if (is_setter) {
- function.SetParameterTypeAt(pos, AbstractType::dynamic_type());
+ function.SetParameterTypeAt(pos, field_type);
function.SetParameterNameAt(pos, Symbols::Value());
pos++;
}
diff --git a/runtime/vm/kernel_loader.h b/runtime/vm/kernel_loader.h
index 7758a58..d49b2d9 100644
--- a/runtime/vm/kernel_loader.h
+++ b/runtime/vm/kernel_loader.h
@@ -219,7 +219,9 @@
const Field& field,
FieldHelper* field_helper);
- void SetupFieldAccessorFunction(const Class& klass, const Function& function);
+ void SetupFieldAccessorFunction(const Class& klass,
+ const Function& function,
+ const AbstractType& field_type);
void LoadLibraryImportsAndExports(Library* library);
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index 863fd5c..6a3d0f6 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -18590,6 +18590,8 @@
int64_t value = 0;
const char* cstr = str.ToCString();
if (!OS::StringToInt64(cstr, &value)) {
+ // TODO(T31600): Remove overflow checking code when 64-bit ints semantics
+ // are only supported through the Kernel FE.
if (FLAG_limit_ints_to_64_bits) {
if (strcmp(cstr, kMaxInt64Plus1) == 0) {
// Allow MAX_INT64 + 1 integer literal as it can be used as an argument
@@ -18615,6 +18617,8 @@
int64_t value = 0;
const char* cstr = str.ToCString();
if (!OS::StringToInt64(cstr, &value)) {
+ // TODO(T31600): Remove overflow checking code when 64-bit ints semantics
+ // are only supported through the Kernel FE.
if (FLAG_limit_ints_to_64_bits) {
if (strcmp(cstr, kMaxInt64Plus1) == 0) {
// Allow MAX_INT64 + 1 integer literal as it can be used as an argument
diff --git a/runtime/vm/object_test.cc b/runtime/vm/object_test.cc
index 2629ac8..056a349 100644
--- a/runtime/vm/object_test.cc
+++ b/runtime/vm/object_test.cc
@@ -2544,9 +2544,9 @@
int next_frame_index = parent_scope->AllocateVariables(
first_parameter_index, num_parameters, first_frame_index, NULL,
&found_captured_vars);
- // Variables a and c are captured, therefore are not allocated in frame.
- // Variable var_ta, although captured, still requires a slot in frame.
- EXPECT_EQ(-1, next_frame_index - first_frame_index); // Indices in frame < 0.
+ // Variables a, c and var_ta are captured, therefore are not allocated in
+ // frame.
+ EXPECT_EQ(0, next_frame_index - first_frame_index); // Indices in frame < 0.
const intptr_t parent_scope_context_level = 1;
EXPECT_EQ(parent_scope_context_level, parent_scope->context_level());
EXPECT(found_captured_vars);
diff --git a/runtime/vm/pages.cc b/runtime/vm/pages.cc
index 07d95b9..1587348 100644
--- a/runtime/vm/pages.cc
+++ b/runtime/vm/pages.cc
@@ -113,7 +113,8 @@
}
void HeapPage::VisitObjectPointers(ObjectPointerVisitor* visitor) const {
- ASSERT(Thread::Current()->IsAtSafepoint());
+ ASSERT(Thread::Current()->IsAtSafepoint() ||
+ (Thread::Current()->task_kind() == Thread::kCompactorTask));
NoSafepointScope no_safepoint;
uword obj_addr = object_start();
uword end_addr = object_end();
@@ -248,11 +249,11 @@
if (exec_pages_ == NULL) {
exec_pages_ = page;
} else {
- if (FLAG_write_protect_code && !exec_pages_tail_->is_image_page()) {
+ if (FLAG_write_protect_code) {
exec_pages_tail_->WriteProtect(false);
}
exec_pages_tail_->set_next(page);
- if (FLAG_write_protect_code && !exec_pages_tail_->is_image_page()) {
+ if (FLAG_write_protect_code) {
exec_pages_tail_->WriteProtect(true);
}
}
@@ -826,14 +827,12 @@
HeapPage* page = exec_pages_;
while (page != NULL) {
ASSERT(page->type() == HeapPage::kExecutable);
- if (!page->is_image_page()) {
- page->WriteProtect(read_only);
- }
+ page->WriteProtect(read_only);
page = page->next();
}
page = large_pages_;
while (page != NULL) {
- if (page->type() == HeapPage::kExecutable && !page->is_image_page()) {
+ if (page->type() == HeapPage::kExecutable) {
page->WriteProtect(read_only);
}
page = page->next();
@@ -985,14 +984,14 @@
}
mid3 = OS::GetCurrentMonotonicMicros();
+ }
- if (compact) {
- Compact(thread);
- } else if (FLAG_concurrent_sweep) {
- ConcurrentSweep(isolate);
- } else {
- BlockingSweep();
- }
+ if (compact) {
+ Compact(thread);
+ } else if (FLAG_concurrent_sweep) {
+ ConcurrentSweep(isolate);
+ } else {
+ BlockingSweep();
}
// Make code pages read-only.
@@ -1051,6 +1050,9 @@
}
void PageSpace::BlockingSweep() {
+ MutexLocker mld(freelist_[HeapPage::kData].mutex());
+ MutexLocker mle(freelist_[HeapPage::kExecutable].mutex());
+
// Sweep all regular sized pages now.
GCSweeper sweeper;
HeapPage* prev_page = NULL;
@@ -1083,7 +1085,7 @@
void PageSpace::Compact(Thread* thread) {
thread->isolate()->set_compaction_in_progress(true);
GCCompactor compactor(thread, heap_);
- compactor.CompactBySliding(pages_, &freelist_[HeapPage::kData], pages_lock_);
+ compactor.Compact(pages_, &freelist_[HeapPage::kData], pages_lock_);
thread->isolate()->set_compaction_in_progress(false);
if (FLAG_verify_after_gc) {
diff --git a/runtime/vm/pages.h b/runtime/vm/pages.h
index 1702aca..6ff35c8 100644
--- a/runtime/vm/pages.h
+++ b/runtime/vm/pages.h
@@ -457,6 +457,7 @@
friend class PageSpaceController;
friend class SweeperTask;
friend class GCCompactor;
+ friend class CompactorTask;
DISALLOW_IMPLICIT_CONSTRUCTORS(PageSpace);
};
diff --git a/runtime/vm/parser.cc b/runtime/vm/parser.cc
index a476faa..fe0b255 100644
--- a/runtime/vm/parser.cc
+++ b/runtime/vm/parser.cc
@@ -13,6 +13,7 @@
#include "vm/bootstrap.h"
#include "vm/class_finalizer.h"
#include "vm/compiler/aot/precompiler.h"
+#include "vm/compiler/backend/il_printer.h"
#include "vm/compiler/frontend/kernel_binary_flowgraph.h"
#include "vm/compiler/jit/compiler.h"
#include "vm/compiler_stats.h"
@@ -167,6 +168,52 @@
return a.raw();
}
+ParsedFunction::ParsedFunction(Thread* thread, const Function& function)
+ : thread_(thread),
+ function_(function),
+ code_(Code::Handle(zone(), function.unoptimized_code())),
+ node_sequence_(NULL),
+ regexp_compile_data_(NULL),
+ instantiator_(NULL),
+ function_type_arguments_(NULL),
+ parent_type_arguments_(NULL),
+ current_context_var_(NULL),
+ arg_desc_var_(NULL),
+ expression_temp_var_(NULL),
+ finally_return_temp_var_(NULL),
+ deferred_prefixes_(new ZoneGrowableArray<const LibraryPrefix*>()),
+ guarded_fields_(new ZoneGrowableArray<const Field*>()),
+ default_parameter_values_(NULL),
+ raw_type_arguments_var_(NULL),
+ first_parameter_index_(0),
+ num_stack_locals_(0),
+ have_seen_await_expr_(false),
+ kernel_scopes_(NULL) {
+ ASSERT(function.IsZoneHandle());
+ // Every function has a local variable for the current context.
+ LocalVariable* temp = new (zone())
+ LocalVariable(function.token_pos(), function.token_pos(),
+ Symbols::CurrentContextVar(), Object::dynamic_type());
+ current_context_var_ = temp;
+
+ const bool reify_generic_argument =
+ function.IsGeneric() && Isolate::Current()->reify_generic_functions();
+
+ const bool load_optional_arguments = function.HasOptionalParameters();
+
+ const bool check_arguments =
+ (function_.IsClosureFunction() || function_.IsConvertedClosureFunction());
+
+ const bool need_argument_descriptor =
+ load_optional_arguments || check_arguments || reify_generic_argument;
+
+ if (need_argument_descriptor) {
+ arg_desc_var_ = new (zone())
+ LocalVariable(TokenPosition::kNoSource, TokenPosition::kNoSource,
+ Symbols::ArgDescVar(), Object::dynamic_type());
+ }
+}
+
void ParsedFunction::AddToGuardedFields(const Field* field) const {
if ((field->guarded_cid() == kDynamicCid) ||
(field->guarded_cid() == kIllegalCid)) {
@@ -274,32 +321,97 @@
const intptr_t num_fixed_params = function().num_fixed_parameters();
const intptr_t num_opt_params = function().NumOptionalParameters();
const intptr_t num_params = num_fixed_params + num_opt_params;
- // Compute start indices to parameters and locals, and the number of
- // parameters to copy.
- if (num_opt_params == 0) {
- // Parameter i will be at fp[kParamEndSlotFromFp + num_params - i] and
- // local variable j will be at fp[kFirstLocalSlotFromFp - j].
- first_parameter_index_ = kParamEndSlotFromFp + num_params;
- first_stack_local_index_ = kFirstLocalSlotFromFp;
- num_copied_params_ = 0;
- } else {
- // Parameter i will be at fp[kFirstLocalSlotFromFp - i] and local variable
- // j will be at fp[kFirstLocalSlotFromFp - num_params - j].
- first_parameter_index_ = kFirstLocalSlotFromFp;
- first_stack_local_index_ = first_parameter_index_ - num_params;
- num_copied_params_ = num_params;
+
+ // Before we start allocating frame indices to variables, we'll setup the
+ // parameters array, which can be used to access the raw parameters (i.e. not
+ // the potentially variables which are in the context)
+
+ for (intptr_t param = 0; param < function().NumParameters(); ++param) {
+ LocalVariable* raw_parameter = scope->VariableAt(param);
+ if (raw_parameter->is_captured()) {
+ String& tmp = String::ZoneHandle(Z);
+ tmp = Symbols::FromConcat(T, Symbols::OriginalParam(),
+ raw_parameter->name());
+
+ RELEASE_ASSERT(scope->LocalLookupVariable(tmp) == NULL);
+ raw_parameter = new LocalVariable(raw_parameter->declaration_token_pos(),
+ raw_parameter->token_pos(), tmp,
+ raw_parameter->type());
+ if (function().HasOptionalParameters()) {
+ bool ok = scope->AddVariable(raw_parameter);
+ ASSERT(ok);
+
+ // Currently our optimizer cannot prove liveness of variables properly
+ // when a function has try/catch. It therefore makes the conservative
+ // estimate that all [LocalVariable]s in the frame are live and spills
+ // them before call sites (in some shape or form).
+ //
+ // Since we are guaranteed to not need that, we tell the try/catch
+ // spilling mechanism not to care about this variable.
+ raw_parameter->set_is_captured_parameter(true);
+
+ } else {
+ raw_parameter->set_index(kParamEndSlotFromFp +
+ function().NumParameters() - param);
+ }
+ }
+ raw_parameters_.Add(raw_parameter);
+ }
+ if (function_type_arguments_ != NULL) {
+ LocalVariable* raw_type_args_parameter = function_type_arguments_;
+ if (function_type_arguments_->is_captured()) {
+ String& tmp = String::ZoneHandle(Z);
+ tmp = Symbols::FromConcat(T, Symbols::OriginalParam(),
+ function_type_arguments_->name());
+
+ ASSERT(scope->LocalLookupVariable(tmp) == NULL);
+ raw_type_args_parameter =
+ new LocalVariable(raw_type_args_parameter->declaration_token_pos(),
+ raw_type_args_parameter->token_pos(), tmp,
+ raw_type_args_parameter->type());
+ bool ok = scope->AddVariable(raw_type_args_parameter);
+ ASSERT(ok);
+ }
+ raw_type_arguments_var_ = raw_type_args_parameter;
+ }
+
+ // The copy parameters implementation will still write to local variables
+ // which we assign indices as with the old CopyParams implementation.
+ intptr_t parameter_frame_index_start;
+ intptr_t reamining_local_variables_start;
+ {
+ // Compute start indices to parameters and locals, and the number of
+ // parameters to copy.
+ if (num_opt_params == 0) {
+ // Parameter i will be at fp[kParamEndSlotFromFp + num_params - i] and
+ // local variable j will be at fp[kFirstLocalSlotFromFp - j].
+ parameter_frame_index_start = first_parameter_index_ =
+ kParamEndSlotFromFp + num_params;
+ reamining_local_variables_start = kFirstLocalSlotFromFp;
+ } else {
+ // Parameter i will be at fp[kFirstLocalSlotFromFp - i] and local variable
+ // j will be at fp[kFirstLocalSlotFromFp - num_params - j].
+ parameter_frame_index_start = first_parameter_index_ =
+ kFirstLocalSlotFromFp;
+ reamining_local_variables_start = first_parameter_index_ - num_params;
+ }
+ }
+
+ if (function_type_arguments_ != NULL && num_opt_params > 0) {
+ reamining_local_variables_start--;
}
// Allocate parameters and local variables, either in the local frame or
// in the context(s).
bool found_captured_variables = false;
int next_free_frame_index = scope->AllocateVariables(
- first_parameter_index_, num_params, first_stack_local_index_, NULL,
- &found_captured_variables);
+ parameter_frame_index_start, num_params,
+ parameter_frame_index_start > 0 ? kFirstLocalSlotFromFp
+ : kFirstLocalSlotFromFp - num_params,
+ NULL, &found_captured_variables);
// Frame indices are relative to the frame pointer and are decreasing.
- ASSERT(next_free_frame_index <= first_stack_local_index_);
- num_stack_locals_ = first_stack_local_index_ - next_free_frame_index;
+ num_stack_locals_ = -(next_free_frame_index - kFirstLocalSlotFromFp);
}
struct CatchParamDesc {
@@ -324,8 +436,6 @@
// Parameter i will be at fp[kParamEndSlotFromFp + num_params - i] and
// local variable j will be at fp[kFirstLocalSlotFromFp - j].
first_parameter_index_ = kParamEndSlotFromFp + num_params;
- first_stack_local_index_ = kFirstLocalSlotFromFp;
- num_copied_params_ = 0;
// Frame indices are relative to the frame pointer and are decreasing.
num_stack_locals_ = num_stack_locals;
@@ -1063,6 +1173,7 @@
}
#endif // !PRODUCT
SequenceNode* node_sequence = NULL;
+
switch (func.kind()) {
case RawFunction::kImplicitClosureFunction:
node_sequence = parser.ParseImplicitClosure(func);
@@ -1454,6 +1565,11 @@
OpenFunctionBlock(func);
+ if (parsed_function_->has_arg_desc_var() && FunctionLevel() == 0) {
+ EnsureExpressionTemp();
+ current_block_->scope->AddVariable(parsed_function_->arg_desc_var());
+ }
+
const Function& parent = Function::Handle(func.parent_function());
intptr_t type_args_len = 0; // Length of type args vector passed to parent.
LocalVariable* type_args_var = NULL;
@@ -1674,6 +1790,11 @@
ASSERT(FunctionLevel() == 0);
parsed_function_->set_function_type_arguments(type_args_var);
}
+
+ if (parsed_function_->has_arg_desc_var() && FunctionLevel() == 0) {
+ EnsureExpressionTemp();
+ current_block_->scope->AddVariable(parsed_function_->arg_desc_var());
+ }
}
SequenceNode* Parser::ParseNoSuchMethodDispatcher(const Function& func) {
@@ -3249,6 +3370,12 @@
}
OpenFunctionBlock(func);
+
+ if (parsed_function_->has_arg_desc_var() && FunctionLevel() == 0) {
+ EnsureExpressionTemp();
+ current_block_->scope->AddVariable(parsed_function_->arg_desc_var());
+ }
+
ParamList params;
ASSERT(CurrentToken() == Token::kLPAREN);
@@ -3421,6 +3548,11 @@
ASSERT(!func.IsGenerativeConstructor());
OpenFunctionBlock(func); // Build local scope for function.
+ if (parsed_function_->has_arg_desc_var() && FunctionLevel() == 0) {
+ EnsureExpressionTemp();
+ current_block_->scope->AddVariable(parsed_function_->arg_desc_var());
+ }
+
if (Isolate::Current()->reify_generic_functions()) {
// Lookup function type arguments variable in parent function scope, if any.
if (func.HasGenericParent()) {
@@ -6342,7 +6474,8 @@
// libraries, including indirectly through exports.
const String& lib_url = String::Handle(Z, library_.url());
if (canon_url.StartsWith(Symbols::DartSchemePrivate()) &&
- !lib_url.StartsWith(Symbols::DartScheme())) {
+ !lib_url.StartsWith(Symbols::DartScheme()) &&
+ !lib_url.StartsWith(Symbols::DartInternalPackage())) {
ReportError(import_pos, "private library is not accessible");
}
diff --git a/runtime/vm/parser.h b/runtime/vm/parser.h
index 14333fb..ad9283e 100644
--- a/runtime/vm/parser.h
+++ b/runtime/vm/parser.h
@@ -89,35 +89,7 @@
// The class ParsedFunction holds the result of parsing a function.
class ParsedFunction : public ZoneAllocated {
public:
- ParsedFunction(Thread* thread, const Function& function)
- : thread_(thread),
- function_(function),
- code_(Code::Handle(zone(), function.unoptimized_code())),
- node_sequence_(NULL),
- regexp_compile_data_(NULL),
- instantiator_(NULL),
- function_type_arguments_(NULL),
- parent_type_arguments_(NULL),
- current_context_var_(NULL),
- expression_temp_var_(NULL),
- finally_return_temp_var_(NULL),
- deferred_prefixes_(new ZoneGrowableArray<const LibraryPrefix*>()),
- guarded_fields_(new ZoneGrowableArray<const Field*>()),
- default_parameter_values_(NULL),
- first_parameter_index_(0),
- first_stack_local_index_(0),
- num_copied_params_(0),
- num_stack_locals_(0),
- have_seen_await_expr_(false),
- kernel_scopes_(NULL) {
- ASSERT(function.IsZoneHandle());
- // Every function has a local variable for the current context.
- LocalVariable* temp = new (zone())
- LocalVariable(function.token_pos(), function.token_pos(),
- Symbols::CurrentContextVar(), Object::dynamic_type());
- ASSERT(temp != NULL);
- current_context_var_ = temp;
- }
+ ParsedFunction(Thread* thread, const Function& function);
const Function& function() const { return function_; }
const Code& code() const { return code_; }
@@ -172,6 +144,9 @@
LocalVariable* current_context_var() const { return current_context_var_; }
+ bool has_arg_desc_var() const { return arg_desc_var_ != NULL; }
+ LocalVariable* arg_desc_var() const { return arg_desc_var_; }
+
LocalVariable* expression_temp_var() const {
ASSERT(has_expression_temp_var());
return expression_temp_var_;
@@ -208,12 +183,7 @@
}
int first_parameter_index() const { return first_parameter_index_; }
- int first_stack_local_index() const { return first_stack_local_index_; }
- int num_copied_params() const { return num_copied_params_; }
int num_stack_locals() const { return num_stack_locals_; }
- int num_non_copied_params() const {
- return (num_copied_params_ == 0) ? function().num_fixed_parameters() : 0;
- }
void AllocateVariables();
void AllocateIrregexpVariables(intptr_t num_stack_locals);
@@ -233,6 +203,14 @@
kernel::ScopeBuildingResult* EnsureKernelScopes();
+ LocalVariable* RawTypeArgumentsVariable() const {
+ return raw_type_arguments_var_;
+ }
+
+ LocalVariable* RawParameterVariable(intptr_t i) const {
+ return raw_parameters_[i];
+ }
+
private:
Thread* thread_;
const Function& function_;
@@ -243,15 +221,17 @@
LocalVariable* function_type_arguments_;
LocalVariable* parent_type_arguments_;
LocalVariable* current_context_var_;
+ LocalVariable* arg_desc_var_;
LocalVariable* expression_temp_var_;
LocalVariable* finally_return_temp_var_;
ZoneGrowableArray<const LibraryPrefix*>* deferred_prefixes_;
ZoneGrowableArray<const Field*>* guarded_fields_;
ZoneGrowableArray<const Instance*>* default_parameter_values_;
+ LocalVariable* raw_type_arguments_var_;
+ ZoneGrowableArray<LocalVariable*> raw_parameters_;
+
int first_parameter_index_;
- int first_stack_local_index_;
- int num_copied_params_;
int num_stack_locals_;
bool have_seen_await_expr_;
diff --git a/runtime/vm/parser_test.cc b/runtime/vm/parser_test.cc
index 057c38b..02c0854 100644
--- a/runtime/vm/parser_test.cc
+++ b/runtime/vm/parser_test.cc
@@ -261,21 +261,21 @@
EXPECT_STREQ(
// function f uses one ctx var at (0); doesn't save ctx.
"main.f\n"
- " 0 ContextLevel level=0 begin=0 end=12\n"
+ " 0 ContextLevel level=0 begin=0 end=56\n"
" 1 ContextVar level=0 begin=14 end=28 name=value\n"
" 2 StackVar scope=1 begin=16 end=28 name=param\n"
" 3 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
// Closure call saves current context.
"_Closure.call\n"
- " 0 ContextLevel level=0 begin=0 end=8\n"
+ " 0 ContextLevel level=0 begin=0 end=12\n"
" 1 StackVar scope=1 begin=-1 end=0 name=this\n"
" 2 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
// function main uses one ctx var at (1); saves caller ctx.
"main\n"
- " 0 ContextLevel level=0 begin=0 end=6\n"
- " 1 ContextLevel level=1 begin=8 end=16\n"
+ " 0 ContextLevel level=0 begin=0 end=10\n"
+ " 1 ContextLevel level=1 begin=12 end=20\n"
" 2 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
" 3 ContextVar level=1 begin=10 end=38 name=value\n"
" 4 StackVar scope=2 begin=12 end=38 name=f\n",
@@ -302,28 +302,28 @@
// Innermost function uses captured variable 'value' from middle
// function.
"a.b.c\n"
- " 0 ContextLevel level=0 begin=0 end=10\n"
+ " 0 ContextLevel level=0 begin=0 end=54\n"
" 1 ContextVar level=0 begin=20 end=30 name=value\n"
" 2 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
// Closure call saves current context.
"_Closure.call\n"
- " 0 ContextLevel level=0 begin=0 end=8\n"
+ " 0 ContextLevel level=0 begin=0 end=12\n"
" 1 StackVar scope=1 begin=-1 end=0 name=this\n"
" 2 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
// Middle function saves the entry context. Notice that this
// happens here and not in the outermost function. We always
// save the entry context at the last possible moment.
"a.b\n"
- " 0 ContextLevel level=0 begin=0 end=6\n"
- " 1 ContextLevel level=1 begin=8 end=16\n"
+ " 0 ContextLevel level=0 begin=0 end=50\n"
+ " 1 ContextLevel level=1 begin=52 end=60\n"
" 2 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
" 3 ContextVar level=1 begin=16 end=38 name=value\n"
" 4 StackVar scope=2 begin=18 end=38 name=c\n"
// Closure call saves current context.
"_Closure.call\n"
- " 0 ContextLevel level=0 begin=0 end=8\n"
+ " 0 ContextLevel level=0 begin=0 end=12\n"
" 1 StackVar scope=1 begin=-1 end=0 name=this\n"
" 2 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
@@ -331,7 +331,7 @@
// don't save the entry context if the function has no captured
// variables.
"a\n"
- " 0 ContextLevel level=0 begin=0 end=14\n"
+ " 0 ContextLevel level=0 begin=0 end=18\n"
" 1 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
" 2 StackVar scope=2 begin=6 end=46 name=b\n",
vars);
@@ -361,14 +361,14 @@
EXPECT_STREQ(
// bb captures only value2 from aa. No others.
"a.b.aa.bb\n"
- " 0 ContextLevel level=0 begin=0 end=10\n"
+ " 0 ContextLevel level=0 begin=0 end=54\n"
" 1 ContextVar level=0 begin=35 end=46 name=value2\n"
" 2 CurrentCtx scope=0 begin=0 end=0"
" name=:current_context_var\n"
// Closure call saves current context.
"_Closure.call\n"
- " 0 ContextLevel level=0 begin=0 end=8\n"
+ " 0 ContextLevel level=0 begin=0 end=12\n"
" 1 StackVar scope=1 begin=-1 end=0 name=this\n"
" 2 CurrentCtx scope=0 begin=0 end=0"
" name=:current_context_var\n"
@@ -377,22 +377,22 @@
// of chaining from b. This keeps us from holding onto closures
// that we would never access.
"a.b.aa\n"
- " 0 ContextLevel level=0 begin=0 end=6\n"
- " 1 ContextLevel level=1 begin=8 end=16\n"
+ " 0 ContextLevel level=0 begin=0 end=50\n"
+ " 1 ContextLevel level=1 begin=52 end=60\n"
" 2 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
" 3 ContextVar level=1 begin=30 end=55 name=value2\n"
" 4 StackVar scope=2 begin=32 end=55 name=bb\n"
// Closure call saves current context.
"_Closure.call\n"
- " 0 ContextLevel level=0 begin=0 end=8\n"
+ " 0 ContextLevel level=0 begin=0 end=12\n"
" 1 StackVar scope=1 begin=-1 end=0 name=this\n"
" 2 CurrentCtx scope=0 begin=0 end=0"
" name=:current_context_var\n"
// b captures value1 from a.
"a.b\n"
- " 0 ContextLevel level=0 begin=0 end=16\n"
+ " 0 ContextLevel level=0 begin=0 end=60\n"
" 1 ContextVar level=0 begin=14 end=65 name=value1\n"
" 2 CurrentCtx scope=0 begin=0 end=0"
" name=:current_context_var\n"
@@ -400,15 +400,15 @@
// Closure call saves current context.
"_Closure.call\n"
- " 0 ContextLevel level=0 begin=0 end=8\n"
+ " 0 ContextLevel level=0 begin=0 end=12\n"
" 1 StackVar scope=1 begin=-1 end=0 name=this\n"
" 2 CurrentCtx scope=0 begin=0 end=0"
" name=:current_context_var\n"
// a shares value1, saves entry ctx.
"a\n"
- " 0 ContextLevel level=0 begin=0 end=6\n"
- " 1 ContextLevel level=1 begin=8 end=16\n"
+ " 0 ContextLevel level=0 begin=0 end=10\n"
+ " 1 ContextLevel level=1 begin=12 end=20\n"
" 2 CurrentCtx scope=0 begin=0 end=0"
" name=:current_context_var\n"
" 3 ContextVar level=1 begin=10 end=73 name=value1\n"
@@ -450,24 +450,24 @@
// This frame saves the entry context instead of chaining. Good.
"doIt.<anonymous closure>\n"
" 0 ContextLevel level=0 begin=0 end=0\n"
- " 1 ContextLevel level=1 begin=4 end=12\n"
+ " 1 ContextLevel level=1 begin=48 end=56\n"
" 2 ContextVar level=1 begin=44 end=67 name=y\n"
" 3 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
// Closure call saves current context.
"_Closure.call\n"
- " 0 ContextLevel level=0 begin=0 end=8\n"
+ " 0 ContextLevel level=0 begin=0 end=12\n"
" 1 StackVar scope=1 begin=-1 end=0 name=this\n"
" 2 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
"X.onX\n"
- " 0 ContextLevel level=0 begin=0 end=10\n"
+ " 0 ContextLevel level=0 begin=0 end=14\n"
" 1 StackVar scope=1 begin=-1 end=0 name=this\n"
" 2 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
// No context is saved here since no vars are captured.
"doIt\n"
- " 0 ContextLevel level=0 begin=0 end=18\n"
+ " 0 ContextLevel level=0 begin=0 end=22\n"
" 1 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
" 2 StackVar scope=2 begin=36 end=83 name=x\n",
vars);
@@ -496,22 +496,22 @@
EXPECT_STREQ(
// inner function captures variable value. That's fine.
"outer.inner\n"
- " 0 ContextLevel level=0 begin=0 end=10\n"
+ " 0 ContextLevel level=0 begin=0 end=54\n"
" 1 ContextVar level=0 begin=34 end=44 name=value\n"
" 2 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
// Closure call saves current context.
"_Closure.call\n"
- " 0 ContextLevel level=0 begin=0 end=8\n"
+ " 0 ContextLevel level=0 begin=0 end=12\n"
" 1 StackVar scope=1 begin=-1 end=0 name=this\n"
" 2 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
// The outer function saves the entry context, even though the
// captured variable is in a loop. Good.
"outer\n"
- " 0 ContextLevel level=0 begin=0 end=8\n"
- " 1 ContextLevel level=1 begin=10 end=18\n"
- " 2 ContextLevel level=0 begin=20 end=34\n"
+ " 0 ContextLevel level=0 begin=0 end=12\n"
+ " 1 ContextLevel level=1 begin=14 end=22\n"
+ " 2 ContextLevel level=0 begin=24 end=38\n"
" 3 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
" 4 StackVar scope=3 begin=12 end=53 name=i\n"
" 5 ContextVar level=1 begin=29 end=53 name=value\n"
@@ -542,20 +542,20 @@
char* vars = CaptureVarsAtLine(lib, "a", 10);
EXPECT_STREQ(
"a.b.c\n"
- " 0 ContextLevel level=0 begin=0 end=12\n"
+ " 0 ContextLevel level=0 begin=0 end=56\n"
" 1 ContextVar level=0 begin=52 end=65 name=x\n"
" 2 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
"_Closure.call\n"
- " 0 ContextLevel level=0 begin=0 end=8\n"
+ " 0 ContextLevel level=0 begin=0 end=12\n"
" 1 StackVar scope=1 begin=-1 end=0 name=this\n"
" 2 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
// Doesn't save the entry context. Chains to parent instead.
"a.b\n"
- " 0 ContextLevel level=0 begin=0 end=6\n"
- " 1 ContextLevel level=1 begin=8 end=32\n"
- " 2 ContextLevel level=0 begin=34 end=40\n"
+ " 0 ContextLevel level=0 begin=0 end=50\n"
+ " 1 ContextLevel level=1 begin=52 end=76\n"
+ " 2 ContextLevel level=0 begin=78 end=84\n"
" 3 ContextVar level=0 begin=12 end=74 name=x\n"
" 4 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
" 5 StackVar scope=2 begin=49 end=74 name=c\n"
@@ -563,13 +563,13 @@
" 7 StackVar scope=4 begin=34 end=49 name=d\n"
"_Closure.call\n"
- " 0 ContextLevel level=0 begin=0 end=8\n"
+ " 0 ContextLevel level=0 begin=0 end=12\n"
" 1 StackVar scope=1 begin=-1 end=0 name=this\n"
" 2 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
"a\n"
- " 0 ContextLevel level=0 begin=0 end=6\n"
- " 1 ContextLevel level=1 begin=8 end=16\n"
+ " 0 ContextLevel level=0 begin=0 end=10\n"
+ " 1 ContextLevel level=1 begin=12 end=20\n"
" 2 CurrentCtx scope=0 begin=0 end=0 name=:current_context_var\n"
" 3 ContextVar level=1 begin=9 end=82 name=x\n"
" 4 StackVar scope=2 begin=11 end=82 name=b\n",
diff --git a/runtime/vm/raw_object.cc b/runtime/vm/raw_object.cc
index e0e03b0..e78d53a 100644
--- a/runtime/vm/raw_object.cc
+++ b/runtime/vm/raw_object.cc
@@ -528,11 +528,13 @@
intptr_t RawObjectPool::VisitObjectPoolPointers(RawObjectPool* raw_obj,
ObjectPointerVisitor* visitor) {
const intptr_t length = raw_obj->ptr()->length_;
+ RawObjectPool::Entry* entries = raw_obj->ptr()->data();
+ uint8_t* entry_types = raw_obj->ptr()->entry_types();
for (intptr_t i = 0; i < length; ++i) {
ObjectPool::EntryType entry_type =
- static_cast<ObjectPool::EntryType>(raw_obj->ptr()->entry_types()[i]);
+ static_cast<ObjectPool::EntryType>(entry_types[i]);
if (entry_type == ObjectPool::kTaggedObject) {
- visitor->VisitPointer(&raw_obj->ptr()->data()[i].raw_obj_);
+ visitor->VisitPointer(&entries[i].raw_obj_);
}
}
return ObjectPool::InstanceSize(length);
diff --git a/runtime/vm/raw_object.h b/runtime/vm/raw_object.h
index 9278da2..e2bcab8 100644
--- a/runtime/vm/raw_object.h
+++ b/runtime/vm/raw_object.h
@@ -671,7 +671,7 @@
friend class Serializer; // GetClassId
friend class Array;
friend class Become; // GetClassId
- friend class GCCompactor; // GetClassId
+ friend class CompactorTask; // GetClassId
friend class Bigint;
friend class ByteBuffer;
friend class CidRewriteVisitor;
diff --git a/runtime/vm/runtime_entry.cc b/runtime/vm/runtime_entry.cc
index 3a2a1d2..b1c853e 100644
--- a/runtime/vm/runtime_entry.cc
+++ b/runtime/vm/runtime_entry.cc
@@ -1603,6 +1603,7 @@
// name of the closurized function so that exception contains more
// relevant information.
const Function& function = Function::Handle(receiver.function());
+ ASSERT(!function.IsNull());
const String& original_function_name =
String::Handle(function.QualifiedUserVisibleName());
const Object& result = Object::Handle(DartEntry::InvokeNoSuchMethod(
diff --git a/runtime/vm/scavenger.cc b/runtime/vm/scavenger.cc
index b61c763..1a16fd4 100644
--- a/runtime/vm/scavenger.cc
+++ b/runtime/vm/scavenger.cc
@@ -802,7 +802,8 @@
void Scavenger::VisitObjectPointers(ObjectPointerVisitor* visitor) const {
ASSERT(Thread::Current()->IsAtSafepoint() ||
- (Thread::Current()->task_kind() == Thread::kMarkerTask));
+ (Thread::Current()->task_kind() == Thread::kMarkerTask) ||
+ (Thread::Current()->task_kind() == Thread::kCompactorTask));
FlushTLS();
uword cur = FirstObjectStart();
while (cur < top_) {
diff --git a/runtime/vm/scopes.cc b/runtime/vm/scopes.cc
index d0f72d6..4dbb6b6 100644
--- a/runtime/vm/scopes.cc
+++ b/runtime/vm/scopes.cc
@@ -222,17 +222,7 @@
if (variable->is_captured()) {
AllocateContextVariable(variable, &context_owner);
*found_captured_variables = true;
- if (variable->name().raw() ==
- Symbols::FunctionTypeArgumentsVar().raw()) {
- ASSERT(pos == num_parameters);
- // A captured type args variable has a slot allocated in the frame and
- // one in the context, where it gets copied to.
- frame_index--;
- }
} else {
- ASSERT((variable->name().raw() !=
- Symbols::FunctionTypeArgumentsVar().raw()) ||
- (pos == num_parameters));
variable->set_index(frame_index--);
}
}
@@ -447,6 +437,7 @@
void LocalScope::CaptureVariable(LocalVariable* variable) {
ASSERT(variable != NULL);
+
// The variable must exist in an enclosing scope, not necessarily in this one.
variable->set_is_captured();
const int variable_function_level = variable->owner()->function_level();
@@ -651,7 +642,8 @@
if (variable->is_forced_stack() ||
(variable->name().raw() == Symbols::StackTraceVar().raw()) ||
(variable->name().raw() == Symbols::ExceptionVar().raw()) ||
- (variable->name().raw() == Symbols::SavedTryContextVar().raw())) {
+ (variable->name().raw() == Symbols::SavedTryContextVar().raw()) ||
+ (variable->name().raw() == Symbols::ArgDescVar().raw())) {
// Don't capture those variables because the VM expects them to be on
// the stack.
continue;
@@ -700,8 +692,8 @@
int LocalVariable::BitIndexIn(intptr_t fixed_parameter_count) const {
ASSERT(!is_captured());
// Parameters have positive indexes with the lowest index being
- // kParamEndSlotFromFp + 1. Locals and copied parameters have negative
- // indexes with the lowest (closest to 0) index being kFirstLocalSlotFromFp.
+ // kParamEndSlotFromFp + 1. Locals have negative indexes with the lowest
+ // (closest to 0) index being kFirstLocalSlotFromFp.
if (index() > 0) {
// Shift non-negative indexes so that the lowest one is 0.
return fixed_parameter_count - (index() - kParamEndSlotFromFp);
diff --git a/runtime/vm/scopes.h b/runtime/vm/scopes.h
index 096b1d2..7ed478e 100644
--- a/runtime/vm/scopes.h
+++ b/runtime/vm/scopes.h
@@ -104,7 +104,7 @@
// allocated to the frame.
// var_count is the total number of stack-allocated variables including
// all parameters.
- int BitIndexIn(intptr_t var_count) const;
+ int BitIndexIn(intptr_t fixed_parameter_count) const;
private:
static const int kUninitializedIndex = INT_MIN;
diff --git a/runtime/vm/simulator_dbc.cc b/runtime/vm/simulator_dbc.cc
index fc2e385e..d7ddb93 100644
--- a/runtime/vm/simulator_dbc.cc
+++ b/runtime/vm/simulator_dbc.cc
@@ -500,7 +500,8 @@
DART_FORCE_INLINE static RawFunction* FrameFunction(RawObject** FP) {
RawFunction* function = static_cast<RawFunction*>(FP[kFunctionSlotFromFp]);
- ASSERT(SimulatorHelpers::GetClassId(function) == kFunctionCid);
+ ASSERT(SimulatorHelpers::GetClassId(function) == kFunctionCid ||
+ SimulatorHelpers::GetClassId(function) == kNullCid);
return function;
}
@@ -932,6 +933,24 @@
Invoke(thread, call_base, top, pc, FP, SP);
}
+DART_FORCE_INLINE void Simulator::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[kFunctionSlotFromFp] = Object::null();
+ FP[kPcMarkerSlotFromFp] = 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.
@@ -1045,6 +1064,15 @@
rB = ((op >> Bytecode::kBShift) & Bytecode::kBMask); \
rC = ((op >> Bytecode::kCShift) & Bytecode::kCMask);
+#define DECLARE_A_B_Y \
+ uint16_t rB; \
+ int8_t rY; \
+ USE(rB); \
+ USE(rY)
+#define DECODE_A_B_Y \
+ rB = ((op >> Bytecode::kBShift) & Bytecode::kBMask); \
+ rY = ((op >> Bytecode::kYShift) & Bytecode::kYMask);
+
#define DECLARE_0
#define DECODE_0
@@ -1308,7 +1336,6 @@
RawBool* true_value = Bool::True().raw();
RawBool* false_value = Bool::False().raw();
RawObject* null_value = Object::null();
- RawObject* empty_context = Object::empty_context().raw();
#if defined(DEBUG)
Function& function_h = Function::Handle();
@@ -1319,48 +1346,22 @@
// Bytecode handlers (see constants_dbc.h for bytecode descriptions).
{
- BYTECODE(Entry, A_B_C);
- const uint8_t num_fixed_params = rA;
- const uint16_t num_locals = rB;
- const uint16_t context_reg = rC;
+ BYTECODE(Entry, A_D);
+ const uint16_t num_locals = rD;
- // Decode arguments descriptor.
- const intptr_t pos_count = SimulatorHelpers::ArgDescPosCount(argdesc_);
-
- // Check that we got the right number of positional parameters.
- if (pos_count != num_fixed_params) {
- // Mismatch can only occur if current function is a closure.
- goto ClosureNoSuchMethod;
+ // Initialize locals with null & set SP.
+ for (intptr_t i = 0; i < num_locals; i++) {
+ FP[i] = null_value;
}
-
- // Initialize locals with null and set current context variable to
- // empty context.
- {
- RawObject** L = FP;
- for (intptr_t i = 0; i < num_locals; i++) {
- L[i] = null_value;
- }
- L[context_reg] = empty_context;
- SP = FP + num_locals - 1;
- }
+ SP = FP + num_locals - 1;
DISPATCH();
}
{
BYTECODE(EntryOptimized, A_D);
- const uint8_t num_fixed_params = rA;
const uint16_t num_registers = rD;
- // Decode arguments descriptor.
- const intptr_t pos_count = SimulatorHelpers::ArgDescPosCount(argdesc_);
-
- // Check that we got the right number of positional parameters.
- if (pos_count != num_fixed_params) {
- // Mismatch can only occur if current function is a closure.
- goto ClosureNoSuchMethod;
- }
-
// Reserve space for registers used by the optimized code.
SP = FP + num_registers - 1;
@@ -1368,122 +1369,6 @@
}
{
- BYTECODE(EntryOptional, A_B_C);
- const uint16_t num_fixed_params = rA;
- const uint16_t num_opt_pos_params = rB;
- const uint16_t num_opt_named_params = rC;
- const intptr_t min_num_pos_args = num_fixed_params;
- const intptr_t max_num_pos_args = num_fixed_params + num_opt_pos_params;
-
- // Decode arguments descriptor.
- const intptr_t arg_count = SimulatorHelpers::ArgDescArgCount(argdesc_);
- const intptr_t pos_count = SimulatorHelpers::ArgDescPosCount(argdesc_);
- const intptr_t named_count = (arg_count - pos_count);
-
- // Check that got the right number of positional parameters.
- if ((min_num_pos_args > pos_count) || (pos_count > max_num_pos_args)) {
- goto ClosureNoSuchMethod;
- }
-
- // Copy all passed position arguments.
- RawObject** first_arg = FrameArguments(FP, arg_count);
- memmove(FP, first_arg, pos_count * kWordSize);
-
- if (num_opt_named_params != 0) {
- // This is a function with named parameters.
- // Walk the list of named parameters and their
- // default values encoded as pairs of LoadConstant instructions that
- // follows the entry point and find matching values via arguments
- // descriptor.
- RawObject** argdesc_data = argdesc_->ptr()->data();
-
- intptr_t i = named_count - 1; // argument position
- intptr_t j = num_opt_named_params - 1; // parameter position
- while ((j >= 0) && (i >= 0)) {
- // Fetch formal parameter information: name, default value, target slot.
- const uint32_t load_name = pc[2 * j];
- const uint32_t load_value = pc[2 * j + 1];
- ASSERT(Bytecode::DecodeOpcode(load_name) == Bytecode::kLoadConstant);
- ASSERT(Bytecode::DecodeOpcode(load_value) == Bytecode::kLoadConstant);
- const uint8_t reg = Bytecode::DecodeA(load_name);
- ASSERT(reg == Bytecode::DecodeA(load_value));
-
- RawString* name = static_cast<RawString*>(
- LOAD_CONSTANT(Bytecode::DecodeD(load_name)));
- if (name == argdesc_data[ArgumentsDescriptor::name_index(i)]) {
- // Parameter was passed. Fetch passed value.
- const intptr_t arg_index = Smi::Value(static_cast<RawSmi*>(
- argdesc_data[ArgumentsDescriptor::position_index(i)]));
- FP[reg] = first_arg[arg_index];
- i--; // Consume passed argument.
- } else {
- // Parameter was not passed. Fetch default value.
- FP[reg] = LOAD_CONSTANT(Bytecode::DecodeD(load_value));
- }
- j--; // Next formal parameter.
- }
-
- // If we have unprocessed formal parameters then initialize them all
- // using default values.
- while (j >= 0) {
- const uint32_t load_name = pc[2 * j];
- const uint32_t load_value = pc[2 * j + 1];
- ASSERT(Bytecode::DecodeOpcode(load_name) == Bytecode::kLoadConstant);
- ASSERT(Bytecode::DecodeOpcode(load_value) == Bytecode::kLoadConstant);
- const uint8_t reg = Bytecode::DecodeA(load_name);
- ASSERT(reg == Bytecode::DecodeA(load_value));
-
- FP[reg] = LOAD_CONSTANT(Bytecode::DecodeD(load_value));
- j--;
- }
-
- // If we have unprocessed passed arguments that means we have mismatch
- // between formal parameters and concrete arguments. This can only
- // occur if the current function is a closure.
- if (i != -1) {
- goto ClosureNoSuchMethod;
- }
-
- // Skip LoadConstant-s encoding information about named parameters.
- pc += num_opt_named_params * 2;
-
- // SP points past copied arguments.
- SP = FP + num_fixed_params + num_opt_named_params - 1;
- } else {
- ASSERT(num_opt_pos_params != 0);
- if (named_count != 0) {
- // Function can't have both named and optional positional parameters.
- // This kind of mismatch can only occur if the current function
- // is a closure.
- goto ClosureNoSuchMethod;
- }
-
- // Process the list of default values encoded as a sequence of
- // LoadConstant instructions after EntryOpt bytecode.
- // Execute only those that correspond to parameters that were not passed.
- for (intptr_t i = pos_count - num_fixed_params; i < num_opt_pos_params;
- i++) {
- const uint32_t load_value = pc[i];
- ASSERT(Bytecode::DecodeOpcode(load_value) == Bytecode::kLoadConstant);
-#if defined(DEBUG)
- const uint8_t reg = Bytecode::DecodeA(load_value);
- ASSERT((num_fixed_params + i) == reg);
-#endif
- FP[num_fixed_params + i] = LOAD_CONSTANT(Bytecode::DecodeD(load_value));
- }
-
- // Skip LoadConstant-s encoding default values for optional positional
- // parameters.
- pc += num_opt_pos_params;
-
- // SP points past the last copied parameter.
- SP = FP + max_num_pos_args - 1;
- }
-
- DISPATCH();
- }
-
- {
BYTECODE(Frame, A_D);
// Initialize locals with null and increment SP.
const uint16_t num_locals = rD;
@@ -2083,6 +1968,30 @@
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(Add, A_B_C);
SMI_OP_CHECK(intptr_t, SignedAddWithOverflow);
DISPATCH();
@@ -3449,6 +3358,50 @@
}
{
+ 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];
@@ -3748,6 +3701,89 @@
}
{
+ 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(SimulatorHelpers::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());
@@ -3862,7 +3898,7 @@
ClosureNoSuchMethod:
#if defined(DEBUG)
function_h ^= FrameFunction(FP);
- ASSERT(function_h.IsClosureFunction());
+ ASSERT(function_h.IsNull() || function_h.IsClosureFunction());
#endif
// Restore caller context as we are going to throw NoSuchMethod.
diff --git a/runtime/vm/simulator_dbc.h b/runtime/vm/simulator_dbc.h
index 06b54f5..c0d0e79 100644
--- a/runtime/vm/simulator_dbc.h
+++ b/runtime/vm/simulator_dbc.h
@@ -21,6 +21,7 @@
class Code;
class Array;
class RawICData;
+class RawImmutableArray;
class RawArray;
class RawObjectPool;
class RawFunction;
@@ -164,6 +165,12 @@
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;
diff --git a/runtime/vm/stub_code.h b/runtime/vm/stub_code.h
index 744e9e2..0ef2edc 100644
--- a/runtime/vm/stub_code.h
+++ b/runtime/vm/stub_code.h
@@ -75,6 +75,7 @@
#define VM_STUB_CODE_LIST(V) \
V(LazyCompile) \
V(OptimizeFunction) \
+ V(CallClosureNoSuchMethod) \
V(RunExceptionHandler) \
V(DeoptForRewind) \
V(FixCallersTarget) \
diff --git a/runtime/vm/stub_code_dbc.cc b/runtime/vm/stub_code_dbc.cc
index a187deb..4b7157c 100644
--- a/runtime/vm/stub_code_dbc.cc
+++ b/runtime/vm/stub_code_dbc.cc
@@ -33,6 +33,10 @@
__ Compile();
}
+void StubCode::GenerateCallClosureNoSuchMethodStub(Assembler* assembler) {
+ __ NoSuchMethod();
+}
+
// Not executed, but used as a stack marker when calling
// DRT_OptimizeInvokedFunction.
void StubCode::GenerateOptimizeFunctionStub(Assembler* assembler) {
diff --git a/runtime/vm/symbols.h b/runtime/vm/symbols.h
index d49aa75..5c7f208 100644
--- a/runtime/vm/symbols.h
+++ b/runtime/vm/symbols.h
@@ -92,6 +92,7 @@
V(InterpolateSingle, "_interpolateSingle") \
V(Iterator, "iterator") \
V(NoSuchMethod, "noSuchMethod") \
+ V(ArgDescVar, ":arg_desc") \
V(CurrentContextVar, ":current_context_var") \
V(SavedTryContextVar, ":saved_try_context_var") \
V(ExceptionParameter, ":exception") \
@@ -359,6 +360,7 @@
V(Index, "index") \
V(DartScheme, "dart:") \
V(DartSchemePrivate, "dart:_") \
+ V(DartInternalPackage, "package:dart_internal/") \
V(DartNativeWrappers, "dart:nativewrappers") \
V(DartNativeWrappersLibName, "nativewrappers") \
V(DartCore, "dart:core") \
@@ -396,6 +398,7 @@
V(OptimizedOut, "<optimized out>") \
V(NotInitialized, "<not initialized>") \
V(NotNamed, "<not named>") \
+ V(OriginalParam, ":original:") \
V(TempParam, ":temp_param") \
V(_UserTag, "_UserTag") \
V(Default, "Default") \
diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h
index 720a9a8..3a8fd38 100644
--- a/runtime/vm/thread.h
+++ b/runtime/vm/thread.h
@@ -166,9 +166,10 @@
kUnknownTask = 0x0,
kMutatorTask = 0x1,
kCompilerTask = 0x2,
- kSweeperTask = 0x4,
- kMarkerTask = 0x8,
- kLowMemoryTask = 0x10,
+ kMarkerTask = 0x4,
+ kSweeperTask = 0x8,
+ kCompactorTask = 0x10,
+ kLowMemoryTask = 0x20,
};
// Converts a TaskKind to its corresponding C-String name.
static const char* TaskKindToCString(TaskKind kind);
diff --git a/sdk/bin/dartdevk.bat b/sdk/bin/dartdevk.bat
index 980c636..154162a 100644
--- a/sdk/bin/dartdevk.bat
+++ b/sdk/bin/dartdevk.bat
@@ -32,9 +32,9 @@
rem Remove trailing backslash if there is one
if %DART_ROOT:~-1%==\ set DART_ROOT=%DART_ROOT:~0,-1%
-set DEV_COMPILER=%DART_ROOT%\third_party\pkg\dev_compiler\bin\dartdevk.dart
+set DEV_COMPILER=%DART_ROOT%\pkg\dev_compiler\bin\dartdevk.dart
-"%DART%" "--packages=%SDK_DIR%\.packages" %EXTRA_VM_OPTIONS% "%DEV_COMPILER%" %*
+"%DART%" "--packages=%DART_ROOT%\.packages" %EXTRA_VM_OPTIONS% "%DEV_COMPILER%" %*
endlocal
diff --git a/sdk/lib/_internal/js_runtime/lib/internal_patch.dart b/sdk/lib/_internal/js_runtime/lib/internal_patch.dart
index 05a9d39..420901d4 100644
--- a/sdk/lib/_internal/js_runtime/lib/internal_patch.dart
+++ b/sdk/lib/_internal/js_runtime/lib/internal_patch.dart
@@ -48,6 +48,9 @@
@patch
Object extractTypeArguments<T>(T instance, Function extract) {
- // TODO(31371): Implement this.
- throw new UnimplementedError();
+ // TODO(31371): Implement this correctly for Dart 2.0.
+ // 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.
+ return extract();
}
diff --git a/sdk/lib/_internal/js_runtime/lib/js_helper.dart b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
index ed44d90..a0d0bc8 100644
--- a/sdk/lib/_internal/js_runtime/lib/js_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/js_helper.dart
@@ -3862,3 +3862,7 @@
// Hook to register new global object if necessary.
// This is currently a no-op in dart2js.
void registerGlobalObject(object) {}
+
+// Hook to register new browser classes.
+// This is currently a no-op in dart2js.
+void applyExtension(name, nativeObject) {}
diff --git a/sdk/lib/core/bigint.dart b/sdk/lib/core/bigint.dart
new file mode 100644
index 0000000..92fe61b
--- /dev/null
+++ b/sdk/lib/core/bigint.dart
@@ -0,0 +1,2490 @@
+// 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.
+
+part of dart.core;
+
+// Copyright 2009 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+/*
+ * Copyright (c) 2003-2005 Tom Wu
+ * Copyright (c) 2012 Adam Singer (adam@solvr.io)
+ * All Rights Reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the
+ * "Software"), to deal in the Software without restriction, including
+ * without limitation the rights to use, copy, modify, merge, publish,
+ * distribute, sublicense, and/or sell copies of the Software, and to
+ * permit persons to whom the Software is furnished to do so, subject to
+ * the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be
+ * included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
+ * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
+ *
+ * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
+ * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
+ * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
+ * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
+ * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ * In addition, the following condition applies:
+ *
+ * All redistributions must retain an intact copy of this copyright notice
+ * and disclaimer.
+ */
+
+/**
+ * An arbitrarily large integer.
+ */
+abstract class BigInt implements Comparable<BigInt> {
+ static final BigInt zero = _BigIntImpl.zero;
+ static final BigInt one = _BigIntImpl.one;
+ static final BigInt two = _BigIntImpl.two;
+
+ /**
+ * Parses [source] as a, possibly signed, integer literal and returns its
+ * value.
+ *
+ * The [source] must be a non-empty sequence of base-[radix] digits,
+ * optionally prefixed with a minus or plus sign ('-' or '+').
+ *
+ * The [radix] must be in the range 2..36. The digits used are
+ * first the decimal digits 0..9, and then the letters 'a'..'z' with
+ * values 10 through 35. Also accepts upper-case letters with the same
+ * values as the lower-case ones.
+ *
+ * If no [radix] is given then it defaults to 10. In this case, the [source]
+ * digits may also start with `0x`, in which case the number is interpreted
+ * as a hexadecimal literal, which effectively means that the `0x` is ignored
+ * and the radix is instead set to 16.
+ *
+ * For any int `n` and radix `r`, it is guaranteed that
+ * `n == int.parse(n.toRadixString(r), radix: r)`.
+ *
+ * Throws a [FormatException] if the [source] is not a valid integer literal,
+ * optionally prefixed by a sign.
+ */
+ static BigInt parse(String source, {int radix}) =>
+ _BigIntImpl.parse(source, radix: radix);
+
+ /// Allocates a big integer from the provided [value] number.
+ factory BigInt.from(num value) = _BigIntImpl.from;
+
+ /**
+ * Returns the absolute value of this integer.
+ *
+ * For any integer `x`, the result is the same as `x < 0 ? -x : x`.
+ */
+ BigInt abs();
+
+ /**
+ * Return the negative value of this integer.
+ *
+ * The result of negating an integer always has the opposite sign, except
+ * for zero, which is its own negation.
+ */
+ BigInt operator -();
+
+ /// Addition operator.
+ BigInt operator +(BigInt other);
+
+ /// Subtraction operator.
+ BigInt operator -(BigInt other);
+
+ /// Multiplication operator.
+ BigInt operator *(BigInt other);
+
+ /// Division operator.
+ double operator /(BigInt other);
+
+ /**
+ * Truncating division operator.
+ *
+ * Performs a truncating integer division, where the remainder is discarded.
+ *
+ * The remainder can be computed using the [remainder] method.
+ *
+ * Examples:
+ * ```
+ * var seven = new BigInt.from(7);
+ * var three = new BigInt.from(3);
+ * seven ~/ three; // => 2
+ * (-seven) ~/ three; // => -2
+ * seven ~/ -three; // => -2
+ * seven.remainder(three); // => 1
+ * (-seven).remainder(three); // => -1
+ * seven.remainder(-three); // => 1
+ * ```
+ */
+ BigInt operator ~/(BigInt other);
+
+ /**
+ * Euclidean modulo operator.
+ *
+ * Returns the remainder of the Euclidean division. The Euclidean division of
+ * two integers `a` and `b` yields two integers `q` and `r` such that
+ * `a == b * q + r` and `0 <= r < b.abs()`.
+ *
+ * The sign of the returned value `r` is always positive.
+ *
+ * See [remainder] for the remainder of the truncating division.
+ */
+ BigInt operator %(BigInt other);
+
+ /**
+ * Returns the remainder of the truncating division of `this` by [other].
+ *
+ * The result `r` of this operation satisfies:
+ * `this == (this ~/ other) * other + r`.
+ * As a consequence the remainder `r` has the same sign as the divider `this`.
+ */
+ BigInt remainder(BigInt other);
+
+ /**
+ * Shift the bits of this integer to the left by [shiftAmount].
+ *
+ * Shifting to the left makes the number larger, effectively multiplying
+ * the number by `pow(2, shiftIndex)`.
+ *
+ * There is no limit on the size of the result. It may be relevant to
+ * limit intermediate values by using the "and" operator with a suitable
+ * mask.
+ *
+ * It is an error if [shiftAmount] is negative.
+ */
+ BigInt operator <<(int shiftAmount);
+
+ /**
+ * Shift the bits of this integer to the right by [shiftAmount].
+ *
+ * Shifting to the right makes the number smaller and drops the least
+ * significant bits, effectively doing an integer division by
+ *`pow(2, shiftIndex)`.
+ *
+ * It is an error if [shiftAmount] is negative.
+ */
+ BigInt operator >>(int shiftAmount);
+
+ /**
+ * Bit-wise and operator.
+ *
+ * Treating both `this` and [other] as sufficiently large two's component
+ * integers, the result is a number with only the bits set that are set in
+ * both `this` and [other]
+ *
+ * Of both operands are negative, the result is negative, otherwise
+ * the result is non-negative.
+ */
+ BigInt operator &(BigInt other);
+
+ /**
+ * Bit-wise or operator.
+ *
+ * Treating both `this` and [other] as sufficiently large two's component
+ * integers, the result is a number with the bits set that are set in either
+ * of `this` and [other]
+ *
+ * If both operands are non-negative, the result is non-negative,
+ * otherwise the result us negative.
+ */
+ BigInt operator |(BigInt other);
+
+ /**
+ * Bit-wise exclusive-or operator.
+ *
+ * Treating both `this` and [other] as sufficiently large two's component
+ * integers, the result is a number with the bits set that are set in one,
+ * but not both, of `this` and [other]
+ *
+ * If the operands have the same sign, the result is non-negative,
+ * otherwise the result is negative.
+ */
+ BigInt operator ^(BigInt other);
+
+ /**
+ * The bit-wise negate operator.
+ *
+ * Treating `this` as a sufficiently large two's component integer,
+ * the result is a number with the opposite bits set.
+ *
+ * This maps any integer `x` to `-x - 1`.
+ */
+ BigInt operator ~();
+
+ /** Relational less than operator. */
+ bool operator <(BigInt other);
+
+ /** Relational less than or equal operator. */
+ bool operator <=(BigInt other);
+
+ /** Relational greater than operator. */
+ bool operator >(BigInt other);
+
+ /** Relational greater than or equal operator. */
+ bool operator >=(BigInt other);
+
+ /**
+ * Compares this to `other`.
+ *
+ * Returns a negative number if `this` is less than `other`, zero if they are
+ * equal, and a positive number if `this` is greater than `other`.
+ */
+ int compareTo(BigInt other);
+
+ /**
+ * Returns the minimum number of bits required to store this big integer.
+ *
+ * The number of bits excludes the sign bit, which gives the natural length
+ * for non-negative (unsigned) values. Negative values are complemented to
+ * return the bit position of the first bit that differs from the sign bit.
+ *
+ * To find the number of bits needed to store the value as a signed value,
+ * add one, i.e. use `x.bitLength + 1`.
+ *
+ * ```
+ * x.bitLength == (-x-1).bitLength
+ *
+ * new BigInt.from(3).bitLength == 2; // 00000011
+ * new BigInt.from(2).bitLength == 2; // 00000010
+ * new BigInt.from(1).bitLength == 1; // 00000001
+ * new BigInt.from(0).bitLength == 0; // 00000000
+ * new BigInt.from(-1).bitLength == 0; // 11111111
+ * new BigInt.from(-2).bitLength == 1; // 11111110
+ * new BigInt.from(-3).bitLength == 2; // 11111101
+ * new BigInt.from(-4).bitLength == 2; // 11111100
+ * ```
+ */
+ int get bitLength;
+
+ /**
+ * Returns the sign of this big integer.
+ *
+ * Returns 0 for zero, -1 for values less than zero and
+ * +1 for values greater than zero.
+ */
+ int get sign;
+
+ /// Whether this big integer is even.
+ bool get isEven;
+
+ /// Whether this big integer is odd.
+ bool get isOdd;
+
+ /// Whether this number is negative.
+ bool get isNegative;
+
+ /**
+ * Returns `this` to the power of [exponent].
+ *
+ * Returns [one] if the [exponent] equals 0.
+ *
+ * The [exponent] must otherwise be positive.
+ *
+ * The result is always equal to the mathematical result of this to the power
+ * [exponent], only limited by the available memory.
+ */
+ BigInt pow(int exponent);
+
+ /**
+ * Returns this integer to the power of [exponent] modulo [modulus].
+ *
+ * The [exponent] must be non-negative and [modulus] must be
+ * positive.
+ */
+ BigInt modPow(BigInt exponent, BigInt modulus);
+
+ /**
+ * Returns the modular multiplicative inverse of this big integer
+ * modulo [modulus].
+ *
+ * The [modulus] must be positive.
+ *
+ * It is an error if no modular inverse exists.
+ */
+ // Returns 1/this % modulus, with modulus > 0.
+ BigInt modInverse(BigInt modulus);
+
+ /**
+ * Returns the greatest common divisor of this big integer and [other].
+ *
+ * If either number is non-zero, the result is the numerically greatest
+ * integer dividing both `this` and `other`.
+ *
+ * The greatest common divisor is independent of the order,
+ * so `x.gcd(y)` is always the same as `y.gcd(x)`.
+ *
+ * For any integer `x`, `x.gcd(x)` is `x.abs()`.
+ *
+ * If both `this` and `other` is zero, the result is also zero.
+ */
+ BigInt gcd(BigInt other);
+
+ /**
+ * Returns the least significant [width] bits of this big integer as a
+ * non-negative number (i.e. unsigned representation). The returned value has
+ * zeros in all bit positions higher than [width].
+ *
+ * ```
+ * new BigInt.from(-1).toUnsigned(5) == 31 // 11111111 -> 00011111
+ * ```
+ *
+ * This operation can be used to simulate arithmetic from low level languages.
+ * For example, to increment an 8 bit quantity:
+ *
+ * ```
+ * q = (q + 1).toUnsigned(8);
+ * ```
+ *
+ * `q` will count from `0` up to `255` and then wrap around to `0`.
+ *
+ * If the input fits in [width] bits without truncation, the result is the
+ * same as the input. The minimum width needed to avoid truncation of `x` is
+ * given by `x.bitLength`, i.e.
+ *
+ * ```
+ * x == x.toUnsigned(x.bitLength);
+ * ```
+ */
+ BigInt toUnsigned(int width);
+
+ /**
+ * Returns the least significant [width] bits of this integer, extending the
+ * highest retained bit to the sign. This is the same as truncating the value
+ * to fit in [width] bits using an signed 2-s complement representation. The
+ * returned value has the same bit value in all positions higher than [width].
+ *
+ * ```
+ * var big15 = new BigInt.from(15);
+ * var big16 = new BigInt.from(16);
+ * var big239 = new BigInt.from(239);
+ * V--sign bit-V
+ * big16.toSigned(5) == -big16 // 00010000 -> 11110000
+ * big239.toSigned(5) == big15 // 11101111 -> 00001111
+ * ^ ^
+ * ```
+ *
+ * This operation can be used to simulate arithmetic from low level languages.
+ * For example, to increment an 8 bit signed quantity:
+ *
+ * ```
+ * q = (q + 1).toSigned(8);
+ * ```
+ *
+ * `q` will count from `0` up to `127`, wrap to `-128` and count back up to
+ * `127`.
+ *
+ * If the input value fits in [width] bits without truncation, the result is
+ * the same as the input. The minimum width needed to avoid truncation of `x`
+ * is `x.bitLength + 1`, i.e.
+ *
+ * ```
+ * x == x.toSigned(x.bitLength + 1);
+ * ```
+ */
+ BigInt toSigned(int width);
+
+ /**
+ * Whether this big integer can be represented as an `int` without losing
+ * precision.
+ *
+ * Warning: this function is not yet implemented and always returns true.
+ */
+ bool get isValidInt;
+
+ /**
+ * Returns this [BigInt] as an [int].
+ *
+ * If the number does not fit clamps to the max (or min) integer.
+ *
+ * Warning: the clamping is not yet implemented and the behavior of this
+ * function will change in future versions of this library.
+ */
+ int toInt();
+
+ /**
+ * Returns this [BigInt] as a [double].
+ *
+ * If the number is not representable as a [double], an
+ * approximation is returned. For numerically large integers, the
+ * approximation may be infinite.
+ */
+ double toDouble();
+
+ /**
+ * Returns a String-representation of this integer.
+ *
+ * The returned string is parsable by [parse].
+ * For any `BigInt` `i`, it is guaranteed that
+ * `i == BigInt.parse(i.toString())`.
+ */
+ String toString();
+
+ /**
+ * Converts [this] to a string representation in the given [radix].
+ *
+ * In the string representation, lower-case letters are used for digits above
+ * '9', with 'a' being 10 an 'z' being 35.
+ *
+ * The [radix] argument must be an integer in the range 2 to 36.
+ */
+ String toRadixString(int radix);
+}
+
+int _max(int a, int b) => a > b ? a : b;
+int _min(int a, int b) => a < b ? a : b;
+
+/**
+ * An implementation for the arbitrarily large integer.
+ *
+ * The integer number is represented by a sign, an array of 16-bit unsigned
+ * integers in little endian format, and a number of used digits in that array.
+ */
+class _BigIntImpl implements BigInt {
+ // Bits per digit.
+ static const int _digitBits = 16;
+ static const int _digitBase = 1 << _digitBits;
+ static const int _digitMask = (1 << _digitBits) - 1;
+
+ static final _BigIntImpl zero = new _BigIntImpl._fromInt(0);
+ static final _BigIntImpl one = new _BigIntImpl._fromInt(1);
+ static final _BigIntImpl two = new _BigIntImpl._fromInt(2);
+
+ static final _BigIntImpl _minusOne = -one;
+ static final _BigIntImpl _bigInt10000 = new _BigIntImpl._fromInt(10000);
+
+ // Result cache for last _divRem call.
+ // Result cache for last _divRem call.
+ static Uint16List _lastDividendDigits;
+ static int _lastDividendUsed;
+ static Uint16List _lastDivisorDigits;
+ static int _lastDivisorUsed;
+ static Uint16List _lastQuoRemDigits;
+ static int _lastQuoRemUsed;
+ static int _lastRemUsed;
+ static int _lastRem_nsh;
+
+ /// Whether this bigint is negative.
+ final bool _isNegative;
+
+ /// The unsigned digits of this bigint.
+ ///
+ /// The least significant digit is in slot 0.
+ /// The list may have more digits than needed. That is, `_digits.length` may
+ /// be strictly greater than `_used`.
+ final Uint16List _digits;
+
+ /// The number of used entries in [_digits].
+ ///
+ /// To avoid reallocating [Uint16List]s, lists that are too big are not
+ /// replaced.
+ final int _used;
+
+ /**
+ * Parses [source] as a, possibly signed, integer literal and returns its
+ * value.
+ *
+ * The [source] must be a non-empty sequence of base-[radix] digits,
+ * optionally prefixed with a minus or plus sign ('-' or '+').
+ *
+ * The [radix] must be in the range 2..36. The digits used are
+ * first the decimal digits 0..9, and then the letters 'a'..'z' with
+ * values 10 through 35. Also accepts upper-case letters with the same
+ * values as the lower-case ones.
+ *
+ * If no [radix] is given then it defaults to 10. In this case, the [source]
+ * digits may also start with `0x`, in which case the number is interpreted
+ * as a hexadecimal literal, which effectively means that the `0x` is ignored
+ * and the radix is instead set to 16.
+ *
+ * For any int `n` and radix `r`, it is guaranteed that
+ * `n == int.parse(n.toRadixString(r), radix: r)`.
+ *
+ * Throws a [FormatException] if the [source] is not a valid integer literal,
+ * optionally prefixed by a sign.
+ */
+ static _BigIntImpl parse(String source, {int radix}) {
+ var result = _tryParse(source, radix: radix);
+ if (result == null) {
+ throw new FormatException("Could not parse BigInt", source);
+ }
+ return result;
+ }
+
+ /// Parses a decimal bigint literal.
+ ///
+ /// The [source] must not contain leading or trailing whitespace.
+ static _BigIntImpl _parseDecimal(String source, bool isNegative) {
+ const _0 = 48;
+
+ int part = 0;
+ _BigIntImpl result = zero;
+ // Read in the source 4 digits at a time.
+ // The first part may have a few leading virtual '0's to make the remaining
+ // parts all have exactly 4 digits.
+ int digitInPartCount = 4 - source.length.remainder(4);
+ if (digitInPartCount == 4) digitInPartCount = 0;
+ for (int i = 0; i < source.length; i++) {
+ part = part * 10 + source.codeUnitAt(i) - _0;
+ if (++digitInPartCount == 4) {
+ result = result * _bigInt10000 + new _BigIntImpl._fromInt(part);
+ part = 0;
+ digitInPartCount = 0;
+ }
+ }
+ if (isNegative) return -result;
+ return result;
+ }
+
+ /// Returns the value of a given source digit.
+ ///
+ /// Source digits between "0" and "9" (inclusive) return their decimal value.
+ ///
+ /// Source digits between "a" and "z", or "A" and "Z" (inclusive) return
+ /// 10 + their position in the ASCII alphabet.
+ ///
+ /// The incoming [codeUnit] must be an ASCII code-unit.
+ static int _codeUnitToRadixValue(int codeUnit) {
+ // We know that the characters must be ASCII as otherwise the
+ // regexp wouldn't have matched. Lowercasing by doing `| 0x20` is thus
+ // guaranteed to be a safe operation, since it preserves digits
+ // and lower-cases ASCII letters.
+ const int _0 = 48;
+ const int _9 = 57;
+ const int _a = 97;
+ if (_0 <= codeUnit && codeUnit <= _9) return codeUnit - _0;
+ codeUnit |= 0x20;
+ var result = codeUnit - _a + 10;
+ return result;
+ }
+
+ /// Parses the given [source] string, starting at [startPos], as a hex
+ /// literal.
+ ///
+ /// If [isNegative] is true, negates the result before returning it.
+ ///
+ /// The [source] (substring) must be a valid hex literal.
+ static _BigIntImpl _parseHex(String source, int startPos, bool isNegative) {
+ int hexDigitsPerChunk = _digitBits ~/ 4;
+ int sourceLength = source.length - startPos;
+ int chunkCount = (sourceLength / hexDigitsPerChunk).ceil();
+ var digits = new Uint16List(chunkCount);
+
+ int lastDigitLength = sourceLength - (chunkCount - 1) * hexDigitsPerChunk;
+ int digitIndex = digits.length - 1;
+ int i = startPos;
+ int chunk = 0;
+ for (int j = 0; j < lastDigitLength; j++) {
+ var digitValue = _codeUnitToRadixValue(source.codeUnitAt(i++));
+ if (digitValue >= 16) return null;
+ chunk = chunk * 16 + digitValue;
+ }
+ digits[digitIndex--] = chunk;
+
+ while (i < source.length) {
+ chunk = 0;
+ for (int j = 0; j < 4; j++) {
+ var digitValue = _codeUnitToRadixValue(source.codeUnitAt(i++));
+ if (digitValue >= 16) return null;
+ chunk = chunk * 16 + digitValue;
+ }
+ digits[digitIndex--] = chunk;
+ }
+ if (digits.length == 1 && digits[0] == 0) return zero;
+ return new _BigIntImpl._(isNegative, digits.length, digits);
+ }
+
+ /// Parses the given [source] as a [radix] literal.
+ ///
+ /// The [source] will be checked for invalid characters. If it is invalid,
+ /// this function returns `null`.
+ static _BigIntImpl _parseRadix(String source, int radix, bool isNegative) {
+ var result = zero;
+ var base = new _BigIntImpl._fromInt(radix);
+ for (int i = 0; i < source.length; i++) {
+ var digitValue = _codeUnitToRadixValue(source.codeUnitAt(i));
+ if (digitValue >= radix) return null;
+ result = result * base + new _BigIntImpl._fromInt(digitValue);
+ }
+ if (isNegative) return -result;
+ return result;
+ }
+
+ /// Tries to parse the given [source] as a [radix] literal.
+ ///
+ /// Returns the parsed big integer, or `null` if it failed.
+ ///
+ /// If the [radix] is `null` accepts decimal literals or `0x` hex literals.
+ static _BigIntImpl _tryParse(String source, {int radix}) {
+ if (source == "") return null;
+
+ var re = new RegExp(r'^\s*([+-]?)((0x[a-f0-9]+)|(\d+)|([a-z0-9]+))\s*$',
+ caseSensitive: false);
+ var match = re.firstMatch(source);
+ int signIndex = 1;
+ int hexIndex = 3;
+ int decimalIndex = 4;
+ int nonDecimalHexIndex = 5;
+ if (match == null) return null;
+
+ bool isNegative = match[signIndex] == "-";
+
+ String decimalMatch = match[decimalIndex];
+ String hexMatch = match[hexIndex];
+ String nonDecimalMatch = match[nonDecimalHexIndex];
+
+ if (radix == null) {
+ if (decimalMatch != null) {
+ // Cannot fail because we know that the digits are all decimal.
+ return _parseDecimal(decimalMatch, isNegative);
+ }
+ if (hexMatch != null) {
+ // Cannot fail because we know that the digits are all hex.
+ return _parseHex(hexMatch, 2, isNegative);
+ }
+ return null;
+ }
+
+ if (radix is! int) {
+ throw new ArgumentError.value(radix, 'radix', 'is not an integer');
+ }
+ if (radix < 2 || radix > 36) {
+ throw new RangeError.range(radix, 2, 36, 'radix');
+ }
+ if (radix == 10 && decimalMatch != null) {
+ return _parseDecimal(decimalMatch, isNegative);
+ }
+ if (radix == 16 && (decimalMatch != null || nonDecimalMatch != null)) {
+ return _parseHex(decimalMatch ?? nonDecimalMatch, 0, isNegative);
+ }
+
+ return _parseRadix(
+ decimalMatch ?? nonDecimalMatch ?? hexMatch, radix, isNegative);
+ }
+
+ /// Finds the amount significant digits in the provided [digits] array.
+ static int _normalize(int used, Uint16List digits) {
+ while (used > 0 && digits[used - 1] == 0) used--;
+ return used;
+ }
+
+ /// Factory returning an instance initialized with the given field values.
+ /// If the [digits] array contains leading 0s, the [used] value is adjusted
+ /// accordingly. The [digits] array is not modified.
+ _BigIntImpl._(bool isNegative, int used, Uint16List digits)
+ : this._normalized(isNegative, _normalize(used, digits), digits);
+
+ _BigIntImpl._normalized(bool isNegative, this._used, this._digits)
+ : _isNegative = _used == 0 ? false : isNegative;
+
+ /// Whether this big integer is zero.
+ bool get _isZero => _used == 0;
+
+ /// Allocates an array of the given [length] and copies the [digits] in the
+ /// range [from] to [to-1], starting at index 0, followed by leading zero
+ /// digits.
+ static Uint16List _cloneDigits(
+ Uint16List digits, int from, int to, int length) {
+ var resultDigits = new Uint16List(length);
+ var n = to - from;
+ for (var i = 0; i < n; i++) {
+ resultDigits[i] = digits[from + i];
+ }
+ return resultDigits;
+ }
+
+ /// Allocates a big integer from the provided [value] number.
+ factory _BigIntImpl.from(num value) {
+ if (value == 0) return zero;
+ if (value == 1) return one;
+ if (value == 2) return two;
+
+ // Given this order dart2js will use the `_fromInt` for smaller value and
+ // then use the bit-manipulating `_fromDouble` for all other values.
+ if (value.abs() < 0x100000000)
+ return new _BigIntImpl._fromInt(value.toInt());
+ if (value is double) return new _BigIntImpl._fromDouble(value);
+ return new _BigIntImpl._fromInt(value);
+ }
+
+ factory _BigIntImpl._fromInt(int value) {
+ bool isNegative = value < 0;
+ if (isNegative) {
+ // Handle the min 64-bit value differently, since its negation is not
+ // positive.
+ // TODO(floitsch): we should use min.minValue or 0x8000000000000000 here.
+ const int minInt64 = -9223372036854775807 - 1;
+ if (value == minInt64) {
+ var digits = new Uint16List(4);
+ digits[3] = 0x8000;
+ return new _BigIntImpl._(true, digits.length, digits);
+ }
+ value = -value;
+ }
+ assert(_digitBits == 16);
+ if (value < _digitBase) {
+ var digits = new Uint16List(1);
+ digits[0] = value;
+ return new _BigIntImpl._(isNegative, digits.length, digits);
+ }
+ if (value <= 0xFFFFFFFF) {
+ var digits = new Uint16List(2);
+ digits[0] = value & _digitMask;
+ digits[1] = value >> _digitBits;
+ return new _BigIntImpl._(isNegative, digits.length, digits);
+ }
+
+ var bits = value.bitLength;
+ var digits = new Uint16List((bits - 1) ~/ _digitBits + 1);
+ var i = 0;
+ while (value != 0) {
+ digits[i++] = value & _digitMask;
+ value = value ~/ _digitBase;
+ }
+ return new _BigIntImpl._(isNegative, digits.length, digits);
+ }
+
+ /// An 8-byte Uint8List we can reuse for [_fromDouble] to avoid generating
+ /// garbage.
+ static final Uint8List _bitsForFromDouble = new Uint8List(8);
+
+ factory _BigIntImpl._fromDouble(double value) {
+ const int exponentBias = 1075;
+
+ if (value.isNaN || value.isInfinite) {
+ throw new ArgumentError("Value must be finite: $value");
+ }
+ bool isNegative = value < 0;
+ if (isNegative) value = -value;
+
+ value = value.floorToDouble();
+ if (value == 0) return zero;
+
+ var bits = _bitsForFromDouble;
+ for (int i = 0; i < 8; i++) {
+ bits[i] = 0;
+ }
+ bits.buffer.asByteData().setFloat64(0, value, Endian.little);
+ // The exponent is in bits 53..63.
+ var biasedExponent = (bits[7] << 4) + (bits[6] >> 4);
+ var exponent = biasedExponent - exponentBias;
+
+ assert(_digitBits == 16);
+ // The significant bits are in 0 .. 52.
+ var unshiftedDigits = new Uint16List(4);
+ unshiftedDigits[0] = (bits[1] << 8) + bits[0];
+ unshiftedDigits[1] = (bits[3] << 8) + bits[2];
+ unshiftedDigits[2] = (bits[5] << 8) + bits[4];
+ // Don't forget to add the hidden bit.
+ unshiftedDigits[3] = 0x10 | (bits[6] & 0xF);
+
+ var unshiftedBig = new _BigIntImpl._normalized(false, 4, unshiftedDigits);
+ _BigIntImpl absResult;
+ if (exponent < 0) {
+ absResult = unshiftedBig >> -exponent;
+ } else if (exponent > 0) {
+ absResult = unshiftedBig << exponent;
+ }
+ if (isNegative) return -absResult;
+ return absResult;
+ }
+
+ /**
+ * Return the negative value of this integer.
+ *
+ * The result of negating an integer always has the opposite sign, except
+ * for zero, which is its own negation.
+ */
+ _BigIntImpl operator -() {
+ if (_used == 0) return this;
+ return new _BigIntImpl._(!_isNegative, _used, _digits);
+ }
+
+ /**
+ * Returns the absolute value of this integer.
+ *
+ * For any integer `x`, the result is the same as `x < 0 ? -x : x`.
+ */
+ _BigIntImpl abs() => _isNegative ? -this : this;
+
+ /// Returns this << n *_DIGIT_BITS.
+ _BigIntImpl _dlShift(int n) {
+ final used = _used;
+ if (used == 0) {
+ return zero;
+ }
+ final resultUsed = used + n;
+ final digits = _digits;
+ final resultDigits = new Uint16List(resultUsed);
+ for (int i = used - 1; i >= 0; i--) {
+ resultDigits[i + n] = digits[i];
+ }
+ return new _BigIntImpl._(_isNegative, resultUsed, resultDigits);
+ }
+
+ /// Same as [_dlShift] but works on the decomposed big integers.
+ ///
+ /// Returns `resultUsed`.
+ ///
+ /// `resultDigits[0..resultUsed-1] = xDigits[0..xUsed-1] << n*_DIGIT_BITS`.
+ static int _dlShiftDigits(
+ Uint16List xDigits, int xUsed, int n, Uint16List resultDigits) {
+ if (xUsed == 0) {
+ return 0;
+ }
+ if (n == 0 && identical(resultDigits, xDigits)) {
+ return xUsed;
+ }
+ final resultUsed = xUsed + n;
+ for (int i = xUsed - 1; i >= 0; i--) {
+ resultDigits[i + n] = xDigits[i];
+ }
+ for (int i = n - 1; i >= 0; i--) {
+ resultDigits[i] = 0;
+ }
+ return resultUsed;
+ }
+
+ /// Returns `this >> n*_DIGIT_BITS`.
+ _BigIntImpl _drShift(int n) {
+ final used = _used;
+ if (used == 0) {
+ return zero;
+ }
+ final resultUsed = used - n;
+ if (resultUsed <= 0) {
+ return _isNegative ? _minusOne : zero;
+ }
+ final digits = _digits;
+ final resultDigits = new Uint16List(resultUsed);
+ for (var i = n; i < used; i++) {
+ resultDigits[i - n] = digits[i];
+ }
+ final result = new _BigIntImpl._(_isNegative, resultUsed, resultDigits);
+ if (_isNegative) {
+ // Round down if any bit was shifted out.
+ for (var i = 0; i < n; i++) {
+ if (digits[i] != 0) {
+ return result - one;
+ }
+ }
+ }
+ return result;
+ }
+
+ /// Shifts the digits of [xDigits] into the right place in [resultDigits].
+ ///
+ /// `resultDigits[ds..xUsed+ds] = xDigits[0..xUsed-1] << (n % _DIGIT_BITS)`
+ /// where `ds = ceil(n / _DIGIT_BITS)`
+ ///
+ /// Does *not* clear digits below ds.
+ static void _lsh(
+ Uint16List xDigits, int xUsed, int n, Uint16List resultDigits) {
+ final digitShift = n ~/ _digitBits;
+ final bitShift = n % _digitBits;
+ final carryBitShift = _digitBits - bitShift;
+ final bitMask = (1 << carryBitShift) - 1;
+ var carry = 0;
+ for (int i = xUsed - 1; i >= 0; i--) {
+ final digit = xDigits[i];
+ resultDigits[i + digitShift + 1] = (digit >> carryBitShift) | carry;
+ carry = (digit & bitMask) << bitShift;
+ }
+ resultDigits[digitShift] = carry;
+ }
+
+ /**
+ * Shift the bits of this integer to the left by [shiftAmount].
+ *
+ * Shifting to the left makes the number larger, effectively multiplying
+ * the number by `pow(2, shiftIndex)`.
+ *
+ * There is no limit on the size of the result. It may be relevant to
+ * limit intermediate values by using the "and" operator with a suitable
+ * mask.
+ *
+ * It is an error if [shiftAmount] is negative.
+ */
+ _BigIntImpl operator <<(int shiftAmount) {
+ if (shiftAmount < 0) {
+ throw new ArgumentError("shift-amount must be posititve $shiftAmount");
+ }
+ final digitShift = shiftAmount ~/ _digitBits;
+ final bitShift = shiftAmount % _digitBits;
+ if (bitShift == 0) {
+ return _dlShift(digitShift);
+ }
+ var resultUsed = _used + digitShift + 1;
+ var resultDigits = new Uint16List(resultUsed);
+ _lsh(_digits, _used, shiftAmount, resultDigits);
+ return new _BigIntImpl._(_isNegative, resultUsed, resultDigits);
+ }
+
+ // resultDigits[0..resultUsed-1] = xDigits[0..xUsed-1] << n.
+ // Returns resultUsed.
+ static int _lShiftDigits(
+ Uint16List xDigits, int xUsed, int n, Uint16List resultDigits) {
+ final digitsShift = n ~/ _digitBits;
+ final bitShift = n % _digitBits;
+ if (bitShift == 0) {
+ return _dlShiftDigits(xDigits, xUsed, digitsShift, resultDigits);
+ }
+ var resultUsed = xUsed + digitsShift + 1;
+ _lsh(xDigits, xUsed, n, resultDigits);
+ var i = digitsShift;
+ while (--i >= 0) {
+ resultDigits[i] = 0;
+ }
+ if (resultDigits[resultUsed - 1] == 0) {
+ resultUsed--; // Clamp result.
+ }
+ return resultUsed;
+ }
+
+ // resultDigits[0..resultUsed-1] = xDigits[0..xUsed-1] >> n.
+ static void _rsh(
+ Uint16List xDigits, int xUsed, int n, Uint16List resultDigits) {
+ final digitsShift = n ~/ _digitBits;
+ final bitShift = n % _digitBits;
+ final carryBitShift = _digitBits - bitShift;
+ final bitMask = (1 << bitShift) - 1;
+ var carry = xDigits[digitsShift] >> bitShift;
+ final last = xUsed - digitsShift - 1;
+ for (var i = 0; i < last; i++) {
+ final digit = xDigits[i + digitsShift + 1];
+ resultDigits[i] = ((digit & bitMask) << carryBitShift) | carry;
+ carry = digit >> bitShift;
+ }
+ resultDigits[last] = carry;
+ }
+
+ /**
+ * Shift the bits of this integer to the right by [shiftAmount].
+ *
+ * Shifting to the right makes the number smaller and drops the least
+ * significant bits, effectively doing an integer division by
+ *`pow(2, shiftIndex)`.
+ *
+ * It is an error if [shiftAmount] is negative.
+ */
+ _BigIntImpl operator >>(int shiftAmount) {
+ if (shiftAmount < 0) {
+ throw new ArgumentError("shift-amount must be posititve $shiftAmount");
+ }
+ final digitShift = shiftAmount ~/ _digitBits;
+ final bitShift = shiftAmount % _digitBits;
+ if (bitShift == 0) {
+ return _drShift(digitShift);
+ }
+ final used = _used;
+ final resultUsed = used - digitShift;
+ if (resultUsed <= 0) {
+ return _isNegative ? _minusOne : zero;
+ }
+ final digits = _digits;
+ final resultDigits = new Uint16List(resultUsed);
+ _rsh(digits, used, shiftAmount, resultDigits);
+ final result = new _BigIntImpl._(_isNegative, resultUsed, resultDigits);
+ if (_isNegative) {
+ // Round down if any bit was shifted out.
+ if ((digits[digitShift] & ((1 << bitShift) - 1)) != 0) {
+ return result - one;
+ }
+ for (var i = 0; i < digitShift; i++) {
+ if (digits[i] != 0) {
+ return result - one;
+ }
+ }
+ }
+ return result;
+ }
+
+ /// Compares this to [other] taking the absolute value of both operands.
+ ///
+ /// Returns 0 if abs(this) == abs(other); a positive number if
+ /// abs(this) > abs(other); and a negative number if abs(this) < abs(other).
+ int _absCompare(BigInt bigInt) {
+ _BigIntImpl other = bigInt;
+ return _compareDigits(_digits, _used, other._digits, other._used);
+ }
+
+ /**
+ * Compares this to `other`.
+ *
+ * Returns a negative number if `this` is less than `other`, zero if they are
+ * equal, and a positive number if `this` is greater than `other`.
+ */
+ int compareTo(BigInt bigInt) {
+ _BigIntImpl other = bigInt;
+ if (_isNegative == other._isNegative) {
+ var result = _absCompare(other);
+ // Use 0 - result to avoid negative zero in JavaScript.
+ return _isNegative ? 0 - result : result;
+ }
+ return _isNegative ? -1 : 1;
+ }
+
+ /// Compares `digits[0..used-1]` with `otherDigits[0..otherUsed-1]`.
+ ///
+ /// Returns 0 if equal; a positive number if larger;
+ /// and a negative number if smaller.
+ static int _compareDigits(
+ Uint16List digits, int used, Uint16List otherDigits, int otherUsed) {
+ var result = used - otherUsed;
+ if (result == 0) {
+ for (int i = used - 1; i >= 0; i--) {
+ result = digits[i] - otherDigits[i];
+ if (result != 0) return result;
+ }
+ }
+ return result;
+ }
+
+ // resultDigits[0..used] = digits[0..used-1] + otherDigits[0..otherUsed-1].
+ // used >= otherUsed > 0.
+ static void _absAdd(Uint16List digits, int used, Uint16List otherDigits,
+ int otherUsed, Uint16List resultDigits) {
+ assert(used >= otherUsed && otherUsed > 0);
+ var carry = 0;
+ for (var i = 0; i < otherUsed; i++) {
+ carry += digits[i] + otherDigits[i];
+ resultDigits[i] = carry & _digitMask;
+ carry >>= _digitBits;
+ }
+ for (var i = otherUsed; i < used; i++) {
+ carry += digits[i];
+ resultDigits[i] = carry & _digitMask;
+ carry >>= _digitBits;
+ }
+ resultDigits[used] = carry;
+ }
+
+ // resultDigits[0..used-1] = digits[0..used-1] - otherDigits[0..otherUsed-1].
+ // used >= otherUsed > 0.
+ static void _absSub(Uint16List digits, int used, Uint16List otherDigits,
+ int otherUsed, Uint16List resultDigits) {
+ assert(used >= otherUsed && otherUsed > 0);
+
+ var carry = 0;
+ for (var i = 0; i < otherUsed; i++) {
+ carry += digits[i] - otherDigits[i];
+ resultDigits[i] = carry & _digitMask;
+ // Dart2js only supports unsigned shifts.
+ // Since the carry can only be -1 or 0 use this hack.
+ carry = 0 - ((carry >> _digitBits) & 1);
+ }
+ for (var i = otherUsed; i < used; i++) {
+ carry += digits[i];
+ resultDigits[i] = carry & _digitMask;
+ // Dart2js only supports unsigned shifts.
+ // Since the carry can only be -1 or 0 use this hack.
+ carry = 0 - ((carry >> _digitBits) & 1);
+ }
+ }
+
+ /// Returns `abs(this) + abs(other)` with sign set according to [isNegative].
+ _BigIntImpl _absAddSetSign(_BigIntImpl other, bool isNegative) {
+ var used = _used;
+ var otherUsed = other._used;
+ if (used < otherUsed) {
+ return other._absAddSetSign(this, isNegative);
+ }
+ if (used == 0) {
+ assert(!isNegative);
+ return zero;
+ }
+ if (otherUsed == 0) {
+ return _isNegative == isNegative ? this : -this;
+ }
+ var resultUsed = used + 1;
+ var resultDigits = new Uint16List(resultUsed);
+ _absAdd(_digits, used, other._digits, otherUsed, resultDigits);
+ return new _BigIntImpl._(isNegative, resultUsed, resultDigits);
+ }
+
+ /// Returns `abs(this) - abs(other)` with sign set according to [isNegative].
+ ///
+ /// Requirement: `abs(this) >= abs(other)`.
+ _BigIntImpl _absSubSetSign(_BigIntImpl other, bool isNegative) {
+ assert(_absCompare(other) >= 0);
+ var used = _used;
+ if (used == 0) {
+ assert(!isNegative);
+ return zero;
+ }
+ var otherUsed = other._used;
+ if (otherUsed == 0) {
+ return _isNegative == isNegative ? this : -this;
+ }
+ var resultDigits = new Uint16List(used);
+ _absSub(_digits, used, other._digits, otherUsed, resultDigits);
+ return new _BigIntImpl._(isNegative, used, resultDigits);
+ }
+
+ /// Returns `abs(this) & abs(other)` with sign set according to [isNegative].
+ _BigIntImpl _absAndSetSign(_BigIntImpl other, bool isNegative) {
+ var resultUsed = _min(_used, other._used);
+ var digits = _digits;
+ var otherDigits = other._digits;
+ var resultDigits = new Uint16List(resultUsed);
+ for (var i = 0; i < resultUsed; i++) {
+ resultDigits[i] = digits[i] & otherDigits[i];
+ }
+ return new _BigIntImpl._(isNegative, resultUsed, resultDigits);
+ }
+
+ /// Returns `abs(this) &~ abs(other)` with sign set according to [isNegative].
+ _BigIntImpl _absAndNotSetSign(_BigIntImpl other, bool isNegative) {
+ var resultUsed = _used;
+ var digits = _digits;
+ var otherDigits = other._digits;
+ var resultDigits = new Uint16List(resultUsed);
+ var m = _min(resultUsed, other._used);
+ for (var i = 0; i < m; i++) {
+ resultDigits[i] = digits[i] & ~otherDigits[i];
+ }
+ for (var i = m; i < resultUsed; i++) {
+ resultDigits[i] = digits[i];
+ }
+ return new _BigIntImpl._(isNegative, resultUsed, resultDigits);
+ }
+
+ /// Returns `abs(this) | abs(other)` with sign set according to [isNegative].
+ _BigIntImpl _absOrSetSign(_BigIntImpl other, bool isNegative) {
+ var used = _used;
+ var otherUsed = other._used;
+ var resultUsed = _max(used, otherUsed);
+ var digits = _digits;
+ var otherDigits = other._digits;
+ var resultDigits = new Uint16List(resultUsed);
+ var l, m;
+ if (used < otherUsed) {
+ l = other;
+ m = used;
+ } else {
+ l = this;
+ m = otherUsed;
+ }
+ for (var i = 0; i < m; i++) {
+ resultDigits[i] = digits[i] | otherDigits[i];
+ }
+ var lDigits = l._digits;
+ for (var i = m; i < resultUsed; i++) {
+ resultDigits[i] = lDigits[i];
+ }
+ return new _BigIntImpl._(isNegative, resultUsed, resultDigits);
+ }
+
+ /// Returns `abs(this) ^ abs(other)` with sign set according to [isNegative].
+ _BigIntImpl _absXorSetSign(_BigIntImpl other, bool isNegative) {
+ var used = _used;
+ var otherUsed = other._used;
+ var resultUsed = _max(used, otherUsed);
+ var digits = _digits;
+ var otherDigits = other._digits;
+ var resultDigits = new Uint16List(resultUsed);
+ var l, m;
+ if (used < otherUsed) {
+ l = other;
+ m = used;
+ } else {
+ l = this;
+ m = otherUsed;
+ }
+ for (var i = 0; i < m; i++) {
+ resultDigits[i] = digits[i] ^ otherDigits[i];
+ }
+ var lDigits = l._digits;
+ for (var i = m; i < resultUsed; i++) {
+ resultDigits[i] = lDigits[i];
+ }
+ return new _BigIntImpl._(isNegative, resultUsed, resultDigits);
+ }
+
+ /**
+ * Bit-wise and operator.
+ *
+ * Treating both `this` and [other] as sufficiently large two's component
+ * integers, the result is a number with only the bits set that are set in
+ * both `this` and [other]
+ *
+ * Of both operands are negative, the result is negative, otherwise
+ * the result is non-negative.
+ */
+ _BigIntImpl operator &(BigInt bigInt) {
+ _BigIntImpl other = bigInt;
+ if (_isNegative == other._isNegative) {
+ if (_isNegative) {
+ // (-this) & (-other) == ~(this-1) & ~(other-1)
+ // == ~((this-1) | (other-1))
+ // == -(((this-1) | (other-1)) + 1)
+ _BigIntImpl this1 = _absSubSetSign(one, true);
+ _BigIntImpl other1 = other._absSubSetSign(one, true);
+ // Result cannot be zero if this and other are negative.
+ return this1._absOrSetSign(other1, true)._absAddSetSign(one, true);
+ }
+ return _absAndSetSign(other, false);
+ }
+ // _isNegative != other._isNegative
+ var p, n;
+ if (_isNegative) {
+ p = other;
+ n = this;
+ } else {
+ // & is symmetric.
+ p = this;
+ n = other;
+ }
+ // p & (-n) == p & ~(n-1) == p &~ (n-1)
+ var n1 = n._absSubSetSign(one, false);
+ return p._absAndNotSetSign(n1, false);
+ }
+
+ /**
+ * Bit-wise or operator.
+ *
+ * Treating both `this` and [other] as sufficiently large two's component
+ * integers, the result is a number with the bits set that are set in either
+ * of `this` and [other]
+ *
+ * If both operands are non-negative, the result is non-negative,
+ * otherwise the result us negative.
+ */
+ _BigIntImpl operator |(BigInt bigInt) {
+ _BigIntImpl other = bigInt;
+ if (_isNegative == other._isNegative) {
+ if (_isNegative) {
+ // (-this) | (-other) == ~(this-1) | ~(other-1)
+ // == ~((this-1) & (other-1))
+ // == -(((this-1) & (other-1)) + 1)
+ var this1 = _absSubSetSign(one, true);
+ var other1 = other._absSubSetSign(one, true);
+ // Result cannot be zero if this and a are negative.
+ return this1._absAndSetSign(other1, true)._absAddSetSign(one, true);
+ }
+ return _absOrSetSign(other, false);
+ }
+ // _neg != a._neg
+ var p, n;
+ if (_isNegative) {
+ p = other;
+ n = this;
+ } else {
+ // | is symmetric.
+ p = this;
+ n = other;
+ }
+ // p | (-n) == p | ~(n-1) == ~((n-1) &~ p) == -(~((n-1) &~ p) + 1)
+ var n1 = n._absSubSetSign(one, true);
+ // Result cannot be zero if only one of this or a is negative.
+ return n1._absAndNotSetSign(p, true)._absAddSetSign(one, true);
+ }
+
+ /**
+ * Bit-wise exclusive-or operator.
+ *
+ * Treating both `this` and [other] as sufficiently large two's component
+ * integers, the result is a number with the bits set that are set in one,
+ * but not both, of `this` and [other]
+ *
+ * If the operands have the same sign, the result is non-negative,
+ * otherwise the result is negative.
+ */
+ _BigIntImpl operator ^(BigInt bigInt) {
+ _BigIntImpl other = bigInt;
+ if (_isNegative == other._isNegative) {
+ if (_isNegative) {
+ // (-this) ^ (-other) == ~(this-1) ^ ~(other-1) == (this-1) ^ (other-1)
+ var this1 = _absSubSetSign(one, true);
+ var other1 = other._absSubSetSign(one, true);
+ return this1._absXorSetSign(other1, false);
+ }
+ return _absXorSetSign(other, false);
+ }
+ // _isNegative != a._isNegative
+ var p, n;
+ if (_isNegative) {
+ p = other;
+ n = this;
+ } else {
+ // ^ is symmetric.
+ p = this;
+ n = other;
+ }
+ // p ^ (-n) == p ^ ~(n-1) == ~(p ^ (n-1)) == -((p ^ (n-1)) + 1)
+ var n1 = n._absSubSetSign(one, true);
+ // Result cannot be zero if only one of this or a is negative.
+ return p._absXorSetSign(n1, true)._absAddSetSign(one, true);
+ }
+
+ /**
+ * The bit-wise negate operator.
+ *
+ * Treating `this` as a sufficiently large two's component integer,
+ * the result is a number with the opposite bits set.
+ *
+ * This maps any integer `x` to `-x - 1`.
+ */
+ _BigIntImpl operator ~() {
+ if (_isNegative) {
+ // ~(-this) == ~(~(this-1)) == this-1
+ return _absSubSetSign(one, false);
+ }
+ // ~this == -this-1 == -(this+1)
+ // Result cannot be zero if this is positive.
+ return _absAddSetSign(one, true);
+ }
+
+ /// Addition operator.
+ _BigIntImpl operator +(BigInt bigInt) {
+ _BigIntImpl other = bigInt;
+ var isNegative = _isNegative;
+ if (isNegative == other._isNegative) {
+ // this + other == this + other
+ // (-this) + (-other) == -(this + other)
+ return _absAddSetSign(other, isNegative);
+ }
+ // this + (-other) == this - other == -(this - other)
+ // (-this) + other == other - this == -(this - other)
+ if (_absCompare(other) >= 0) {
+ return _absSubSetSign(other, isNegative);
+ }
+ return other._absSubSetSign(this, !isNegative);
+ }
+
+ /// Subtraction operator.
+ _BigIntImpl operator -(BigInt bigInt) {
+ _BigIntImpl other = bigInt;
+ var isNegative = _isNegative;
+ if (isNegative != other._isNegative) {
+ // this - (-other) == this + other
+ // (-this) - other == -(this + other)
+ return _absAddSetSign(other, isNegative);
+ }
+ // this - other == this - a == -(this - other)
+ // (-this) - (-other) == other - this == -(this - other)
+ if (_absCompare(other) >= 0) {
+ return _absSubSetSign(other, isNegative);
+ }
+ return other._absSubSetSign(this, !isNegative);
+ }
+
+ /// Multiplies [x] with [multiplicandDigits] and adds the result to
+ /// [accumulatorDigits].
+ ///
+ /// The [multiplicandDigits] in the range [i] to [i]+[n]-1 are the
+ /// multiplicand digits.
+ ///
+ /// The [acculumatorDigits] in the range [j] to [j]+[n]-1 are the accumulator
+ /// digits.
+ ///
+ /// Adds the result of the multiplicand-digits * [x] to the accumulator.
+ ///
+ /// Concretely: `accumulatorDigits[j..j+n] += x * m_digits[i..i+n-1]`.
+ static void _mulAdd(int x, Uint16List multiplicandDigits, int i,
+ Uint16List accumulatorDigits, int j, int n) {
+ if (x == 0) {
+ // No-op if x is 0.
+ return;
+ }
+ int c = 0;
+ while (--n >= 0) {
+ int product = x * multiplicandDigits[i++];
+ int combined = product + accumulatorDigits[j] + c;
+ accumulatorDigits[j++] = combined & _digitMask;
+ // Note that this works with 53 bits, as the division will not lose
+ // bits.
+ c = combined ~/ _digitBase;
+ }
+ while (c != 0) {
+ int l = accumulatorDigits[j] + c;
+ accumulatorDigits[j++] = l & _digitMask;
+ c = l ~/ _digitBase;
+ }
+ }
+
+ /// Multiplication operator.
+ _BigIntImpl operator *(BigInt bigInt) {
+ _BigIntImpl other = bigInt;
+ var used = _used;
+ var otherUsed = other._used;
+ if (used == 0 || otherUsed == 0) {
+ return zero;
+ }
+ var resultUsed = used + otherUsed;
+ var digits = _digits;
+ var otherDigits = other._digits;
+ var resultDigits = new Uint16List(resultUsed);
+ var i = 0;
+ while (i < otherUsed) {
+ _mulAdd(otherDigits[i], digits, 0, resultDigits, i, used);
+ i++;
+ }
+ return new _BigIntImpl._(
+ _isNegative != other._isNegative, resultUsed, resultDigits);
+ }
+
+ // r_digits[0..rUsed-1] = xDigits[0..xUsed-1]*otherDigits[0..otherUsed-1].
+ // Return resultUsed = xUsed + otherUsed.
+ static int _mulDigits(Uint16List xDigits, int xUsed, Uint16List otherDigits,
+ int otherUsed, Uint16List resultDigits) {
+ var resultUsed = xUsed + otherUsed;
+ var i = resultUsed;
+ assert(resultDigits.length >= i);
+ while (--i >= 0) {
+ resultDigits[i] = 0;
+ }
+ i = 0;
+ while (i < otherUsed) {
+ _mulAdd(otherDigits[i], xDigits, 0, resultDigits, i, xUsed);
+ i++;
+ }
+ return resultUsed;
+ }
+
+ /// Returns an estimate of `digits[i-1..i] ~/ topDigitDivisor`.
+ static int _estimateQuotientDigit(
+ int topDigitDivisor, Uint16List digits, int i) {
+ if (digits[i] == topDigitDivisor) return _digitMask;
+ var quotientDigit =
+ (digits[i] << _digitBits | digits[i - 1]) ~/ topDigitDivisor;
+ if (quotientDigit > _digitMask) return _digitMask;
+ return quotientDigit;
+ }
+
+ /// Returns `trunc(this / other)`, with `other != 0`.
+ _BigIntImpl _div(BigInt bigInt) {
+ _BigIntImpl other = bigInt;
+ assert(other._used > 0);
+ if (_used < other._used) {
+ return zero;
+ }
+ _divRem(other);
+ // Return quotient, i.e.
+ // _lastQuoRem_digits[_lastRem_used.._lastQuoRem_used-1] with proper sign.
+ var lastQuo_used = _lastQuoRemUsed - _lastRemUsed;
+ var quo_digits = _cloneDigits(
+ _lastQuoRemDigits, _lastRemUsed, _lastQuoRemUsed, lastQuo_used);
+ var quo = new _BigIntImpl._(false, lastQuo_used, quo_digits);
+ if ((_isNegative != other._isNegative) && (quo._used > 0)) {
+ quo = -quo;
+ }
+ return quo;
+ }
+
+ /// Returns `this - other * trunc(this / other)`, with `other != 0`.
+ _BigIntImpl _rem(BigInt bigInt) {
+ _BigIntImpl other = bigInt;
+ assert(other._used > 0);
+ if (_used < other._used) {
+ return this;
+ }
+ _divRem(other);
+ // Return remainder, i.e.
+ // denormalized _lastQuoRem_digits[0.._lastRem_used-1] with proper sign.
+ var remDigits =
+ _cloneDigits(_lastQuoRemDigits, 0, _lastRemUsed, _lastRemUsed);
+ var rem = new _BigIntImpl._(false, _lastRemUsed, remDigits);
+ if (_lastRem_nsh > 0) {
+ rem = rem >> _lastRem_nsh; // Denormalize remainder.
+ }
+ if (_isNegative && (rem._used > 0)) {
+ rem = -rem;
+ }
+ return rem;
+ }
+
+ /// Computes this ~/ other and this.remainder(other).
+ ///
+ /// Stores the result in [_lastQuoRemDigits], [_lastQuoRemUsed] and
+ /// [_lastRemUsed]. The [_lastQuoRemDigits] contains the digits of *both*, the
+ /// quotient and the remainder.
+ ///
+ /// Caches the input to avoid doing the work again when users write
+ /// `a ~/ b` followed by a `a % b`.
+ void _divRem(_BigIntImpl other) {
+ // Check if result is already cached.
+ if ((this._used == _lastDividendUsed) &&
+ (other._used == _lastDivisorUsed) &&
+ identical(this._digits, _lastDividendDigits) &&
+ identical(other._digits, _lastDivisorDigits)) {
+ return;
+ }
+ assert(_used >= other._used);
+
+ var nsh = _digitBits - other._digits[other._used - 1].bitLength;
+ // Concatenated positive quotient and normalized positive remainder.
+ // The resultDigits can have at most one more digit than the dividend.
+ Uint16List resultDigits;
+ int resultUsed;
+ // Normalized positive divisor.
+ // The normalized divisor has the most-significant bit of it's most
+ // significant digit set.
+ // This makes estimating the quotient easier.
+ Uint16List yDigits;
+ int yUsed;
+ if (nsh > 0) {
+ yDigits = new Uint16List(other._used + 5);
+ yUsed = _lShiftDigits(other._digits, other._used, nsh, yDigits);
+ resultDigits = new Uint16List(_used + 5);
+ resultUsed = _lShiftDigits(_digits, _used, nsh, resultDigits);
+ } else {
+ yDigits = other._digits;
+ yUsed = other._used;
+ resultDigits = _cloneDigits(_digits, 0, _used, _used + 2);
+ resultUsed = _used;
+ }
+ var topDigitDivisor = yDigits[yUsed - 1];
+ var i = resultUsed;
+ var j = i - yUsed;
+ // tmpDigits is a temporary array of i (resultUsed) digits.
+ var tmpDigits = new Uint16List(i);
+ var tmpUsed = _dlShiftDigits(yDigits, yUsed, j, tmpDigits);
+ // Explicit first division step in case normalized dividend is larger or
+ // equal to shifted normalized divisor.
+ if (_compareDigits(resultDigits, resultUsed, tmpDigits, tmpUsed) >= 0) {
+ assert(i == resultUsed);
+ resultDigits[resultUsed++] = 1; // Quotient = 1.
+ // Subtract divisor from remainder.
+ _absSub(resultDigits, resultUsed, tmpDigits, tmpUsed, resultDigits);
+ } else {
+ // Account for possible carry in _mulAdd step.
+ resultDigits[resultUsed++] = 0;
+ }
+
+ // Negate y so we can later use _mulAdd instead of non-existent _mulSub.
+ var nyDigits = new Uint16List(yUsed + 2);
+ nyDigits[yUsed] = 1;
+ _absSub(nyDigits, yUsed + 1, yDigits, yUsed, nyDigits);
+ // nyDigits is read-only and has yUsed digits (possibly including several
+ // leading zeros).
+ // resultDigits is modified during iteration.
+ // resultDigits[0..yUsed-1] is the current remainder.
+ // resultDigits[yUsed..resultUsed-1] is the current quotient.
+ --i;
+
+ while (j > 0) {
+ var estimatedQuotientDigit =
+ _estimateQuotientDigit(topDigitDivisor, resultDigits, i);
+ j--;
+ _mulAdd(estimatedQuotientDigit, nyDigits, 0, resultDigits, j, yUsed);
+ if (resultDigits[i] < estimatedQuotientDigit) {
+ // Reusing the already existing tmpDigits array.
+ var tmpUsed = _dlShiftDigits(nyDigits, yUsed, j, tmpDigits);
+ _absSub(resultDigits, resultUsed, tmpDigits, tmpUsed, resultDigits);
+ while (resultDigits[i] < --estimatedQuotientDigit) {
+ _absSub(resultDigits, resultUsed, tmpDigits, tmpUsed, resultDigits);
+ }
+ }
+ i--;
+ }
+ // Cache result.
+ _lastDividendDigits = _digits;
+ _lastDividendUsed = _used;
+ _lastDivisorDigits = other._digits;
+ _lastDivisorUsed = other._used;
+ _lastQuoRemDigits = resultDigits;
+ _lastQuoRemUsed = resultUsed;
+ _lastRemUsed = yUsed;
+ _lastRem_nsh = nsh;
+ }
+
+ int get hashCode {
+ // This is the [Jenkins hash function][1] but using masking to keep
+ // values in SMI range.
+ //
+ // [1]: http://en.wikipedia.org/wiki/Jenkins_hash_function
+
+ int combine(int hash, int value) {
+ hash = 0x1fffffff & (hash + value);
+ hash = 0x1fffffff & (hash + ((0x0007ffff & hash) << 10));
+ return hash ^ (hash >> 6);
+ }
+
+ int finish(int hash) {
+ hash = 0x1fffffff & (hash + ((0x03ffffff & hash) << 3));
+ hash = hash ^ (hash >> 11);
+ return 0x1fffffff & (hash + ((0x00003fff & hash) << 15));
+ }
+
+ if (_isZero) return 6707; // Just a random number.
+ var hash = _isNegative ? 83585 : 429689; // Also random.
+ for (int i = 0; i < _used; i++) {
+ hash = combine(hash, _digits[i]);
+ }
+ return finish(hash);
+ }
+
+ /**
+ * Test whether this value is numerically equal to `other`.
+ *
+ * If [other] is a [_BigIntImpl] returns whether the two operands have the same
+ * value.
+ *
+ * Returns false if `other` is not a [_BigIntImpl].
+ */
+ bool operator ==(Object other) =>
+ other is _BigIntImpl && compareTo(other) == 0;
+
+ /**
+ * Returns the minimum number of bits required to store this big integer.
+ *
+ * The number of bits excludes the sign bit, which gives the natural length
+ * for non-negative (unsigned) values. Negative values are complemented to
+ * return the bit position of the first bit that differs from the sign bit.
+ *
+ * To find the number of bits needed to store the value as a signed value,
+ * add one, i.e. use `x.bitLength + 1`.
+ *
+ * ```
+ * x.bitLength == (-x-1).bitLength
+ *
+ * new BigInt.from(3).bitLength == 2; // 00000011
+ * new BigInt.from(2).bitLength == 2; // 00000010
+ * new BigInt.from(1).bitLength == 1; // 00000001
+ * new BigInt.from(0).bitLength == 0; // 00000000
+ * new BigInt.from(-1).bitLength == 0; // 11111111
+ * new BigInt.from(-2).bitLength == 1; // 11111110
+ * new BigInt.from(-3).bitLength == 2; // 11111101
+ * new BigInt.from(-4).bitLength == 2; // 11111100
+ * ```
+ */
+ int get bitLength {
+ if (_used == 0) return 0;
+ if (_isNegative) return (~this).bitLength;
+ return _digitBits * (_used - 1) + _digits[_used - 1].bitLength;
+ }
+
+ /**
+ * Truncating division operator.
+ *
+ * Performs a truncating integer division, where the remainder is discarded.
+ *
+ * The remainder can be computed using the [remainder] method.
+ *
+ * Examples:
+ * ```
+ * var seven = new BigInt.from(7);
+ * var three = new BigInt.from(3);
+ * seven ~/ three; // => 2
+ * (-seven) ~/ three; // => -2
+ * seven ~/ -three; // => -2
+ * seven.remainder(three); // => 1
+ * (-seven).remainder(three); // => -1
+ * seven.remainder(-three); // => 1
+ * ```
+ */
+ _BigIntImpl operator ~/(BigInt bigInt) {
+ _BigIntImpl other = bigInt;
+ if (other._used == 0) {
+ throw const IntegerDivisionByZeroException();
+ }
+ return _div(other);
+ }
+
+ /**
+ * Returns the remainder of the truncating division of `this` by [other].
+ *
+ * The result `r` of this operation satisfies:
+ * `this == (this ~/ other) * other + r`.
+ * As a consequence the remainder `r` has the same sign as the divider `this`.
+ */
+ _BigIntImpl remainder(BigInt bigInt) {
+ _BigIntImpl other = bigInt;
+ if (other._used == 0) {
+ throw const IntegerDivisionByZeroException();
+ }
+ return _rem(other);
+ }
+
+ /// Division operator.
+ double operator /(BigInt other) => this.toDouble() / other.toDouble();
+
+ /** Relational less than operator. */
+ bool operator <(BigInt other) => compareTo(other) < 0;
+
+ /** Relational less than or equal operator. */
+ bool operator <=(BigInt other) => compareTo(other) <= 0;
+
+ /** Relational greater than operator. */
+ bool operator >(BigInt other) => compareTo(other) > 0;
+
+ /** Relational greater than or equal operator. */
+ bool operator >=(BigInt other) => compareTo(other) >= 0;
+
+ /**
+ * Euclidean modulo operator.
+ *
+ * Returns the remainder of the Euclidean division. The Euclidean division of
+ * two integers `a` and `b` yields two integers `q` and `r` such that
+ * `a == b * q + r` and `0 <= r < b.abs()`.
+ *
+ * The sign of the returned value `r` is always positive.
+ *
+ * See [remainder] for the remainder of the truncating division.
+ */
+ _BigIntImpl operator %(BigInt bigInt) {
+ _BigIntImpl other = bigInt;
+ if (other._used == 0) {
+ throw const IntegerDivisionByZeroException();
+ }
+ var result = _rem(other);
+ if (result._isNegative) {
+ if (other._isNegative) {
+ result = result - other;
+ } else {
+ result = result + other;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Returns the sign of this big integer.
+ *
+ * Returns 0 for zero, -1 for values less than zero and
+ * +1 for values greater than zero.
+ */
+ int get sign {
+ if (_used == 0) return 0;
+ return _isNegative ? -1 : 1;
+ }
+
+ /// Whether this big integer is even.
+ bool get isEven => _used == 0 || (_digits[0] & 1) == 0;
+
+ /// Whether this big integer is odd.
+ bool get isOdd => !isEven;
+
+ /// Whether this number is negative.
+ bool get isNegative => _isNegative;
+
+ _BigIntImpl pow(int exponent) {
+ if (exponent < 0) {
+ throw new ArgumentError("Exponent must not be negative: $exponent");
+ }
+ if (exponent == 0) return one;
+
+ // Exponentiation by squaring.
+ var result = one;
+ var base = this;
+ while (exponent != 0) {
+ if ((exponent & 1) == 1) {
+ result *= base;
+ }
+ exponent >>= 1;
+ // Skip unnecessary operation.
+ if (exponent != 0) {
+ base *= base;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Returns this integer to the power of [exponent] modulo [modulus].
+ *
+ * The [exponent] must be non-negative and [modulus] must be
+ * positive.
+ */
+ _BigIntImpl modPow(BigInt bigExponent, BigInt bigModulus) {
+ _BigIntImpl exponent = bigExponent;
+ _BigIntImpl modulus = bigModulus;
+ if (exponent._isNegative) {
+ throw new ArgumentError("exponent must be positive: $exponent");
+ }
+ if (modulus <= zero) {
+ throw new ArgumentError("modulus must be strictly positive: $modulus");
+ }
+ if (exponent._isZero) return one;
+
+ final modulusUsed = modulus._used;
+ final modulusUsed2p4 = 2 * modulusUsed + 4;
+ final exponentBitlen = exponent.bitLength;
+ if (exponentBitlen <= 0) return one;
+ _BigIntReduction z = new _BigIntClassic(modulus);
+ var resultDigits = new Uint16List(modulusUsed2p4);
+ var result2Digits = new Uint16List(modulusUsed2p4);
+ var gDigits = new Uint16List(modulusUsed);
+ var gUsed = z.convert(this, gDigits);
+ // Initialize result with g.
+ // Copy leading zero if any.
+ for (int j = gUsed - 1; j >= 0; j--) {
+ resultDigits[j] = gDigits[j];
+ }
+ var resultUsed = gUsed;
+ var result2Used;
+ for (int i = exponentBitlen - 2; i >= 0; i--) {
+ result2Used = z.sqr(resultDigits, resultUsed, result2Digits);
+ if (!(exponent & (one << i))._isZero) {
+ resultUsed =
+ z.mul(result2Digits, result2Used, gDigits, gUsed, resultDigits);
+ } else {
+ // Swap result and result2.
+ var tmpDigits = resultDigits;
+ var tmpUsed = resultUsed;
+ resultDigits = result2Digits;
+ resultUsed = result2Used;
+ result2Digits = tmpDigits;
+ result2Used = tmpUsed;
+ }
+ }
+ return z.revert(resultDigits, resultUsed);
+ }
+
+ // If inv is false, returns gcd(x, y).
+ // If inv is true and gcd(x, y) = 1, returns d, so that c*x + d*y = 1.
+ // If inv is true and gcd(x, y) != 1, throws Exception("Not coprime").
+ static _BigIntImpl _binaryGcd(_BigIntImpl x, _BigIntImpl y, bool inv) {
+ var xDigits = x._digits;
+ var yDigits = y._digits;
+ var xUsed = x._used;
+ var yUsed = y._used;
+ var maxUsed = xUsed > yUsed ? xUsed : yUsed;
+ var unshiftedMaxUsed = maxUsed; // Keep
+ xDigits = _cloneDigits(xDigits, 0, xUsed, maxUsed);
+ yDigits = _cloneDigits(yDigits, 0, yUsed, maxUsed);
+ int shiftAmount = 0;
+ if (inv) {
+ if ((yUsed == 1) && (yDigits[0] == 1)) return one;
+ if ((yUsed == 0) || (yDigits[0].isEven && xDigits[0].isEven)) {
+ throw new Exception("Not coprime");
+ }
+ } else {
+ if (x._isZero) {
+ throw new ArgumentError.value(0, "this", "must not be zero");
+ }
+ if (y._isZero) {
+ throw new ArgumentError.value(0, "other", "must not be zero");
+ }
+ if (((xUsed == 1) && (xDigits[0] == 1)) ||
+ ((yUsed == 1) && (yDigits[0] == 1))) return one;
+ while (((xDigits[0] & 1) == 0) && ((yDigits[0] & 1) == 0)) {
+ _rsh(xDigits, xUsed, 1, xDigits);
+ _rsh(yDigits, yUsed, 1, yDigits);
+ shiftAmount++;
+ }
+ if (shiftAmount >= _digitBits) {
+ var digitShiftAmount = shiftAmount ~/ _digitBits;
+ xUsed -= digitShiftAmount;
+ yUsed -= digitShiftAmount;
+ maxUsed -= digitShiftAmount;
+ }
+ if ((yDigits[0] & 1) == 1) {
+ // Swap x and y.
+ var tmpDigits = xDigits;
+ var tmpUsed = xUsed;
+ xDigits = yDigits;
+ xUsed = yUsed;
+ yDigits = tmpDigits;
+ yUsed = tmpUsed;
+ }
+ }
+ var uDigits = _cloneDigits(xDigits, 0, xUsed, unshiftedMaxUsed);
+ var vDigits =
+ _cloneDigits(yDigits, 0, yUsed, unshiftedMaxUsed + 2); // +2 for lsh.
+ final bool ac = (xDigits[0] & 1) == 0;
+
+ // Variables a, b, c, and d require one more digit.
+ final abcdUsed = maxUsed + 1;
+ final abcdLen = abcdUsed + 2; // +2 to satisfy _absAdd.
+ var aDigits, bDigits, cDigits, dDigits;
+ bool aIsNegative, bIsNegative, cIsNegative, dIsNegative;
+ if (ac) {
+ aDigits = new Uint16List(abcdLen);
+ aIsNegative = false;
+ aDigits[0] = 1;
+ cDigits = new Uint16List(abcdLen);
+ cIsNegative = false;
+ }
+ bDigits = new Uint16List(abcdLen);
+ bIsNegative = false;
+ dDigits = new Uint16List(abcdLen);
+ dIsNegative = false;
+ dDigits[0] = 1;
+
+ while (true) {
+ while ((uDigits[0] & 1) == 0) {
+ _rsh(uDigits, maxUsed, 1, uDigits);
+ if (ac) {
+ if (((aDigits[0] & 1) == 1) || ((bDigits[0] & 1) == 1)) {
+ if (aIsNegative) {
+ if ((aDigits[maxUsed] != 0) ||
+ (_compareDigits(aDigits, maxUsed, yDigits, maxUsed)) > 0) {
+ _absSub(aDigits, abcdUsed, yDigits, maxUsed, aDigits);
+ } else {
+ _absSub(yDigits, maxUsed, aDigits, maxUsed, aDigits);
+ aIsNegative = false;
+ }
+ } else {
+ _absAdd(aDigits, abcdUsed, yDigits, maxUsed, aDigits);
+ }
+ if (bIsNegative) {
+ _absAdd(bDigits, abcdUsed, xDigits, maxUsed, bDigits);
+ } else if ((bDigits[maxUsed] != 0) ||
+ (_compareDigits(bDigits, maxUsed, xDigits, maxUsed) > 0)) {
+ _absSub(bDigits, abcdUsed, xDigits, maxUsed, bDigits);
+ } else {
+ _absSub(xDigits, maxUsed, bDigits, maxUsed, bDigits);
+ bIsNegative = true;
+ }
+ }
+ _rsh(aDigits, abcdUsed, 1, aDigits);
+ } else if ((bDigits[0] & 1) == 1) {
+ if (bIsNegative) {
+ _absAdd(bDigits, abcdUsed, xDigits, maxUsed, bDigits);
+ } else if ((bDigits[maxUsed] != 0) ||
+ (_compareDigits(bDigits, maxUsed, xDigits, maxUsed) > 0)) {
+ _absSub(bDigits, abcdUsed, xDigits, maxUsed, bDigits);
+ } else {
+ _absSub(xDigits, maxUsed, bDigits, maxUsed, bDigits);
+ bIsNegative = true;
+ }
+ }
+ _rsh(bDigits, abcdUsed, 1, bDigits);
+ }
+ while ((vDigits[0] & 1) == 0) {
+ _rsh(vDigits, maxUsed, 1, vDigits);
+ if (ac) {
+ if (((cDigits[0] & 1) == 1) || ((dDigits[0] & 1) == 1)) {
+ if (cIsNegative) {
+ if ((cDigits[maxUsed] != 0) ||
+ (_compareDigits(cDigits, maxUsed, yDigits, maxUsed) > 0)) {
+ _absSub(cDigits, abcdUsed, yDigits, maxUsed, cDigits);
+ } else {
+ _absSub(yDigits, maxUsed, cDigits, maxUsed, cDigits);
+ cIsNegative = false;
+ }
+ } else {
+ _absAdd(cDigits, abcdUsed, yDigits, maxUsed, cDigits);
+ }
+ if (dIsNegative) {
+ _absAdd(dDigits, abcdUsed, xDigits, maxUsed, dDigits);
+ } else if ((dDigits[maxUsed] != 0) ||
+ (_compareDigits(dDigits, maxUsed, xDigits, maxUsed) > 0)) {
+ _absSub(dDigits, abcdUsed, xDigits, maxUsed, dDigits);
+ } else {
+ _absSub(xDigits, maxUsed, dDigits, maxUsed, dDigits);
+ dIsNegative = true;
+ }
+ }
+ _rsh(cDigits, abcdUsed, 1, cDigits);
+ } else if ((dDigits[0] & 1) == 1) {
+ if (dIsNegative) {
+ _absAdd(dDigits, abcdUsed, xDigits, maxUsed, dDigits);
+ } else if ((dDigits[maxUsed] != 0) ||
+ (_compareDigits(dDigits, maxUsed, xDigits, maxUsed) > 0)) {
+ _absSub(dDigits, abcdUsed, xDigits, maxUsed, dDigits);
+ } else {
+ _absSub(xDigits, maxUsed, dDigits, maxUsed, dDigits);
+ dIsNegative = true;
+ }
+ }
+ _rsh(dDigits, abcdUsed, 1, dDigits);
+ }
+ if (_compareDigits(uDigits, maxUsed, vDigits, maxUsed) >= 0) {
+ _absSub(uDigits, maxUsed, vDigits, maxUsed, uDigits);
+ if (ac) {
+ if (aIsNegative == cIsNegative) {
+ var a_cmp_c = _compareDigits(aDigits, abcdUsed, cDigits, abcdUsed);
+ if (a_cmp_c > 0) {
+ _absSub(aDigits, abcdUsed, cDigits, abcdUsed, aDigits);
+ } else {
+ _absSub(cDigits, abcdUsed, aDigits, abcdUsed, aDigits);
+ aIsNegative = !aIsNegative && (a_cmp_c != 0);
+ }
+ } else {
+ _absAdd(aDigits, abcdUsed, cDigits, abcdUsed, aDigits);
+ }
+ }
+ if (bIsNegative == dIsNegative) {
+ var b_cmp_d = _compareDigits(bDigits, abcdUsed, dDigits, abcdUsed);
+ if (b_cmp_d > 0) {
+ _absSub(bDigits, abcdUsed, dDigits, abcdUsed, bDigits);
+ } else {
+ _absSub(dDigits, abcdUsed, bDigits, abcdUsed, bDigits);
+ bIsNegative = !bIsNegative && (b_cmp_d != 0);
+ }
+ } else {
+ _absAdd(bDigits, abcdUsed, dDigits, abcdUsed, bDigits);
+ }
+ } else {
+ _absSub(vDigits, maxUsed, uDigits, maxUsed, vDigits);
+ if (ac) {
+ if (cIsNegative == aIsNegative) {
+ var c_cmp_a = _compareDigits(cDigits, abcdUsed, aDigits, abcdUsed);
+ if (c_cmp_a > 0) {
+ _absSub(cDigits, abcdUsed, aDigits, abcdUsed, cDigits);
+ } else {
+ _absSub(aDigits, abcdUsed, cDigits, abcdUsed, cDigits);
+ cIsNegative = !cIsNegative && (c_cmp_a != 0);
+ }
+ } else {
+ _absAdd(cDigits, abcdUsed, aDigits, abcdUsed, cDigits);
+ }
+ }
+ if (dIsNegative == bIsNegative) {
+ var d_cmp_b = _compareDigits(dDigits, abcdUsed, bDigits, abcdUsed);
+ if (d_cmp_b > 0) {
+ _absSub(dDigits, abcdUsed, bDigits, abcdUsed, dDigits);
+ } else {
+ _absSub(bDigits, abcdUsed, dDigits, abcdUsed, dDigits);
+ dIsNegative = !dIsNegative && (d_cmp_b != 0);
+ }
+ } else {
+ _absAdd(dDigits, abcdUsed, bDigits, abcdUsed, dDigits);
+ }
+ }
+ // Exit loop if u == 0.
+ var i = maxUsed;
+ while ((i > 0) && (uDigits[i - 1] == 0)) --i;
+ if (i == 0) break;
+ }
+ if (!inv) {
+ if (shiftAmount > 0) {
+ maxUsed = _lShiftDigits(vDigits, maxUsed, shiftAmount, vDigits);
+ }
+ return new _BigIntImpl._(false, maxUsed, vDigits);
+ }
+ // No inverse if v != 1.
+ var i = maxUsed - 1;
+ while ((i > 0) && (vDigits[i] == 0)) --i;
+ if ((i != 0) || (vDigits[0] != 1)) {
+ throw new Exception("Not coprime");
+ }
+
+ if (dIsNegative) {
+ if ((dDigits[maxUsed] != 0) ||
+ (_compareDigits(dDigits, maxUsed, xDigits, maxUsed) > 0)) {
+ _absSub(dDigits, abcdUsed, xDigits, maxUsed, dDigits);
+ if ((dDigits[maxUsed] != 0) ||
+ (_compareDigits(dDigits, maxUsed, xDigits, maxUsed) > 0)) {
+ _absSub(dDigits, abcdUsed, xDigits, maxUsed, dDigits);
+ } else {
+ _absSub(xDigits, maxUsed, dDigits, maxUsed, dDigits);
+ dIsNegative = false;
+ }
+ } else {
+ _absSub(xDigits, maxUsed, dDigits, maxUsed, dDigits);
+ dIsNegative = false;
+ }
+ } else if ((dDigits[maxUsed] != 0) ||
+ (_compareDigits(dDigits, maxUsed, xDigits, maxUsed) > 0)) {
+ _absSub(dDigits, abcdUsed, xDigits, maxUsed, dDigits);
+ if ((dDigits[maxUsed] != 0) ||
+ (_compareDigits(dDigits, maxUsed, xDigits, maxUsed) > 0)) {
+ _absSub(dDigits, abcdUsed, xDigits, maxUsed, dDigits);
+ }
+ }
+ return new _BigIntImpl._(false, maxUsed, dDigits);
+ }
+
+ /**
+ * Returns the modular multiplicative inverse of this big integer
+ * modulo [modulus].
+ *
+ * The [modulus] must be positive.
+ *
+ * It is an error if no modular inverse exists.
+ */
+ // Returns 1/this % modulus, with modulus > 0.
+ _BigIntImpl modInverse(BigInt bigInt) {
+ _BigIntImpl modulus = bigInt;
+ if (modulus <= zero) {
+ throw new ArgumentError("Modulus must be strictly positive: $modulus");
+ }
+ if (modulus == one) return zero;
+ var tmp = this;
+ if (tmp._isNegative || (tmp._absCompare(modulus) >= 0)) {
+ tmp %= modulus;
+ }
+ return _binaryGcd(modulus, tmp, true);
+ }
+
+ /**
+ * Returns the greatest common divisor of this big integer and [other].
+ *
+ * If either number is non-zero, the result is the numerically greatest
+ * integer dividing both `this` and `other`.
+ *
+ * The greatest common divisor is independent of the order,
+ * so `x.gcd(y)` is always the same as `y.gcd(x)`.
+ *
+ * For any integer `x`, `x.gcd(x)` is `x.abs()`.
+ *
+ * If both `this` and `other` is zero, the result is also zero.
+ */
+ _BigIntImpl gcd(BigInt bigInt) {
+ _BigIntImpl other = bigInt;
+ if (_isZero) return other.abs();
+ if (other._isZero) return this.abs();
+ return _binaryGcd(this, other, false);
+ }
+
+ /**
+ * Returns the least significant [width] bits of this big integer as a
+ * non-negative number (i.e. unsigned representation). The returned value has
+ * zeros in all bit positions higher than [width].
+ *
+ * ```
+ * new BigInt.from(-1).toUnsigned(5) == 31 // 11111111 -> 00011111
+ * ```
+ *
+ * This operation can be used to simulate arithmetic from low level languages.
+ * For example, to increment an 8 bit quantity:
+ *
+ * ```
+ * q = (q + 1).toUnsigned(8);
+ * ```
+ *
+ * `q` will count from `0` up to `255` and then wrap around to `0`.
+ *
+ * If the input fits in [width] bits without truncation, the result is the
+ * same as the input. The minimum width needed to avoid truncation of `x` is
+ * given by `x.bitLength`, i.e.
+ *
+ * ```
+ * x == x.toUnsigned(x.bitLength);
+ * ```
+ */
+ _BigIntImpl toUnsigned(int width) {
+ return this & ((one << width) - one);
+ }
+
+ /**
+ * Returns the least significant [width] bits of this integer, extending the
+ * highest retained bit to the sign. This is the same as truncating the value
+ * to fit in [width] bits using an signed 2-s complement representation. The
+ * returned value has the same bit value in all positions higher than [width].
+ *
+ * ```
+ * var big15 = new BigInt.from(15);
+ * var big16 = new BigInt.from(16);
+ * var big239 = new BigInt.from(239);
+ * V--sign bit-V
+ * big16.toSigned(5) == -big16 // 00010000 -> 11110000
+ * big239.toSigned(5) == big15 // 11101111 -> 00001111
+ * ^ ^
+ * ```
+ *
+ * This operation can be used to simulate arithmetic from low level languages.
+ * For example, to increment an 8 bit signed quantity:
+ *
+ * ```
+ * q = (q + 1).toSigned(8);
+ * ```
+ *
+ * `q` will count from `0` up to `127`, wrap to `-128` and count back up to
+ * `127`.
+ *
+ * If the input value fits in [width] bits without truncation, the result is
+ * the same as the input. The minimum width needed to avoid truncation of `x`
+ * is `x.bitLength + 1`, i.e.
+ *
+ * ```
+ * x == x.toSigned(x.bitLength + 1);
+ * ```
+ */
+ _BigIntImpl toSigned(int width) {
+ // The value of binary number weights each bit by a power of two. The
+ // twos-complement value weights the sign bit negatively. We compute the
+ // value of the negative weighting by isolating the sign bit with the
+ // correct power of two weighting and subtracting it from the value of the
+ // lower bits.
+ var signMask = one << (width - 1);
+ return (this & (signMask - one)) - (this & signMask);
+ }
+
+ // TODO(floitsch): implement `isValidInt`.
+ // Remove the comment in [BigInt.isValidInt] when done.
+ bool get isValidInt => true;
+
+ // TODO(floitsch): implement the clamping. It behaves differently on dart2js
+ // and the VM.
+ // Remove the comment in [BigInt.isValidInt] when done.
+ int toInt() {
+ var result = 0;
+ for (int i = _used - 1; i >= 0; i--) {
+ result = result * _digitBase + _digits[i];
+ }
+ return _isNegative ? -result : result;
+ }
+
+ /**
+ * Returns this [_BigIntImpl] as a [double].
+ *
+ * If the number is not representable as a [double], an
+ * approximation is returned. For numerically large integers, the
+ * approximation may be infinite.
+ */
+ double toDouble() {
+ const int exponentBias = 1075;
+ // There are 11 bits for the exponent.
+ // 2047 (all bits set to 1) is reserved for infinity and NaN.
+ // When storing the exponent in the 11 bits, it is biased by exponentBias
+ // to support negative exponents.
+ const int maxDoubleExponent = 2046 - exponentBias;
+ if (_isZero) return 0.0;
+
+ // We fill the 53 bits little-endian.
+ var resultBits = new Uint8List(8);
+
+ var length = _digitBits * (_used - 1) + _digits[_used - 1].bitLength;
+ if (length - 53 > maxDoubleExponent) return double.INFINITY;
+
+ // The most significant bit is for the sign.
+ if (_isNegative) resultBits[7] = 0x80;
+
+ // Write the exponent into bits 1..12:
+ var biasedExponent = length - 53 + exponentBias;
+ resultBits[6] = (biasedExponent & 0xF) << 4;
+ resultBits[7] |= biasedExponent >> 4;
+
+ int cachedBits = 0;
+ int cachedBitsLength = 0;
+ int digitIndex = _used - 1;
+ int readBits(int n) {
+ // Ensure that we have enough bits in [cachedBits].
+ while (cachedBitsLength < n) {
+ int nextDigit;
+ int nextDigitLength = _digitBits; // May get updated.
+ if (digitIndex < 0) {
+ nextDigit = 0;
+ digitIndex--;
+ } else {
+ nextDigit = _digits[digitIndex];
+ if (digitIndex == _used - 1) nextDigitLength = nextDigit.bitLength;
+ digitIndex--;
+ }
+ cachedBits = (cachedBits << nextDigitLength) + nextDigit;
+ cachedBitsLength += nextDigitLength;
+ }
+ // Read the top [n] bits.
+ var result = cachedBits >> (cachedBitsLength - n);
+ // Remove the bits from the cache.
+ cachedBits -= result << (cachedBitsLength - n);
+ cachedBitsLength -= n;
+ return result;
+ }
+
+ // The first leading 1 bit is implicit in the double-representation and can
+ // be discarded.
+ var leadingBits = readBits(5) & 0xF;
+ resultBits[6] |= leadingBits;
+
+ for (int i = 5; i >= 0; i--) {
+ // Get the remaining 48 bits.
+ resultBits[i] = readBits(8);
+ }
+
+ void roundUp() {
+ // Simply consists of adding 1 to the whole 64 bit "number".
+ // It will update the exponent, if necessary.
+ // It might even round up to infinity (which is what we want).
+ var carry = 1;
+ for (int i = 0; i < 8; i++) {
+ if (carry == 0) break;
+ var sum = resultBits[i] + carry;
+ resultBits[i] = sum & 0xFF;
+ carry = sum >> 8;
+ }
+ }
+
+ if (readBits(1) == 1) {
+ if (resultBits[0].isOdd) {
+ // Rounds to even all the time.
+ roundUp();
+ } else {
+ // Round up, if there is at least one other digit that is not 0.
+ if (cachedBits != 0) {
+ // There is already one in the cachedBits.
+ roundUp();
+ } else {
+ for (int i = digitIndex; digitIndex >= 0; i--) {
+ if (_digits[i] != 0) {
+ roundUp();
+ break;
+ }
+ }
+ }
+ }
+ }
+ return resultBits.buffer.asByteData().getFloat64(0, Endian.little);
+ }
+
+ /**
+ * Returns a String-representation of this integer.
+ *
+ * The returned string is parsable by [parse].
+ * For any `_BigIntImpl` `i`, it is guaranteed that
+ * `i == _BigIntImpl.parse(i.toString())`.
+ */
+ String toString() {
+ if (_used == 0) return "0";
+ if (_used == 1) {
+ if (_isNegative) return (-_digits[0]).toString();
+ return _digits[0].toString();
+ }
+
+ // Generate in chunks of 4 digits.
+ // The chunks are in reversed order.
+ var decimalDigitChunks = <String>[];
+ var rest = isNegative ? -this : this;
+ while (rest._used > 1) {
+ var digits4 = rest.remainder(_bigInt10000).toString();
+ decimalDigitChunks.add(digits4);
+ if (digits4.length == 1) decimalDigitChunks.add("000");
+ if (digits4.length == 2) decimalDigitChunks.add("00");
+ if (digits4.length == 3) decimalDigitChunks.add("0");
+ rest = rest ~/ _bigInt10000;
+ }
+ decimalDigitChunks.add(rest._digits[0].toString());
+ if (_isNegative) decimalDigitChunks.add("-");
+ return decimalDigitChunks.reversed.join();
+ }
+
+ int _toRadixCodeUnit(int digit) {
+ const int _0 = 48;
+ const int _a = 97;
+ if (digit < 10) return _0 + digit;
+ return _a + digit - 10;
+ }
+
+ /**
+ * Converts [this] to a string representation in the given [radix].
+ *
+ * In the string representation, lower-case letters are used for digits above
+ * '9', with 'a' being 10 an 'z' being 35.
+ *
+ * The [radix] argument must be an integer in the range 2 to 36.
+ */
+ String toRadixString(int radix) {
+ if (radix > 36) throw new RangeError.range(radix, 2, 36);
+
+ if (_used == 0) return "0";
+
+ if (_used == 1) {
+ var digitString = _digits[0].toRadixString(radix);
+ if (_isNegative) return "-" + digitString;
+ return digitString;
+ }
+
+ if (radix == 16) return _toHexString();
+
+ var base = new _BigIntImpl._fromInt(radix);
+ var reversedDigitCodeUnits = <int>[];
+ var rest = this.abs();
+ while (!rest._isZero) {
+ var digit = rest.remainder(base).toInt();
+ rest = rest ~/ base;
+ reversedDigitCodeUnits.add(_toRadixCodeUnit(digit));
+ }
+ var digitString = new String.fromCharCodes(reversedDigitCodeUnits.reversed);
+ if (_isNegative) return "-" + digitString;
+ return digitString;
+ }
+
+ String _toHexString() {
+ var chars = <int>[];
+ for (int i = 0; i < _used - 1; i++) {
+ int chunk = _digits[i];
+ for (int j = 0; j < (_digitBits ~/ 4); j++) {
+ chars.add(_toRadixCodeUnit(chunk & 0xF));
+ chunk >>= 4;
+ }
+ }
+ var msbChunk = _digits[_used - 1];
+ while (msbChunk != 0) {
+ chars.add(_toRadixCodeUnit(msbChunk & 0xF));
+ msbChunk >>= 4;
+ }
+ if (_isNegative) {
+ const _dash = 45;
+ chars.add(_dash);
+ }
+ return new String.fromCharCodes(chars.reversed);
+ }
+}
+
+// Interface for modular reduction.
+abstract class _BigIntReduction {
+ // Return the number of digits used by r_digits.
+ int convert(_BigIntImpl x, Uint16List r_digits);
+ int mul(Uint16List xDigits, int xUsed, Uint16List yDigits, int yUsed,
+ Uint16List resultDigits);
+ int sqr(Uint16List xDigits, int xUsed, Uint16List resultDigits);
+
+ // Return x reverted to _BigIntImpl.
+ _BigIntImpl revert(Uint16List xDigits, int xUsed);
+}
+
+// Modular reduction using "classic" algorithm.
+class _BigIntClassic implements _BigIntReduction {
+ final _BigIntImpl _modulus; // Modulus.
+ final _BigIntImpl _normalizedModulus; // Normalized _modulus.
+
+ _BigIntClassic(this._modulus)
+ : _normalizedModulus = _modulus <<
+ (_BigIntImpl._digitBits -
+ _modulus._digits[_modulus._used - 1].bitLength);
+
+ int convert(_BigIntImpl x, Uint16List resultDigits) {
+ var digits;
+ var used;
+ if (x._isNegative || x.compareTo(_modulus) >= 0) {
+ var remainder = x._rem(_modulus);
+ if (x._isNegative && !remainder._isNegative && remainder._used > 0) {
+ remainder = _modulus - remainder;
+ }
+ assert(!remainder._isNegative);
+ used = remainder._used;
+ digits = remainder._digits;
+ } else {
+ used = x._used;
+ digits = x._digits;
+ }
+ var i = used; // Copy leading zero if any.
+ while (--i >= 0) {
+ resultDigits[i] = digits[i];
+ }
+ return used;
+ }
+
+ _BigIntImpl revert(Uint16List xDigits, int xUsed) {
+ return new _BigIntImpl._(false, xUsed, xDigits);
+ }
+
+ int _reduce(Uint16List xDigits, int xUsed) {
+ if (xUsed < _modulus._used) {
+ return xUsed;
+ }
+ var reverted = revert(xDigits, xUsed);
+ var rem = reverted._rem(_normalizedModulus);
+ return convert(rem, xDigits);
+ }
+
+ int sqr(Uint16List xDigits, int xUsed, Uint16List resultDigits) {
+ var b = new _BigIntImpl._(false, xUsed, xDigits);
+ var b2 = b * b;
+ for (int i = 0; i < b2._used; i++) {
+ resultDigits[i] = b2._digits[i];
+ }
+ for (int i = b2._used; i < 2 * xUsed; i++) {
+ resultDigits[i] = 0;
+ }
+ return _reduce(resultDigits, 2 * xUsed);
+ }
+
+ int mul(Uint16List xDigits, int xUsed, Uint16List yDigits, int yUsed,
+ Uint16List resultDigits) {
+ var resultUsed =
+ _BigIntImpl._mulDigits(xDigits, xUsed, yDigits, yUsed, resultDigits);
+ return _reduce(resultDigits, resultUsed);
+ }
+}
diff --git a/sdk/lib/core/core.dart b/sdk/lib/core/core.dart
index 0eae3ec..bb46d6c 100644
--- a/sdk/lib/core/core.dart
+++ b/sdk/lib/core/core.dart
@@ -165,9 +165,10 @@
StringConversionSink,
utf8;
import "dart:math" show Random; // Used by List.shuffle.
-import "dart:typed_data" show Uint8List;
+import "dart:typed_data" show Uint8List, Uint16List, Endian;
part "annotations.dart";
+part "bigint.dart";
part "bool.dart";
part "comparable.dart";
part "date_time.dart";
diff --git a/sdk/lib/core/core_sources.gni b/sdk/lib/core/core_sources.gni
index ad8e40d..ce2785e 100644
--- a/sdk/lib/core/core_sources.gni
+++ b/sdk/lib/core/core_sources.gni
@@ -7,6 +7,7 @@
# The above file needs to be first as it lists the parts below.
"annotations.dart",
+ "bigint.dart",
"bool.dart",
"comparable.dart",
"date_time.dart",
diff --git a/sdk/lib/html/dart2js/html_dart2js.dart b/sdk/lib/html/dart2js/html_dart2js.dart
index 0c46647..09a775c 100644
--- a/sdk/lib/html/dart2js/html_dart2js.dart
+++ b/sdk/lib/html/dart2js/html_dart2js.dart
@@ -64,7 +64,8 @@
findDispatchTagForInterceptorClass,
setNativeSubclassDispatchRecord,
makeLeafDispatchRecord,
- registerGlobalObject;
+ registerGlobalObject,
+ applyExtension;
import 'dart:_interceptors'
show
Interceptor,
@@ -9745,6 +9746,7 @@
Future<Entry> _getFile(String path, {Map options}) {
var completer = new Completer<Entry>();
__getFile(path, options: options, successCallback: (value) {
+ applyExtension('FileEntry', value);
completer.complete(value);
}, errorCallback: (error) {
completer.completeError(error);
@@ -17234,6 +17236,7 @@
Future<FileWriter> createWriter() {
var completer = new Completer<FileWriter>();
_createWriter((value) {
+ applyExtension('FileWriter', value);
completer.complete(value);
}, (error) {
completer.completeError(error);
@@ -17253,6 +17256,7 @@
Future<Blob> file() {
var completer = new Completer<Blob>();
_file((value) {
+ applyExtension('Blob', value);
completer.complete(value);
}, (error) {
completer.completeError(error);
@@ -24429,7 +24433,7 @@
String origin,
String lastEventId,
Window source,
- List<MessagePort> messagePorts}) {
+ List<MessagePort> messagePorts: const []}) {
if (source == null) {
source = window;
}
@@ -38402,6 +38406,8 @@
Future<FileSystem> _requestFileSystem(int type, int size) {
var completer = new Completer<FileSystem>();
__requestFileSystem(type, size, (value) {
+ applyExtension('DOMFileSystem', value);
+ applyExtension('DirectoryEntry', value.root);
completer.complete(value);
}, (error) {
completer.completeError(error);
@@ -46052,61 +46058,41 @@
}
var eventObj;
- // In these two branches we create an underlying native KeyboardEvent, but
- // we set it with our specified values. Because we are doing custom setting
- // of certain values (charCode/keyCode, etc) only in this class (as opposed
- // to KeyboardEvent) and the way we set these custom values depends on the
- // type of underlying JS object, we do all the construction for the
- // underlying KeyboardEvent here.
- if (canUseDispatchEvent) {
- // Currently works in everything but Internet Explorer.
- eventObj = new Event.eventType('Event', type,
- canBubble: canBubble, cancelable: cancelable);
- JS('void', '#.keyCode = #', eventObj, keyCode);
- JS('void', '#.which = #', eventObj, keyCode);
- JS('void', '#.charCode = #', eventObj, charCode);
+ // Currently this works on everything but Safari. Safari throws an
+ // "Attempting to change access mechanism for an unconfigurable property"
+ // TypeError when trying to do the Object.defineProperty hack, so we avoid
+ // this branch if possible.
+ // Also, if we want this branch to work in FF, we also need to modify
+ // _initKeyboardEvent to also take charCode and keyCode values to
+ // initialize initKeyEvent.
- JS('void', '#.location = #', eventObj, location);
- JS('void', '#.ctrlKey = #', eventObj, ctrlKey);
- JS('void', '#.altKey = #', eventObj, altKey);
- JS('void', '#.shiftKey = #', eventObj, shiftKey);
- JS('void', '#.metaKey = #', eventObj, metaKey);
- } else {
- // Currently this works on everything but Safari. Safari throws an
- // "Attempting to change access mechanism for an unconfigurable property"
- // TypeError when trying to do the Object.defineProperty hack, so we avoid
- // this branch if possible.
- // Also, if we want this branch to work in FF, we also need to modify
- // _initKeyboardEvent to also take charCode and keyCode values to
- // initialize initKeyEvent.
+ eventObj = new Event.eventType('KeyboardEvent', type,
+ canBubble: canBubble, cancelable: cancelable);
- eventObj = new Event.eventType('KeyboardEvent', type,
- canBubble: canBubble, cancelable: cancelable);
+ // Chromium Hack
+ JS(
+ 'void',
+ "Object.defineProperty(#, 'keyCode', {"
+ " get : function() { return this.keyCodeVal; } })",
+ eventObj);
+ JS(
+ 'void',
+ "Object.defineProperty(#, 'which', {"
+ " get : function() { return this.keyCodeVal; } })",
+ eventObj);
+ JS(
+ 'void',
+ "Object.defineProperty(#, 'charCode', {"
+ " get : function() { return this.charCodeVal; } })",
+ eventObj);
- // Chromium Hack
- JS(
- 'void',
- "Object.defineProperty(#, 'keyCode', {"
- " get : function() { return this.keyCodeVal; } })",
- eventObj);
- JS(
- 'void',
- "Object.defineProperty(#, 'which', {"
- " get : function() { return this.keyCodeVal; } })",
- eventObj);
- JS(
- 'void',
- "Object.defineProperty(#, 'charCode', {"
- " get : function() { return this.charCodeVal; } })",
- eventObj);
+ var keyIdentifier = _convertToHexString(charCode, keyCode);
+ eventObj._initKeyboardEvent(type, canBubble, cancelable, view,
+ keyIdentifier, location, ctrlKey, altKey, shiftKey, metaKey);
+ JS('void', '#.keyCodeVal = #', eventObj, keyCode);
+ JS('void', '#.charCodeVal = #', eventObj, charCode);
- var keyIdentifier = _convertToHexString(charCode, keyCode);
- eventObj._initKeyboardEvent(type, canBubble, cancelable, view,
- keyIdentifier, location, ctrlKey, altKey, shiftKey, metaKey);
- JS('void', '#.keyCodeVal = #', eventObj, keyCode);
- JS('void', '#.charCodeVal = #', eventObj, charCode);
- }
// Tell dart2js that it smells like a KeyboardEvent!
setDispatchProperty(eventObj, _keyboardEventDispatchRecord);
diff --git a/sdk/lib/html/html_common/conversions.dart b/sdk/lib/html/html_common/conversions.dart
index bf63ae6..a8e3329 100644
--- a/sdk/lib/html/html_common/conversions.dart
+++ b/sdk/lib/html/html_common/conversions.dart
@@ -77,7 +77,7 @@
cleanupSlots() {} // Will be needed if we mark objects with a property.
bool cloneNotRequired(object);
newJsMap();
- newJsList(length);
+ List newJsList(length);
void putIntoMap(map, key, value);
// Returns the input, or a clone of the input.
@@ -128,7 +128,7 @@
// non-native properties or methods from interceptors and such, e.g.
// an immutability marker. So we had to stop doing that.
var slot = findSlot(e);
- var copy = readSlot(slot);
+ var copy = JS('List|Null', '#', readSlot(slot));
if (copy != null) return copy;
copy = copyList(e, slot);
return copy;
@@ -137,7 +137,7 @@
throw new UnimplementedError('structured clone of other type');
}
- copyList(List e, int slot) {
+ List copyList(List e, int slot) {
int i = 0;
int length = e.length;
var copy = newJsList(length);
@@ -198,11 +198,11 @@
}
/// Iterate over the JS properties.
- forEachJsField(object, action);
+ forEachJsField(object, action(key, value));
/// Create a new Dart list of the given length. May create a native List or
/// a JsArray, depending if we're in Dartium or dart2js.
- newDartList(length);
+ List newDartList(length);
walk(e) {
if (e == null) return e;
@@ -237,18 +237,19 @@
}
if (isJavaScriptArray(e)) {
- var slot = findSlot(e);
- var copy = readSlot(slot);
+ var l = JS('List', '#', e);
+ var slot = findSlot(l);
+ var copy = JS('List|Null', '#', readSlot(slot));
if (copy != null) return copy;
- int length = e.length;
+ int length = l.length;
// Since a JavaScript Array is an instance of Dart List, we can modify it
// in-place unless we must copy.
- copy = mustCopy ? newDartList(length) : e;
+ copy = mustCopy ? newDartList(length) : l;
writeSlot(slot, copy);
for (int i = 0; i < length; i++) {
- copy[i] = walk(e[i]);
+ copy[i] = walk(l[i]);
}
return copy;
}
diff --git a/sdk/lib/html/html_common/conversions_dart2js.dart b/sdk/lib/html/html_common/conversions_dart2js.dart
index c98b73c..0a315ec 100644
--- a/sdk/lib/html/html_common/conversions_dart2js.dart
+++ b/sdk/lib/html/html_common/conversions_dart2js.dart
@@ -13,7 +13,7 @@
}
/// Converts a flat Dart map into a JavaScript object with properties.
-convertDartToNative_Dictionary(Map dict, [void postCreate(dynamic)]) {
+convertDartToNative_Dictionary(Map dict, [void postCreate(Object f)]) {
if (dict == null) return null;
var object = JS('var', '{}');
if (postCreate != null) {
@@ -60,11 +60,11 @@
}
class _AcceptStructuredCloneDart2Js extends _AcceptStructuredClone {
- newJsList(length) => JS('JSExtendableArray', 'new Array(#)', length);
- newDartList(length) => newJsList(length);
- identicalInJs(a, b) => identical(a, b);
+ List newJsList(length) => JS('JSExtendableArray', 'new Array(#)', length);
+ List newDartList(length) => newJsList(length);
+ bool identicalInJs(a, b) => identical(a, b);
- void forEachJsField(object, action) {
+ void forEachJsField(object, action(key, value)) {
for (final key in JS('JSExtendableArray', 'Object.keys(#)', object)) {
action(key, JS('var', '#[#]', object, key));
}
diff --git a/sdk/lib/io/file_impl.dart b/sdk/lib/io/file_impl.dart
index 0e719b8..53090f7 100644
--- a/sdk/lib/io/file_impl.dart
+++ b/sdk/lib/io/file_impl.dart
@@ -560,8 +560,19 @@
}
}
- Future<String> readAsString({Encoding encoding: utf8}) =>
- readAsBytes().then((bytes) => _tryDecode(bytes, encoding));
+ Future<String> readAsString({Encoding encoding: utf8}) {
+ // TODO(dart:io): If the change in async semantics to run synchronously
+ // until await lands, this is as efficient as
+ // return _tryDecode(await readAsBytes(), encoding);
+ var stack = StackTrace.current;
+ return readAsBytes().then((bytes) {
+ try {
+ return _tryDecode(bytes, encoding);
+ } catch (e) {
+ return new Future.error(e, stack);
+ }
+ });
+ }
String readAsStringSync({Encoding encoding: utf8}) =>
_tryDecode(readAsBytesSync(), encoding);
diff --git a/sdk/lib/io/io_sink.dart b/sdk/lib/io/io_sink.dart
index 696288b..a8386dc 100644
--- a/sdk/lib/io/io_sink.dart
+++ b/sdk/lib/io/io_sink.dart
@@ -180,19 +180,19 @@
if (_isBound) {
throw new StateError("StreamSink is already bound to a stream");
}
- _isBound = true;
if (_hasError) return done;
- // Wait for any sync operations to complete.
- Future targetAddStream() {
- return _target.addStream(stream).whenComplete(() {
- _isBound = false;
- });
- }
- if (_controllerInstance == null) return targetAddStream();
- var future = _controllerCompleter.future;
- _controllerInstance.close();
- return future.then((_) => targetAddStream());
+ _isBound = true;
+ var future = _controllerCompleter == null
+ ? _target.addStream(stream)
+ : _controllerCompleter.future.then((_) => _target.addStream(stream));
+ _controllerInstance?.close();
+
+ // Wait for any pending events in [_controller] to be dispatched before
+ // adding [stream].
+ return future.whenComplete(() {
+ _isBound = false;
+ });
}
Future flush() {
diff --git a/sdk/lib/io/socket.dart b/sdk/lib/io/socket.dart
index b2c24e7..3f89cff 100644
--- a/sdk/lib/io/socket.dart
+++ b/sdk/lib/io/socket.dart
@@ -577,9 +577,9 @@
*/
InternetAddress get remoteAddress;
- Future<Socket> close();
+ Future close();
- Future<Socket> get done;
+ Future get done;
}
/**
diff --git a/sdk/lib/vmservice/message.dart b/sdk/lib/vmservice/message.dart
index 4e9ffd9..560ec63 100644
--- a/sdk/lib/vmservice/message.dart
+++ b/sdk/lib/vmservice/message.dart
@@ -7,7 +7,7 @@
enum MessageType { Request, Notification, Response }
class Message {
- final Completer _completer = new Completer.sync();
+ final Completer<String> _completer = new Completer<String>.sync();
bool get completed => _completer.isCompleted;
/// Future of response.
@@ -187,7 +187,7 @@
final receivePort = new RawReceivePort();
receivePort.handler = (value) {
receivePort.close();
- _completer.complete(value);
+ _setResponseFromPort(value);
};
var keys = _makeAllString(params.keys.toList(growable: false));
var values = _makeAllString(params.values.toList(growable: false));
@@ -235,34 +235,40 @@
final receivePort = new RawReceivePort();
receivePort.handler = (value) {
receivePort.close();
- _completer.complete(value);
+ _setResponseFromPort(value);
};
+ final keys = params.keys.toList(growable: false);
+ final values = params.values.toList(growable: false);
+ if (!_methodNeedsObjectParameters(method)) {
+ _makeAllString(keys);
+ _makeAllString(values);
+ }
+
+ final request = new List(6)
+ ..[0] = 0 // Make room for OOB message type.
+ ..[1] = receivePort.sendPort
+ ..[2] = serial
+ ..[3] = method
+ ..[4] = keys
+ ..[5] = values;
+
if (_methodNeedsObjectParameters(method)) {
// We use a different method invocation path here.
- var keys = params.keys.toList(growable: false);
- var values = params.values.toList(growable: false);
- var request = new List(6)
- ..[0] = 0 // Make room for OOB message type.
- ..[1] = receivePort.sendPort
- ..[2] = serial
- ..[3] = method
- ..[4] = keys
- ..[5] = values;
sendObjectRootServiceMessage(request);
- return _completer.future;
} else {
- var keys = _makeAllString(params.keys.toList(growable: false));
- var values = _makeAllString(params.values.toList(growable: false));
- var request = new List(6)
- ..[0] = 0 // Make room for OOB message type.
- ..[1] = receivePort.sendPort
- ..[2] = serial
- ..[3] = method
- ..[4] = keys
- ..[5] = values;
sendRootServiceMessage(request);
- return _completer.future;
}
+
+ return _completer.future;
+ }
+
+ void _setResponseFromPort(response) {
+ if (response is List) {
+ // See JSONStream::PostReply for the format of messages that arrive from
+ // VM.
+ response = utf8.decode(response[0]);
+ }
+ _completer.complete(response);
}
void setResponse(String response) {
diff --git a/sdk/lib/vmservice/vmservice.dart b/sdk/lib/vmservice/vmservice.dart
index 717fe86..0fcfeef 100644
--- a/sdk/lib/vmservice/vmservice.dart
+++ b/sdk/lib/vmservice/vmservice.dart
@@ -531,14 +531,7 @@
return encodeSuccess(message);
}
- static responseAsJson(portResponse) {
- if (portResponse is String) {
- return json.decode(portResponse);
- } else {
- var cstring = portResponse[0];
- return json.fuse(utf8).decode(cstring);
- }
- }
+ static _responseAsJson(String response) => json.decode(response);
// TODO(johnmccutchan): Turn this into a command line tool that uses the
// service library.
@@ -563,12 +556,12 @@
// Request VM.
var getVM = Uri.parse('getVM');
var getVmResponse =
- responseAsJson(await new Message.fromUri(client, getVM).sendToVM());
+ _responseAsJson(await new Message.fromUri(client, getVM).sendToVM());
responses[getVM.toString()] = getVmResponse['result'];
// Request command line flags.
var getFlagList = Uri.parse('getFlagList');
- var getFlagListResponse = responseAsJson(
+ var getFlagListResponse = _responseAsJson(
await new Message.fromUri(client, getFlagList).sendToVM());
responses[getFlagList.toString()] = getFlagListResponse['result'];
@@ -578,13 +571,13 @@
var message = new Message.forIsolate(client, request, isolate);
// Decode the JSON and and insert it into the map. The map key
// is the request Uri.
- var response = responseAsJson(await isolate.routeRequest(message));
+ var response = _responseAsJson(await isolate.routeRequest(message));
responses[message.toUri().toString()] = response['result'];
}
// Dump the object id ring requests.
var message =
new Message.forIsolate(client, Uri.parse('_dumpIdZone'), isolate);
- var response = responseAsJson(await isolate.routeRequest(message));
+ var response = _responseAsJson(await isolate.routeRequest(message));
// Insert getObject requests into responses map.
for (var object in response['result']['objects']) {
final requestUri =
@@ -597,7 +590,7 @@
return encodeResult(message, responses);
}
- Future routeRequest(Message message) async {
+ Future<String> routeRequest(Message message) async {
try {
if (message.completed) {
return await message.response;
diff --git a/tests/co19/co19-dart2js.status b/tests/co19/co19-dart2js.status
index 2dc6f9c..be5d4a9 100644
--- a/tests/co19/co19-dart2js.status
+++ b/tests/co19/co19-dart2js.status
@@ -724,7 +724,6 @@
LayoutTests/fast/events/scroll-event-does-not-bubble_t01: RuntimeError # Please triage this failure
LayoutTests/fast/events/scroll-event-phase_t01: Skip # Times out. Please triage this failure
LayoutTests/fast/events/tabindex-removal-from-focused-element_t01: Pass, RuntimeError # Please triage this failure
-LayoutTests/fast/eventsource/eventsource-attribute-listeners_t01: RuntimeError # Please triage this failure
LayoutTests/fast/eventsource/eventsource-constructor_t01: RuntimeError # https://github.com/dart-lang/sdk/issues/29814
LayoutTests/fast/exclusions/parsing/parsing-wrap-flow_t01: RuntimeError # Please triage this failure
LayoutTests/fast/exclusions/parsing/parsing-wrap-through_t01: RuntimeError # Please triage this failure
@@ -1009,6 +1008,7 @@
LibTest/html/Element/getNamespacedAttributes_A01_t01: RuntimeError # Issue 16395
LibTest/html/Element/isTagSupported_A01_t01: RuntimeError # Issue 25155
LibTest/html/Element/marginEdge_A01_t01: RuntimeError # Issue 16574
+LibTest/html/Element/mouseOverEvent_A01_t01: RuntimeError, Pass # Issue 30068
LibTest/html/Element/mouseWheelEvent_A01_t01: Skip # Times out. Please triage this failure
LibTest/html/Element/onMouseWheel_A01_t01: Skip # Times out. Please triage this failure
LibTest/html/Element/onTransitionEnd_A01_t01: Skip # Please triage this failure
@@ -3012,7 +3012,6 @@
LayoutTests/fast/events/selectstart-on-selectall_t01: RuntimeError # Please triage this failure
LayoutTests/fast/events/selectstart-prevent-selectall_t01: RuntimeError # Please triage this failure
LayoutTests/fast/events/tabindex-removal-from-focused-element_t01: Pass, RuntimeError # Please triage this failure
-LayoutTests/fast/eventsource/eventsource-attribute-listeners_t01: RuntimeError # Issue 28983
LayoutTests/fast/eventsource/eventsource-constructor_t01: RuntimeError # Please triage this failure
LayoutTests/fast/exclusions/parsing/parsing-wrap-flow_t01: RuntimeError # Please triage this failure
LayoutTests/fast/exclusions/parsing/parsing-wrap-through_t01: RuntimeError # Please triage this failure
diff --git a/tests/co19/co19-kernel.status b/tests/co19/co19-kernel.status
index c643a7b..abe1e10 100644
--- a/tests/co19/co19-kernel.status
+++ b/tests/co19/co19-kernel.status
@@ -13,15 +13,31 @@
# dartk: precompilation failures
[ $compiler == dartkp ]
Language/Classes/Constructors/Generative_Constructors/execution_of_an_initializer_t02: Pass
-Language/Expressions/Constants/bitwise_operators_t05: Crash
+Language/Classes/Superinterfaces/more_than_once_t01: MissingCompileTimeError # New entries after going from kernel-service to batch-mode compilation. Please investigate.
+Language/Classes/Superinterfaces/superclass_as_superinterface_t01: MissingCompileTimeError # New entries after going from kernel-service to batch-mode compilation. Please investigate.
+Language/Classes/definition_t23: RuntimeError # New entries after going from kernel-service to batch-mode compilation. Please investigate.
Language/Expressions/Constants/depending_on_itself_t01: MissingCompileTimeError
+Language/Expressions/Constants/depending_on_itself_t01: Crash # New entries after going from kernel-service to batch-mode compilation. Please investigate.
Language/Expressions/Constants/depending_on_itself_t02: MissingCompileTimeError
-Language/Expressions/Constants/logical_expression_t04: Crash
+Language/Expressions/Constants/depending_on_itself_t02: Crash # New entries after going from kernel-service to batch-mode compilation. Please investigate.
+Language/Expressions/Null/extend_or_implement_t02: MissingCompileTimeError # New entries after going from kernel-service to batch-mode compilation. Please investigate.
+Language/Expressions/Null/extend_or_implement_t03: MissingCompileTimeError # New entries after going from kernel-service to batch-mode compilation. Please investigate.
+Language/Expressions/Null/extend_or_implement_t04: MissingCompileTimeError # New entries after going from kernel-service to batch-mode compilation. Please investigate.
+Language/Expressions/Null/extend_or_implement_t05: MissingCompileTimeError # New entries after going from kernel-service to batch-mode compilation. Please investigate.
+Language/Mixins/Mixin_Application/syntax_t16: RuntimeError # New entries after going from kernel-service to batch-mode compilation. Please investigate.
Language/Overview/Scoping/hiding_declaration_t11: Crash
Language/Overview/Scoping/hiding_declaration_t11: Pass
Language/Overview/Scoping/hiding_declaration_t12: Crash
Language/Overview/Scoping/hiding_declaration_t12: Pass
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $arch == simarm64 && $compiler == dartk && $mode == debug ]
+LibTest/core/DateTime/parse_A01_t02: Crash # Please triage.
+LibTest/core/DateTime/parse_A01_t03: Crash # Please triage.
+LibTest/core/DateTime/parse_A03_t01: Crash # Please triage.
+
# dartk: JIT failures (debug)
[ $compiler == dartk && $mode == debug ]
LibTest/isolate/Isolate/spawnUri_A01_t04: Pass, Slow, Timeout
@@ -29,6 +45,21 @@
[ $compiler == dartk && $strong ]
*: SkipByDesign
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $compiler == dartk && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
+Language/Classes/Superinterfaces/more_than_once_t01: MissingCompileTimeError # Please triaage.
+Language/Classes/Superinterfaces/superclass_as_superinterface_t01: MissingCompileTimeError # Please triaage.
+Language/Classes/definition_t23: RuntimeError # Please triaage.
+Language/Expressions/Null/extend_or_implement_t02: MissingCompileTimeError # Please triaage.
+Language/Expressions/Null/extend_or_implement_t03: MissingCompileTimeError # Please triaage.
+Language/Expressions/Null/extend_or_implement_t04: MissingCompileTimeError # Please triaage.
+Language/Expressions/Null/extend_or_implement_t05: MissingCompileTimeError # Please triaage.
+Language/Expressions/Spawning_an_Isolate/*: Skip
+Language/Mixins/Mixin_Application/syntax_t16: RuntimeError # Please triaage.
+LibTest/isolate/*/*: Skip
+
# dartk: precompilation failures (debug)
[ $compiler == dartkp && $mode == debug ]
Language/Functions/External_Functions/not_connected_to_a_body_t01: Crash
diff --git a/tests/compiler/dart2js/all_native_test.dart b/tests/compiler/dart2js/all_native_test.dart
index 24cbdb2..3d1d5fd 100644
--- a/tests/compiler/dart2js/all_native_test.dart
+++ b/tests/compiler/dart2js/all_native_test.dart
@@ -3,23 +3,34 @@
// BSD-style license that can be found in the LICENSE file.
import 'package:async_helper/async_helper.dart';
-import 'package:compiler/src/common/names.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:expect/expect.dart';
import 'memory_compiler.dart';
main() {
asyncTest(() async {
- DiagnosticCollector collector = new DiagnosticCollector();
- await runCompiler(
- entryPoint: Uris.dart_html,
- diagnosticHandler: collector,
- options: [Flags.analyzeAll, Flags.verbose]);
- int allNativeUsedCount =
- collector.verboseInfos.where((CollectedMessage message) {
- return message.text.startsWith('All native types marked as used due to ');
- }).length;
- Expect.equals(
- 1, allNativeUsedCount, "Unexpected message count: $allNativeUsedCount");
+ print('--test from ast---------------------------------------------------');
+ await test([]);
+ print('--test from kernel------------------------------------------------');
+ await test([Flags.useKernel]);
});
}
+
+test(List<String> options) async {
+ DiagnosticCollector collector = new DiagnosticCollector();
+ await runCompiler(
+ memorySourceFiles: {
+ 'main.dart': '''
+ import 'dart:html';
+ main() => document;
+ '''
+ },
+ diagnosticHandler: collector,
+ options: [Flags.analyzeAll, Flags.verbose]..addAll(options));
+ int allNativeUsedCount =
+ collector.verboseInfos.where((CollectedMessage message) {
+ return message.text.startsWith('All native types marked as used due to ');
+ }).length;
+ Expect.equals(
+ 1, allNativeUsedCount, "Unexpected message count: $allNativeUsedCount");
+}
diff --git a/tests/compiler/dart2js/arithmetic_simplification_test.dart b/tests/compiler/dart2js/arithmetic_simplification_test.dart
index 09b1e32..6c2d57d 100644
--- a/tests/compiler/dart2js/arithmetic_simplification_test.dart
+++ b/tests/compiler/dart2js/arithmetic_simplification_test.dart
@@ -3,7 +3,6 @@
// BSD-style license that can be found in the LICENSE file.
// Test constant folding on numbers.
-import 'dart:async';
import 'package:async_helper/async_helper.dart';
import 'compiler_helper.dart';
@@ -79,14 +78,29 @@
var timesOne = new RegExp(r"\* 1");
var oneTimes = new RegExp(r"1 \*");
- asyncTest(() => Future.wait([
- compileAndDoNotMatch(INT_PLUS_ZERO, 'main', plusZero),
- compileAndDoNotMatch(ZERO_PLUS_INT, 'main', zeroPlus),
- compileAndMatch(NUM_PLUS_ZERO, 'main', plusZero),
- compileAndMatch(ZERO_PLUS_NUM, 'main', zeroPlus),
- compileAndDoNotMatch(INT_TIMES_ONE, 'main', timesOne),
- compileAndDoNotMatch(ONE_TIMES_INT, 'main', oneTimes),
- compileAndDoNotMatch(NUM_TIMES_ONE, 'main', timesOne),
- compileAndDoNotMatch(ONE_TIMES_NUM, 'main', oneTimes),
- ]));
+ test(CompileMode compileMode) async {
+ await compileAndDoNotMatch(INT_PLUS_ZERO, 'main', plusZero,
+ compileMode: compileMode);
+ await compileAndDoNotMatch(ZERO_PLUS_INT, 'main', zeroPlus,
+ compileMode: compileMode);
+ await compileAndMatch(NUM_PLUS_ZERO, 'main', plusZero,
+ compileMode: compileMode);
+ await compileAndMatch(ZERO_PLUS_NUM, 'main', zeroPlus,
+ compileMode: compileMode);
+ await compileAndDoNotMatch(INT_TIMES_ONE, 'main', timesOne,
+ compileMode: compileMode);
+ await compileAndDoNotMatch(ONE_TIMES_INT, 'main', oneTimes,
+ compileMode: compileMode);
+ await compileAndDoNotMatch(NUM_TIMES_ONE, 'main', timesOne,
+ compileMode: compileMode);
+ await compileAndDoNotMatch(ONE_TIMES_NUM, 'main', oneTimes,
+ compileMode: compileMode);
+ }
+
+ asyncTest(() async {
+ print('--test from ast---------------------------------------------------');
+ await test(CompileMode.memory);
+ print('--test from kernel------------------------------------------------');
+ await test(CompileMode.kernel);
+ });
}
diff --git a/tests/compiler/dart2js/array_static_intercept_test.dart b/tests/compiler/dart2js/array_static_intercept_test.dart
index dbe3978..0ad768d 100644
--- a/tests/compiler/dart2js/array_static_intercept_test.dart
+++ b/tests/compiler/dart2js/array_static_intercept_test.dart
@@ -15,10 +15,20 @@
""";
main() {
- asyncTest(() => compile(TEST_ONE, entry: 'foo', check: (String generated) {
- Expect.isTrue(generated.contains(r'.add$1('));
- Expect.isTrue(generated.contains(r'.removeLast$0('));
- Expect.isTrue(generated.contains(r'.length'),
- "Unexpected code to contain '.length':\n$generated");
- }));
+ test(CompileMode compileMode) async {
+ await compile(TEST_ONE, entry: 'foo', compileMode: compileMode,
+ check: (String generated) {
+ Expect.isTrue(generated.contains(r'.add$1('));
+ Expect.isTrue(generated.contains(r'.removeLast$0('));
+ Expect.isTrue(generated.contains(r'.length'),
+ "Unexpected code to contain '.length':\n$generated");
+ });
+ }
+
+ asyncTest(() async {
+ print('--test from ast---------------------------------------------------');
+ await test(CompileMode.memory);
+ print('--test from kernel------------------------------------------------');
+ await test(CompileMode.kernel);
+ });
}
diff --git a/tests/compiler/dart2js/async_compiler_input_provider_test.dart b/tests/compiler/dart2js/async_compiler_input_provider_test.dart
index b178c3e..7ce403a0 100644
--- a/tests/compiler/dart2js/async_compiler_input_provider_test.dart
+++ b/tests/compiler/dart2js/async_compiler_input_provider_test.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// TODO(johnniwinther): Port this test to use '--use-kernel'.
+
import "dart:async";
import "dart:io";
diff --git a/tests/compiler/dart2js/bad_output_io_test.dart b/tests/compiler/dart2js/bad_output_io_test.dart
index 96cc736..487af98 100644
--- a/tests/compiler/dart2js/bad_output_io_test.dart
+++ b/tests/compiler/dart2js/bad_output_io_test.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+// TODO(johnniwinther): Port this test to use '--use-kernel'.
+
// Test that the compiler can handle imports when package root has not been set.
library dart2js.test.bad_output_io;
diff --git a/tests/compiler/dart2js/boolified_operator_test.dart b/tests/compiler/dart2js/boolified_operator_test.dart
deleted file mode 100644
index 6f51ac4..0000000
--- a/tests/compiler/dart2js/boolified_operator_test.dart
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (c) 2012, 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 boolified_operator_test;
-
-import 'dart:async';
-import 'package:expect/expect.dart';
-import 'package:async_helper/async_helper.dart';
-import 'compiler_helper.dart';
-
-const String TEST_EQUAL = r"""
-foo(param0, param1) {
- if (param0 == param1) return 0;
- return 1;
-}
-""";
-
-const String TEST_EQUAL_NULL = r"""
-foo(param0) {
- if (param0 == null) return 0;
- return 1;
-}
-""";
-
-const String TEST_LESS = r"""
-foo(param0, param1) {
- if (param0 < param1) return 0;
- return 1;
-}
-""";
-
-const String TEST_LESS_EQUAL = r"""
-foo(param0, param1) {
- if (param0 <= param1) return 0;
- return 1;
-}
-""";
-const String TEST_GREATER = r"""
-foo(param0, param1) {
- if (param0 > param1) return 0;
- return 1;
-}
-""";
-
-const String TEST_GREATER_EQUAL = r"""
-foo(param0, param1) {
- if (param0 >= param1) return 0;
- return 1;
-}
-""";
-
-main() {
- asyncTest(() => Future.wait([
- compile(TEST_EQUAL, entry: 'foo', check: (String generated) {
- Expect.isFalse(generated.contains('=== true'));
- Expect.isTrue(generated.contains('eqB'));
- }),
- compile(TEST_EQUAL_NULL, entry: 'foo', check: (String generated) {
- Expect.isFalse(generated.contains('=== true'));
- Expect.isTrue(generated.contains('== null'));
- }),
- compile(TEST_LESS, entry: 'foo', check: (String generated) {
- Expect.isFalse(generated.contains('=== true'));
- Expect.isTrue(generated.contains('ltB'));
- }),
- compile(TEST_LESS_EQUAL, entry: 'foo', check: (String generated) {
- Expect.isFalse(generated.contains('=== true'));
- Expect.isTrue(generated.contains('leB'));
- }),
- compile(TEST_GREATER, entry: 'foo', check: (String generated) {
- Expect.isFalse(generated.contains('=== true'));
- Expect.isTrue(generated.contains('gtB'));
- }),
- compile(TEST_GREATER_EQUAL, entry: 'foo', check: (String generated) {
- Expect.isFalse(generated.contains('=== true'));
- Expect.isTrue(generated.contains('geB'));
- }),
- ]));
-}
diff --git a/tests/compiler/dart2js/boolify_test.dart b/tests/compiler/dart2js/boolify_test.dart
index 12685a3..fb382cb 100644
--- a/tests/compiler/dart2js/boolify_test.dart
+++ b/tests/compiler/dart2js/boolify_test.dart
@@ -17,7 +17,17 @@
""";
main() {
- asyncTest(() => compile(TEST, entry: 'foo', check: (String generated) {
- Expect.isTrue(generated.contains('foo() !== true)'));
- }));
+ test(CompileMode compileMode) async {
+ await compile(TEST, entry: 'foo', compileMode: compileMode,
+ check: (String generated) {
+ Expect.isTrue(generated.contains('foo() !== true)'));
+ });
+ }
+
+ asyncTest(() async {
+ print('--test from ast---------------------------------------------------');
+ await test(CompileMode.memory);
+ print('--test from kernel------------------------------------------------');
+ await test(CompileMode.kernel);
+ });
}
diff --git a/tests/compiler/dart2js/builtin_equals_test.dart b/tests/compiler/dart2js/builtin_equals_test.dart
index e60bdd5..6571c34 100644
--- a/tests/compiler/dart2js/builtin_equals_test.dart
+++ b/tests/compiler/dart2js/builtin_equals_test.dart
@@ -18,12 +18,23 @@
""";
main() {
- asyncTest(() => compile(TEST, entry: 'foo', enableTypeAssertions: true,
- check: (String generated) {
- Expect.isTrue(!generated.contains('eqB'));
+ test(CompileMode compileMode) async {
+ await compile(TEST,
+ entry: 'foo',
+ enableTypeAssertions: true,
+ compileMode: compileMode, check: (String generated) {
+ Expect.isTrue(!generated.contains('eqB'));
- RegExp regexp = new RegExp('==');
- Iterator<Match> matches = regexp.allMatches(generated).iterator;
- checkNumberOfMatches(matches, 4);
- }));
+ RegExp regexp = new RegExp('==');
+ Iterator<Match> matches = regexp.allMatches(generated).iterator;
+ checkNumberOfMatches(matches, 4);
+ });
+ }
+
+ asyncTest(() async {
+ print('--test from ast---------------------------------------------------');
+ await test(CompileMode.memory);
+ print('--test from kernel------------------------------------------------');
+ await test(CompileMode.kernel);
+ });
}
diff --git a/tests/compiler/dart2js/builtin_interceptor_test.dart b/tests/compiler/dart2js/builtin_interceptor_test.dart
index a9ae6b2..19533c0 100644
--- a/tests/compiler/dart2js/builtin_interceptor_test.dart
+++ b/tests/compiler/dart2js/builtin_interceptor_test.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.
-import 'dart:async';
import 'package:expect/expect.dart';
import 'package:async_helper/async_helper.dart';
import 'compiler_helper.dart';
@@ -26,15 +25,25 @@
""";
main() {
- asyncTest(() => Future.wait([
- compile(TEST_ONE, entry: 'foo', check: (String generated) {
- Expect.isTrue(generated.contains("return 3;"));
- }),
- compile(TEST_TWO, entry: 'foo', check: (String generated) {
- Expect.isTrue(generated.contains("return 3;"));
- }),
- compile(TEST_THREE, entry: 'foo', check: (String generated) {
- Expect.isTrue(generated.contains("push(2);"));
- }),
- ]));
+ test(CompileMode compileMode) async {
+ await compile(TEST_ONE, entry: 'foo', compileMode: compileMode,
+ check: (String generated) {
+ Expect.isTrue(generated.contains("return 3;"));
+ });
+ await compile(TEST_TWO, entry: 'foo', compileMode: compileMode,
+ check: (String generated) {
+ Expect.isTrue(generated.contains("return 3;"));
+ });
+ await compile(TEST_THREE, entry: 'foo', compileMode: compileMode,
+ check: (String generated) {
+ Expect.isTrue(generated.contains("push(2);"));
+ });
+ }
+
+ asyncTest(() async {
+ print('--test from ast---------------------------------------------------');
+ await test(CompileMode.memory);
+ print('--test from kernel------------------------------------------------');
+ await test(CompileMode.kernel);
+ });
}
diff --git a/tests/compiler/dart2js/class_set_test.dart b/tests/compiler/dart2js/class_set_test.dart
index 84f18fd..8a9fe87 100644
--- a/tests/compiler/dart2js/class_set_test.dart
+++ b/tests/compiler/dart2js/class_set_test.dart
@@ -18,7 +18,7 @@
void main() {
asyncTest(() async {
await testAll(CompileMode.memory);
- await testAll(CompileMode.dill);
+ await testAll(CompileMode.kernel);
});
}
diff --git a/tests/compiler/dart2js/compiler_annotations.dart b/tests/compiler/dart2js/compiler_annotations.dart
deleted file mode 100644
index c920add..0000000
--- a/tests/compiler/dart2js/compiler_annotations.dart
+++ /dev/null
@@ -1,12 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library compiler_annotations;
-
-// This library contains annotations useful for testing.
-
-// TODO(ngeoffray): Implement in dart2js.
-class DontInline {
- const DontInline();
-}
diff --git a/tests/compiler/dart2js/compiler_helper.dart b/tests/compiler/dart2js/compiler_helper.dart
index c74ad57..9462622 100644
--- a/tests/compiler/dart2js/compiler_helper.dart
+++ b/tests/compiler/dart2js/compiler_helper.dart
@@ -12,6 +12,7 @@
import 'package:compiler/src/common_elements.dart';
import 'package:compiler/src/elements/elements.dart';
+import 'package:compiler/src/elements/entities.dart';
export 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/js_backend/js_backend.dart' as js;
@@ -45,6 +46,8 @@
import 'output_collector.dart';
export 'output_collector.dart';
+enum CompileMode { mock, memory, kernel }
+
/// Compile [code] and returns either the code for [entry] or, if [returnAll] is
/// true, the code for the entire program.
///
@@ -58,11 +61,11 @@
bool analyzeAll: false,
bool disableInlining: true,
bool trustJSInteropTypeAnnotations: false,
- bool useMock: false,
+ CompileMode compileMode: CompileMode.memory,
void check(String generatedEntry),
bool returnAll: false}) async {
OutputCollector outputCollector = returnAll ? new OutputCollector() : null;
- if (useMock) {
+ if (compileMode == CompileMode.mock) {
// TODO(johnniwinther): Remove this when no longer needed by
// `arithmetic_simplication_test.dart`.
MockCompiler compiler = new MockCompiler.internal(
@@ -111,6 +114,9 @@
if (trustJSInteropTypeAnnotations) {
options.add(Flags.trustJSInteropTypeAnnotations);
}
+ if (compileMode == CompileMode.kernel) {
+ options.add(Flags.useKernel);
+ }
if (disableInlining) {
options.add(Flags.disableInlining);
@@ -129,9 +135,11 @@
outputProvider: outputCollector);
Expect.isTrue(result.isSuccess);
Compiler compiler = result.compiler;
- LibraryElement mainApp =
- compiler.frontendStrategy.elementEnvironment.mainLibrary;
- MemberElement element = mainApp.find(entry);
+ ClosedWorld closedWorld = compiler.backendClosedWorldForTesting;
+ ElementEnvironment elementEnvironment = closedWorld.elementEnvironment;
+ LibraryEntity mainLibrary = elementEnvironment.mainLibrary;
+ FunctionEntity element =
+ elementEnvironment.lookupLibraryMember(mainLibrary, entry);
js.JavaScriptBackend backend = compiler.backend;
String generated = backend.getGeneratedCode(element);
if (check != null) {
@@ -231,16 +239,18 @@
}
Future compileAndMatch(String code, String entry, RegExp regexp,
- {bool useMock: false}) {
- return compile(code, entry: entry, useMock: useMock,
+ {CompileMode compileMode: CompileMode.memory}) {
+ return compile(code, entry: entry, compileMode: compileMode,
check: (String generated) {
Expect.isTrue(
regexp.hasMatch(generated), '"$generated" does not match /$regexp/');
});
}
-Future compileAndDoNotMatch(String code, String entry, RegExp regexp) {
- return compile(code, entry: entry, check: (String generated) {
+Future compileAndDoNotMatch(String code, String entry, RegExp regexp,
+ {CompileMode compileMode: CompileMode.memory}) {
+ return compile(code, entry: entry, compileMode: compileMode,
+ check: (String generated) {
Expect.isFalse(
regexp.hasMatch(generated), '"$generated" has a match in /$regexp/');
});
diff --git a/tests/compiler/dart2js/dart2js.status b/tests/compiler/dart2js/dart2js.status
index d189e0d..f7e0d06 100644
--- a/tests/compiler/dart2js/dart2js.status
+++ b/tests/compiler/dart2js/dart2js.status
@@ -6,8 +6,8 @@
async_await_syntax_test: Pass # DON'T CHANGE THIS LINE -- Don't mark these tests as failing. Instead, fix the errors/warnings that they report or update the whitelist in the test-files to temporarily allow digression.
backend_dart/opt_cyclic_redundant_phi_test: Fail # Issue 20159
boolified_operator_test: Fail # Issue 8001
-check_elements_invariants_test: Skip # Times out even with Slow marker. Slow due to inlining in the CPS backend
-compile_with_empty_libraries_test: Fail # Issue 24223
+old_frontend/check_elements_invariants_test: Skip # Times out even with Slow marker. Slow due to inlining in the CPS backend
+old_frontend/compile_with_empty_libraries_test: Fail # Issue 24223
equivalence/id_equivalence_test: Pass, Slow
gvn_dynamic_field_get_test: Fail # Issue 18519
inference/inference_test: Slow, Pass
@@ -52,11 +52,11 @@
uri_retention_test: Fail # Issue 26504
[ $mode == debug ]
-analyze_api_test: Pass, Slow # DON'T CHANGE THIS LINE -- Don't mark these tests as failing. Instead, fix the errors/warnings that they report or update the whitelist in the test-files to temporarily allow digression.
-analyze_dart2js_test: Pass, Slow # DON'T CHANGE THIS LINE -- Don't mark these tests as failing. Instead, fix the errors/warnings that they report or update the whitelist in the test-files to temporarily allow digression.
-analyze_unused_dart2js_test: Pass, Slow
-check_elements_invariants_test: Skip # Slow and only needs to be run in one configuration
-check_members_test: Pass, Slow
+old_frontend/analyze_api_test: Pass, Slow # DON'T CHANGE THIS LINE -- Don't mark these tests as failing. Instead, fix the errors/warnings that they report or update the whitelist in the test-files to temporarily allow digression.
+old_frontend/analyze_dart2js_test: Pass, Slow # DON'T CHANGE THIS LINE -- Don't mark these tests as failing. Instead, fix the errors/warnings that they report or update the whitelist in the test-files to temporarily allow digression.
+old_frontend/analyze_unused_dart2js_test: Pass, Slow
+old_frontend/check_elements_invariants_test: Skip # Slow and only needs to be run in one configuration
+old_frontend/check_members_test: Pass, Slow
dart2js_batch_test: Pass, Slow
deferred_load_graph_segmentation_test: Pass, Slow
deferred_load_mapping_test: Pass, Slow
@@ -74,9 +74,9 @@
dart2js_batch2_test: Pass, RuntimeError # Issue 29021
[ $checked ]
-analyze_dart2js_helpers_test: Pass, Slow
-analyze_dart2js_test: Pass, Slow
-analyze_unused_dart2js_test: Pass, Slow
+old_frontend/analyze_dart2js_helpers_test: Pass, Slow
+old_frontend/analyze_dart2js_test: Pass, Slow
+old_frontend/analyze_unused_dart2js_test: Pass, Slow
dart2js_resolver_test: Pass, Slow
deferred_mirrors_test: Pass, Slow
duplicate_library_test: Pass, Slow
diff --git a/tests/compiler/dart2js/deferred_closures_test.dart b/tests/compiler/dart2js/deferred_closures_test.dart
index f65fc1c..747b9a9 100644
--- a/tests/compiler/dart2js/deferred_closures_test.dart
+++ b/tests/compiler/dart2js/deferred_closures_test.dart
@@ -52,10 +52,6 @@
"lib.dart": """
library deferred;
- unique_method_name() {
- return (() => print("unique-string"))();
- // TODO(sigmund): this line prevents inlining, but it should not be
- // necessary: the kernel pipeline is incorrectly inlining this method.
- return "1";
- }"""
+ unique_method_name() => (() => print("unique-string"))();
+ """
};
diff --git a/tests/compiler/dart2js/equivalence/show_helper.dart b/tests/compiler/dart2js/equivalence/show_helper.dart
new file mode 100644
index 0000000..aa46e75
--- /dev/null
+++ b/tests/compiler/dart2js/equivalence/show_helper.dart
@@ -0,0 +1,71 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// Helper program that shows the equivalence-based data on a dart program.
+
+import 'dart:io';
+import 'package:args/args.dart';
+import 'package:compiler/src/commandline_options.dart';
+import 'package:compiler/src/filenames.dart';
+import 'package:compiler/src/inferrer/inferrer_engine.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';
+
+show(List<String> args, ComputeMemberDataFunction computeAstData,
+ ComputeMemberDataFunction computeKernelData) async {
+ ArgParser argParser = new ArgParser(allowTrailingOptions: true);
+ argParser.addFlag('verbose', negatable: true, defaultsTo: false);
+ argParser.addFlag('colors', negatable: true);
+ argParser.addFlag('use-kernel', negatable: false, defaultsTo: false);
+ ArgResults argResults = argParser.parse(args);
+ if (argResults.wasParsed('colors')) {
+ useColors = argResults['colors'];
+ }
+ bool verbose = argResults['verbose'];
+ bool useKernel = argResults['use-kernel'];
+
+ InferrerEngineImpl.useSorterForTesting = true;
+ String file = argResults.rest.first;
+ List<String> show;
+ if (argResults.rest.length > 1) {
+ show = argResults.rest.skip(1).toList();
+ }
+
+ Uri entryPoint = Uri.base.resolve(nativeToUriPath(file));
+ List<String> options = <String>[];
+ if (useKernel) {
+ options.add(Flags.useKernel);
+ }
+ CompiledData data = await computeData(
+ entryPoint, const {}, useKernel ? computeKernelData : computeAstData,
+ options: options,
+ forMainLibraryOnly: false,
+ skipUnprocessedMembers: true,
+ skipFailedCompilations: true,
+ verbose: verbose);
+ if (data == null) {
+ print('Compilation failed.');
+ } else {
+ SourceFileProvider provider = data.compiler.provider;
+ for (Uri uri in data.actualMaps.keys) {
+ 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) {
+ sourceCode = new File.fromUri(uri).readAsStringSync();
+ }
+ if (sourceCode == null) {
+ print('--source code missing for $uri--------------------------------');
+ } else {
+ print('--annotations for $uri----------------------------------------');
+ print(withAnnotations(sourceCode, data.computeAnnotations(uri)));
+ }
+ }
+ }
+}
diff --git a/tests/compiler/dart2js/frontend_checker.dart b/tests/compiler/dart2js/frontend_checker.dart
index 09043312..c210ba2 100644
--- a/tests/compiler/dart2js/frontend_checker.dart
+++ b/tests/compiler/dart2js/frontend_checker.dart
@@ -14,7 +14,7 @@
import 'memory_compiler.dart';
import '../../../tools/testing/dart/multitest.dart'
- show ExtractTestsFromMultitest;
+ show extractTestsFromMultitest;
import '../../../tools/testing/dart/path.dart' show Path;
/// Check the analysis of the multitests in [testFiles] to result in the
@@ -37,7 +37,7 @@
Map<String, String> testSources = {};
Map<String, Set<String>> testOutcomes = {};
String fileName = 'tests/$testFile';
- ExtractTestsFromMultitest(
+ extractTestsFromMultitest(
new Path(fileName), testSources, testOutcomes);
return Future.forEach(testSources.keys, (String testName) async {
String testFileName = '$fileName/$testName';
diff --git a/tests/compiler/dart2js/function_type_variable_test.dart b/tests/compiler/dart2js/function_type_variable_test.dart
index 0193b35..a7b833c 100644
--- a/tests/compiler/dart2js/function_type_variable_test.dart
+++ b/tests/compiler/dart2js/function_type_variable_test.dart
@@ -14,6 +14,8 @@
const FunctionTypeData('void', 'F2', '<S>(S s)'),
const FunctionTypeData('void', 'F3', '<U, V>(U u, V v)'),
const FunctionTypeData('void', 'F4', '<U, V>(V v, U u)'),
+ const FunctionTypeData('void', 'F5', '<W extends num>(W w)'),
+ const FunctionTypeData('void', 'F6', '<X extends int>(X x)'),
];
main() {
@@ -23,12 +25,21 @@
.create(createTypedefs(existentialTypeData, additionalData: """
class C1 {}
class C2 {}
- """), compileMode: CompileMode.dill);
+ """), compileMode: CompileMode.kernel);
testToString(FunctionType type, String expectedToString) {
Expect.equals(expectedToString, type.toString());
}
+ testBounds(FunctionType type, List<DartType> expectedBounds) {
+ Expect.equals(expectedBounds.length, type.typeVariables.length,
+ "Unexpected type variable count in $type.");
+ for (int i = 0; i < expectedBounds.length; i++) {
+ Expect.equals(expectedBounds[i], type.typeVariables[i].bound,
+ "Unexpected ${i}th bound in $type.");
+ }
+ }
+
testInstantiate(FunctionType type, List<DartType> instantiation,
String expectedToString) {
DartType result = type.instantiate(instantiation);
@@ -36,51 +47,95 @@
"Unexpected instantiation of $type with $instantiation: $result");
}
- testEquals(DartType a, DartType b, bool expectedEquals) {
+ testRelations(DartType a, DartType b, bool areEqual, bool isSubtype) {
Expect.equals(
- expectedEquals, a == b, "Unexpected equality for $a and $b.");
+ areEqual,
+ a == b,
+ "Expected `$a` and `$b` to be ${areEqual ? 'equal' : 'non-equal'}, "
+ "but they are not.");
+ Expect.equals(
+ isSubtype,
+ env.isSubtype(a, b),
+ "Expected `$a` ${isSubtype ? '' : 'not '}to be a subtype of `$b`, "
+ "but it is${isSubtype ? ' not' : ''}.");
}
+ InterfaceType Object_ = env['Object'];
+ InterfaceType num_ = env['num'];
+ InterfaceType int_ = env['int'];
InterfaceType C1 = instantiate(env.getClass('C1'), []);
InterfaceType C2 = instantiate(env.getClass('C2'), []);
FunctionType F1 = env.getFieldType('F1');
FunctionType F2 = env.getFieldType('F2');
FunctionType F3 = env.getFieldType('F3');
FunctionType F4 = env.getFieldType('F4');
+ FunctionType F5 = env.getFieldType('F5');
+ FunctionType F6 = env.getFieldType('F6');
testToString(F1, 'void Function<#A>(#A)');
testToString(F2, 'void Function<#A>(#A)');
testToString(F3, 'void Function<#A,#B>(#A,#B)');
testToString(F4, 'void Function<#A,#B>(#B,#A)');
+ testToString(F5, 'void Function<#A extends num>(#A)');
+ testToString(F6, 'void Function<#A extends int>(#A)');
+
+ testBounds(F1, [Object_]);
+ testBounds(F2, [Object_]);
+ testBounds(F3, [Object_, Object_]);
+ testBounds(F4, [Object_, Object_]);
+ testBounds(F5, [num_]);
+ testBounds(F6, [int_]);
testInstantiate(F1, [C1], 'void Function(C1)');
testInstantiate(F2, [C2], 'void Function(C2)');
testInstantiate(F3, [C1, C2], 'void Function(C1,C2)');
testInstantiate(F4, [C1, C2], 'void Function(C2,C1)');
+ testInstantiate(F5, [num_], 'void Function(num)');
+ testInstantiate(F6, [int_], 'void Function(int)');
- testEquals(F1, F1, true);
- testEquals(F1, F2, true);
- testEquals(F1, F3, false);
- testEquals(F1, F4, false);
+ testRelations(F1, F1, true, true);
+ testRelations(F1, F2, true, true);
+ testRelations(F1, F3, false, false);
+ testRelations(F1, F4, false, false);
+ testRelations(F1, F5, false, false);
+ testRelations(F1, F6, false, false);
- testEquals(F2, F1, true);
- testEquals(F2, F2, true);
- testEquals(F2, F3, false);
- testEquals(F2, F4, false);
+ testRelations(F2, F1, true, true);
+ testRelations(F2, F2, true, true);
+ testRelations(F2, F3, false, false);
+ testRelations(F2, F4, false, false);
+ testRelations(F2, F5, false, false);
+ testRelations(F2, F6, false, false);
- testEquals(F3, F1, false);
- testEquals(F3, F2, false);
- testEquals(F3, F3, true);
- testEquals(F3, F4, false);
+ testRelations(F3, F1, false, false);
+ testRelations(F3, F2, false, false);
+ testRelations(F3, F3, true, true);
+ testRelations(F3, F4, false, false);
+ testRelations(F3, F5, false, false);
+ testRelations(F3, F6, false, false);
- testEquals(F4, F1, false);
- testEquals(F4, F2, false);
- testEquals(F4, F3, false);
- testEquals(F4, F4, true);
+ testRelations(F4, F1, false, false);
+ testRelations(F4, F2, false, false);
+ testRelations(F4, F3, false, false);
+ testRelations(F4, F4, true, true);
+ testRelations(F4, F5, false, false);
+ testRelations(F4, F6, false, false);
- testEquals(F1.typeVariables.first, F1.typeVariables.first, true);
- testEquals(F1.typeVariables.first, F2.typeVariables.first, false);
+ testRelations(F5, F1, false, false);
+ testRelations(F5, F2, false, false);
+ testRelations(F5, F3, false, false);
+ testRelations(F5, F4, false, false);
+ testRelations(F5, F5, true, true);
+ testRelations(F5, F6, false, false);
- // TODO(johnniwinther): Test subtyping.
+ testRelations(F6, F1, false, false);
+ testRelations(F6, F2, false, false);
+ testRelations(F6, F3, false, false);
+ testRelations(F6, F4, false, false);
+ testRelations(F6, F5, false, false);
+ testRelations(F6, F6, true, true);
+
+ testRelations(F1.typeVariables.first, F1.typeVariables.first, true, true);
+ testRelations(F1.typeVariables.first, F2.typeVariables.first, false, false);
});
}
diff --git a/tests/compiler/dart2js/generic_method_test.dart b/tests/compiler/dart2js/generic_method_test.dart
index 69412bd..8f01ba3 100644
--- a/tests/compiler/dart2js/generic_method_test.dart
+++ b/tests/compiler/dart2js/generic_method_test.dart
@@ -16,6 +16,8 @@
const FunctionTypeData("void", "2", "<T, S>(T t, S s)"),
const FunctionTypeData("void", "3", "<T, S>(T t, [S s])"),
const FunctionTypeData("void", "4", "<T, S>(T t, {S s})"),
+ const FunctionTypeData("void", "5", "<T extends num>(T t)"),
+ const FunctionTypeData("void", "6", "<T extends int>(T t)"),
];
main() {
@@ -25,7 +27,7 @@
TypeEnvironment env = await TypeEnvironment.create("""
${createTypedefs(signatures, prefix: 't')}
${createMethods(signatures, prefix: 'm')}
- """, compileMode: CompileMode.dill);
+ """, compileMode: CompileMode.kernel);
for (FunctionTypeData data in signatures) {
FunctionType functionType = env.getElementType('t${data.name}');
diff --git a/tests/compiler/dart2js/assert_message_throw_test.dart b/tests/compiler/dart2js/inference/assert_message_throw_test.dart
similarity index 93%
rename from tests/compiler/dart2js/assert_message_throw_test.dart
rename to tests/compiler/dart2js/inference/assert_message_throw_test.dart
index be95a24..b6f202b 100644
--- a/tests/compiler/dart2js/assert_message_throw_test.dart
+++ b/tests/compiler/dart2js/inference/assert_message_throw_test.dart
@@ -2,6 +2,8 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
+/// TODO(johnniwinther): Port this test to use the equivalence framework.
+
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/compiler.dart';
@@ -9,8 +11,8 @@
import 'package:compiler/src/types/masks.dart';
import 'package:compiler/src/world.dart' show ClosedWorld;
import 'package:expect/expect.dart';
-import 'memory_compiler.dart';
-import 'type_mask_test_helper.dart';
+import '../memory_compiler.dart';
+import '../type_mask_test_helper.dart';
const String SOURCE = '''
main(args) {
diff --git a/tests/compiler/dart2js/call_site_simple_type_inferer_test.dart b/tests/compiler/dart2js/inference/call_site_simple_type_inferer_test.dart
similarity index 97%
rename from tests/compiler/dart2js/call_site_simple_type_inferer_test.dart
rename to tests/compiler/dart2js/inference/call_site_simple_type_inferer_test.dart
index 3960da8..1337230 100644
--- a/tests/compiler/dart2js/call_site_simple_type_inferer_test.dart
+++ b/tests/compiler/dart2js/inference/call_site_simple_type_inferer_test.dart
@@ -2,13 +2,15 @@
// 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.
+/// TODO(johnniwinther): Port this test to use the equivalence framework.
+
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/elements/elements.dart';
import 'package:compiler/src/types/masks.dart';
import 'package:expect/expect.dart';
-import 'compiler_helper.dart';
-import 'type_mask_test_helper.dart';
+import '../compiler_helper.dart';
+import '../type_mask_test_helper.dart';
void compileAndFind(String code, String className, String memberName,
bool disableInlining, check(compiler, element)) {
diff --git a/tests/compiler/dart2js/inference/show.dart b/tests/compiler/dart2js/inference/show.dart
index f341278..6870b5f 100644
--- a/tests/compiler/dart2js/inference/show.dart
+++ b/tests/compiler/dart2js/inference/show.dart
@@ -4,68 +4,9 @@
/// Helper program that shows the inferrer data on a dart program.
-import 'dart:io';
-import 'package:args/args.dart';
-import 'package:compiler/src/commandline_options.dart';
-import 'package:compiler/src/filenames.dart';
-import 'package:compiler/src/inferrer/inferrer_engine.dart';
-import 'package:compiler/src/io/source_file.dart';
-import 'package:compiler/src/source_file_provider.dart';
-import '../equivalence/id_equivalence_helper.dart';
-import '../kernel/test_helpers.dart';
+import '../equivalence/show_helper.dart';
import 'inference_test_helper.dart';
main(List<String> args) async {
- ArgParser argParser = new ArgParser(allowTrailingOptions: true);
- argParser.addFlag('verbose', negatable: true, defaultsTo: false);
- argParser.addFlag('colors', negatable: true);
- argParser.addFlag('use-kernel', negatable: false, defaultsTo: false);
- ArgResults argResults = argParser.parse(args);
- if (argResults.wasParsed('colors')) {
- useColors = argResults['colors'];
- }
- bool verbose = argResults['verbose'];
- bool useKernel = argResults['use-kernel'];
-
- InferrerEngineImpl.useSorterForTesting = true;
- String file = argResults.rest.first;
- List<String> show;
- if (argResults.rest.length > 1) {
- show = argResults.rest.skip(1).toList();
- }
-
- Uri entryPoint = Uri.base.resolve(nativeToUriPath(file));
- List<String> options = <String>[];
- if (useKernel) {
- options.add(Flags.useKernel);
- }
- CompiledData data = await computeData(entryPoint, const {},
- useKernel ? computeMemberIrTypeMasks : computeMemberAstTypeMasks,
- options: options,
- forMainLibraryOnly: false,
- skipUnprocessedMembers: true,
- skipFailedCompilations: true,
- verbose: verbose);
- if (data == null) {
- print('Compilation failed.');
- } else {
- SourceFileProvider provider = data.compiler.provider;
- for (Uri uri in data.actualMaps.keys) {
- 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) {
- sourceCode = new File.fromUri(uri).readAsStringSync();
- }
- if (sourceCode == null) {
- print('--source code missing for $uri--------------------------------');
- } else {
- print('--annotations for $uri----------------------------------------');
- print(withAnnotations(sourceCode, data.computeAnnotations(uri)));
- }
- }
- }
+ await show(args, computeMemberAstTypeMasks, computeMemberIrTypeMasks);
}
diff --git a/tests/compiler/dart2js/inlining/data/external.dart b/tests/compiler/dart2js/inlining/data/external.dart
new file mode 100644
index 0000000..9204a33
--- /dev/null
+++ b/tests/compiler/dart2js/inlining/data/external.dart
@@ -0,0 +1,20 @@
+// 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.
+
+/// ignore: IMPORT_INTERNAL_LIBRARY
+import 'dart:_js_helper';
+
+/*element: main:[]*/
+main() {
+ externalFunction();
+}
+
+/*element: externalFunction:[]*/
+@NoInline()
+externalFunction() {
+ _externalFunction();
+}
+
+/*element: _externalFunction:[]*/
+external _externalFunction();
diff --git a/tests/compiler/dart2js/inlining/data/map.dart b/tests/compiler/dart2js/inlining/data/map.dart
new file mode 100644
index 0000000..8206a6b
--- /dev/null
+++ b/tests/compiler/dart2js/inlining/data/map.dart
@@ -0,0 +1,22 @@
+// 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.
+
+/// ignore: IMPORT_INTERNAL_LIBRARY
+import 'dart:_js_helper';
+
+/*element: main:[]*/
+main() {
+ passMapToNull();
+}
+
+/*element: _passMapToNull:[passMapToNull]*/
+_passMapToNull(f) {
+ f({});
+}
+
+/*element: passMapToNull:[]*/
+@NoInline()
+passMapToNull() {
+ _passMapToNull(null);
+}
diff --git a/tests/compiler/dart2js/inlining/data/switch.dart b/tests/compiler/dart2js/inlining/data/switch.dart
new file mode 100644
index 0000000..09577d7
--- /dev/null
+++ b/tests/compiler/dart2js/inlining/data/switch.dart
@@ -0,0 +1,28 @@
+// 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.
+
+/// ignore: IMPORT_INTERNAL_LIBRARY
+import 'dart:_js_helper';
+
+/*element: main:[]*/
+main() {
+ switchThrowing();
+}
+
+/*element: switchThrowing:[]*/
+@NoInline()
+switchThrowing() {
+ switch (0) {
+ case 0:
+ _switchThrowing();
+ break;
+ default:
+ return;
+ }
+}
+
+/*element: _switchThrowing:[]*/
+_switchThrowing() {
+ throw '';
+}
diff --git a/tests/compiler/dart2js/inlining/data/too_difficult.dart b/tests/compiler/dart2js/inlining/data/too_difficult.dart
index 5033474..446f66d 100644
--- a/tests/compiler/dart2js/inlining/data/too_difficult.dart
+++ b/tests/compiler/dart2js/inlining/data/too_difficult.dart
@@ -24,6 +24,10 @@
codeAfterReturn();
multipleThrows();
returnAndThrow();
+
+ throwClosure();
+ returnClosure();
+ closureInInitializer();
}
/*element: _multipleReturns:code after return*/
@@ -152,3 +156,28 @@
i++;
} while (i < 10);
}
+
+/*element: returnClosure:closure*/
+returnClosure() {
+ return /*[]*/ () {};
+}
+
+/*element: throwClosure:closure*/
+throwClosure() {
+ throw /*[]*/ () {};
+}
+
+class Class1 {
+ var f;
+
+ /*element: Class1.:closure*/
+ Class1() : f = (/*[]*/ () {}) {
+ print(f);
+ }
+}
+
+/*element: closureInInitializer:[]*/
+@NoInline()
+closureInInitializer() {
+ new Class1();
+}
diff --git a/tests/compiler/dart2js/inlining/data/type_variables.dart b/tests/compiler/dart2js/inlining/data/type_variables.dart
new file mode 100644
index 0000000..8c9366d
--- /dev/null
+++ b/tests/compiler/dart2js/inlining/data/type_variables.dart
@@ -0,0 +1,29 @@
+// 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.
+
+/// ignore: IMPORT_INTERNAL_LIBRARY
+import 'dart:_js_helper';
+
+/*element: main:[]*/
+main() {
+ inlineTypeTests();
+}
+
+/*element: Mixin1.:[inlineTypeTests:Mixin1<int>]*/
+class Mixin1<S> {
+ var field = /*[]*/ (S s) => null;
+}
+
+/*element: Class1.:[inlineTypeTests:Class1<int>]*/
+class Class1<T> extends Object with Mixin1<T> {}
+
+/*element: _inlineTypeTests:[inlineTypeTests]*/
+_inlineTypeTests(o) => o.field is dynamic Function(int);
+
+/*element: inlineTypeTests:[]*/
+@NoInline()
+void inlineTypeTests() {
+ _inlineTypeTests(new Mixin1<int>());
+ _inlineTypeTests(new Class1<int>());
+}
diff --git a/tests/compiler/dart2js/inlining/inlining_test.dart b/tests/compiler/dart2js/inlining/inlining_test.dart
index c602214..aeb1207 100644
--- a/tests/compiler/dart2js/inlining/inlining_test.dart
+++ b/tests/compiler/dart2js/inlining/inlining_test.dart
@@ -28,7 +28,7 @@
Directory dataDir = new Directory.fromUri(Platform.script.resolve('data'));
await checkTests(
dataDir, computeMemberAstInlinings, computeMemberIrInlinings,
- args: args, skipForKernel: []);
+ args: args, skipforAst: ['external.dart'], skipForKernel: []);
});
}
@@ -116,6 +116,9 @@
@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);
}
diff --git a/tests/compiler/dart2js/inlining/inlining_viewer.dart b/tests/compiler/dart2js/inlining/inlining_viewer.dart
new file mode 100644
index 0000000..ed25d93
--- /dev/null
+++ b/tests/compiler/dart2js/inlining/inlining_viewer.dart
@@ -0,0 +1,14 @@
+// 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 shows the inlining data on a dart program.
+
+import 'package:compiler/src/js_backend/backend.dart';
+import '../equivalence/show_helper.dart';
+import 'inlining_test.dart';
+
+main(List<String> args) async {
+ JavaScriptBackend.cacheCodegenImpactForTesting = true;
+ await show(args, computeMemberAstInlinings, computeMemberIrInlinings);
+}
diff --git a/tests/compiler/dart2js/jsinterop/world_test.dart b/tests/compiler/dart2js/jsinterop/world_test.dart
index 10f945f..a706741 100644
--- a/tests/compiler/dart2js/jsinterop/world_test.dart
+++ b/tests/compiler/dart2js/jsinterop/world_test.dart
@@ -16,7 +16,7 @@
void main() {
asyncTest(() async {
await testClasses(CompileMode.memory);
- await testClasses(CompileMode.dill);
+ await testClasses(CompileMode.kernel);
});
}
diff --git a/tests/compiler/dart2js/kernel/compiler_helper.dart b/tests/compiler/dart2js/kernel/compiler_helper.dart
index 27313b0..05a434b 100644
--- a/tests/compiler/dart2js/kernel/compiler_helper.dart
+++ b/tests/compiler/dart2js/kernel/compiler_helper.dart
@@ -14,17 +14,12 @@
import 'package:compiler/src/common.dart';
import 'package:compiler/src/common/tasks.dart';
import 'package:compiler/src/compiler.dart';
-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:kernel/ast.dart' as ir;
import '../memory_compiler.dart';
-import '../../../../pkg/compiler/tool/generate_kernel.dart' as generate;
-
-import 'package:front_end/src/compute_platform_binaries_location.dart'
- show computePlatformBinariesLocation;
typedef Future<Compiler> CompileFunction();
@@ -119,25 +114,6 @@
return entryPoint;
}
-Future generateDill(Uri entryPoint, Map<String, String> memorySourceFiles,
- {bool printSteps: false}) async {
- entryPoint =
- await createTemp(entryPoint, memorySourceFiles, printSteps: printSteps);
- if (printSteps) {
- print('---- generate dill -----------------------------------------------');
- }
-
- Uri dillFile = Uri.parse('$entryPoint.dill');
- Uri platform =
- computePlatformBinariesLocation().resolve("dart2js_platform.dill");
- await generate.main([
- '--platform=${platform.toFilePath()}',
- '--out=${uriPathToNative(dillFile.path)}',
- '${entryPoint.path}',
- ]);
- return dillFile;
-}
-
Future<Compiler> compileWithDill(
{Uri entryPoint,
Map<String, String> memorySourceFiles: const <String, String>{},
diff --git a/tests/compiler/dart2js/kernel/run_from_dill_test.dart b/tests/compiler/dart2js/kernel/run_from_dill_test.dart
index 4d73a35..77243cc 100644
--- a/tests/compiler/dart2js/kernel/run_from_dill_test.dart
+++ b/tests/compiler/dart2js/kernel/run_from_dill_test.dart
@@ -19,13 +19,56 @@
import '../serialization/helper.dart';
const SOURCE = const {
- 'main.dart': '''
+ '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!');
+ 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)));
}
'''
};
@@ -61,16 +104,15 @@
memorySourceFiles = SOURCE;
}
- Uri dillFile =
- await generateDill(entryPoint, memorySourceFiles, printSteps: true);
- String output = uriPathToNative(dillFile.resolve('out.js').path);
+ Uri mainFile =
+ await createTemp(entryPoint, memorySourceFiles, printSteps: true);
+ String output = uriPathToNative(mainFile.resolve('out.js').path);
List<String> dart2jsArgs = [
- dillFile.toString(),
+ mainFile.toString(),
'-o$output',
Flags.useKernel,
- Flags.disableTypeInference,
- Flags.disableInlining,
- Flags.enableAssertMessage
+ Flags.enableAssertMessage,
+ '--packages=${Platform.packageConfig}',
];
print('Running: dart2js ${dart2jsArgs.join(' ')}');
diff --git a/tests/compiler/dart2js/message_kind_helper.dart b/tests/compiler/dart2js/message_kind_helper.dart
index 86e6081..bd1f19c 100644
--- a/tests/compiler/dart2js/message_kind_helper.dart
+++ b/tests/compiler/dart2js/message_kind_helper.dart
@@ -112,7 +112,10 @@
Expect.isTrue(
messageFound,
'${template.kind}} does not match any in\n '
- '${messages.join('\n ')}');
+ '${messages.join('\n ')}\n'
+ 'Consider searching for ${template.kind} in\n'
+ ' pkg/compiler/lib/src/diagnostics/messages.dart\n'
+ 'and removing the associated example');
dynamic reporter = compiler.reporter;
Expect.isFalse(reporter.hasCrashed);
if (!unexpectedMessages.isEmpty) {
diff --git a/tests/compiler/dart2js/array_tracing_mirror_test.dart b/tests/compiler/dart2js/mirrors/array_tracing_mirror_test.dart
similarity index 96%
rename from tests/compiler/dart2js/array_tracing_mirror_test.dart
rename to tests/compiler/dart2js/mirrors/array_tracing_mirror_test.dart
index d19f1fb..7e3cec6 100644
--- a/tests/compiler/dart2js/array_tracing_mirror_test.dart
+++ b/tests/compiler/dart2js/mirrors/array_tracing_mirror_test.dart
@@ -7,7 +7,7 @@
import 'package:expect/expect.dart';
import "package:async_helper/async_helper.dart";
-import 'memory_compiler.dart';
+import '../memory_compiler.dart';
const MEMORY_SOURCE_FILES = const {
'main.dart': '''
diff --git a/tests/compiler/dart2js/analyze_all_test.dart b/tests/compiler/dart2js/old_frontend/analyze_all_test.dart
similarity index 98%
rename from tests/compiler/dart2js/analyze_all_test.dart
rename to tests/compiler/dart2js/old_frontend/analyze_all_test.dart
index 9b1b6e3f..b6daf1c 100644
--- a/tests/compiler/dart2js/analyze_all_test.dart
+++ b/tests/compiler/dart2js/old_frontend/analyze_all_test.dart
@@ -7,7 +7,7 @@
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/diagnostics/messages.dart';
import 'package:expect/expect.dart';
-import 'memory_compiler.dart';
+import '../memory_compiler.dart';
const String SOURCE = """
class Foo {
diff --git a/tests/compiler/dart2js/analyze_api_test.dart b/tests/compiler/dart2js/old_frontend/analyze_api_test.dart
similarity index 100%
rename from tests/compiler/dart2js/analyze_api_test.dart
rename to tests/compiler/dart2js/old_frontend/analyze_api_test.dart
diff --git a/tests/compiler/dart2js/analyze_dart2js_helpers_test.dart b/tests/compiler/dart2js/old_frontend/analyze_dart2js_helpers_test.dart
similarity index 99%
rename from tests/compiler/dart2js/analyze_dart2js_helpers_test.dart
rename to tests/compiler/dart2js/old_frontend/analyze_dart2js_helpers_test.dart
index 7e190bf..9375f46 100644
--- a/tests/compiler/dart2js/analyze_dart2js_helpers_test.dart
+++ b/tests/compiler/dart2js/old_frontend/analyze_dart2js_helpers_test.dart
@@ -25,7 +25,7 @@
import 'package:compiler/src/universe/call_structure.dart' show CallStructure;
import 'package:expect/expect.dart';
-import 'memory_compiler.dart';
+import '../memory_compiler.dart';
main(List<String> arguments) {
bool verbose = arguments.contains('-v');
diff --git a/tests/compiler/dart2js/analyze_dart2js_test.dart b/tests/compiler/dart2js/old_frontend/analyze_dart2js_test.dart
similarity index 98%
rename from tests/compiler/dart2js/analyze_dart2js_test.dart
rename to tests/compiler/dart2js/old_frontend/analyze_dart2js_test.dart
index 7abf3d1..3b15544 100644
--- a/tests/compiler/dart2js/analyze_dart2js_test.dart
+++ b/tests/compiler/dart2js/old_frontend/analyze_dart2js_test.dart
@@ -8,7 +8,7 @@
import 'package:compiler/src/filenames.dart';
import 'package:compiler/src/compiler.dart';
import 'analyze_helper.dart';
-import 'related_types.dart';
+import '../related_types.dart';
/**
* Map of whitelisted warnings and errors.
diff --git a/tests/compiler/dart2js/analyze_helper.dart b/tests/compiler/dart2js/old_frontend/analyze_helper.dart
similarity index 99%
rename from tests/compiler/dart2js/analyze_helper.dart
rename to tests/compiler/dart2js/old_frontend/analyze_helper.dart
index dadcf0c..e11223e 100644
--- a/tests/compiler/dart2js/analyze_helper.dart
+++ b/tests/compiler/dart2js/old_frontend/analyze_helper.dart
@@ -15,7 +15,7 @@
import 'package:compiler/src/options.dart' show CompilerOptions;
import 'package:compiler/src/source_file_provider.dart';
import 'package:compiler/src/util/uri_extras.dart';
-import 'diagnostic_helper.dart';
+import '../diagnostic_helper.dart';
/// Option for hiding whitelisted messages.
const String HIDE_WHITELISTED = '--hide-whitelisted';
diff --git a/tests/compiler/dart2js/analyze_only_test.dart b/tests/compiler/dart2js/old_frontend/analyze_only_test.dart
similarity index 98%
rename from tests/compiler/dart2js/analyze_only_test.dart
rename to tests/compiler/dart2js/old_frontend/analyze_only_test.dart
index 7a70127..9b88dc9 100644
--- a/tests/compiler/dart2js/analyze_only_test.dart
+++ b/tests/compiler/dart2js/old_frontend/analyze_only_test.dart
@@ -17,8 +17,8 @@
import 'package:compiler/src/old_to_new_api.dart';
import 'package:compiler/src/options.dart';
-import '../dart2js_extra/dummy_compiler_test.dart' as dummy;
-import 'output_collector.dart';
+import '../../dart2js_extra/dummy_compiler_test.dart' as dummy;
+import '../output_collector.dart';
runCompiler(String main, List<String> options,
onValue(String code, List errors, List warnings)) {
diff --git a/tests/compiler/dart2js/analyze_test_test.dart b/tests/compiler/dart2js/old_frontend/analyze_test_test.dart
similarity index 100%
rename from tests/compiler/dart2js/analyze_test_test.dart
rename to tests/compiler/dart2js/old_frontend/analyze_test_test.dart
diff --git a/tests/compiler/dart2js/analyze_unused_dart2js_test.dart b/tests/compiler/dart2js/old_frontend/analyze_unused_dart2js_test.dart
similarity index 100%
rename from tests/compiler/dart2js/analyze_unused_dart2js_test.dart
rename to tests/compiler/dart2js/old_frontend/analyze_unused_dart2js_test.dart
diff --git a/tests/compiler/dart2js/async_await_syntax_test.dart b/tests/compiler/dart2js/old_frontend/async_await_syntax_test.dart
similarity index 95%
rename from tests/compiler/dart2js/async_await_syntax_test.dart
rename to tests/compiler/dart2js/old_frontend/async_await_syntax_test.dart
index 16be073..1823e93 100644
--- a/tests/compiler/dart2js/async_await_syntax_test.dart
+++ b/tests/compiler/dart2js/old_frontend/async_await_syntax_test.dart
@@ -5,7 +5,7 @@
// Test that dart2js produces the expected static type warnings and
// compile-time errors for these tests.
-import 'frontend_checker.dart';
+import '../frontend_checker.dart';
/// Map of test files to run together with their associated whitelist.
///
diff --git a/tests/compiler/dart2js/bad_loop_test.dart b/tests/compiler/dart2js/old_frontend/bad_loop_test.dart
similarity index 91%
rename from tests/compiler/dart2js/bad_loop_test.dart
rename to tests/compiler/dart2js/old_frontend/bad_loop_test.dart
index c0a72f9..889cecd 100644
--- a/tests/compiler/dart2js/bad_loop_test.dart
+++ b/tests/compiler/dart2js/old_frontend/bad_loop_test.dart
@@ -2,17 +2,16 @@
// 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:expect/expect.dart';
-import 'memory_source_file_helper.dart';
-import "package:async_helper/async_helper.dart";
-
+import 'package:async_helper/async_helper.dart';
import 'package:compiler/compiler.dart' show Diagnostic;
import 'package:compiler/src/options.dart' show CompilerOptions;
import 'package:compiler/src/old_to_new_api.dart';
+import 'package:expect/expect.dart';
+import '../memory_source_file_helper.dart';
main() {
Uri script = currentDirectory.resolveUri(Platform.script);
- Uri libraryRoot = script.resolve('../../../sdk/');
+ Uri libraryRoot = script.resolve('../../../../sdk/');
Uri packageRoot = script.resolve('./packages/');
var provider = new MemorySourceFileProvider(MEMORY_SOURCE_FILES);
diff --git a/tests/compiler/dart2js/begin_end_token_test.dart b/tests/compiler/dart2js/old_frontend/begin_end_token_test.dart
similarity index 98%
rename from tests/compiler/dart2js/begin_end_token_test.dart
rename to tests/compiler/dart2js/old_frontend/begin_end_token_test.dart
index fca0712..33a6853 100644
--- a/tests/compiler/dart2js/begin_end_token_test.dart
+++ b/tests/compiler/dart2js/old_frontend/begin_end_token_test.dart
@@ -2,9 +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.
-import "package:expect/expect.dart";
-import 'parser_helper.dart';
import 'package:compiler/src/tree/tree.dart';
+import 'package:expect/expect.dart';
+import '../parser_helper.dart';
void testNode(Node node, String expected, String text, [bool hard = true]) {
var debug = 'text=$text,expected=$expected,node:${node}';
diff --git a/tests/compiler/dart2js/benign_error_test.dart b/tests/compiler/dart2js/old_frontend/benign_error_test.dart
similarity index 97%
rename from tests/compiler/dart2js/benign_error_test.dart
rename to tests/compiler/dart2js/old_frontend/benign_error_test.dart
index 3e01a7d..9fd009f 100644
--- a/tests/compiler/dart2js/benign_error_test.dart
+++ b/tests/compiler/dart2js/old_frontend/benign_error_test.dart
@@ -4,7 +4,7 @@
// Test that benign error do not prevent compilation.
-import 'memory_compiler.dart';
+import '../memory_compiler.dart';
import 'package:async_helper/async_helper.dart';
import 'package:compiler/src/compiler.dart';
diff --git a/tests/compiler/dart2js/categories_test.dart b/tests/compiler/dart2js/old_frontend/categories_test.dart
similarity index 97%
rename from tests/compiler/dart2js/categories_test.dart
rename to tests/compiler/dart2js/old_frontend/categories_test.dart
index 552fd49..d1b8eaa 100644
--- a/tests/compiler/dart2js/categories_test.dart
+++ b/tests/compiler/dart2js/old_frontend/categories_test.dart
@@ -5,7 +5,7 @@
import "package:expect/expect.dart";
import 'package:async_helper/async_helper.dart';
-import "memory_compiler.dart";
+import "../memory_compiler.dart";
runTest(String source, String categories, int expectedErrors) async {
var collector = new DiagnosticCollector();
diff --git a/tests/compiler/dart2js/check_elements_invariants_test.dart b/tests/compiler/dart2js/old_frontend/check_elements_invariants_test.dart
similarity index 97%
rename from tests/compiler/dart2js/check_elements_invariants_test.dart
rename to tests/compiler/dart2js/old_frontend/check_elements_invariants_test.dart
index 714493a..3d0bea5 100644
--- a/tests/compiler/dart2js/check_elements_invariants_test.dart
+++ b/tests/compiler/dart2js/old_frontend/check_elements_invariants_test.dart
@@ -9,7 +9,7 @@
import 'package:compiler/src/elements/entities.dart' show ClassEntity;
import 'package:compiler/src/resolution/class_members.dart'
show ClassMemberMixin;
-import 'memory_compiler.dart';
+import '../memory_compiler.dart';
const String DART2JS_SOURCE = 'pkg/compiler/lib/src/dart2js.dart';
const List<String> DART2JS_OPTIONS = const <String>[
diff --git a/tests/compiler/dart2js/check_members_test.dart b/tests/compiler/dart2js/old_frontend/check_members_test.dart
similarity index 98%
rename from tests/compiler/dart2js/check_members_test.dart
rename to tests/compiler/dart2js/old_frontend/check_members_test.dart
index 26a5a53..08c4718 100644
--- a/tests/compiler/dart2js/check_members_test.dart
+++ b/tests/compiler/dart2js/old_frontend/check_members_test.dart
@@ -6,7 +6,7 @@
// bound language tests. This ensures that the analyzer and dart2js agrees
// on these tests.
-import 'warnings_checker.dart';
+import '../warnings_checker.dart';
/// Map from test files to a map of their expected status. If the status map is
/// `null` no warnings must be missing or unexpected, otherwise the status map
diff --git a/tests/compiler/dart2js/combinator_hint_test.dart b/tests/compiler/dart2js/old_frontend/combinator_hint_test.dart
similarity index 98%
rename from tests/compiler/dart2js/combinator_hint_test.dart
rename to tests/compiler/dart2js/old_frontend/combinator_hint_test.dart
index 0518285..30f9535 100644
--- a/tests/compiler/dart2js/combinator_hint_test.dart
+++ b/tests/compiler/dart2js/old_frontend/combinator_hint_test.dart
@@ -9,7 +9,7 @@
import 'package:expect/expect.dart';
import 'package:compiler/src/commandline_options.dart';
import 'package:compiler/src/compiler.dart';
-import 'memory_compiler.dart';
+import '../memory_compiler.dart';
const SOURCE = const {
'show_local.dart': """
diff --git a/tests/compiler/dart2js/compile_with_empty_libraries_test.dart b/tests/compiler/dart2js/old_frontend/compile_with_empty_libraries_test.dart
similarity index 94%
rename from tests/compiler/dart2js/compile_with_empty_libraries_test.dart
rename to tests/compiler/dart2js/old_frontend/compile_with_empty_libraries_test.dart
index d16fe9e..5b6c354 100644
--- a/tests/compiler/dart2js/compile_with_empty_libraries_test.dart
+++ b/tests/compiler/dart2js/old_frontend/compile_with_empty_libraries_test.dart
@@ -6,7 +6,7 @@
/// references to core library definitions.
import 'package:async_helper/async_helper.dart';
-import 'mock_compiler.dart';
+import '../mock_compiler.dart';
const String TEST = r"main() {}";
diff --git a/tests/compiler/dart2js/compiler_test.dart b/tests/compiler/dart2js/old_frontend/compiler_test.dart
similarity index 97%
rename from tests/compiler/dart2js/compiler_test.dart
rename to tests/compiler/dart2js/old_frontend/compiler_test.dart
index 82db42a..a2b10f3 100644
--- a/tests/compiler/dart2js/compiler_test.dart
+++ b/tests/compiler/dart2js/old_frontend/compiler_test.dart
@@ -10,7 +10,7 @@
import "package:compiler/src/old_to_new_api.dart";
import "package:expect/expect.dart";
-import "mock_compiler.dart";
+import "../mock_compiler.dart";
Future testErrorHandling() {
// Test that compiler.currentElement is set correctly when
diff --git a/tests/compiler/dart2js/embedded_category_api_boundary_test.dart b/tests/compiler/dart2js/old_frontend/embedded_category_api_boundary_test.dart
similarity index 100%
rename from tests/compiler/dart2js/embedded_category_api_boundary_test.dart
rename to tests/compiler/dart2js/old_frontend/embedded_category_api_boundary_test.dart
diff --git a/tests/compiler/dart2js/receiver_type_test.dart b/tests/compiler/dart2js/receiver_type_test.dart
index aac37ef..aeb6e81 100644
--- a/tests/compiler/dart2js/receiver_type_test.dart
+++ b/tests/compiler/dart2js/receiver_type_test.dart
@@ -14,7 +14,7 @@
main() {
asyncTest(() async {
await runTest(CompileMode.memory);
- await runTest(CompileMode.dill);
+ await runTest(CompileMode.kernel);
});
}
diff --git a/tests/compiler/dart2js/subtype_test.dart b/tests/compiler/dart2js/subtype_test.dart
index ddacca5..7f0c366 100644
--- a/tests/compiler/dart2js/subtype_test.dart
+++ b/tests/compiler/dart2js/subtype_test.dart
@@ -15,7 +15,7 @@
void main() {
asyncTest(() async {
await runTests(CompileMode.memory);
- await runTests(CompileMode.dill);
+ await runTests(CompileMode.kernel);
});
}
diff --git a/tests/compiler/dart2js/type_test_helper.dart b/tests/compiler/dart2js/type_test_helper.dart
index 8dde099..3ebebb8 100644
--- a/tests/compiler/dart2js/type_test_helper.dart
+++ b/tests/compiler/dart2js/type_test_helper.dart
@@ -18,9 +18,12 @@
import 'package:compiler/src/kernel/kernel_strategy.dart';
import 'package:compiler/src/world.dart' show ClosedWorld;
import 'compiler_helper.dart' as mock;
+import 'compiler_helper.dart' show CompileMode;
import 'memory_compiler.dart' as memory;
import 'kernel/compiler_helper.dart' as dill;
+export 'compiler_helper.dart' show CompileMode;
+
DartType instantiate(Entity element, List<DartType> arguments) {
if (element is ClassElement) {
return new ResolutionInterfaceType(element, arguments);
@@ -32,8 +35,6 @@
}
}
-enum CompileMode { mock, memory, dill }
-
class TypeEnvironment {
final Compiler compiler;
final bool testBackendWorld;
@@ -66,7 +67,7 @@
source = '$mainSource\n$source';
}
memory.DiagnosticCollector collector;
- if (compileMode == CompileMode.dill) {
+ if (compileMode == CompileMode.kernel) {
collector = new memory.DiagnosticCollector();
uri = Uri.parse('memory:main.dart');
compiler = await dill.compileWithDill(
diff --git a/tests/compiler/dart2js/warnings_checker.dart b/tests/compiler/dart2js/warnings_checker.dart
index b29d19c..9e98299 100644
--- a/tests/compiler/dart2js/warnings_checker.dart
+++ b/tests/compiler/dart2js/warnings_checker.dart
@@ -21,11 +21,10 @@
void checkWarnings(Map<String, dynamic> tests, [List<String> arguments]) {
bool isWindows = Platform.isWindows;
- Uri script = currentDirectory.resolveUri(Platform.script);
bool warningsMismatch = false;
bool verbose = arguments != null && arguments.contains('-v');
asyncTest(() => Future.forEach(tests.keys, (String test) async {
- Uri uri = script.resolve('../../$test');
+ Uri uri = Uri.base.resolve('tests/$test');
String source = utf8.decode(readAll(uriPathToNative(uri.path)));
SourceFile file = new StringSourceFile(
uri, relativize(currentDirectory, uri, isWindows), source);
diff --git a/tests/compiler/dart2js_extra/class_hierarchy_extends_clause_test.dart b/tests/compiler/dart2js_extra/class_hierarchy_extends_clause_test.dart
new file mode 100644
index 0000000..1cd8ebb
--- /dev/null
+++ b/tests/compiler/dart2js_extra/class_hierarchy_extends_clause_test.dart
@@ -0,0 +1,23 @@
+// 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:expect/expect.dart';
+
+class A {}
+
+abstract class B<T> {
+ final Box<T> x = new Box<T>();
+}
+
+class C extends B<A> {}
+
+class Box<T> {
+ Box();
+
+ bool doCheck(Object o) => o is T;
+}
+
+main() {
+ var c = new C();
+ Expect.isFalse(c.x.doCheck(3));
+}
diff --git a/tests/compiler/dart2js_extra/dart2js_extra.status b/tests/compiler/dart2js_extra/dart2js_extra.status
index e6eedf8..9c164b4 100644
--- a/tests/compiler/dart2js_extra/dart2js_extra.status
+++ b/tests/compiler/dart2js_extra/dart2js_extra.status
@@ -162,8 +162,8 @@
deferred/reflect_multiple_annotations_test: Crash # Assertion failure: Missing scope info for j:method(_loadLibraryWrapper).
deferred/reflect_multiple_default_arg_test: Crash # Assertion failure: Missing scope info for j:method(_loadLibraryWrapper).
deferred_custom_loader_test: RuntimeError
-deferred_fail_and_retry_test: Crash # type 'Class' is not a subtype of type 'Member' of 'key' where
-deferred_fail_and_retry_worker_test: Crash # type 'Class' is not a subtype of type 'Member' of 'key' where
+deferred_fail_and_retry_test: RuntimeError
+deferred_fail_and_retry_worker_test: Fail
invalid_annotation2_test/none: RuntimeError
label_test/06: MissingCompileTimeError
mirror_invalid_field_access2_test: RuntimeError
diff --git a/tests/compiler/dart2js_native/dart2js_native.status b/tests/compiler/dart2js_native/dart2js_native.status
index fb8f6dd..c339153 100644
--- a/tests/compiler/dart2js_native/dart2js_native.status
+++ b/tests/compiler/dart2js_native/dart2js_native.status
@@ -16,7 +16,6 @@
native_mirror_test: RuntimeError
native_no_such_method_exception4_frog_test: RuntimeError
native_no_such_method_exception5_frog_test: RuntimeError
-optimization_hints_test: RuntimeError
subclassing_constructor_1_test: RuntimeError
subclassing_super_call_test: RuntimeError
subclassing_super_field_1_test: RuntimeError
@@ -46,7 +45,6 @@
native_mirror_test: RuntimeError
native_no_such_method_exception4_frog_test: RuntimeError
native_no_such_method_exception5_frog_test: RuntimeError
-optimization_hints_test: RuntimeError
subclassing_constructor_1_test: RuntimeError
subclassing_super_call_test: RuntimeError
subclassing_super_field_1_test: RuntimeError
diff --git a/tests/corelib/corelib.status b/tests/corelib/corelib.status
index 9c4289e..cb88d10 100644
--- a/tests/corelib/corelib.status
+++ b/tests/corelib/corelib.status
@@ -14,14 +14,12 @@
[ $compiler == dart2js ]
regexp/pcre_test: Pass, Slow # Issue 21593
-[ $compiler == dartkp ]
-apply3_test: CompileTimeError # No support for mirrors
-
[ $compiler == precompiler ]
apply3_test: SkipByDesign # Imports dart:mirrors
big_integer_huge_mul_vm_test: Pass, Timeout # --no_intrinsify
big_integer_parsed_mul_div_vm_test: Pass, Timeout # --no_intrinsify
int_parse_radix_test: Pass, Timeout # --no_intrinsify
+regexp/stack-overflow_test: RuntimeError, OK # Smaller limit with irregex interpreter
[ $mode == debug ]
regexp/pcre_test: Pass, Slow # Timeout. Issue 22008
@@ -66,7 +64,7 @@
unicode_test: RuntimeError # jsshell does not recognize character 223 aka \xdf
[ $strong ]
-*: SkipByDesign # tests/corelib_strong has the strong mode versions of these tests.
+*: SkipByDesign # tests/corelib_2 has the strong mode versions of these tests.
[ $arch == simarmv5te && ($runtime == dart_precompiled || $runtime == vm) ]
big_integer_parsed_mul_div_vm_test: Pass, Slow
@@ -139,6 +137,7 @@
bit_twiddling_bigint_test: RuntimeError
compare_to2_test: RuntimeError
double_parse_test/01: RuntimeError
+error_stack_trace1_test: RuntimeError # Issue 12399
from_environment_const_type_test/02: MissingCompileTimeError
from_environment_const_type_test/03: MissingCompileTimeError
from_environment_const_type_test/04: MissingCompileTimeError
@@ -240,7 +239,7 @@
bit_twiddling_bigint_test: RuntimeError
compare_to2_test: RuntimeError
double_parse_test/01: RuntimeError
-error_stack_trace1_test: Pass # Issue 27394
+error_stack_trace1_test: RuntimeError # Issue 12399
hash_set_test/01: RuntimeError
int_modulo_arith_test/bignum: RuntimeError
int_modulo_arith_test/modPow: RuntimeError
@@ -347,58 +346,6 @@
symbol_test/02: MissingCompileTimeError # bug 11669
symbol_test/03: MissingCompileTimeError # bug 11669
-# dartk: checked mode failures
-[ $checked && ($compiler == dartk || $compiler == dartkp) ]
-from_environment_const_type_test/02: MissingCompileTimeError
-from_environment_const_type_test/03: MissingCompileTimeError
-from_environment_const_type_test/04: MissingCompileTimeError
-from_environment_const_type_test/06: MissingCompileTimeError
-from_environment_const_type_test/07: MissingCompileTimeError
-from_environment_const_type_test/08: MissingCompileTimeError
-from_environment_const_type_test/09: MissingCompileTimeError
-from_environment_const_type_test/11: MissingCompileTimeError
-from_environment_const_type_test/12: MissingCompileTimeError
-from_environment_const_type_test/13: MissingCompileTimeError
-from_environment_const_type_test/14: MissingCompileTimeError
-from_environment_const_type_test/16: MissingCompileTimeError
-from_environment_const_type_undefined_test/02: MissingCompileTimeError
-from_environment_const_type_undefined_test/03: MissingCompileTimeError
-from_environment_const_type_undefined_test/04: MissingCompileTimeError
-from_environment_const_type_undefined_test/06: MissingCompileTimeError
-from_environment_const_type_undefined_test/07: MissingCompileTimeError
-from_environment_const_type_undefined_test/08: MissingCompileTimeError
-symbol_test/01: Pass
-symbol_test/02: Pass
-
-[ ($compiler == dartk || $compiler == dartkp) && ($runtime == dart_precompiled || $runtime == vm) ]
-bool_from_environment2_test/01: MissingCompileTimeError
-bool_from_environment2_test/02: MissingCompileTimeError
-bool_from_environment2_test/03: MissingCompileTimeError
-bool_from_environment2_test/04: MissingCompileTimeError
-compare_to2_test: RuntimeError
-int_from_environment3_test/01: MissingCompileTimeError
-int_from_environment3_test/02: MissingCompileTimeError
-int_from_environment3_test/03: MissingCompileTimeError
-int_from_environment3_test/04: MissingCompileTimeError
-string_case_test/01: RuntimeError
-string_from_environment3_test/01: MissingCompileTimeError
-string_from_environment3_test/02: MissingCompileTimeError
-string_from_environment3_test/03: MissingCompileTimeError
-string_from_environment3_test/04: MissingCompileTimeError
-string_trimlr_test/02: RuntimeError
-symbol_operator_test/03: RuntimeError
-symbol_reserved_word_test/04: MissingCompileTimeError
-symbol_reserved_word_test/06: RuntimeError
-symbol_reserved_word_test/07: MissingCompileTimeError
-symbol_reserved_word_test/09: RuntimeError
-symbol_reserved_word_test/10: MissingCompileTimeError
-symbol_reserved_word_test/12: RuntimeError
-symbol_test/01: MissingCompileTimeError
-symbol_test/02: MissingCompileTimeError
-symbol_test/03: MissingCompileTimeError
-symbol_test/none: RuntimeError
-unicode_test: Fail # Bug 6706
-
[ $arch == simdbc || $arch == simdbc64 ]
regexp/stack-overflow_test: RuntimeError, OK # Smaller limit with irregex interpreter
@@ -425,8 +372,10 @@
package_resource_test: Skip # Resolve URI not supported yet in product mode.
string_trimlr_test/02: RuntimeError # Issue 29060
-[ $compiler == dartkp || $compiler == precompiler ]
-regexp/stack-overflow_test: RuntimeError, OK # Smaller limit with irregex interpreter
+# We skip all the Dart 1.0 tests in dartk and dartkp mode as these
+# modes are intended only for Dart 2.0 with strong mode enabled.
+[ $compiler == dartk || $compiler == dartkp ]
+*: Skip
[ $runtime == dart_precompiled || $runtime == flutter || $runtime == vm ]
regexp/capture-3: Pass, Slow, Timeout # Issues 21593 and 22008
diff --git a/tests/corelib_2/bigint_parse_radix_test.dart b/tests/corelib_2/bigint_parse_radix_test.dart
new file mode 100644
index 0000000..ad94bbf
--- /dev/null
+++ b/tests/corelib_2/bigint_parse_radix_test.dart
@@ -0,0 +1,139 @@
+// 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.
+
+// Testing Bigints with and without intrinsics.
+// VMOptions=
+// VMOptions=--no_intrinsify
+// VMOptions=--optimization_counter_threshold=10 --no-background_compilation
+
+import "package:expect/expect.dart";
+
+import 'dart:math' show pow;
+
+void testParseRadix() {
+ bool checkedMode = false;
+ assert((checkedMode = true));
+ const String oneByteWhiteSpace = "\x09\x0a\x0b\x0c\x0d\x20"
+ // "\x85" // Might make troubles on some systems. Was marked as OK test.
+ "\xa0";
+ const String whiteSpace = "$oneByteWhiteSpace\u1680"
+ "\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a"
+ "\u2028\u2029\u202f\u205f\u3000\ufeff";
+
+ var digits = "0123456789abcdefghijklmnopqrstuvwxyz";
+ var zeros = "0" * 64;
+
+ for (int i = 0; i < whiteSpace.length; i++) {
+ var ws = whiteSpace[i];
+ Expect.equals(BigInt.zero, BigInt.parse("${ws}0${ws}", radix: 2));
+ }
+
+ void testParse(BigInt result, String radixString, int radix) {
+ var m = "$radixString/$radix->$result";
+ Expect.equals(
+ result, BigInt.parse(radixString.toLowerCase(), radix: radix), m);
+ Expect.equals(
+ result, BigInt.parse(radixString.toUpperCase(), radix: radix), m);
+ Expect.equals(result, BigInt.parse(" $radixString", radix: radix), m);
+ Expect.equals(result, BigInt.parse("$radixString ", radix: radix), m);
+ Expect.equals(result, BigInt.parse(" $radixString ", radix: radix), m);
+ Expect.equals(result, BigInt.parse("+$radixString", radix: radix), m);
+ Expect.equals(result, BigInt.parse(" +$radixString", radix: radix), m);
+ Expect.equals(result, BigInt.parse("+$radixString ", radix: radix), m);
+ Expect.equals(result, BigInt.parse(" +$radixString ", radix: radix), m);
+ Expect.equals(-result, BigInt.parse("-$radixString", radix: radix), m);
+ Expect.equals(-result, BigInt.parse(" -$radixString", radix: radix), m);
+ Expect.equals(-result, BigInt.parse("-$radixString ", radix: radix), m);
+ Expect.equals(-result, BigInt.parse(" -$radixString ", radix: radix), m);
+ Expect.equals(
+ result,
+ BigInt.parse("$oneByteWhiteSpace$radixString$oneByteWhiteSpace",
+ radix: radix),
+ m);
+ Expect.equals(
+ -result,
+ BigInt.parse("$oneByteWhiteSpace-$radixString$oneByteWhiteSpace",
+ radix: radix),
+ m);
+ Expect.equals(result,
+ BigInt.parse("$whiteSpace$radixString$whiteSpace", radix: radix), m);
+ Expect.equals(-result,
+ BigInt.parse("$whiteSpace-$radixString$whiteSpace", radix: radix), m);
+
+ Expect.equals(result, BigInt.parse("$zeros$radixString", radix: radix), m);
+ Expect.equals(result, BigInt.parse("+$zeros$radixString", radix: radix), m);
+ Expect.equals(
+ -result, BigInt.parse("-$zeros$radixString", radix: radix), m);
+ }
+
+ for (int r = 2; r <= 36; r++) {
+ for (var i = BigInt.zero; i <= new BigInt.from(r * r); i += BigInt.one) {
+ String radixString = i.toRadixString(r);
+ testParse(i, radixString, r);
+ }
+ }
+
+ for (int i = 2; i <= 36; i++) {
+ var digit = digits[i - 1];
+ testParse(new BigInt.from(i).pow(64) - BigInt.one, digit * 64, i);
+ testParse(BigInt.zero, zeros, i);
+ }
+
+ // Allow both upper- and lower-case letters.
+ Expect.equals(new BigInt.from(0xABCD), BigInt.parse("ABCD", radix: 16));
+ Expect.equals(new BigInt.from(0xABCD), BigInt.parse("abcd", radix: 16));
+ Expect.equals(new BigInt.from(15628859), BigInt.parse("09azAZ", radix: 36));
+
+ Expect.equals(
+ (new BigInt.from(0x12345678) << 96) +
+ (new BigInt.from(0x12345678) << 64) +
+ (new BigInt.from(0x12345678) << 32) +
+ new BigInt.from(0x12345678),
+ BigInt.parse("0x12345678123456781234567812345678"));
+
+ // Allow whitespace before and after the number.
+ Expect.equals(BigInt.one, BigInt.parse(" 1", radix: 2));
+ Expect.equals(BigInt.one, BigInt.parse("1 ", radix: 2));
+ Expect.equals(BigInt.one, BigInt.parse(" 1 ", radix: 2));
+ Expect.equals(BigInt.one, BigInt.parse("\n1", radix: 2));
+ Expect.equals(BigInt.one, BigInt.parse("1\n", radix: 2));
+ Expect.equals(BigInt.one, BigInt.parse("\n1\n", radix: 2));
+ Expect.equals(BigInt.one, BigInt.parse("+1", radix: 2));
+
+ void testFails(String source, int radix) {
+ Expect.throws(() {
+ BigInt.parse(source, radix: radix);
+ }, (e) => e is FormatException, "$source/$radix");
+ }
+
+ for (int i = 2; i < 36; i++) {
+ var char = i.toRadixString(36);
+ testFails(char.toLowerCase(), i);
+ testFails(char.toUpperCase(), i);
+ }
+ testFails("", 2);
+ testFails("+ 1", 2); // No space between sign and digits.
+ testFails("- 1", 2); // No space between sign and digits.
+ testFails("0x", null);
+ for (int i = 2; i <= 33; i++) {
+ // No 0x specially allowed.
+ // At radix 34 and above, "x" is a valid digit.
+ testFails("0x10", i);
+ }
+
+ testBadArguments(String source, int radix) {
+ // If the types match, it should be an ArgumentError of some sort.
+ Expect.throws(
+ () => BigInt.parse(source, radix: radix), (e) => e is ArgumentError);
+ }
+
+ testBadArguments("0", -1);
+ testBadArguments("0", 0);
+ testBadArguments("0", 1);
+ testBadArguments("0", 37);
+}
+
+main() {
+ testParseRadix();
+}
diff --git a/tests/corelib_2/bigint_test.dart b/tests/corelib_2/bigint_test.dart
new file mode 100644
index 0000000..5d5dd3d
--- /dev/null
+++ b/tests/corelib_2/bigint_test.dart
@@ -0,0 +1,926 @@
+// 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.
+
+// Testing Bigints with and without intrinsics.
+// VMOptions=
+// VMOptions=--no_intrinsify
+// VMOptions=--optimization_counter_threshold=10 --no-background_compilation
+
+import "package:expect/expect.dart";
+
+import 'dart:math' show pow;
+
+var smallNumber = new BigInt.from(1234567890); // is 31-bit integer.
+var mediumNumber = new BigInt.from(1234567890123456); // is 53-bit integer
+var bigNumber = BigInt.parse("590295810358705600000"); // > 64-bit integer
+
+testModPow() {
+ void test(BigInt x, BigInt e, BigInt m, BigInt expectedResult) {
+ // Check that expected result is correct, using an unoptimized version.
+ assert(() {
+ slowModPow(BigInt x, BigInt e, BigInt m) {
+ var r = BigInt.one;
+ while (e > BigInt.zero) {
+ if (e.isOdd) r = (r * x) % m;
+ e >>= 1;
+ x = (x * x) % m;
+ }
+ return r;
+ }
+
+ return slowModPow(x, e, m) == expectedResult;
+ }());
+ var result = x.modPow(e, m);
+ Expect.equals(expectedResult, result, "$x.modPow($e, $m)");
+ }
+
+ test(new BigInt.from(10), new BigInt.from(20), BigInt.one, BigInt.zero);
+ test(new BigInt.from(1234567890), new BigInt.from(1000000001),
+ new BigInt.from(19), new BigInt.from(11));
+ test(new BigInt.from(1234567890), new BigInt.from(19),
+ new BigInt.from(1000000001), new BigInt.from(122998977));
+ test(new BigInt.from(19), new BigInt.from(1234567890),
+ new BigInt.from(1000000001), new BigInt.from(619059596));
+ test(new BigInt.from(19), new BigInt.from(1000000001),
+ new BigInt.from(1234567890), new BigInt.from(84910879));
+ test(new BigInt.from(1000000001), new BigInt.from(19),
+ new BigInt.from(1234567890), new BigInt.from(872984351));
+ test(new BigInt.from(1000000001), new BigInt.from(1234567890),
+ new BigInt.from(19), BigInt.zero);
+ test(BigInt.parse("12345678901234567890"),
+ BigInt.parse("10000000000000000001"), new BigInt.from(19), BigInt.two);
+ test(
+ BigInt.parse("12345678901234567890"),
+ new BigInt.from(19),
+ BigInt.parse("10000000000000000001"),
+ BigInt.parse("3239137215315834625"));
+ test(
+ new BigInt.from(19),
+ BigInt.parse("12345678901234567890"),
+ BigInt.parse("10000000000000000001"),
+ BigInt.parse("4544207837373941034"));
+ test(
+ new BigInt.from(19),
+ BigInt.parse("10000000000000000001"),
+ BigInt.parse("12345678901234567890"),
+ BigInt.parse("11135411705397624859"));
+ test(
+ BigInt.parse("10000000000000000001"),
+ new BigInt.from(19),
+ BigInt.parse("12345678901234567890"),
+ BigInt.parse("2034013733189773841"));
+ test(BigInt.parse("10000000000000000001"),
+ BigInt.parse("12345678901234567890"), new BigInt.from(19), BigInt.one);
+ test(
+ BigInt.parse("12345678901234567890"),
+ new BigInt.from(19),
+ BigInt.parse("10000000000000000001"),
+ BigInt.parse("3239137215315834625"));
+ test(BigInt.parse("12345678901234567890"),
+ BigInt.parse("10000000000000000001"), new BigInt.from(19), BigInt.two);
+ test(
+ BigInt.parse("123456789012345678901234567890"),
+ BigInt.parse("123456789012345678901234567891"),
+ BigInt.parse("123456789012345678901234567899"),
+ BigInt.parse("116401406051033429924651549616"));
+ test(
+ BigInt.parse("123456789012345678901234567890"),
+ BigInt.parse("123456789012345678901234567899"),
+ BigInt.parse("123456789012345678901234567891"),
+ BigInt.parse("123456789012345678901234567890"));
+ test(
+ BigInt.parse("123456789012345678901234567899"),
+ BigInt.parse("123456789012345678901234567890"),
+ BigInt.parse("123456789012345678901234567891"),
+ BigInt.parse("35088523091000351053091545070"));
+ test(
+ BigInt.parse("123456789012345678901234567899"),
+ BigInt.parse("123456789012345678901234567891"),
+ BigInt.parse("123456789012345678901234567890"),
+ BigInt.parse("18310047270234132455316941949"));
+ test(
+ BigInt.parse("123456789012345678901234567891"),
+ BigInt.parse("123456789012345678901234567899"),
+ BigInt.parse("123456789012345678901234567890"),
+ BigInt.one);
+ test(
+ BigInt.parse("123456789012345678901234567891"),
+ BigInt.parse("123456789012345678901234567890"),
+ BigInt.parse("123456789012345678901234567899"),
+ BigInt.parse("40128068573873018143207285483"));
+}
+
+testModInverse() {
+ void test(BigInt x, BigInt m, BigInt expectedResult) {
+ //print("$x op $m == $expectedResult");
+ // Check that expectedResult is an inverse.
+ assert(expectedResult < m);
+ // The 1 % m handles the m = 1 special case.
+ assert((((x % m) * expectedResult) - BigInt.one) % m == BigInt.zero);
+
+ var result = x.modInverse(m);
+ Expect.equals(expectedResult, result, "$x modinv $m");
+
+ if (x > m) {
+ x = x % m;
+ var result = x.modInverse(m);
+ Expect.equals(expectedResult, result, "$x modinv $m");
+ }
+ }
+
+ void testThrows(BigInt x, BigInt m) {
+ // Throws if not co-prime, which is a symmetric property.
+ Expect.throws(() => x.modInverse(m), null, "$x modinv $m");
+ Expect.throws(() => m.modInverse(x), null, "$m modinv $x");
+ }
+
+ test(BigInt.one, BigInt.one, BigInt.zero);
+
+ testThrows(BigInt.zero, new BigInt.from(1000000001));
+ testThrows(BigInt.two, new BigInt.from(4));
+ testThrows(new BigInt.from(99), new BigInt.from(9));
+ testThrows(new BigInt.from(19), new BigInt.from(1000000001));
+ testThrows(BigInt.parse("123456789012345678901234567890"),
+ BigInt.parse("123456789012345678901234567899"));
+
+ // Co-prime numbers
+ test(new BigInt.from(1234567890), new BigInt.from(19), new BigInt.from(11));
+ test(new BigInt.from(1234567890), new BigInt.from(1000000001),
+ new BigInt.from(189108911));
+ test(new BigInt.from(19), new BigInt.from(1234567890),
+ new BigInt.from(519818059));
+ test(new BigInt.from(1000000001), new BigInt.from(1234567890),
+ new BigInt.from(1001100101));
+
+ test(new BigInt.from(12345), new BigInt.from(12346), new BigInt.from(12345));
+ test(new BigInt.from(12345), new BigInt.from(12346), new BigInt.from(12345));
+
+ test(smallNumber, new BigInt.from(137), new BigInt.from(42));
+ test(new BigInt.from(137), smallNumber, new BigInt.from(856087223));
+ test(mediumNumber, new BigInt.from(137), new BigInt.from(77));
+ test(new BigInt.from(137), mediumNumber, new BigInt.from(540686667207353));
+ test(bigNumber, new BigInt.from(137), new BigInt.from(128));
+}
+
+testGcd() {
+ // Call testFunc with all combinations and orders of plus/minus
+ // value and other.
+ void callCombos(
+ BigInt value, BigInt other, void testFunc(BigInt a, BigInt b)) {
+ testFunc(value, other);
+ testFunc(value, -other);
+ testFunc(-value, other);
+ testFunc(-value, -other);
+ if (value == other) return;
+ testFunc(other, value);
+ testFunc(other, -value);
+ testFunc(-other, value);
+ testFunc(-other, -value);
+ }
+
+ // Test that gcd of value and other (non-negative) is expectedResult.
+ // Tests all combinations of positive and negative values and order of
+ // operands, so use positive values and order is not important.
+ void test(BigInt value, BigInt other, BigInt expectedResult) {
+ // Check for bug in test.
+ assert(
+ expectedResult == BigInt.zero || value % expectedResult == BigInt.zero);
+ assert(
+ expectedResult == BigInt.zero || other % expectedResult == BigInt.zero);
+
+ callCombos(value, other, (BigInt a, BigInt b) {
+ var result = a.gcd(b);
+
+ /// Check that the result is a divisor.
+ Expect.equals(
+ BigInt.zero, result == BigInt.zero ? a : a % result, "$result | $a");
+ Expect.equals(
+ BigInt.zero, result == BigInt.zero ? b : b % result, "$result | $b");
+ // Check for bug in test. If assert fails, the expected value is too low,
+ // and the gcd call has found a greater common divisor.
+ assert(result >= expectedResult);
+ Expect.equals(expectedResult, result, "$a.gcd($b)");
+ });
+ }
+
+ // Test that gcd of value and other (non-negative) throws.
+ testThrows(value, other) {
+ callCombos(value, other, (a, b) {
+ Expect.throws(() => a.gcd(b), null, "$a.gcd($b)");
+ });
+ }
+
+ // Format:
+ // test(value1, value2, expectedResult);
+ test(BigInt.one, BigInt.one, BigInt.one); // both are 1
+ test(BigInt.one, BigInt.two, BigInt.one); // one is 1
+ test(new BigInt.from(3), new BigInt.from(5), BigInt.one); // coprime.
+ test(new BigInt.from(37), new BigInt.from(37),
+ new BigInt.from(37)); // Same larger prime.
+
+ test(new BigInt.from(9999), new BigInt.from(7272),
+ new BigInt.from(909)); // Larger numbers
+
+ test(BigInt.zero, new BigInt.from(1000),
+ new BigInt.from(1000)); // One operand is zero.
+ test(BigInt.zero, BigInt.zero, BigInt.zero); // Both operands are zero.
+
+ // Multiplying both operands by a number multiplies result by same number.
+ test(new BigInt.from(693), new BigInt.from(609), new BigInt.from(21));
+ test(new BigInt.from(693) << 5, new BigInt.from(609) << 5,
+ new BigInt.from(21) << 5);
+ test(
+ new BigInt.from(693) * new BigInt.from(937),
+ new BigInt.from(609) * new BigInt.from(937),
+ new BigInt.from(21) * new BigInt.from(937));
+ test(
+ new BigInt.from(693) * new BigInt.from(pow(2, 32)),
+ new BigInt.from(609) * new BigInt.from(pow(2, 32)),
+ new BigInt.from(21) * new BigInt.from(pow(2, 32)));
+ test(
+ new BigInt.from(693) * BigInt.two.pow(52),
+ new BigInt.from(609) * BigInt.two.pow(52),
+ new BigInt.from(21) * BigInt.two.pow(52));
+ test(
+ new BigInt.from(693) * BigInt.two.pow(53),
+ new BigInt.from(609) * BigInt.two.pow(53),
+ new BigInt.from(21) * BigInt.two.pow(53)); // Regression.
+ test(
+ new BigInt.from(693) * BigInt.two.pow(99),
+ new BigInt.from(609) * BigInt.two.pow(99),
+ new BigInt.from(21) * BigInt.two.pow(99));
+
+ test(new BigInt.from(1234567890), new BigInt.from(19), BigInt.one);
+ test(new BigInt.from(1234567890), new BigInt.from(1000000001), BigInt.one);
+ test(new BigInt.from(19), new BigInt.from(1000000001), new BigInt.from(19));
+
+ test(new BigInt.from(0x3FFFFFFF), new BigInt.from(0x3FFFFFFF),
+ new BigInt.from(0x3FFFFFFF));
+ test(new BigInt.from(0x3FFFFFFF), new BigInt.from(0x40000000), BigInt.one);
+
+ test(BigInt.two.pow(54), BigInt.two.pow(53), BigInt.two.pow(53));
+
+ test(
+ (BigInt.two.pow(52) - BigInt.one) * BigInt.two.pow(14),
+ (BigInt.two.pow(26) - BigInt.one) * BigInt.two.pow(22),
+ (BigInt.two.pow(26) - BigInt.one) * BigInt.two.pow(14));
+}
+
+foo() => BigInt.parse("1234567890123456789");
+bar() => BigInt.parse("12345678901234567890");
+
+testSmiOverflow() {
+ var a = new BigInt.from(1073741823);
+ var b = new BigInt.from(1073741822);
+ Expect.equals(new BigInt.from(2147483645), a + b);
+ a = -new BigInt.from(1000000000);
+ b = new BigInt.from(1000000001);
+ Expect.equals(-new BigInt.from(2000000001), a - b);
+ Expect.equals(-BigInt.parse("1000000001000000000"), a * b);
+}
+
+testBigintAdd() {
+ // Bigint and Smi.
+ var a = BigInt.parse("12345678901234567890");
+ var b = BigInt.two;
+ Expect.equals(BigInt.parse("12345678901234567892"), a + b);
+ Expect.equals(BigInt.parse("12345678901234567892"), b + a);
+ // Bigint and Bigint.
+ a = BigInt.parse("10000000000000000001");
+ Expect.equals(BigInt.parse("20000000000000000002"), a + a);
+}
+
+testBigintSub() {
+ // Bigint and Smi.
+ var a = BigInt.parse("12345678901234567890");
+ var b = BigInt.two;
+ Expect.equals(BigInt.parse("12345678901234567888"), a - b);
+ Expect.equals(-BigInt.parse("12345678901234567888"), b - a);
+ // Bigint and Bigint.
+ a = BigInt.parse("10000000000000000001");
+ Expect.equals(BigInt.parse("20000000000000000002"), a + a);
+}
+
+testBigintMul() {
+ // Bigint and Smi.
+ var a = BigInt.parse("12345678901234567890");
+ var b = new BigInt.from(10);
+ Expect.equals(BigInt.parse("123456789012345678900"), a * b);
+ Expect.equals(BigInt.parse("123456789012345678900"), b * a);
+ // Bigint and Bigint.
+ a = BigInt.parse("12345678901234567890");
+ b = BigInt.parse("10000000000000000");
+ Expect.equals(BigInt.parse("123456789012345678900000000000000000"), a * b);
+}
+
+testBigintTruncDiv() {
+ var a = BigInt.parse("12345678901234567890");
+ var b = new BigInt.from(10);
+ // Bigint and Smi.
+ Expect.equals(BigInt.parse("1234567890123456789"), a ~/ b);
+ Expect.equals(BigInt.zero, b ~/ a);
+ Expect.equals(new BigInt.from(123456789),
+ BigInt.parse("123456789012345678") ~/ new BigInt.from(1000000000));
+ // Bigint and Bigint.
+ a = BigInt.parse("12345678901234567890");
+ b = BigInt.parse("10000000000000000");
+ Expect.equals(new BigInt.from(1234), a ~/ b);
+}
+
+testBigintDiv() {
+ // Bigint and Smi.
+ Expect.equals(1234567890123456789.1,
+ BigInt.parse("12345678901234567891") / new BigInt.from(10));
+ Expect.equals(
+ 0.000000001234, new BigInt.from(1234) / new BigInt.from(1000000000000));
+ Expect.equals(12345678901234000000.0,
+ BigInt.parse("123456789012340000000") / new BigInt.from(10));
+ // Bigint and Bigint.
+ var a = BigInt.parse("12345670000000000000");
+ var b = BigInt.parse("10000000000000000");
+ Expect.equals(1234.567, a / b);
+}
+
+testBigintModulo() {
+ // Bigint and Smi.
+ var a = new BigInt.from(1000000000005);
+ var b = new BigInt.from(10);
+ Expect.equals(new BigInt.from(5), a % b);
+ Expect.equals(new BigInt.from(10), b % a);
+ // Bigint & Bigint
+ a = BigInt.parse("10000000000000000001");
+ b = BigInt.parse("10000000000000000000");
+ Expect.equals(BigInt.one, a % b);
+ Expect.equals(BigInt.parse("10000000000000000000"), b % a);
+}
+
+testBigintModPow() {
+ var x, e, m;
+ x = new BigInt.from(1234567890);
+ e = new BigInt.from(1000000001);
+ m = new BigInt.from(19);
+ Expect.equals(new BigInt.from(11), x.modPow(e, m));
+ x = new BigInt.from(1234567890);
+ e = new BigInt.from(19);
+ m = new BigInt.from(1000000001);
+ Expect.equals(new BigInt.from(122998977), x.modPow(e, m));
+ x = new BigInt.from(19);
+ e = new BigInt.from(1234567890);
+ m = new BigInt.from(1000000001);
+ Expect.equals(new BigInt.from(619059596), x.modPow(e, m));
+ x = new BigInt.from(19);
+ e = new BigInt.from(1000000001);
+ m = new BigInt.from(1234567890);
+ Expect.equals(new BigInt.from(84910879), x.modPow(e, m));
+ x = new BigInt.from(1000000001);
+ e = new BigInt.from(19);
+ m = new BigInt.from(1234567890);
+ Expect.equals(new BigInt.from(872984351), x.modPow(e, m));
+ x = new BigInt.from(1000000001);
+ e = new BigInt.from(1234567890);
+ m = new BigInt.from(19);
+ Expect.equals(BigInt.zero, x.modPow(e, m));
+ x = BigInt.parse("12345678901234567890");
+ e = BigInt.parse("10000000000000000001");
+ m = new BigInt.from(19);
+ Expect.equals(BigInt.two, x.modPow(e, m));
+ x = BigInt.parse("12345678901234567890");
+ e = new BigInt.from(19);
+ m = BigInt.parse("10000000000000000001");
+ Expect.equals(BigInt.parse("3239137215315834625"), x.modPow(e, m));
+ x = new BigInt.from(19);
+ e = BigInt.parse("12345678901234567890");
+ m = BigInt.parse("10000000000000000001");
+ Expect.equals(BigInt.parse("4544207837373941034"), x.modPow(e, m));
+ x = new BigInt.from(19);
+ e = BigInt.parse("10000000000000000001");
+ m = BigInt.parse("12345678901234567890");
+ Expect.equals(BigInt.parse("11135411705397624859"), x.modPow(e, m));
+ x = BigInt.parse("10000000000000000001");
+ e = new BigInt.from(19);
+ m = BigInt.parse("12345678901234567890");
+ Expect.equals(BigInt.parse("2034013733189773841"), x.modPow(e, m));
+ x = BigInt.parse("10000000000000000001");
+ e = BigInt.parse("12345678901234567890");
+ m = new BigInt.from(19);
+ Expect.equals(BigInt.one, x.modPow(e, m));
+ x = BigInt.parse("12345678901234567890");
+ e = new BigInt.from(19);
+ m = BigInt.parse("10000000000000000001");
+ Expect.equals(BigInt.parse("3239137215315834625"), x.modPow(e, m));
+ x = BigInt.parse("12345678901234567890");
+ e = BigInt.parse("10000000000000000001");
+ m = new BigInt.from(19);
+ Expect.equals(BigInt.two, x.modPow(e, m));
+ x = BigInt.parse("123456789012345678901234567890");
+ e = BigInt.parse("123456789012345678901234567891");
+ m = BigInt.parse("123456789012345678901234567899");
+ Expect.equals(BigInt.parse("116401406051033429924651549616"), x.modPow(e, m));
+ x = BigInt.parse("123456789012345678901234567890");
+ e = BigInt.parse("123456789012345678901234567899");
+ m = BigInt.parse("123456789012345678901234567891");
+ Expect.equals(BigInt.parse("123456789012345678901234567890"), x.modPow(e, m));
+ x = BigInt.parse("123456789012345678901234567899");
+ e = BigInt.parse("123456789012345678901234567890");
+ m = BigInt.parse("123456789012345678901234567891");
+ Expect.equals(BigInt.parse("35088523091000351053091545070"), x.modPow(e, m));
+ x = BigInt.parse("123456789012345678901234567899");
+ e = BigInt.parse("123456789012345678901234567891");
+ m = BigInt.parse("123456789012345678901234567890");
+ Expect.equals(BigInt.parse("18310047270234132455316941949"), x.modPow(e, m));
+ x = BigInt.parse("123456789012345678901234567891");
+ e = BigInt.parse("123456789012345678901234567899");
+ m = BigInt.parse("123456789012345678901234567890");
+ Expect.equals(BigInt.one, x.modPow(e, m));
+ x = BigInt.parse("123456789012345678901234567891");
+ e = BigInt.parse("123456789012345678901234567890");
+ m = BigInt.parse("123456789012345678901234567899");
+ Expect.equals(BigInt.parse("40128068573873018143207285483"), x.modPow(e, m));
+}
+
+testBigintModInverse() {
+ var x, m;
+ x = BigInt.one;
+ m = BigInt.one;
+ Expect.equals(BigInt.zero, x.modInverse(m));
+ x = BigInt.zero;
+ m = new BigInt.from(1000000001);
+ Expect.throws(() => x.modInverse(m), (e) => e is Exception); // Not coprime.
+ x = new BigInt.from(1234567890);
+ m = new BigInt.from(19);
+ Expect.equals(new BigInt.from(11), x.modInverse(m));
+ x = new BigInt.from(1234567890);
+ m = new BigInt.from(1000000001);
+ Expect.equals(new BigInt.from(189108911), x.modInverse(m));
+ x = new BigInt.from(19);
+ m = new BigInt.from(1000000001);
+ Expect.throws(() => x.modInverse(m), (e) => e is Exception); // Not coprime.
+ x = new BigInt.from(19);
+ m = new BigInt.from(1234567890);
+ Expect.equals(new BigInt.from(519818059), x.modInverse(m));
+ x = new BigInt.from(1000000001);
+ m = new BigInt.from(1234567890);
+ Expect.equals(new BigInt.from(1001100101), x.modInverse(m));
+ x = new BigInt.from(1000000001);
+ m = new BigInt.from(19);
+ Expect.throws(() => x.modInverse(m), (e) => e is Exception); // Not coprime.
+ x = BigInt.parse("12345678901234567890");
+ m = new BigInt.from(19);
+ Expect.equals(new BigInt.from(3), x.modInverse(m));
+ x = BigInt.parse("12345678901234567890");
+ m = BigInt.parse("10000000000000000001");
+ Expect.equals(BigInt.parse("9736746307686209582"), x.modInverse(m));
+ x = new BigInt.from(19);
+ m = BigInt.parse("10000000000000000001");
+ Expect.equals(BigInt.parse("6315789473684210527"), x.modInverse(m));
+ x = new BigInt.from(19);
+ m = BigInt.parse("12345678901234567890");
+ Expect.equals(BigInt.parse("10396361179987004539"), x.modInverse(m));
+ x = BigInt.parse("10000000000000000001");
+ m = BigInt.parse("12345678901234567890");
+ Expect.equals(BigInt.parse("325004555487045911"), x.modInverse(m));
+ x = BigInt.parse("10000000000000000001");
+ m = new BigInt.from(19);
+ Expect.equals(new BigInt.from(7), x.modInverse(m));
+ x = BigInt.parse("12345678901234567890");
+ m = BigInt.parse("10000000000000000001");
+ Expect.equals(BigInt.parse("9736746307686209582"), x.modInverse(m));
+ x = BigInt.parse("12345678901234567890");
+ m = new BigInt.from(19);
+ Expect.equals(new BigInt.from(3), x.modInverse(m));
+ x = BigInt.parse("123456789012345678901234567890");
+ m = BigInt.parse("123456789012345678901234567899");
+ Expect.throws(() => x.modInverse(m), (e) => e is Exception); // Not coprime.
+ x = BigInt.parse("123456789012345678901234567890");
+ m = BigInt.parse("123456789012345678901234567891");
+ Expect.equals(
+ BigInt.parse("123456789012345678901234567890"), x.modInverse(m));
+ x = BigInt.parse("123456789012345678901234567899");
+ m = BigInt.parse("123456789012345678901234567891");
+ Expect.equals(BigInt.parse("77160493132716049313271604932"), x.modInverse(m));
+ x = BigInt.parse("123456789012345678901234567899");
+ m = BigInt.parse("123456789012345678901234567890");
+ Expect.throws(() => x.modInverse(m), (e) => e is Exception); // Not coprime.
+ x = BigInt.parse("123456789012345678901234567891");
+ m = BigInt.parse("123456789012345678901234567890");
+ Expect.equals(BigInt.one, x.modInverse(m));
+ x = BigInt.parse("123456789012345678901234567891");
+ m = BigInt.parse("123456789012345678901234567899");
+ Expect.equals(BigInt.parse("46296295879629629587962962962"), x.modInverse(m));
+}
+
+testBigintGcd() {
+ var x, m;
+ x = BigInt.one;
+ m = BigInt.one;
+ Expect.equals(BigInt.one, x.gcd(m));
+ x = new BigInt.from(693);
+ m = new BigInt.from(609);
+ Expect.equals(new BigInt.from(21), x.gcd(m));
+ x = new BigInt.from(693) << 40;
+ m = new BigInt.from(609) << 40;
+ Expect.equals(new BigInt.from(21) << 40, x.gcd(m));
+ x = new BigInt.from(609) << 40;
+ m = new BigInt.from(693) << 40;
+ Expect.equals(new BigInt.from(21) << 40, x.gcd(m));
+ x = BigInt.zero;
+ m = new BigInt.from(1000000001);
+ Expect.equals(m, x.gcd(m));
+ x = new BigInt.from(1000000001);
+ m = BigInt.zero;
+ Expect.equals(x, x.gcd(m));
+ x = BigInt.zero;
+ m = -new BigInt.from(1000000001);
+ Expect.equals(-m, x.gcd(m));
+ x = -new BigInt.from(1000000001);
+ m = BigInt.zero;
+ Expect.equals(-x, x.gcd(m));
+ x = BigInt.zero;
+ m = BigInt.zero;
+ Expect.equals(BigInt.zero, x.gcd(m));
+ x = BigInt.zero;
+ m = BigInt.parse("123456789012345678901234567890");
+ Expect.equals(m, x.gcd(m));
+ x = BigInt.parse("123456789012345678901234567890");
+ m = BigInt.zero;
+ Expect.equals(x, x.gcd(m));
+ x = BigInt.zero;
+ m = -BigInt.parse("123456789012345678901234567890");
+ Expect.equals(-m, x.gcd(m));
+ x = -BigInt.parse("123456789012345678901234567890");
+ m = BigInt.zero;
+ Expect.equals(-x, x.gcd(m));
+ x = new BigInt.from(1234567890);
+ m = new BigInt.from(19);
+ Expect.equals(BigInt.one, x.gcd(m));
+ x = new BigInt.from(1234567890);
+ m = new BigInt.from(1000000001);
+ Expect.equals(BigInt.one, x.gcd(m));
+ x = new BigInt.from(19);
+ m = new BigInt.from(1000000001);
+ Expect.equals(new BigInt.from(19), x.gcd(m));
+ x = new BigInt.from(19);
+ m = new BigInt.from(1234567890);
+ Expect.equals(BigInt.one, x.gcd(m));
+ x = new BigInt.from(1000000001);
+ m = new BigInt.from(1234567890);
+ Expect.equals(BigInt.one, x.gcd(m));
+ x = new BigInt.from(1000000001);
+ m = new BigInt.from(19);
+ Expect.equals(new BigInt.from(19), x.gcd(m));
+ x = BigInt.parse("12345678901234567890");
+ m = new BigInt.from(19);
+ Expect.equals(BigInt.one, x.gcd(m));
+ x = BigInt.parse("12345678901234567890");
+ m = BigInt.parse("10000000000000000001");
+ Expect.equals(BigInt.one, x.gcd(m));
+ x = new BigInt.from(19);
+ m = BigInt.parse("10000000000000000001");
+ Expect.equals(BigInt.one, x.gcd(m));
+ x = new BigInt.from(19);
+ m = BigInt.parse("12345678901234567890");
+ Expect.equals(BigInt.one, x.gcd(m));
+ x = BigInt.parse("10000000000000000001");
+ m = BigInt.parse("12345678901234567890");
+ Expect.equals(BigInt.one, x.gcd(m));
+ x = BigInt.parse("10000000000000000001");
+ m = new BigInt.from(19);
+ Expect.equals(BigInt.one, x.gcd(m));
+ x = BigInt.parse("12345678901234567890");
+ m = BigInt.parse("10000000000000000001");
+ Expect.equals(BigInt.one, x.gcd(m));
+ x = BigInt.parse("12345678901234567890");
+ m = new BigInt.from(19);
+ Expect.equals(BigInt.one, x.gcd(m));
+ x = BigInt.parse("123456789012345678901234567890");
+ m = BigInt.parse("123456789012345678901234567899");
+ Expect.equals(new BigInt.from(9), x.gcd(m));
+ x = BigInt.parse("123456789012345678901234567890");
+ m = BigInt.parse("123456789012345678901234567891");
+ Expect.equals(BigInt.one, x.gcd(m));
+ x = BigInt.parse("123456789012345678901234567899");
+ m = BigInt.parse("123456789012345678901234567891");
+ Expect.equals(BigInt.one, x.gcd(m));
+ x = BigInt.parse("123456789012345678901234567899");
+ m = BigInt.parse("123456789012345678901234567890");
+ Expect.equals(new BigInt.from(9), x.gcd(m));
+ x = BigInt.parse("123456789012345678901234567891");
+ m = BigInt.parse("123456789012345678901234567890");
+ Expect.equals(BigInt.one, x.gcd(m));
+ x = BigInt.parse("123456789012345678901234567891");
+ m = BigInt.parse("123456789012345678901234567899");
+ Expect.equals(BigInt.one, x.gcd(m));
+}
+
+testBigintNegate() {
+ var a = BigInt.parse("0xF000000000000000F");
+ var b = ~a; // negate.
+ Expect.equals(BigInt.parse("-0xF0000000000000010"), b);
+ Expect.equals(BigInt.zero, a & b);
+ Expect.equals(-BigInt.one, a | b);
+}
+
+testShiftAmount() {
+ Expect.equals(BigInt.zero, new BigInt.from(12) >> 0x7FFFFFFFFFFFFFFF);
+ Expect.equals(-BigInt.one, -new BigInt.from(12) >> 0x7FFFFFFFFFFFFFFF);
+ bool exceptionCaught = false;
+ try {
+ var a = BigInt.one << 0x7FFFFFFFFFFFFFFF;
+ } on OutOfMemoryError catch (e) {
+ exceptionCaught = true;
+ } catch (e) {
+ // In JavaScript the allocation of the internal array throws different
+ // kind of errors. Just assume it's the right one.
+ exceptionCaught = true;
+ }
+ Expect.equals(true, exceptionCaught);
+}
+
+void testPow() {
+ Expect.throws(() => BigInt.zero.pow(-1), (e) => e is ArgumentError);
+ Expect.throws(() => BigInt.one.pow(-1), (e) => e is ArgumentError);
+ Expect.equals(BigInt.one, BigInt.zero.pow(0));
+ Expect.equals(BigInt.one, BigInt.one.pow(0));
+ Expect.equals(BigInt.one, BigInt.two.pow(0));
+
+ Expect.equals(
+ BigInt.parse("6208695403009031808124000434786599466508260573005"
+ "3508480680160632742505079094163654310415168343540278191693"
+ "5380629274547924077088101599462083663373536705603680787010"
+ "0454231036999140164473780469056908670815701571304455697970"
+ "9971709527651446612272365411298758026041094781651768636427"
+ "4780767345075500515905845436036697865291662016364446907149"
+ "5652136304764312997430969058854587555188117728022873502683"
+ "6327099687782677885098446991121805146733387058565662606025"
+ "2854981418159051193843689364388302820905062090182919338371"
+ "8783490348348213313279505263650976040646393394551465619437"
+ "7126646818740571207346633109049097273375955956480091920939"
+ "5595130499375022416542475049562151695680373438890512164488"
+ "6567991220660935537691145761690539808578087290707813875567"
+ "9145826183642842261374804672283964244725240865733938342036"
+ "1216219271232461693264437901347421563392441043817990067322"
+ "88"),
+ BigInt.parse("90218646930912603144382974164422").pow(27));
+ ;
+}
+
+void testToRadixString() {
+ // Test that we accept radix 2 to 36 and that we use lower-case
+ // letters.
+ var expected = [
+ '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', //
+ 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', //
+ 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' //
+ ];
+ for (var radix = 2; radix <= 36; radix++) {
+ for (var i = 0; i < radix; i++) {
+ Expect.equals(expected[i], new BigInt.from(i).toRadixString(radix));
+ }
+ }
+
+ var illegalRadices = [-1, 0, 1, 37];
+ for (var radix in illegalRadices) {
+ try {
+ new BigInt.from(42).toRadixString(radix);
+ Expect.fail("Exception expected");
+ } on ArgumentError catch (e) {
+ // Nothing to do.
+ }
+ }
+
+ // Try large numbers (regression test for issue 15316).
+ var bignums = [
+ BigInt.parse("0x80000000"),
+ BigInt.parse("0x100000000"),
+ BigInt.parse("0x10000000000000"),
+ BigInt.parse("0x10000000000001"), // 53 significant bits.
+ BigInt.parse("0x20000000000000"),
+ BigInt.parse("0x20000000000002"),
+ BigInt.parse("0x1000000000000000"),
+ BigInt.parse("0x1000000000000100"),
+ BigInt.parse("0x2000000000000000"),
+ BigInt.parse("0x2000000000000200"),
+ BigInt.parse("0x8000000000000000"),
+ BigInt.parse("0x8000000000000800"),
+ BigInt.parse("0x10000000000000000"),
+ BigInt.parse("0x10000000000001000"),
+ BigInt.parse("0x100000000000010000"),
+ BigInt.parse("0x1000000000000100000"),
+ BigInt.parse("0x10000000000001000000"),
+ BigInt.parse("0x100000000000010000000"),
+ BigInt.parse("0x1000000000000100000000"),
+ BigInt.parse("0x10000000000001000000000"),
+ ];
+ for (var bignum in bignums) {
+ for (int radix = 2; radix <= 36; radix++) {
+ String digits = bignum.toRadixString(radix);
+ BigInt result = BigInt.parse(digits, radix: radix);
+ Expect.equals(
+ bignum, result, "${bignum.toRadixString(16)} -> $digits/$radix");
+ }
+ }
+}
+
+testToString() {
+ /// Test that converting [value] to a string gives [expect].
+ /// Also test that `-value` gives `"-"+expect`.
+ test(BigInt value, String expect) {
+ Expect.equals(expect, value.toString());
+ Expect.equals(expect, "$value");
+ Expect.equals(expect, (new StringBuffer()..write(value)).toString());
+ if (value == BigInt.zero) return;
+ expect = "-$expect";
+ value = -value;
+ Expect.equals(expect, value.toString());
+ Expect.equals(expect, "$value");
+ Expect.equals(expect, (new StringBuffer()..write(value)).toString());
+ }
+
+ // Very simple tests.
+ test(BigInt.zero, "0");
+ test(BigInt.one, "1");
+ test(BigInt.two, "2");
+ test(new BigInt.from(5), "5");
+
+ // Binary special cases.
+
+ // ~2^30.
+ test(BigInt.parse("0x3fffffff"), "1073741823");
+ test(BigInt.parse("0x40000000"), "1073741824");
+ test(BigInt.parse("0x40000001"), "1073741825");
+ // ~2^31.
+ test(BigInt.parse("0x7fffffff"), "2147483647");
+ test(BigInt.parse("0x80000000"), "2147483648");
+ test(BigInt.parse("0x80000001"), "2147483649");
+ // ~2^32.
+ test(BigInt.parse("0xffffffff"), "4294967295");
+ test(BigInt.parse("0x100000000"), "4294967296");
+ test(BigInt.parse("0x100000001"), "4294967297");
+
+ // ~2^51.
+ test(BigInt.parse("0x7ffffffffffff"), "2251799813685247");
+ test(BigInt.parse("0x8000000000000"), "2251799813685248");
+ test(BigInt.parse("0x8000000000001"), "2251799813685249");
+ // ~2^52.
+ test(BigInt.parse("0xfffffffffffff"), "4503599627370495");
+ test(BigInt.parse("0x10000000000000"), "4503599627370496");
+ test(BigInt.parse("0x10000000000001"), "4503599627370497");
+ // ~2^53.
+ test(BigInt.parse("0x1fffffffffffff"), "9007199254740991");
+ test(BigInt.parse("0x20000000000000"), "9007199254740992");
+ test(BigInt.parse("0x20000000000001"), "9007199254740993");
+ // ~2^62.
+ test(BigInt.parse("0x3fffffffffffffff"), "4611686018427387903");
+ test(BigInt.parse("0x4000000000000000"), "4611686018427387904");
+ test(BigInt.parse("0x4000000000000001"), "4611686018427387905");
+ // ~2^63.
+ test(BigInt.parse("0x7fffffffffffffff"), "9223372036854775807");
+ test(BigInt.parse("0x8000000000000000"), "9223372036854775808");
+ test(BigInt.parse("0x8000000000000001"), "9223372036854775809");
+ // ~2^64.
+ test(BigInt.parse("0xffffffffffffffff"), "18446744073709551615");
+ test(BigInt.parse("0x10000000000000000"), "18446744073709551616");
+ test(BigInt.parse("0x10000000000000001"), "18446744073709551617");
+ // Big bignum.
+ test(BigInt.parse("123456789012345678901234567890"),
+ "123456789012345678901234567890");
+
+ // Decimal special cases.
+
+ BigInt number = new BigInt.from(10);
+ // Numbers 99..99, 100...00, and 100..01 up to 23 digits.
+ for (int i = 1; i < 22; i++) {
+ test(number - BigInt.one, "9" * i);
+ test(number, "1" + "0" * i);
+ test(number + BigInt.one, "1" + "0" * (i - 1) + "1");
+ number *= new BigInt.from(10);
+ }
+}
+
+void testFromToInt() {
+ void test(int x) {
+ var bigFrom = new BigInt.from(x);
+ var bigStr = bigFrom.toString();
+ Expect.equals(x, bigFrom.toInt());
+ Expect.equals(x, int.parse(bigStr));
+ }
+
+ for (int i = 0; i < 20; i++) {
+ test(i);
+ // Dart2js doesn't know that -0 should stay 0.
+ if (i != 0) test(-i);
+ }
+
+ // For now just test "easy" integers since there is no check yet that clamps
+ // the returned integer.
+ for (int i = 0; i < 2000000; i += 10000) {
+ test(i);
+ // Dart2js doesn't know that -0 should stay 0.
+ if (i != 0) test(-i);
+ }
+
+ const minInt64 = -9223372036854775807 - 1;
+ test(minInt64);
+}
+
+void testFromToDouble() {
+ Expect.equals(-1.0, (-BigInt.one).toDouble());
+
+ Expect.throws(() => new BigInt.from(double.nan));
+ Expect.throws(() => new BigInt.from(double.infinity));
+ Expect.throws(() => new BigInt.from(-double.infinity));
+
+ const double maxDouble = 1.7976931348623157e+308;
+ const String maxDoubleHexStr = "0xfffffffffffff8000000000000000"
+ "00000000000000000000000000000000000000000000000000000000000000"
+ "00000000000000000000000000000000000000000000000000000000000000"
+ "00000000000000000000000000000000000000000000000000000000000000"
+ "00000000000000000000000000000000000000000";
+
+ // The following value lies directly on the boundary between max double and
+ // infinity. It rounds to infinity. Any value below rounds to a finite double
+ // value.
+ const String maxDoubleBoundaryStr = "0xfffffffffffffc0000000000"
+ "00000000000000000000000000000000000000000000000000000000000000"
+ "00000000000000000000000000000000000000000000000000000000000000"
+ "00000000000000000000000000000000000000000000000000000000000000"
+ "0000000000000000000000000000000000000000000000";
+
+ var bigMax = BigInt.parse(maxDoubleHexStr);
+ var bigBoundary = BigInt.parse(maxDoubleBoundaryStr);
+ Expect.equals(maxDouble, bigMax.toDouble());
+ Expect.equals(bigMax, new BigInt.from(maxDouble));
+ Expect.equals(double.infinity, bigBoundary.toDouble());
+ Expect.equals(maxDouble, (bigBoundary - BigInt.one).toDouble());
+
+ Expect.equals(-maxDouble, (-bigMax).toDouble());
+ Expect.equals(-bigMax, new BigInt.from(-maxDouble));
+ Expect.equals(-double.infinity, (-bigBoundary).toDouble());
+ Expect.equals(-maxDouble, (-(bigBoundary - BigInt.one)).toDouble());
+
+ void test(int x) {
+ var str = x.toString();
+ var big = BigInt.parse(str);
+ Expect.equals(x, big.toDouble());
+ }
+
+ for (int i = 0; i < 20; i++) {
+ test(i);
+ // Dart2js doesn't know that -0 should stay 0.
+ if (i != 0) test(-i);
+ }
+
+ for (int i = 0; i < 2000000; i += 10000) {
+ test(i);
+ // Dart2js doesn't know that -0 should stay 0.
+ if (i != 0) test(-i);
+ }
+
+ for (int i = 1000; i < 100000; i += 1000) {
+ var d = 1 / i;
+ Expect.equals(BigInt.zero, new BigInt.from(d));
+ }
+
+ // Non-integer values are truncated.
+ Expect.equals(BigInt.one, new BigInt.from(1.5));
+ Expect.equals(-BigInt.one, new BigInt.from(-1.5));
+
+ Expect.equals(BigInt.zero, new BigInt.from(0.9999999999999999));
+ Expect.equals(BigInt.zero, new BigInt.from(-0.9999999999999999));
+}
+
+main() {
+ for (int i = 0; i < 10; i++) {
+ Expect.equals(BigInt.parse("1234567890123456789"), foo());
+ Expect.equals(BigInt.parse("12345678901234567890"), bar());
+ testModPow();
+ testModInverse();
+ testGcd();
+ testSmiOverflow();
+ testBigintAdd();
+ testBigintSub();
+ testBigintMul();
+ testBigintTruncDiv();
+ testBigintDiv();
+ testBigintModulo();
+ testBigintModPow();
+ testBigintModInverse();
+ testBigintGcd();
+ testBigintNegate();
+ testShiftAmount();
+ testPow();
+ testToRadixString();
+ testToString();
+ testFromToInt();
+ testFromToDouble();
+ Expect.equals(BigInt.parse("12345678901234567890"),
+ BigInt.parse("12345678901234567890").abs());
+ Expect.equals(BigInt.parse("12345678901234567890"),
+ BigInt.parse("-12345678901234567890").abs());
+ var a = BigInt.parse("10000000000000000000");
+ var b = BigInt.parse("10000000000000000001");
+ Expect.equals(false, a.hashCode == b.hashCode);
+ Expect.equals(true, a.hashCode == (b - BigInt.one).hashCode);
+ }
+}
diff --git a/tests/corelib_2/corelib_2.status b/tests/corelib_2/corelib_2.status
index ccb021f..f81aae5 100644
--- a/tests/corelib_2/corelib_2.status
+++ b/tests/corelib_2/corelib_2.status
@@ -209,6 +209,7 @@
[ $compiler == dart2js && $checked && $dart2js_with_kernel ]
apply3_test: RuntimeError
+error_stack_trace1_test: RuntimeError # Issue 12399
from_environment_const_type_test/02: MissingCompileTimeError
from_environment_const_type_test/03: MissingCompileTimeError
from_environment_const_type_test/04: MissingCompileTimeError
@@ -259,6 +260,7 @@
[ $compiler == dart2js && $dart2js_with_kernel && $host_checked ]
apply3_test: RuntimeError
+error_stack_trace1_test: RuntimeError # Issue 12399
iterable_return_type_test/01: RuntimeError
iterable_return_type_test/02: RuntimeError
iterable_to_list_test/01: RuntimeError
@@ -314,6 +316,7 @@
[ $compiler == dartdevc && $runtime != none ]
apply2_test: RuntimeError # Issue 29921
apply3_test: RuntimeError # Issue 29921
+bigint_test: Pass, Slow
compare_to2_test: RuntimeError # Issue 30170
date_time10_test: RuntimeError # Issue 29921
error_stack_trace_test/nullThrown: RuntimeError # .stackTrace not present for exception caught from 'throw null;'
@@ -447,6 +450,15 @@
symbol_test/none: RuntimeError
unicode_test: RuntimeError
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $compiler == dartk && $strong && ($arch == simarm || $arch == simarm64) ]
+bit_twiddling_test/int64: CompileTimeError # Please triage.
+integer_to_radix_string_test/02: CompileTimeError # Please triage.
+integer_to_string_test/01: CompileTimeError # Please triage.
+num_sign_test: CompileTimeError # Please triage.
+
[ $compiler == dartkp && $mode == debug && $runtime == dart_precompiled && $strong ]
bit_twiddling_test/int64: CompileTimeError
integer_parsed_arith_vm_test/01: RuntimeError
@@ -681,5 +693,6 @@
string_trimlr_test/02: RuntimeError # Uses Unicode 6.2.0 or earlier.
[ $hot_reload || $hot_reload_rollback ]
+bigint_parse_radix_test: Pass, Timeout # Issue 31659
+bigint_test: Pass, Crash # Issue 31660
integer_parsed_mul_div_vm_test: Pass, Slow # Slow
-
diff --git a/tests/corelib_2/int_parse_with_limited_ints_test.dart b/tests/corelib_2/int_parse_with_limited_ints_test.dart
index 301d13d..0007cec 100644
--- a/tests/corelib_2/int_parse_with_limited_ints_test.dart
+++ b/tests/corelib_2/int_parse_with_limited_ints_test.dart
@@ -20,10 +20,7 @@
Expect.equals(0x7fffffffffffffff, int.parse("0x7fffffffffffffff"));
Expect.equals(-0x7fffffffffffffff, int.parse("-0x7fffffffffffffff"));
Expect.equals(-0x7fffffffffffffff - 1, int.parse("-0x8000000000000000"));
-
- Expect.throwsFormatException(() => int.parse("0x8000000000000000"));
- Expect.equals(ERROR, int.parse("0x8000000000000000", onError: returnError));
- Expect.equals(ERROR, int.parse("-0x8000000000000001", onError: returnError));
+ Expect.equals(1 << 63, int.parse("0x8000000000000000"));
Expect.equals(8999999999999999999, int.parse("8999999999999999999"));
Expect.equals(-8999999999999999999, int.parse("-8999999999999999999"));
@@ -31,6 +28,7 @@
Expect.equals(-9223372036854775807, int.parse("-9223372036854775807"));
Expect.equals(-9223372036854775807 - 1, int.parse("-9223372036854775808"));
+ Expect.equals(ERROR, int.parse("-0x8000000000000001", onError: returnError));
Expect.equals(ERROR, int.parse("9223372036854775808", onError: returnError));
Expect.equals(ERROR, int.parse("9223372036854775809", onError: returnError));
Expect.equals(ERROR, int.parse("-9223372036854775809", onError: returnError));
diff --git a/tests/html/html.status b/tests/html/html.status
index 663af62..629256f 100644
--- a/tests/html/html.status
+++ b/tests/html/html.status
@@ -161,8 +161,6 @@
fileapi_test/getFile: Fail # TODO(dart2js-team): Please triage this failure.
media_stream_test/supported_MediaStreamEvent: RuntimeError # Please triage.
media_stream_test/supported_MediaStreamTrackEvent: RuntimeError # Please triage.
-messageevent_test: RuntimeError # Please triage this error. New in Chrome 62.
-serialized_script_value_test: RuntimeError # Please triage this error. New in Chrome 62.
speechrecognition_test/types: RuntimeError # Please triage.
touchevent_test/supported: Fail # Touch events are only supported on touch devices
diff --git a/tests/isolate/isolate.status b/tests/isolate/isolate.status
index 9b965dd..2c49cf8 100644
--- a/tests/isolate/isolate.status
+++ b/tests/isolate/isolate.status
@@ -153,6 +153,12 @@
typed_message_test: CompileTimeError
unresolved_ports_test: CompileTimeError
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $compiler == dartk && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
+*: Skip
+
[ $compiler == none && $runtime == vm && $system == fuchsia ]
*: Skip # Not yet triaged.
diff --git a/tests/language/language_analyzer2.status b/tests/language/language_analyzer2.status
index 21780f3..d2c1b6f 100644
--- a/tests/language/language_analyzer2.status
+++ b/tests/language/language_analyzer2.status
@@ -105,6 +105,7 @@
generic_list_checked_test: StaticWarning
generic_local_functions_test: CompileTimeError # Issue 28515
generic_methods_generic_function_parameter_test: CompileTimeError # Issue 28515
+generic_methods_type_expression_test: Skip # This tests now unsupported Dart 1.0 behavior (is check warnings)
generic_test: StaticWarning
generics_test: StaticWarning
get_set_syntax_test/none: Fail # Issue 11575
@@ -397,11 +398,8 @@
*: Skip # Issue 28649
[ $compiler == dart2analyzer && $runtime == none ]
-assertion_initializer_const_error2_test/cc10: CompileTimeError # Issue #31320
-assertion_initializer_const_error2_test/cc11: CompileTimeError # Issue #31320
assertion_initializer_const_function_error_test/01: MissingCompileTimeError
assertion_initializer_const_function_test/01: MissingStaticWarning
-assertion_initializer_test: CompileTimeError
[ $compiler == dart2analyzer && $runtime == none && $checked ]
assertion_initializer_const_error2_test/*: MissingCompileTimeError # Issue #
diff --git a/tests/language/language_dart2js.status b/tests/language/language_dart2js.status
index 96b01ad..dce3ec3 100644
--- a/tests/language/language_dart2js.status
+++ b/tests/language/language_dart2js.status
@@ -55,7 +55,6 @@
library_env_test/has_no_io_support: Pass # Issue 27398
[ $compiler == dart2js && $checked && $dart2js_with_kernel ]
-arithmetic_canonicalization_test: RuntimeError
assertion_initializer_const_function_test/01: RuntimeError
assertion_initializer_test: CompileTimeError
assign_static_type_test/01: Fail
@@ -147,6 +146,7 @@
constructor_redirect2_test/01: MissingCompileTimeError
constructor_redirect_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(A.named2#x), local(A.named2#y), local(A.named2#z)) for j:constructor(A.named2).
cyclic_constructor_test/01: Crash # Issue 30856
+deferred_call_empty_before_load_test: RuntimeError
deferred_closurize_load_library_test: RuntimeError
deferred_constraints_constants_test/default_argument2: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
deferred_constraints_constants_test/none: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
@@ -196,9 +196,9 @@
final_attempt_reinitialization_test/01: MissingCompileTimeError
final_attempt_reinitialization_test/02: MissingCompileTimeError
final_field_initialization_order_test: RuntimeError
-generic_field_mixin4_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in (Instance of 'ThisLocal') for j:field(M.field).
-generic_field_mixin5_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in (Instance of 'ThisLocal') for j:field(M.field).
-generic_field_mixin_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in () for j:constructor(C3.).
+full_stacktrace1_test: RuntimeError # Issue 12698
+full_stacktrace2_test: RuntimeError # Issue 12698
+full_stacktrace3_test: RuntimeError # Issue 12698
generic_local_functions_test: Crash # Unsupported operation: Unsupported type parameter type node Y.
generic_methods_type_expression_test/01: RuntimeError
generic_methods_type_expression_test/03: RuntimeError
@@ -405,6 +405,9 @@
setter_override_test/00: MissingCompileTimeError
setter_override_test/03: MissingCompileTimeError
stacktrace_demangle_ctors_test: RuntimeError
+stacktrace_rethrow_error_test/none: RuntimeError
+stacktrace_rethrow_error_test/withtraceparameter: RuntimeError
+stacktrace_rethrow_nonerror_test: RuntimeError
stacktrace_test: RuntimeError
static_getter_no_setter1_test/01: RuntimeError
static_getter_no_setter2_test/01: RuntimeError
@@ -803,7 +806,6 @@
type_checks_in_factory_method_test: RuntimeError
[ $compiler == dart2js && $dart2js_with_kernel && $host_checked ]
-arithmetic_canonicalization_test: RuntimeError
assertion_initializer_test: CompileTimeError
assertion_test: RuntimeError
async_await_test: Crash # 'file:*/pkg/compiler/lib/src/ssa/locals_handler.dart': Failed assertion: line 296 pos 12: 'local != null': is not true.
@@ -855,6 +857,7 @@
constructor_redirect2_test/01: MissingCompileTimeError
constructor_redirect_test/01: Crash # Assertion failure: Cannot find value Instance of 'ThisLocal' in (local(A.named2#x), local(A.named2#y), local(A.named2#z)) for j:constructor(A.named2).
cyclic_constructor_test/01: Crash # Issue 30856
+deferred_call_empty_before_load_test: RuntimeError
deferred_closurize_load_library_test: RuntimeError
deferred_constraints_constants_test/default_argument2: Crash # Assertion failure: Missing scope info for j:method(_loadLibraryWrapper).
deferred_constraints_constants_test/none: Crash # Assertion failure: Missing scope info for j:method(_loadLibraryWrapper).
@@ -895,9 +898,9 @@
final_attempt_reinitialization_test/01: MissingCompileTimeError
final_attempt_reinitialization_test/02: MissingCompileTimeError
final_field_initialization_order_test: RuntimeError
-generic_field_mixin4_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in ()in j:constructor(C3.).
-generic_field_mixin5_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in ()in j:constructor(C3.).
-generic_field_mixin_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in ()in j:constructor(C3.).
+full_stacktrace1_test: RuntimeError
+full_stacktrace2_test: RuntimeError
+full_stacktrace3_test: RuntimeError
generic_local_functions_test: Crash # Unsupported operation: Unsupported type parameter type node Y.
generic_methods_generic_function_parameter_test: Crash # 'file:*/pkg/compiler/lib/src/ssa/builder_kernel.dart': Failed assertion: line 1728 pos 16: 'type is MethodTypeVariableType': is not true.
generic_methods_type_expression_test/01: Crash # 'file:*/pkg/compiler/lib/src/ssa/builder_kernel.dart': Failed assertion: line 1728 pos 16: 'type is MethodTypeVariableType': is not true.
@@ -1101,8 +1104,11 @@
regress_28255_test: RuntimeError
setter_override_test/00: MissingCompileTimeError
setter_override_test/03: MissingCompileTimeError
-stacktrace_demangle_ctors_test: RuntimeError
-stacktrace_test: RuntimeError
+stacktrace_demangle_ctors_test: RuntimeError # Issue 12698
+stacktrace_rethrow_error_test/none: RuntimeError
+stacktrace_rethrow_error_test/withtraceparameter: RuntimeError
+stacktrace_rethrow_nonerror_test: RuntimeError
+stacktrace_test: RuntimeError # Issue 12698
static_getter_no_setter1_test/01: RuntimeError
static_getter_no_setter2_test/01: RuntimeError
static_getter_no_setter3_test/01: RuntimeError
@@ -1123,7 +1129,6 @@
type_checks_in_factory_method_test: RuntimeError
[ $compiler == dart2js && $dart2js_with_kernel && $minified ]
-arithmetic_canonicalization_test: RuntimeError
assertion_initializer_const_error2_test/none: CompileTimeError
assertion_initializer_test: CompileTimeError
assertion_test: RuntimeError
@@ -1181,6 +1186,7 @@
cyclic_type_test/02: RuntimeError
cyclic_type_test/03: RuntimeError
cyclic_type_test/04: RuntimeError
+deferred_call_empty_before_load_test: RuntimeError
deferred_closurize_load_library_test: Crash # NoSuchMethodError: The getter 'closureClassEntity' was called on null.
deferred_closurize_load_library_test: RuntimeError
deferred_constraints_constants_test/default_argument2: Crash # NoSuchMethodError: The getter 'closureClassEntity' was called on null.
@@ -1230,13 +1236,10 @@
final_attempt_reinitialization_test/01: MissingCompileTimeError
final_attempt_reinitialization_test/02: MissingCompileTimeError
final_field_initialization_order_test: RuntimeError
-full_stacktrace1_test: RuntimeError
-full_stacktrace2_test: RuntimeError
-full_stacktrace3_test: RuntimeError
+full_stacktrace1_test: RuntimeError # Issue 12698
+full_stacktrace2_test: RuntimeError # Issue 12698
+full_stacktrace3_test: RuntimeError # Issue 12698
generic_closure_test: RuntimeError
-generic_field_mixin4_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in ()in j:constructor(C3.).
-generic_field_mixin5_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in ()in j:constructor(C3.).
-generic_field_mixin_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in ()in j:constructor(C3.).
generic_local_functions_test: Crash # Unsupported operation: Unsupported type parameter type node Y.
generic_methods_type_expression_test/01: RuntimeError
generic_methods_type_expression_test/03: RuntimeError
@@ -1440,11 +1443,11 @@
setter_override_test/00: MissingCompileTimeError
setter_override_test/03: MissingCompileTimeError
stack_trace_test: RuntimeError
-stacktrace_demangle_ctors_test: RuntimeError
-stacktrace_rethrow_error_test/none: RuntimeError
-stacktrace_rethrow_error_test/withtraceparameter: RuntimeError
-stacktrace_rethrow_nonerror_test: RuntimeError
-stacktrace_test: RuntimeError
+stacktrace_demangle_ctors_test: RuntimeError # Issue 12698
+stacktrace_rethrow_error_test/none: RuntimeError # Issue 12698
+stacktrace_rethrow_error_test/withtraceparameter: RuntimeError # Issue 12698
+stacktrace_rethrow_nonerror_test: RuntimeError # Issue 12698
+stacktrace_test: RuntimeError # Issue 12698
static_getter_no_setter1_test/01: RuntimeError
static_getter_no_setter2_test/01: RuntimeError
static_getter_no_setter3_test/01: RuntimeError
@@ -1580,7 +1583,7 @@
regress_29481_test: Crash # Issue 29754
scope_variable_test/01: MissingCompileTimeError # Issue 13016
setter4_test: CompileTimeError # issue 13639
-stacktrace_demangle_ctors_test: Fail # dart2js stack traces are not always compliant.
+stacktrace_demangle_ctors_test: Fail # dart2js stack traces are not always compliant, issue 12698
stacktrace_rethrow_error_test: Pass, RuntimeError # Issue 12698
stacktrace_rethrow_nonerror_test: Pass, RuntimeError # Issue 12698
stacktrace_test: Pass, RuntimeError # # Issue 12698
diff --git a/tests/language/language_kernel.status b/tests/language/language_kernel.status
index b3e68f2..acb42e5 100644
--- a/tests/language/language_kernel.status
+++ b/tests/language/language_kernel.status
@@ -2,373 +2,7 @@
# for details. All rights reserved. Use of this source code is governed by a
# BSD-style license that can be found in the LICENSE file.
-# dartk: JIT failures
-[ $compiler == dartk ]
-const_locals_test: RuntimeError
-const_string_test: RuntimeError
-ct_const2_test: Pass, Crash # Flaky
-hello_dart_test: Crash
-library_env_test/has_no_mirror_support: RuntimeError
-redirecting_factory_reflection_test: Crash
-redirecting_factory_reflection_test: RuntimeError
-vm/lazy_deopt_vm_test: Pass, Slow, Timeout
-vm/optimized_stacktrace_test: Skip # Issue 28788
-
-# dartk: precompilation failures
-[ $compiler == dartkp ]
-const_syntax_test/08: Crash
-deferred_redirecting_factory_test: CompileTimeError # Issue 31296
-export_double_same_main_test: Crash # Issue 29895
-final_syntax_test/09: Crash
-final_syntax_test/09: MissingCompileTimeError
-ref_before_declaration_test/none: Pass
-ref_before_declaration_test/none: Crash
-stacktrace_demangle_ctors_test: RuntimeError
-vm/optimized_stacktrace_test: Crash
-vm/regress_27671_test: Crash
-vm/regress_27671_test: Skip # Unsupported
-vm/type_vm_test: Crash
-
-# dartk: JIT failures (debug)
-[ $compiler == dartk && $mode == debug ]
-deopt_inlined_function_lazy_test: Skip
-hello_dart_test: Crash # error: expected: cls.is_type_finalized()
-vm/lazy_deopt_vm_test: Crash
-
-[ $compiler == dartk && $runtime == vm ]
-assertion_initializer_const_function_error_test/01: MissingCompileTimeError
-disassemble_test: Pass, Slow
-
-[ $compiler == dartk && $runtime == vm && $checked ]
-assertion_initializer_const_function_test/01: RuntimeError
-
-# dartk: precompilation failures (debug)
-[ $compiler == dartkp && $mode == debug ]
-assertion_test: Crash
-external_test/13: Crash
-final_syntax_test/09: Crash
-malbounded_type_cast_test: Crash
-regress_29025_test: Crash
-vm/async_await_catch_stacktrace_test: Crash
-
-[ $compiler == dartkp && $runtime == dart_precompiled && $checked ]
-assertion_initializer_const_error2_test/*: Crash
-assertion_initializer_const_error2_test/none: Pass
-assertion_initializer_const_error_test/none: Crash
-assertion_initializer_const_function_error_test/01: Crash
-assertion_initializer_const_function_error_test/none: Crash
-assertion_initializer_const_function_test/01: Crash
-assertion_initializer_const_function_test/none: Crash
-assertion_initializer_test: CompileTimeError
-
-[ $compiler == dartkp && $runtime == dart_precompiled && !$checked ]
-assertion_initializer_const_function_error_test/01: MissingCompileTimeError
-
-# dartk: JIT & AOT failures (debug)
-[ $mode == debug && ($compiler == dartk || $compiler == dartkp) ]
-const_instance_field_test/01: Crash
-cyclic_type_variable_test/01: Crash
-cyclic_type_variable_test/02: Crash
-cyclic_type_variable_test/03: Crash
-cyclic_type_variable_test/04: Crash
-cyclic_type_variable_test/none: Crash
-type_parameter_test/04: Crash
-type_parameter_test/05: Crash
-
-# Triaged checked mode failures
-[ $checked && ($compiler == dartk || $compiler == dartkp) ]
-assert_initializer_test/31: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-assert_initializer_test/32: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-assert_initializer_test/33: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-assert_initializer_test/34: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-assert_initializer_test/35: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-assert_initializer_test/36: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-assert_initializer_test/37: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-assert_initializer_test/38: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-assert_initializer_test/41: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-assert_initializer_test/42: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-assert_initializer_test/43: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-assert_initializer_test/44: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-assert_initializer_test/45: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-assert_initializer_test/46: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-assert_initializer_test/47: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-assert_initializer_test/48: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-assert_initializer_test/none: RuntimeError # KernelVM bug: Constant evaluation.
-assign_static_type_test/02: MissingCompileTimeError
-async_await_test: RuntimeError
-async_return_types_test/nestedFuture: Fail
-async_return_types_test/wrongTypeParameter: Fail
-compile_time_constant_checked_test/02: MissingCompileTimeError
-const_constructor2_test/20: MissingCompileTimeError
-const_constructor2_test/22: MissingCompileTimeError
-const_constructor2_test/24: MissingCompileTimeError
-const_init2_test/02: MissingCompileTimeError
-default_factory2_test/01: Fail
-factory_redirection_test/08: Fail
-factory_redirection_test/09: Fail
-factory_redirection_test/10: Fail
-factory_redirection_test/12: Fail
-factory_redirection_test/13: Fail
-factory_redirection_test/14: Fail
-function_type/function_type0_test: RuntimeError
-function_type/function_type10_test: RuntimeError
-function_type/function_type11_test: RuntimeError
-function_type/function_type12_test: RuntimeError
-function_type/function_type13_test: RuntimeError
-function_type/function_type14_test: RuntimeError
-function_type/function_type15_test: RuntimeError
-function_type/function_type16_test: RuntimeError
-function_type/function_type17_test: RuntimeError
-function_type/function_type18_test: RuntimeError
-function_type/function_type19_test: RuntimeError
-function_type/function_type1_test: RuntimeError
-function_type/function_type20_test: RuntimeError
-function_type/function_type21_test: RuntimeError
-function_type/function_type22_test: RuntimeError
-function_type/function_type23_test: RuntimeError
-function_type/function_type24_test: RuntimeError
-function_type/function_type25_test: RuntimeError
-function_type/function_type26_test: RuntimeError
-function_type/function_type27_test: RuntimeError
-function_type/function_type28_test: RuntimeError
-function_type/function_type29_test: RuntimeError
-function_type/function_type2_test: RuntimeError
-function_type/function_type30_test: RuntimeError
-function_type/function_type31_test: RuntimeError
-function_type/function_type32_test: RuntimeError
-function_type/function_type33_test: RuntimeError
-function_type/function_type34_test: RuntimeError
-function_type/function_type35_test: RuntimeError
-function_type/function_type36_test: RuntimeError
-function_type/function_type37_test: RuntimeError
-function_type/function_type38_test: RuntimeError
-function_type/function_type39_test: RuntimeError
-function_type/function_type3_test: RuntimeError
-function_type/function_type40_test: RuntimeError
-function_type/function_type41_test: RuntimeError
-function_type/function_type42_test: RuntimeError
-function_type/function_type43_test: RuntimeError
-function_type/function_type44_test: RuntimeError
-function_type/function_type45_test: RuntimeError
-function_type/function_type46_test: RuntimeError
-function_type/function_type47_test: RuntimeError
-function_type/function_type48_test: RuntimeError
-function_type/function_type49_test: RuntimeError
-function_type/function_type4_test: RuntimeError
-function_type/function_type50_test: RuntimeError
-function_type/function_type51_test: RuntimeError
-function_type/function_type52_test: RuntimeError
-function_type/function_type53_test: RuntimeError
-function_type/function_type54_test: RuntimeError
-function_type/function_type55_test: RuntimeError
-function_type/function_type56_test: RuntimeError
-function_type/function_type57_test: RuntimeError
-function_type/function_type58_test: RuntimeError
-function_type/function_type59_test: RuntimeError
-function_type/function_type5_test: RuntimeError
-function_type/function_type60_test: RuntimeError
-function_type/function_type61_test: RuntimeError
-function_type/function_type62_test: RuntimeError
-function_type/function_type63_test: RuntimeError
-function_type/function_type64_test: RuntimeError
-function_type/function_type65_test: RuntimeError
-function_type/function_type66_test: RuntimeError
-function_type/function_type67_test: RuntimeError
-function_type/function_type68_test: RuntimeError
-function_type/function_type69_test: RuntimeError
-function_type/function_type6_test: RuntimeError
-function_type/function_type70_test: RuntimeError
-function_type/function_type71_test: RuntimeError
-function_type/function_type72_test: RuntimeError
-function_type/function_type73_test: RuntimeError
-function_type/function_type74_test: RuntimeError
-function_type/function_type75_test: RuntimeError
-function_type/function_type76_test: RuntimeError
-function_type/function_type77_test: RuntimeError
-function_type/function_type78_test: RuntimeError
-function_type/function_type79_test: RuntimeError
-function_type/function_type7_test: RuntimeError
-function_type/function_type80_test: RuntimeError
-function_type/function_type81_test: RuntimeError
-function_type/function_type82_test: RuntimeError
-function_type/function_type83_test: RuntimeError
-function_type/function_type84_test: RuntimeError
-function_type/function_type85_test: RuntimeError
-function_type/function_type86_test: RuntimeError
-function_type/function_type87_test: RuntimeError
-function_type/function_type88_test: RuntimeError
-function_type/function_type89_test: RuntimeError
-function_type/function_type8_test: RuntimeError
-function_type/function_type90_test: RuntimeError
-function_type/function_type91_test: RuntimeError
-function_type/function_type92_test: RuntimeError
-function_type/function_type93_test: RuntimeError
-function_type/function_type94_test: RuntimeError
-function_type/function_type95_test: RuntimeError
-function_type/function_type96_test: RuntimeError
-function_type/function_type97_test: RuntimeError
-function_type/function_type98_test: RuntimeError
-function_type/function_type99_test: RuntimeError
-function_type/function_type9_test: RuntimeError
-function_type2_test: RuntimeError
-list_literal1_test/01: MissingCompileTimeError
-malbounded_redirecting_factory2_test/03: Fail
-malbounded_redirecting_factory2_test/04: Fail
-malbounded_redirecting_factory_test/03: Fail
-malbounded_redirecting_factory_test/04: Fail
-malbounded_type_cast_test: RuntimeError
-malbounded_type_test_test/03: Fail
-malbounded_type_test_test/04: Fail
-malformed2_test/00: RuntimeError
-malformed2_test/01: MissingCompileTimeError
-map_literal1_test/01: MissingCompileTimeError
-mixin_invalid_bound2_test/08: Fail
-mixin_invalid_bound2_test/09: Fail
-mixin_invalid_bound2_test/10: Fail
-mixin_invalid_bound_test/06: Fail
-mixin_invalid_bound_test/07: Fail
-mixin_super_bound2_test/01: RuntimeError
-mixin_super_bound_test: RuntimeError
-msk_bound_test: RuntimeError
-redirecting_factory_infinite_steps_test/01: Fail
-redirecting_factory_malbounded_test/01: Fail
-regress_22728_test: Fail # Dartk Issue 28498
-regress_22728_test: RuntimeError
-regress_26133_test: RuntimeError
-type_parameter_test/05: MissingCompileTimeError
-type_parameter_test/none: RuntimeError
-type_variable_bounds4_test/01: RuntimeError
-
-[ !$checked && ($compiler == dartk || $compiler == dartkp) ]
-cha_deopt1_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-cha_deopt2_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-cha_deopt3_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-compile_time_constant_c_test/02: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-compile_time_constant_k_test/01: RuntimeError # KernelVM bug: Constant map duplicated key.
-compile_time_constant_k_test/02: RuntimeError # KernelVM bug: Constant map duplicated key.
-compile_time_constant_k_test/03: RuntimeError # KernelVM bug: Constant map duplicated key.
-compile_time_constant_o_test/01: RuntimeError # KernelVM bug: Constant map duplicated key.
-compile_time_constant_o_test/02: RuntimeError # KernelVM bug: Constant map duplicated key.
-conditional_import_string_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-conditional_import_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-config_import_corelib_test: RuntimeError # KernelVM bug: Configurable imports.
-config_import_test: RuntimeError # KernelVM bug: Configurable imports.
-const_constructor_nonconst_field_test/01: MissingCompileTimeError # Fasta bug: Non-const expression in field initializer.
-const_dynamic_type_literal_test/02: RuntimeError # KernelVM bug: Constant map duplicated key.
-const_factory_with_body_test/01: MissingCompileTimeError # Fasta bug: Const factory with body.
-const_instance_field_test/01: MissingCompileTimeError # Fasta bug: Const instance field.
-const_map2_test/00: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-const_map3_test/00: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-const_native_factory_test/01: MissingCompileTimeError # Fasta bug: Issue 29763
-const_nested_test: RuntimeError # KernelVM bug: Constant evaluation.
-const_optional_args_negative_test: Fail # Fasta bug: Default parameter values must be const.
-const_switch2_test/01: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-const_syntax_test/05: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-constant_expression_test/01: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-constant_expression_test/03: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-constructor_redirect2_test/01: MissingCompileTimeError # Fasta bug: Body on redirecting constructor.
-constructor_redirect_test/01: MissingCompileTimeError # Fasta bug: Initializer refers to this.
-cyclic_constructor_test/01: MissingCompileTimeError # Fasta bug: Cyclic constructor redirection.
-deferred_call_empty_before_load_test: RuntimeError # Fasta/KernelVM bug: Deferred loading kernel issue 28335.
-deferred_closurize_load_library_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constant_list_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_constants_test/default_argument2: Pass # Passes by mistake. KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_constants_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_constants_test/reference_after_load: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/as_operation: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/catch_check: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/is_check: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/new: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/new_before_load: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/new_generic1: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/new_generic2: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/new_generic3: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/static_method: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/type_annotation1: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/type_annotation_generic1: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/type_annotation_generic2: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/type_annotation_generic3: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/type_annotation_generic4: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/type_annotation_non_deferred: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/type_annotation_null: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_constraints_type_annotation_test/type_annotation_top_level: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_function_type_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_global_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_import_core_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_inheritance_constraints_test/extends: MissingCompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 28335.
-deferred_inheritance_constraints_test/implements: MissingCompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 28335.
-deferred_inheritance_constraints_test/mixin: MissingCompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 28335.
-deferred_inheritance_constraints_test/redirecting_constructor: RuntimeError # Fasta/KernelVM bug: Deferred loading kernel issue 28335.
-deferred_inlined_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_load_constants_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_load_inval_code_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_load_library_wrong_args_test/01: Pass # Passes by mistake. KernelVM bug: Deferred loading kernel issue 28335.
-deferred_load_library_wrong_args_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_mixin_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_no_such_method_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_not_loaded_check_test: RuntimeError # Fasta/KernelVM bug: Deferred loading kernel issue 28335.
-deferred_only_constant_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_optimized_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_redirecting_factory_test: RuntimeError # Fasta/KernelVM bug: Deferred loading kernel issue 28335.
-deferred_regression_22995_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_regression_28678_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_shadow_load_library_test: CompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 28335.
-deferred_shared_and_unshared_classes_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_static_seperate_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_super_dependency_test/01: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_type_dependency_test/as: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_type_dependency_test/is: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_type_dependency_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_type_dependency_test/type_annotation: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-dynamic_prefix_core_test/01: RuntimeError # KernelVM bug: Blocked on language issue 29125.
-external_test/10: MissingRuntimeError # KernelVM bug: Unbound external.
-external_test/13: MissingRuntimeError # KernelVM bug: Unbound external.
-external_test/20: MissingRuntimeError # KernelVM bug: Unbound external.
-factory_redirection_test/07: MissingCompileTimeError # Fasta bug: Bad constructor redirection.
-final_attempt_reinitialization_test/01: MissingCompileTimeError # Issue 29900
-final_attempt_reinitialization_test/02: MissingCompileTimeError # Issue 29900
-issue_1751477_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-library_env_test/has_html_support: RuntimeError # KernelVM bug: Configurable imports.
-library_env_test/has_no_io_support: RuntimeError # KernelVM bug: Configurable imports.
-map_literal3_test: RuntimeError # KernelVM bug: Constant map duplicated key.
-map_literal6_test: RuntimeError # KernelVM bug: Constant map duplicated key.
-method_name_test: CompileTimeError # Fasta bug: Parser bug.
-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_super_constructor_named_test/01: MissingCompileTimeError # KernelVM bug: Issue 15101
-mixin_super_constructor_positionals_test/01: MissingCompileTimeError # KernelVM bug: Issue 15101
-named_constructor_test/01: MissingRuntimeError # Fasta bug: Bad compilation of constructor reference.
-named_parameters_default_eq_test/02: MissingCompileTimeError # Fasta bug: Default values are not allowed on redirecting factory constructors.
-private_super_constructor_test/01: MissingCompileTimeError # Fasta bug: Illegal access to private constructor.
-redirecting_constructor_initializer_test: RuntimeError # Super is evaluated last; same result as source-based pipeline.
-redirecting_factory_default_values_test/01: MissingCompileTimeError # Fasta bug: Default values are not allowed on redirecting factory constructors.
-redirecting_factory_default_values_test/02: MissingCompileTimeError # Fasta bug: Default values are not allowed on redirecting factory constructors.
-redirecting_factory_long_test: RuntimeError # Fasta bug: Bad compilation of type arguments for redirecting factory.
-regress_20394_test/01: MissingCompileTimeError # Fasta bug: Illegal access to private constructor.
-regress_22443_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-regress_23408_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-regress_27617_test/1: MissingCompileTimeError # Fasta bug: Bad constructor redirection.
-regress_28217_test/01: MissingCompileTimeError # Fasta bug: Bad constructor redirection.
-regress_28217_test/none: MissingCompileTimeError # Fasta bug: Bad constructor redirection.
-regress_28278_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-switch_bad_case_test/01: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-switch_bad_case_test/02: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-switch_case_test/00: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-switch_case_test/01: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-switch_case_test/02: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-syntax_test/64: MissingCompileTimeError # Test bug: Test doesn't execute erroneous code.
-syntax_test/65: MissingCompileTimeError # Test bug: Test doesn't execute erroneous code.
-syntax_test/none: CompileTimeError # Issue #30176.
-vm/closure_memory_retention_test: Skip # KernelVM bug: Hits OOM
-vm/debug_break_enabled_vm_test/01: CompileTimeError # KernelVM bug: Bad test using extended break syntax.
-vm/debug_break_enabled_vm_test/none: CompileTimeError # KernelVM bug: Bad test using extended break syntax.
-vm/regress_27201_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-vm/type_vm_test: RuntimeError # Fasta bug: Bad position information in stack trace.
-
+# We skip all the Dart 1.0 tests in dartk and dartkp mode as these
+# modes are intended only for Dart 2.0 with strong mode enabled.
[ $compiler == dartk || $compiler == dartkp ]
-bad_constructor_test/06: DartkCrash # Issue 31299
-const_error_multiply_initialized_test/02: MissingCompileTimeError # Issue 29900
-const_error_multiply_initialized_test/04: MissingCompileTimeError # Issue 29900
-
+*: Skip
diff --git a/tests/language_2/cascade_on_static_field_test.dart b/tests/language_2/cascade_on_static_field_test.dart
new file mode 100644
index 0000000..e92212f
--- /dev/null
+++ b/tests/language_2/cascade_on_static_field_test.dart
@@ -0,0 +1,9 @@
+// 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.
+
+final List<String> list = []..add("foo")..add("bar")..add("baz");
+
+main() {
+ print(list);
+}
diff --git a/tests/language_2/final_syntax_test.dart b/tests/language_2/final_syntax_test.dart
index 64bbf12..42b2163 100644
--- a/tests/language_2/final_syntax_test.dart
+++ b/tests/language_2/final_syntax_test.dart
@@ -56,8 +56,8 @@
// expressions.
final A0 = 42;
final A1 = A0 + 1;
-final A2 = A3 + 1; //# 08: continued
-final A3 = A2 + 1; //# 08: continued
+final dynamic A2 = A3 + 1; //# 08: continued
+final dynamic A3 = A2 + 1; //# 08: continued
class C0 {
static final X = const C1();
diff --git a/tests/language_2/forwarding_semi_stub_test.dart b/tests/language_2/forwarding_semi_stub_test.dart
new file mode 100644
index 0000000..12db5f8
--- /dev/null
+++ b/tests/language_2/forwarding_semi_stub_test.dart
@@ -0,0 +1,26 @@
+// 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:expect/expect.dart";
+
+class B {
+ void f(num x) {}
+}
+
+abstract class I<T> {
+ void f(T x);
+}
+
+class C extends B implements I<num> {
+ // This method is a "forwarding semi-stub"--the front end needs to add an
+ // implementation to it that performs type checking and forwards to B::f.
+ void f(num x);
+}
+
+main() {
+ I<Object> i = new C();
+ Expect.throwsTypeError(() {
+ i.f('oops');
+ });
+}
diff --git a/tests/language_2/generic_methods_type_expression_test.dart b/tests/language_2/generic_methods_type_expression_test.dart
index 06c54eb..c83b20a 100644
--- a/tests/language_2/generic_methods_type_expression_test.dart
+++ b/tests/language_2/generic_methods_type_expression_test.dart
@@ -54,10 +54,9 @@
Expect.equals(f8<int>(), new TypeValue<List<int>>().value);
Expect.isTrue(f9<int>(<int, String>{}));
- Expect
- .isTrue(f9<int>(<bool, String>{})); // `is Map<dynamic, String>` is true.
+ Expect.isFalse(f9<int>(<bool, String>{}));
Expect.isFalse(f9<int>(<int, int>{}));
Expect.isTrue(new IsMap<int>().check<String>(<int, String>{}));
- Expect.isTrue(new IsMap<int>().check<int>(<int, String>{}));
+ Expect.isFalse(new IsMap<int>().check<int>(<int, String>{}));
}
diff --git a/tests/language_2/instantiate_tearoff_after_contravariance_check_test.dart b/tests/language_2/instantiate_tearoff_after_contravariance_check_test.dart
new file mode 100644
index 0000000..cb0fa33
--- /dev/null
+++ b/tests/language_2/instantiate_tearoff_after_contravariance_check_test.dart
@@ -0,0 +1,27 @@
+// 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:expect/expect.dart";
+
+class A {}
+
+class B extends A {}
+
+class C<T> {
+ void Function(T) f<U>(U x) => (y) {};
+}
+
+void test(C<A> cA, C<A> cB) {
+ // Tear-off of c.f needs to be type checked due to contravariance. The
+ // instantiation should occur after the type check, so if the type is wrong we
+ // should get a type error.
+ void Function(A) Function(int) tearoffOfCA = cA.f;
+ Expect.throwsTypeError(() {
+ void Function(A) Function(int) tearoffOfCB = cB.f;
+ });
+}
+
+main() {
+ test(new C<A>(), new C<B>());
+}
diff --git a/tests/language_2/instantiate_tearoff_of_call_test.dart b/tests/language_2/instantiate_tearoff_of_call_test.dart
new file mode 100644
index 0000000..665a271
--- /dev/null
+++ b/tests/language_2/instantiate_tearoff_of_call_test.dart
@@ -0,0 +1,30 @@
+// 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:expect/expect.dart";
+
+T f<T>(T x) => x;
+
+void test(T Function<T>(T) f) {
+ int Function(int) intFunc = f.call;
+ dynamic intFuncDynamic = intFunc;
+ Expect.isTrue(intFuncDynamic is int Function(int));
+ Expect.isFalse(intFuncDynamic is String Function(String));
+ Expect.equals(intFuncDynamic(1), 1);
+ Expect.throwsTypeError(() {
+ intFuncDynamic('oops');
+ });
+ String Function(String) stringFunc = f.call;
+ dynamic stringFuncDynamic = stringFunc;
+ Expect.isTrue(stringFuncDynamic is String Function(String));
+ Expect.isFalse(stringFuncDynamic is int Function(int));
+ Expect.equals(stringFuncDynamic('hello'), 'hello');
+ Expect.throwsTypeError(() {
+ stringFuncDynamic(1);
+ });
+}
+
+main() {
+ test(f);
+}
diff --git a/tests/language_2/instantiate_tearoff_test.dart b/tests/language_2/instantiate_tearoff_test.dart
new file mode 100644
index 0000000..892be77
--- /dev/null
+++ b/tests/language_2/instantiate_tearoff_test.dart
@@ -0,0 +1,26 @@
+// 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:expect/expect.dart";
+
+T f<T>(T x) => x;
+
+main() {
+ int Function(int) intFunc = f;
+ dynamic intFuncDynamic = intFunc;
+ Expect.isTrue(intFuncDynamic is int Function(int));
+ Expect.isFalse(intFuncDynamic is String Function(String));
+ Expect.equals(intFuncDynamic(1), 1);
+ Expect.throwsTypeError(() {
+ intFuncDynamic('oops');
+ });
+ String Function(String) stringFunc = f;
+ dynamic stringFuncDynamic = stringFunc;
+ Expect.isTrue(stringFuncDynamic is String Function(String));
+ Expect.isFalse(stringFuncDynamic is int Function(int));
+ Expect.equals(stringFuncDynamic('hello'), 'hello');
+ Expect.throwsTypeError(() {
+ stringFuncDynamic(1);
+ });
+}
diff --git a/tests/language_2/language_2_analyzer.status b/tests/language_2/language_2_analyzer.status
index 084d0f8..e93ae0d 100644
--- a/tests/language_2/language_2_analyzer.status
+++ b/tests/language_2/language_2_analyzer.status
@@ -144,6 +144,7 @@
test_negative_test: CompileTimeError
try_catch_on_syntax_test/10: MissingCompileTimeError
try_catch_on_syntax_test/11: MissingCompileTimeError
+type_inference_inconsistent_inheritance_test: MissingCompileTimeError
type_variable_scope_test/none: Fail # Issue 11578
type_variable_static_context_negative_test: Fail # Issue 12161
vm/debug_break_enabled_vm_test: Skip
@@ -153,10 +154,7 @@
vm/regress_27201_test: SkipByDesign # Loads bad library, so will always crash.
[ $compiler == dart2analyzer && $runtime == none ]
-assertion_initializer_const_error2_test/cc10: CompileTimeError # Issue 31320
-assertion_initializer_const_error2_test/cc11: CompileTimeError # Issue 31320
assertion_initializer_const_function_test/01: CompileTimeError
-assertion_initializer_test: CompileTimeError
error_stacktrace_test/00: MissingCompileTimeError
vm/lazy_deopt_with_exception_test: CompileTimeError
@@ -327,16 +325,12 @@
function_type_call_getter2_test/05: MissingCompileTimeError
generic_list_checked_test: CompileTimeError
generic_methods_bounds_test/01: MissingCompileTimeError
-generic_methods_closure_test: StaticWarning
generic_methods_dynamic_test/01: MissingCompileTimeError
generic_methods_dynamic_test/03: MissingCompileTimeError
-generic_methods_local_variable_declaration_test: StaticWarning
generic_methods_overriding_test/01: MissingCompileTimeError
generic_methods_overriding_test/03: MissingCompileTimeError
generic_methods_overriding_test/06: StaticWarning
generic_methods_recursive_bound_test/02: MissingCompileTimeError
-generic_methods_shadowing_test: StaticWarning
-generic_methods_simple_is_expression_test: StaticWarning
generic_no_such_method_dispatcher_test: StaticWarning
generic_tearoff_test: CompileTimeError
generic_test: CompileTimeError
@@ -743,16 +737,12 @@
function_type_call_getter2_test/04: MissingCompileTimeError
function_type_call_getter2_test/05: MissingCompileTimeError
generic_methods_bounds_test/01: MissingCompileTimeError
-generic_methods_closure_test: StaticWarning
generic_methods_dynamic_test/01: MissingCompileTimeError
generic_methods_dynamic_test/03: MissingCompileTimeError
-generic_methods_local_variable_declaration_test: StaticWarning
generic_methods_overriding_test/01: MissingCompileTimeError
generic_methods_overriding_test/03: MissingCompileTimeError
generic_methods_overriding_test/06: StaticWarning
generic_methods_recursive_bound_test/02: MissingCompileTimeError
-generic_methods_shadowing_test: StaticWarning
-generic_methods_simple_is_expression_test: StaticWarning
generic_no_such_method_dispatcher_test: StaticWarning
generic_tearoff_test: CompileTimeError
getter_no_setter2_test/00: MissingCompileTimeError
@@ -1037,6 +1027,7 @@
accessor_conflict_import_test: CompileTimeError # Issue 25626
additional_interface_adds_optional_args_test: CompileTimeError # Issue #30568
assertion_initializer_const_function_test/01: MissingStaticWarning
+assertion_initializer_test: CompileTimeError
async_return_types_test/nestedFuture: MissingCompileTimeError
bug31436_test: CompileTimeError
cascaded_forwarding_stubs_test: CompileTimeError
@@ -1054,14 +1045,9 @@
field3a_negative_test: StaticWarning # Issue 28823
forwarding_stub_tearoff_test: CompileTimeError
generic_list_checked_test: CompileTimeError
-generic_methods_closure_test: CompileTimeError # Issue 29070
generic_methods_generic_function_result_test/none: CompileTimeError # Issue #30207
-generic_methods_local_variable_declaration_test: CompileTimeError # Issue 29070
generic_methods_overriding_test/01: MissingCompileTimeError # Issue 29070
generic_methods_overriding_test/03: MissingCompileTimeError # Issue 29070
-generic_methods_shadowing_test: CompileTimeError # Issue 29070
-generic_methods_simple_is_expression_test: CompileTimeError # Issue 29070
-generic_methods_type_expression_test: CompileTimeError # Incorrectly disallows type parameter in "is" test.
generic_no_such_method_dispatcher_test: CompileTimeError
generic_tearoff_test: CompileTimeError
generic_test: CompileTimeError
@@ -1140,6 +1126,7 @@
super_bound_closure_test/none: CompileTimeError
super_setter_test: StaticWarning # Issue 28823
switch_case_test/none: CompileTimeError
+type_inference_circularity_test: MissingCompileTimeError
type_promotion_functions_test/01: Pass
type_promotion_functions_test/05: Pass
type_promotion_functions_test/06: Pass
@@ -1203,8 +1190,6 @@
additional_interface_adds_optional_args_test: StaticWarning
argument_assignability_function_typed_test/01: MissingCompileTimeError
argument_assignability_function_typed_test/02: MissingCompileTimeError
-assertion_initializer_const_error2_test/cc10: CompileTimeError # Issue 31320
-assertion_initializer_const_error2_test/cc11: CompileTimeError # Issue 31320
assertion_initializer_const_function_test/01: MissingStaticWarning
async_congruence_local_test/01: MissingCompileTimeError
async_congruence_local_test/02: MissingCompileTimeError
@@ -1335,7 +1320,6 @@
generic_field_mixin6_test/01: MissingCompileTimeError
generic_function_typedef2_test/04: MissingCompileTimeError
generic_methods_generic_function_result_test/01: MissingCompileTimeError # Issue #30207
-generic_methods_type_expression_test: StaticWarning # Issue 30530
identical_const_test/01: MissingCompileTimeError
identical_const_test/02: MissingCompileTimeError
identical_const_test/03: MissingCompileTimeError
@@ -1585,6 +1569,7 @@
try_catch_on_syntax_test/07: MissingCompileTimeError
try_catch_syntax_test/08: MissingCompileTimeError
type_checks_in_factory_method_test/01: MissingCompileTimeError
+type_inference_circularity_test: MissingCompileTimeError
type_promotion_functions_test/01: MissingCompileTimeError
type_promotion_functions_test/05: MissingCompileTimeError
type_promotion_functions_test/06: MissingCompileTimeError
diff --git a/tests/language_2/language_2_dart2js.status b/tests/language_2/language_2_dart2js.status
index 4559a25..465cd64 100644
--- a/tests/language_2/language_2_dart2js.status
+++ b/tests/language_2/language_2_dart2js.status
@@ -142,7 +142,7 @@
example_constructor_test: RuntimeError
external_test/21: CompileTimeError
external_test/24: CompileTimeError
-extract_type_arguments_test: CompileTimeError # Issue 31371
+extract_type_arguments_test: RuntimeError # Issue 31371
f_bounded_quantification_test/01: MissingCompileTimeError
f_bounded_quantification_test/02: MissingCompileTimeError
factory1_test/00: MissingCompileTimeError
@@ -1076,7 +1076,6 @@
covariant_subtyping_test: CompileTimeError
[ $compiler == dart2js && $checked && $dart2js_with_kernel ]
-arithmetic_canonicalization_test: RuntimeError
assertion_initializer_const_function_test/01: MissingCompileTimeError
assertion_initializer_test: CompileTimeError
assertion_test: RuntimeError
@@ -1197,6 +1196,7 @@
covariant_override/runtime_check_test: RuntimeError
covariant_subtyping_test: Crash # Unsupported operation: Unsupported type parameter type node E.
cyclic_constructor_test/01: Crash # Stack Overflow
+deferred_call_empty_before_load_test: RuntimeError
deferred_closurize_load_library_test: RuntimeError
deferred_constraints_constants_test/default_argument2: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
deferred_constraints_constants_test/none: Crash # Unsupported operation: KernelDeferredLoadTask.addMirrorElementsForLibrary
@@ -1243,13 +1243,13 @@
field_override4_test/02: MissingCompileTimeError
final_attempt_reinitialization_test/01: MissingCompileTimeError
final_attempt_reinitialization_test/02: MissingCompileTimeError
+full_stacktrace1_test: RuntimeError # Issue 12698
+full_stacktrace2_test: RuntimeError # Issue 12698
+full_stacktrace3_test: RuntimeError # Issue 12698
function_type_alias_test: RuntimeError
generalized_void_syntax_test: CompileTimeError
generic_closure_test/01: RuntimeError
generic_closure_test/none: RuntimeError
-generic_field_mixin4_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in () for j:constructor(C3.).
-generic_field_mixin5_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in () for j:constructor(C3.).
-generic_field_mixin_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in () for j:constructor(C3.).
generic_function_bounds_test: Crash # Unsupported operation: Unsupported type parameter type node T.
generic_function_dcall_test: Crash # Unsupported operation: Unsupported type parameter type node T.
generic_function_typedef_test/01: RuntimeError
@@ -1440,8 +1440,11 @@
regress_31057_test: Crash # Unsupported operation: Unsupported type parameter type node B.
setter_override_test/00: MissingCompileTimeError
setter_override_test/03: MissingCompileTimeError
-stacktrace_demangle_ctors_test: RuntimeError
-stacktrace_test: RuntimeError
+stacktrace_demangle_ctors_test: RuntimeError # Issue 12698
+stacktrace_rethrow_error_test/none: RuntimeError # Issue 12698
+stacktrace_rethrow_error_test/withtraceparameter: RuntimeError # Issue 12698
+stacktrace_rethrow_nonerror_test: RuntimeError # Issue 12698
+stacktrace_test: RuntimeError # Issue 12698
super_call4_test: Crash # NoSuchMethodError: The getter 'thisLocal' was called on null.
switch_bad_case_test/01: MissingCompileTimeError
switch_bad_case_test/02: MissingCompileTimeError
@@ -1521,6 +1524,7 @@
cascaded_forwarding_stubs_generic_test: RuntimeError
cascaded_forwarding_stubs_test: RuntimeError
checked_setter3_test: RuntimeError # Issue 31128
+forwarding_semi_stub_test: RuntimeError
forwarding_stub_tearoff_generic_test: RuntimeError
forwarding_stub_tearoff_test: RuntimeError
implicit_downcast_during_assignment_test: RuntimeError
@@ -1566,6 +1570,7 @@
const_constructor3_test/02: MissingCompileTimeError
const_constructor3_test/04: MissingCompileTimeError
const_init2_test/02: MissingCompileTimeError
+forwarding_semi_stub_test: RuntimeError
forwarding_stub_tearoff_generic_test: RuntimeError
forwarding_stub_tearoff_test: RuntimeError
function_subtype_inline2_test: RuntimeError
@@ -1610,6 +1615,9 @@
implicit_downcast_during_super_initializer_test: RuntimeError
implicit_downcast_during_yield_star_test: RuntimeError
implicit_downcast_during_yield_test: RuntimeError
+instantiate_tearoff_after_contravariance_check_test: RuntimeError
+instantiate_tearoff_of_call_test: RuntimeError
+instantiate_tearoff_test: RuntimeError
invalid_cast_test/01: MissingCompileTimeError
invalid_cast_test/02: MissingCompileTimeError
invalid_cast_test/03: MissingCompileTimeError
@@ -1623,6 +1631,8 @@
object_has_no_call_method_test/02: MissingCompileTimeError
object_has_no_call_method_test/05: MissingCompileTimeError
object_has_no_call_method_test/08: MissingCompileTimeError
+type_inference_circularity_test: MissingCompileTimeError
+type_inference_inconsistent_inheritance_test: MissingCompileTimeError
[ $compiler == dart2js && $dart2js_with_kernel && $fast_startup ]
arithmetic_canonicalization_test: RuntimeError
@@ -2026,8 +2036,8 @@
regress_31057_test: Crash # Unsupported operation: Unsupported type parameter type node B.
setter_override_test/00: MissingCompileTimeError
setter_override_test/03: MissingCompileTimeError
-stacktrace_demangle_ctors_test: RuntimeError
-stacktrace_test: RuntimeError
+stacktrace_demangle_ctors_test: RuntimeError # Issue 12698
+stacktrace_test: RuntimeError # Issue 12698
super_call4_test: Crash # NoSuchMethodError: The getter 'thisLocal' was called on null.
switch_bad_case_test/01: MissingCompileTimeError
switch_bad_case_test/02: MissingCompileTimeError
@@ -2048,7 +2058,6 @@
typevariable_substitution2_test/02: RuntimeError
[ $compiler == dart2js && $dart2js_with_kernel && $host_checked ]
-arithmetic_canonicalization_test: RuntimeError
assertion_initializer_const_function_test/01: MissingCompileTimeError
assertion_initializer_test: CompileTimeError
assertion_test: RuntimeError
@@ -2172,6 +2181,7 @@
covariant_subtyping_unsafe_call2_test: RuntimeError
covariant_subtyping_unsafe_call3_test: RuntimeError
cyclic_constructor_test/01: Crash # Issue 30856
+deferred_call_empty_before_load_test: RuntimeError
deferred_closurize_load_library_test: RuntimeError
deferred_constraints_constants_test/default_argument2: Crash # Assertion failure: Missing scope info for j:method(_loadLibraryWrapper).
deferred_constraints_constants_test/none: Crash # Assertion failure: Missing scope info for j:method(_loadLibraryWrapper).
@@ -2220,6 +2230,9 @@
field_override4_test/02: MissingCompileTimeError
final_attempt_reinitialization_test/01: MissingCompileTimeError
final_attempt_reinitialization_test/02: MissingCompileTimeError
+full_stacktrace1_test: RuntimeError
+full_stacktrace2_test: RuntimeError
+full_stacktrace3_test: RuntimeError
function_subtype_bound_closure3_test: RuntimeError
function_subtype_bound_closure4_test: RuntimeError
function_subtype_bound_closure7_test: RuntimeError
@@ -2250,10 +2263,7 @@
generalized_void_syntax_test: CompileTimeError
generic_closure_test/01: RuntimeError
generic_closure_test/none: RuntimeError
-generic_field_mixin4_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in ()in j:constructor(C3.).
-generic_field_mixin5_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in ()in j:constructor(C3.).
generic_field_mixin6_test/none: RuntimeError
-generic_field_mixin_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in ()in j:constructor(C3.).
generic_function_bounds_test: Crash # Unsupported operation: Unsupported type parameter type node T.
generic_function_dcall_test: Crash # Unsupported operation: Unsupported type parameter type node T.
generic_function_typedef_test/01: RuntimeError
@@ -2454,8 +2464,11 @@
regress_31057_test: Crash # Unsupported operation: Unsupported type parameter type node B.
setter_override_test/00: MissingCompileTimeError
setter_override_test/03: MissingCompileTimeError
-stacktrace_demangle_ctors_test: RuntimeError
-stacktrace_test: RuntimeError
+stacktrace_demangle_ctors_test: RuntimeError # Issue 12698
+stacktrace_rethrow_error_test/none: RuntimeError
+stacktrace_rethrow_error_test/withtraceparameter: RuntimeError
+stacktrace_rethrow_nonerror_test: RuntimeError
+stacktrace_test: RuntimeError # Issue 12698
super_call4_test: Crash # Assertion failure: Missing scope info for j:method(E.boz).
switch_bad_case_test/01: MissingCompileTimeError
switch_bad_case_test/02: MissingCompileTimeError
@@ -2478,7 +2491,6 @@
typevariable_substitution2_test/02: RuntimeError
[ $compiler == dart2js && $dart2js_with_kernel && $minified ]
-arithmetic_canonicalization_test: RuntimeError
assertion_initializer_const_function_test/01: MissingCompileTimeError
assertion_initializer_test: CompileTimeError
assertion_test: RuntimeError
@@ -2600,6 +2612,7 @@
covariant_subtyping_unsafe_call2_test: RuntimeError
covariant_subtyping_unsafe_call3_test: RuntimeError
cyclic_constructor_test/01: Crash # Issue 30856
+deferred_call_empty_before_load_test: RuntimeError
deferred_closurize_load_library_test: RuntimeError
deferred_constraints_constants_test/default_argument2: Crash # NoSuchMethodError: The getter 'closureClassEntity' was called on null.
deferred_constraints_constants_test/none: Crash # NoSuchMethodError: The getter 'closureClassEntity' was called on null.
@@ -2648,9 +2661,9 @@
field_override4_test/02: MissingCompileTimeError
final_attempt_reinitialization_test/01: MissingCompileTimeError
final_attempt_reinitialization_test/02: MissingCompileTimeError
-full_stacktrace1_test: RuntimeError
-full_stacktrace2_test: RuntimeError
-full_stacktrace3_test: RuntimeError
+full_stacktrace1_test: RuntimeError # Issue 12698
+full_stacktrace2_test: RuntimeError # Issue 12698
+full_stacktrace3_test: RuntimeError # Issue 12698
function_subtype_bound_closure3_test: RuntimeError
function_subtype_bound_closure4_test: RuntimeError
function_subtype_bound_closure7_test: RuntimeError
@@ -2679,10 +2692,7 @@
function_type_call_getter2_test/none: RuntimeError
function_type_test: RuntimeError
generalized_void_syntax_test: CompileTimeError
-generic_field_mixin4_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in ()in j:constructor(C3.).
-generic_field_mixin5_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in ()in j:constructor(C3.).
generic_field_mixin6_test/none: RuntimeError
-generic_field_mixin_test: Crash # Assertion failure: Runtime type information not available for type_variable_local(M.T) in ()in j:constructor(C3.).
generic_function_bounds_test: Crash # Unsupported operation: Unsupported type parameter type node T.
generic_function_dcall_test: Crash # Unsupported operation: Unsupported type parameter type node T.
generic_function_typedef_test/01: RuntimeError
@@ -2876,11 +2886,11 @@
setter_override_test/00: MissingCompileTimeError
setter_override_test/03: MissingCompileTimeError
stack_trace_test: RuntimeError
-stacktrace_demangle_ctors_test: RuntimeError
-stacktrace_rethrow_error_test/none: RuntimeError
-stacktrace_rethrow_error_test/withtraceparameter: RuntimeError
-stacktrace_rethrow_nonerror_test: RuntimeError
-stacktrace_test: RuntimeError
+stacktrace_demangle_ctors_test: RuntimeError # Issue 12698
+stacktrace_rethrow_error_test/none: RuntimeError # Issue 12698
+stacktrace_rethrow_error_test/withtraceparameter: RuntimeError # Issue 12698
+stacktrace_rethrow_nonerror_test: RuntimeError # Issue 12698
+stacktrace_test: RuntimeError # Issue 12698
super_call4_test: Crash # NoSuchMethodError: The getter 'thisLocal' was called on null.
switch_bad_case_test/01: MissingCompileTimeError
switch_bad_case_test/02: MissingCompileTimeError
@@ -3031,6 +3041,9 @@
if_null_assignment_behavior_test/13: Crash # Issue 23491
if_null_assignment_behavior_test/14: Crash # Issue 23491
infinity_test: RuntimeError # Issue 4984
+instantiate_tearoff_after_contravariance_check_test: RuntimeError
+instantiate_tearoff_of_call_test: RuntimeError
+instantiate_tearoff_test: RuntimeError
integer_division_by_zero_test: RuntimeError # Issue 8301
invocation_mirror2_test: RuntimeError # Issue 6490 (wrong retval).
left_shift_test: RuntimeError # Issue 1533
@@ -3086,13 +3099,15 @@
regress_24283_test: RuntimeError # Issue 1533
scope_variable_test/01: MissingCompileTimeError # Issue 13016
setter4_test: CompileTimeError # issue 13639
-stacktrace_demangle_ctors_test: Fail # dart2js stack traces are not always compliant.
+stacktrace_demangle_ctors_test: Fail # dart2js stack traces are not always compliant, issue 12698
stacktrace_rethrow_error_test: Pass, RuntimeError # Issue 12698
stacktrace_rethrow_nonerror_test: Pass, RuntimeError # Issue 12698
stacktrace_test: Pass, RuntimeError # # Issue 12698
truncdiv_test: RuntimeError # Issue 15246
try_catch_on_syntax_test/10: Fail # Issue 19823
try_catch_on_syntax_test/11: Fail # Issue 19823
+type_inference_circularity_test: MissingCompileTimeError
+type_inference_inconsistent_inheritance_test: MissingCompileTimeError
type_variable_conflict_test/01: Fail # Issue 13702
type_variable_conflict_test/02: Fail # Issue 13702
type_variable_conflict_test/03: Fail # Issue 13702
diff --git a/tests/language_2/language_2_dartdevc.status b/tests/language_2/language_2_dartdevc.status
index f996cb1..f86090e 100644
--- a/tests/language_2/language_2_dartdevc.status
+++ b/tests/language_2/language_2_dartdevc.status
@@ -48,13 +48,8 @@
forwarding_stub_tearoff_test: CompileTimeError
fuzzy_arrows_test/01: MissingCompileTimeError
generic_local_functions_test: CompileTimeError
-generic_methods_closure_test: CompileTimeError # Issue 29920
generic_methods_generic_function_parameter_test: CompileTimeError
generic_methods_generic_function_result_test/none: CompileTimeError # Issue #30208
-generic_methods_local_variable_declaration_test: CompileTimeError # Issue 29920
-generic_methods_shadowing_test: CompileTimeError # Issue 29920
-generic_methods_simple_is_expression_test: CompileTimeError # Issue 29920
-generic_methods_type_expression_test: CompileTimeError
generic_no_such_method_dispatcher_simple_test: Skip # This test is just for kernel.
generic_no_such_method_dispatcher_test: CompileTimeError
generic_test: CompileTimeError
@@ -65,6 +60,8 @@
import_core_prefix_test: CompileTimeError
import_private_test/01: MissingCompileTimeError # Issue 29920
initializing_formal_final_test: MissingCompileTimeError
+instantiate_tearoff_after_contravariance_check_test: RuntimeError
+instantiate_tearoff_of_call_test: RuntimeError
interface_test/00: MissingCompileTimeError
internal_library_test/01: MissingCompileTimeError # Issue 29920
method_override_test: CompileTimeError # Negative test
@@ -111,6 +108,8 @@
syntax_test/none: CompileTimeError
try_catch_on_syntax_test/10: MissingCompileTimeError
try_catch_on_syntax_test/11: MissingCompileTimeError
+type_inference_circularity_test: MissingCompileTimeError
+type_inference_inconsistent_inheritance_test: MissingCompileTimeError
type_promotion_functions_test/02: CompileTimeError # Issue 30895
type_promotion_functions_test/03: CompileTimeError # Issue 30895
type_promotion_functions_test/04: CompileTimeError # Issue 30895
@@ -189,6 +188,7 @@
call_non_method_field_test/02: MissingCompileTimeError
call_with_no_such_method_test: CompileTimeError # Issue 31402 Error: A value of type '#lib1::F' can't be assigned to a variable of type 'dart.core::Function'.
callable_test/none: CompileTimeError
+cascade_on_static_field_test: Crash
check_member_static_test/01: MissingCompileTimeError
check_member_static_test/02: MissingCompileTimeError
class_cycle_test/02: MissingCompileTimeError
@@ -230,7 +230,6 @@
const_qq_test: Crash
const_switch2_test/01: MissingCompileTimeError
const_syntax_test/05: MissingCompileTimeError
-const_syntax_test/08: MissingCompileTimeError
const_syntax_test/09: Crash
const_types_test/34: MissingCompileTimeError
const_types_test/35: MissingCompileTimeError
@@ -286,7 +285,6 @@
export_ambiguous_main_test: MissingCompileTimeError
external_test/21: CompileTimeError
external_test/24: CompileTimeError
-extract_type_arguments_test: CompileTimeError # Issue 31371
f_bounded_quantification_test/01: MissingCompileTimeError
f_bounded_quantification_test/02: MissingCompileTimeError
factory2_test/03: MissingCompileTimeError
@@ -307,7 +305,7 @@
final_attempt_reinitialization_test/02: Crash
final_syntax_test/09: Crash
function_propagation_test: CompileTimeError
-function_subtype_bound_closure7_test: CompileTimeError
+function_subtype_bound_closure7_test: Crash
function_type/function_type10_test: CompileTimeError
function_type/function_type11_test: CompileTimeError
function_type/function_type14_test: CompileTimeError
@@ -378,12 +376,12 @@
function_type_parameter_negative_test: Fail
generalized_void_syntax_test: CompileTimeError
generic_function_bounds_test: CompileTimeError
-generic_function_dcall_test: CompileTimeError
+generic_function_dcall_test: Crash
generic_methods_bounds_test/01: MissingCompileTimeError
generic_methods_generic_function_result_test/01: MissingCompileTimeError
generic_methods_recursive_bound_test/02: MissingCompileTimeError
-generic_methods_tearoff_specialization_test: CompileTimeError
-generic_methods_unused_parameter_test: CompileTimeError
+generic_methods_tearoff_specialization_test: Crash
+generic_methods_unused_parameter_test: Crash
generic_no_such_method_dispatcher_simple_test: CompileTimeError # Warning: Superclass has no method named 'foo'.
generic_no_such_method_dispatcher_test: CompileTimeError # Issue 31533
getter_override2_test/02: MissingCompileTimeError
@@ -400,6 +398,9 @@
initializing_formal_type_annotation_test/01: MissingCompileTimeError
initializing_formal_type_annotation_test/02: MissingCompileTimeError
instance_call_wrong_argument_count_negative_test: Fail
+instantiate_tearoff_after_contravariance_check_test: Crash
+instantiate_tearoff_of_call_test: Crash
+instantiate_tearoff_test: Crash
invocation_mirror_test: CompileTimeError # Issue 31402 Error: A value of type 'dart.core::int' can't be assigned to a variable of type 'dart.core::Invocation'.
issue13179_test: CompileTimeError # Issue 31537
issue18628_2_test/01: MissingCompileTimeError
@@ -544,6 +545,7 @@
mixin_type_parameters_errors_test/03: MissingCompileTimeError
mixin_type_parameters_errors_test/04: MissingCompileTimeError
mixin_type_parameters_errors_test/05: MissingCompileTimeError
+mixin_with_named_import_test: Crash
multiline_newline_test/06: MissingCompileTimeError
multiline_newline_test/06r: MissingCompileTimeError
named_constructor_test/01: MissingCompileTimeError
@@ -641,6 +643,7 @@
super_in_async3_test: Crash
super_in_async4_test: Crash
super_in_async6_test: Crash
+super_in_constructor_test: RuntimeError
super_in_finally_test: Crash
super_no_such_method1_test: CompileTimeError
super_no_such_method2_test: CompileTimeError
@@ -685,6 +688,7 @@
type_variable_bounds_test/06: MissingCompileTimeError
type_variable_bounds_test/08: MissingCompileTimeError
type_variable_bounds_test/11: MissingCompileTimeError
+typedef_class_in_other_file_test: Crash
void_block_return_test/00: MissingCompileTimeError
void_type_callbacks_test/none: CompileTimeError
wrong_number_type_arguments_test/01: MissingCompileTimeError
@@ -738,11 +742,6 @@
super_operator_index7_test: RuntimeError
super_operator_index8_test: RuntimeError
truncdiv_test: RuntimeError # Issue 29920
-yieldstar_pause_test: Skip # Times out
-
-[ $compiler == dartdevk && $runtime == none ]
-no_such_method_negative_test: Fail
-prefix6_negative_test: Fail
[ $compiler == dartdevk && $runtime != none ]
callable_test/none: RuntimeError # Expect.throws(TypeError) fails: Did not throw
@@ -791,7 +790,6 @@
generic_closure_test/none: RuntimeError # ReferenceError: TToT is not defined
generic_list_checked_test: RuntimeError # Expect.throws fails: Did not throw
generic_method_types_test/02: RuntimeError
-generic_methods_type_expression_test: RuntimeError # Expect.isTrue(false) fails.
generic_methods_unused_parameter_test: RuntimeError # Expect.isTrue(false) fails.
generic_test: RuntimeError # ReferenceError: BOfT is not defined
library_env_test/has_io_support: RuntimeError # Unsupported operation: bool.fromEnvironment can only be used as a const constructor
@@ -823,7 +821,6 @@
runtime_type_function_test: RuntimeError # Expect.fail('Type print string does not match expectation
syncstar_yield_test/copyParameters: RuntimeError # Expect.equals(expected: <2>, actual: <3>) fails.
type_literal_test: RuntimeError # Expect.equals(expected: <Func>, actual: <(bool) => int>) fails.
-yieldstar_pause_test: Timeout
# Compiler tests for dartdevc and dartdevk. These contain common expectations
# for all runtimes including $runtime == none. They are organized by: shared
diff --git a/tests/language_2/language_2_kernel.status b/tests/language_2/language_2_kernel.status
index b8486e7..6578d02 100644
--- a/tests/language_2/language_2_kernel.status
+++ b/tests/language_2/language_2_kernel.status
@@ -22,6 +22,9 @@
vm/unaligned_integer_access_register_index_test: CompileTimeError # Issue 31339
[ $compiler == dartk && $mode == debug && $runtime == vm && $strong ]
+bad_named_parameters_test/01: Crash # Issue(http://dartbug.com/31630)
+bad_named_parameters_test/02: Crash # Issue(http://dartbug.com/31630)
+bad_named_parameters_test/04: Crash # Issue(http://dartbug.com/31630)
const_instance_field_test/01: Crash
cyclic_type_variable_test/01: Crash
cyclic_type_variable_test/02: Crash
@@ -30,6 +33,11 @@
cyclic_type_variable_test/none: Crash
deopt_inlined_function_lazy_test: Skip
flatten_test/04: Crash # Issue #31381
+instance_call_wrong_argument_count_negative_test: Crash # Issue(http//dartbug.com/31630)
+optional_named_parameters_test/02: Crash # Issue(http://dartbug.com/31630)
+optional_named_parameters_test/04: Crash # Issue(http://dartbug.com/31630)
+optional_named_parameters_test/06: Crash # Issue(http://dartbug.com/31630)
+optional_named_parameters_test/08: Crash # Issue(http://dartbug.com/31630)
tearoff_dynamic_test: Crash
[ $compiler == dartk && $mode == product && $runtime == vm ]
@@ -176,9 +184,6 @@
async_await_syntax_test/c10a: MissingCompileTimeError
async_await_syntax_test/d08b: MissingCompileTimeError
async_await_syntax_test/d10a: MissingCompileTimeError
-async_await_test/02: CompileTimeError # Issue 31402 (Invocation arguments)
-async_await_test/03: CompileTimeError # Issue 31402 (Invocation arguments)
-async_await_test/none: CompileTimeError # Issue 31402 (Invocation arguments)
async_or_generator_return_type_stacktrace_test/01: MissingCompileTimeError
async_or_generator_return_type_stacktrace_test/02: MissingCompileTimeError
async_or_generator_return_type_stacktrace_test/03: MissingCompileTimeError
@@ -296,9 +301,7 @@
compile_time_constant_static5_test/21: CompileTimeError # Issue 31537
compile_time_constant_static5_test/23: CompileTimeError # Issue 31402 (Field declaration)
conditional_import_string_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-conditional_import_string_test: DartkCompileTimeError
conditional_import_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-conditional_import_test: DartkCompileTimeError
conditional_method_invocation_test/12: MissingCompileTimeError
conditional_method_invocation_test/13: MissingCompileTimeError
conditional_property_access_test/10: MissingCompileTimeError
@@ -425,8 +428,8 @@
deferred_inlined_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
deferred_inlined_test: RuntimeError
deferred_load_constants_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-deferred_load_inval_code_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
deferred_load_inval_code_test: RuntimeError
+deferred_load_inval_code_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
deferred_load_library_wrong_args_test/01: Pass # Passes by mistake. KernelVM bug: Deferred loading kernel issue 28335.
deferred_load_library_wrong_args_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
deferred_load_library_wrong_args_test/none: RuntimeError
@@ -451,8 +454,8 @@
deferred_static_seperate_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
deferred_static_seperate_test: RuntimeError
deferred_super_dependency_test/01: Pass # Passes by mistake. KernelVM bug: Deferred loading kernel issue 28335.
-deferred_type_dependency_test/as: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
deferred_type_dependency_test/as: RuntimeError
+deferred_type_dependency_test/as: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
deferred_type_dependency_test/is: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
deferred_type_dependency_test/is: RuntimeError
deferred_type_dependency_test/none: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
@@ -464,8 +467,8 @@
dynamic_prefix_core_test/01: MissingCompileTimeError
dynamic_prefix_core_test/01: RuntimeError # KernelVM bug: Blocked on language issue 29125.
dynamic_prefix_core_test/none: RuntimeError
-dynamic_test: CompileTimeError # Issue 31402 (Variable declaration)
dynamic_test: RuntimeError
+dynamic_test: CompileTimeError # Issue 31402 (Variable declaration)
emit_const_fields_test: CompileTimeError # Issue 31533
empty_block_case_test: MissingCompileTimeError
enum_private_test/02: MissingCompileTimeError
@@ -473,7 +476,7 @@
external_test/10: MissingRuntimeError # KernelVM bug: Unbound external.
external_test/13: MissingRuntimeError # KernelVM bug: Unbound external.
external_test/20: MissingRuntimeError # KernelVM bug: Unbound external.
-extract_type_arguments_test: CompileTimeError # Issue 31371
+extract_type_arguments_test: RuntimeError # Issue 31371
f_bounded_quantification_test/01: MissingCompileTimeError
f_bounded_quantification_test/02: MissingCompileTimeError
factory2_test/03: MissingCompileTimeError
@@ -644,8 +647,8 @@
generic_function_bounds_test: RuntimeError
generic_function_dcall_test: CompileTimeError
generic_function_dcall_test: RuntimeError
-generic_function_type_as_type_argument_test/02: MissingCompileTimeError, OK # No type inference
generic_function_type_as_type_argument_test/02: Pass # For the wrong reason, issue 30931
+generic_function_type_as_type_argument_test/02: MissingCompileTimeError, OK # No type inference
generic_function_typedef2_test/04: MissingCompileTimeError
generic_instanceof2_test: RuntimeError
generic_instanceof_test: RuntimeError
@@ -658,7 +661,6 @@
generic_methods_recursive_bound_test/02: MissingCompileTimeError
generic_methods_tearoff_specialization_test: CompileTimeError # Issue 31402 (Variable declaration)
generic_methods_tearoff_specialization_test: RuntimeError
-generic_methods_type_expression_test: RuntimeError # Issue 25869 / 27460
generic_methods_unused_parameter_test: CompileTimeError # Issue 31402 (Variable declaration)
generic_methods_unused_parameter_test: RuntimeError
generic_no_such_method_dispatcher_simple_test: CompileTimeError # Issue 31533
@@ -689,6 +691,9 @@
initializing_formal_type_annotation_test/01: MissingCompileTimeError
initializing_formal_type_annotation_test/02: MissingCompileTimeError
instanceof2_test: RuntimeError
+instantiate_tearoff_after_contravariance_check_test: CompileTimeError
+instantiate_tearoff_of_call_test: CompileTimeError
+instantiate_tearoff_test: CompileTimeError
int64_literal_test/03: MissingCompileTimeError # http://dartbug.com/31479
int64_literal_test/30: MissingCompileTimeError # http://dartbug.com/31479
interface_test/00: MissingCompileTimeError
@@ -1140,8 +1145,6 @@
unresolved_top_level_method_test: MissingCompileTimeError
unresolved_top_level_var_test: MissingCompileTimeError
vm/canonicalization_preserves_deopt_test: CompileTimeError # Issue 31402 (Assert statement)
-vm/causal_async_exception_stack2_test: CompileTimeError # Issue 31402 (Invocation arguments)
-vm/causal_async_exception_stack_test: CompileTimeError # Issue 31402 (Invocation arguments)
vm/closure_memory_retention_test: Skip # KernelVM bug: Hits OOM
vm/debug_break_enabled_vm_test/01: CompileTimeError # KernelVM bug: Bad test using extended break syntax.
vm/debug_break_enabled_vm_test/none: CompileTimeError # KernelVM bug: Bad test using extended break syntax.
@@ -1194,6 +1197,30 @@
wrong_number_type_arguments_test/*: MissingCompileTimeError
wrong_number_type_arguments_test/none: Pass
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $compiler == dartk && $strong && ($arch == simarm || $arch == simarm64) ]
+bit_operations_test/03: CompileTimeError # Please triage.
+bit_operations_test/04: CompileTimeError # Please triage.
+bit_operations_test/none: CompileTimeError # Please triage.
+class_cycle_test/02: MissingCompileTimeError # Please triage.
+class_cycle_test/03: MissingCompileTimeError # Please triage.
+duplicate_implements_test/01: MissingCompileTimeError # Please triage.
+duplicate_implements_test/02: MissingCompileTimeError # Please triage.
+duplicate_implements_test/03: MissingCompileTimeError # Please triage.
+duplicate_implements_test/04: MissingCompileTimeError # Please triage.
+generic_methods_generic_function_result_test/01: MissingCompileTimeError # Please triage.
+identical_closure2_test: CompileTimeError # Please triage.
+issue23244_test: RuntimeError # Please triage.
+least_upper_bound_expansive_test/none: RuntimeError # Please triage.
+mint_arithmetic_test: CompileTimeError # Please triage.
+mixin_black_listed_test/02: MissingCompileTimeError # Please triage.
+null_test/02: MissingCompileTimeError # Please triage.
+null_test/03: MissingCompileTimeError # Please triage.
+vm/unaligned_integer_access_literal_index_test: CompileTimeError # Please triage.
+vm/unaligned_integer_access_register_index_test: CompileTimeError # Please triage.
+
[ $compiler == dartk && !$strong ]
*: SkipByDesign # language_2 is only supported in strong mode.
@@ -1208,8 +1235,7 @@
cyclic_type_variable_test/04: Crash
cyclic_type_variable_test/none: Crash
external_test/13: Crash
-final_syntax_test/09: Crash
-flatten_test/04: Crash
+instance_call_wrong_argument_count_negative_test: Crash # Issue(http://dartbug.com/31630)
optional_named_parameters_test/06: Crash
optional_named_parameters_test/08: Crash
regress_29025_test: Crash
@@ -1399,8 +1425,8 @@
async_star_test/01: CompileTimeError # Issue 2238.
async_star_test/01: Crash
async_star_test/01: Pass
-async_star_test/02: RuntimeError
async_star_test/02: CompileTimeError # Issue 31402 (Invocation arguments)
+async_star_test/02: RuntimeError
async_star_test/03: CompileTimeError # Issue 31402 (Invocation arguments)
async_star_test/04: CompileTimeError # Issue 31402 (Invocation arguments)
async_star_test/05: CompileTimeError # Issue 31402 (Invocation arguments)
@@ -1471,8 +1497,8 @@
checked_setter3_test/03: MissingCompileTimeError
class_cycle_test/02: MissingCompileTimeError
class_cycle_test/03: MissingCompileTimeError
-class_keyword_test/02: Pass
class_keyword_test/02: MissingCompileTimeError # Issue 13627
+class_keyword_test/02: Pass
class_literal_static_test/12: MissingCompileTimeError
class_literal_static_test/13: MissingCompileTimeError
class_literal_static_test/17: MissingCompileTimeError
@@ -1543,7 +1569,6 @@
const_redirecting_factory_test: CompileTimeError # Issue 31402 (Field declaration)
const_switch2_test/01: MissingCompileTimeError # KernelVM bug: Constant evaluation.
const_syntax_test/05: MissingCompileTimeError # KernelVM bug: Constant evaluation.
-const_syntax_test/08: Crash
const_types_test/01: MissingCompileTimeError
const_types_test/02: MissingCompileTimeError
const_types_test/03: MissingCompileTimeError
@@ -1615,8 +1640,8 @@
deferred_constraints_type_annotation_test/type_annotation_generic1: Pass
deferred_constraints_type_annotation_test/type_annotation_generic2: MissingCompileTimeError
deferred_constraints_type_annotation_test/type_annotation_generic2: Pass
-deferred_constraints_type_annotation_test/type_annotation_generic3: Pass
deferred_constraints_type_annotation_test/type_annotation_generic3: MissingCompileTimeError
+deferred_constraints_type_annotation_test/type_annotation_generic3: Pass
deferred_constraints_type_annotation_test/type_annotation_generic4: MissingCompileTimeError
deferred_constraints_type_annotation_test/type_annotation_generic4: Pass
deferred_constraints_type_annotation_test/type_annotation_non_deferred: CompileTimeError
@@ -1678,9 +1703,8 @@
external_test/10: MissingRuntimeError # KernelVM bug: Unbound external.
external_test/13: MissingRuntimeError # KernelVM bug: Unbound external.
external_test/20: MissingRuntimeError # KernelVM bug: Unbound external.
-external_test/21: CompileTimeError
-external_test/24: CompileTimeError
-extract_type_arguments_test: CompileTimeError # Issue 31371
+external_test/24: Pass, CompileTimeError # Started to pass after switching to batch-mode.
+extract_type_arguments_test: RuntimeError # Issue 31371
f_bounded_quantification_test/01: MissingCompileTimeError
f_bounded_quantification_test/02: MissingCompileTimeError
factory2_test/03: MissingCompileTimeError
@@ -1706,7 +1730,6 @@
final_for_in_variable_test: MissingCompileTimeError
final_param_test: MissingCompileTimeError
final_super_field_set_test: MissingCompileTimeError
-final_syntax_test/09: Crash
final_variable_assignment_test/01: MissingCompileTimeError
final_variable_assignment_test/02: MissingCompileTimeError
final_variable_assignment_test/03: MissingCompileTimeError
@@ -1890,8 +1913,6 @@
generic_methods_reuse_type_variables_test: Pass
generic_methods_tearoff_specialization_test: RuntimeError
generic_methods_tearoff_specialization_test: CompileTimeError # Issue 31402 (Variable declaration)
-generic_methods_type_expression_test: Crash
-generic_methods_type_expression_test: RuntimeError # Issue 25869 / 27460
generic_methods_unused_parameter_test: CompileTimeError # Issue 31402 (Variable declaration)
generic_methods_unused_parameter_test: RuntimeError
generic_no_such_method_dispatcher_simple_test: CompileTimeError # Issue 31533
@@ -1951,6 +1972,9 @@
instanceof4_test/01: RuntimeError
instanceof4_test/none: Pass
instanceof4_test/none: RuntimeError
+instantiate_tearoff_after_contravariance_check_test: CompileTimeError
+instantiate_tearoff_of_call_test: CompileTimeError
+instantiate_tearoff_test: CompileTimeError
int64_literal_test/03: MissingCompileTimeError # http://dartbug.com/31479
int64_literal_test/30: MissingCompileTimeError # http://dartbug.com/31479
interface_test/00: MissingCompileTimeError
@@ -2162,8 +2186,8 @@
mock_writable_final_private_field_test: RuntimeError # Issue 30849
multiline_strings_test: Pass
multiline_strings_test: Fail # Issue 23020
-named_constructor_test/01: MissingRuntimeError # Fasta bug: Bad compilation of constructor reference.
named_constructor_test/01: MissingCompileTimeError
+named_constructor_test/01: MissingRuntimeError # Fasta bug: Bad compilation of constructor reference.
named_constructor_test/03: MissingCompileTimeError
named_parameters2_test: MissingCompileTimeError
named_parameters3_test: MissingCompileTimeError
@@ -2333,15 +2357,15 @@
regress_28217_test/none: MissingCompileTimeError # Fasta bug: Bad constructor redirection.
regress_28255_test: SkipByDesign
regress_28278_test: CompileTimeError # KernelVM bug: Deferred loading kernel issue 28335.
-regress_28341_test: RuntimeError
regress_28341_test: Pass
+regress_28341_test: RuntimeError
regress_29025_test: CompileTimeError # Issue 31402 (Variable declaration)
regress_29405_test: CompileTimeError # Issue 31402 (Invocation arguments)
regress_29784_test/01: MissingCompileTimeError
regress_29784_test/02: MissingCompileTimeError
regress_30339_test: CompileTimeError # Issue 31402 (Variable declaration)
setter4_test: MissingCompileTimeError # Issue 14736
-setter_no_getter_test/01: CompileTimeError # Issue 31533
+setter_no_getter_test/01: Pass, CompileTimeError # Issue 31533 (started passing after switching to batch-mode)
setter_override_test/01: MissingCompileTimeError
setter_override_test/02: MissingCompileTimeError
stacktrace_demangle_ctors_test: RuntimeError
@@ -2449,8 +2473,8 @@
vm/reflect_core_vm_test: SkipByDesign
vm/regress_27201_test: CompileTimeError # Fasta/KernelVM bug: Deferred loading kernel issue 28335.
vm/regress_27201_test: Fail
-vm/regress_27671_test: Skip # Unsupported
vm/regress_27671_test: Crash
+vm/regress_27671_test: Skip # Unsupported
vm/regress_29145_test: Skip # Issue 29145
vm/type_cast_vm_test: RuntimeError # Expects line and column numbers
vm/type_vm_test: RuntimeError, Pass # Expects line and column numbers
diff --git a/tests/language_2/language_2_precompiled.status b/tests/language_2/language_2_precompiled.status
index ec2cac1..f5f5cd5 100644
--- a/tests/language_2/language_2_precompiled.status
+++ b/tests/language_2/language_2_precompiled.status
@@ -282,7 +282,7 @@
export_ambiguous_main_negative_test: Skip # Issue 29895
export_ambiguous_main_test: Crash
export_double_same_main_test: Skip # Issue 29895
-extract_type_arguments_test: CompileTimeError # Issue 31371
+extract_type_arguments_test: RuntimeError # Issue 31371
f_bounded_quantification_test/01: MissingCompileTimeError
f_bounded_quantification_test/02: MissingCompileTimeError
factory1_test/00: MissingCompileTimeError
@@ -405,7 +405,6 @@
generic_methods_recursive_bound_test/02: MissingCompileTimeError
generic_methods_recursive_bound_test/03: Crash, Pass
generic_methods_tearoff_specialization_test: RuntimeError
-generic_methods_type_expression_test: RuntimeError # Issue 25869 / 27460
generic_methods_unused_parameter_test: RuntimeError
generic_tearoff_test: RuntimeError
getter_no_setter2_test/00: MissingCompileTimeError
@@ -472,6 +471,9 @@
instanceof2_test: RuntimeError
instanceof4_test/01: RuntimeError
instanceof4_test/none: RuntimeError
+instantiate_tearoff_after_contravariance_check_test: RuntimeError
+instantiate_tearoff_of_call_test: RuntimeError
+instantiate_tearoff_test: RuntimeError
interface_test/00: MissingCompileTimeError
invalid_cast_test/01: MissingCompileTimeError
invalid_cast_test/02: MissingCompileTimeError
@@ -881,6 +883,8 @@
try_catch_on_syntax_test/11: MissingCompileTimeError
try_catch_syntax_test/08: MissingCompileTimeError
type_checks_in_factory_method_test/01: MissingCompileTimeError
+type_inference_circularity_test: MissingCompileTimeError
+type_inference_inconsistent_inheritance_test: MissingCompileTimeError
type_parameter_test/05: MissingCompileTimeError
type_promotion_functions_test/01: MissingCompileTimeError
type_promotion_functions_test/05: MissingCompileTimeError
@@ -1045,6 +1049,7 @@
covariance_type_parameter_test/01: RuntimeError
covariance_type_parameter_test/02: RuntimeError
covariance_type_parameter_test/03: RuntimeError
+forwarding_semi_stub_test: RuntimeError
forwarding_stub_tearoff_generic_test: RuntimeError
forwarding_stub_tearoff_test: RuntimeError
function_type_call_getter2_test/none: RuntimeError
diff --git a/tests/language_2/language_2_vm.status b/tests/language_2/language_2_vm.status
index 2af057b..360e97e 100644
--- a/tests/language_2/language_2_vm.status
+++ b/tests/language_2/language_2_vm.status
@@ -43,7 +43,6 @@
export_ambiguous_main_negative_test: Fail # Issue 14763
field_initialization_order_test: Fail, OK
generalized_void_syntax_test: CompileTimeError # Issue #30176
-generic_methods_type_expression_test: RuntimeError # Issue 25869 / 27460
hello_dart_test: Skip # Incompatible flag: --compile_all
language_2/least_upper_bound_expansive_test/none: CompileTimeError
library_env_test/has_html_support: RuntimeError, OK
@@ -311,7 +310,7 @@
enum_private_test/02: MissingCompileTimeError
error_stacktrace_test/00: MissingCompileTimeError
export_ambiguous_main_test: MissingCompileTimeError
-extract_type_arguments_test: CompileTimeError # Issue 31371
+extract_type_arguments_test: RuntimeError # Issue 31371
f_bounded_quantification_test/01: MissingCompileTimeError
f_bounded_quantification_test/02: MissingCompileTimeError
factory1_test/00: MissingCompileTimeError
@@ -462,6 +461,9 @@
initializing_formal_final_test: MissingCompileTimeError
initializing_formal_type_test: MissingCompileTimeError
instanceof2_test: RuntimeError
+instantiate_tearoff_after_contravariance_check_test: RuntimeError
+instantiate_tearoff_of_call_test: RuntimeError
+instantiate_tearoff_test: RuntimeError
interface_test/00: MissingCompileTimeError
invalid_cast_test/01: MissingCompileTimeError
invalid_cast_test/02: MissingCompileTimeError
@@ -837,6 +839,8 @@
try_catch_on_syntax_test/11: MissingCompileTimeError
try_catch_syntax_test/08: MissingCompileTimeError
type_checks_in_factory_method_test/01: MissingCompileTimeError
+type_inference_circularity_test: MissingCompileTimeError
+type_inference_inconsistent_inheritance_test: MissingCompileTimeError
type_promotion_functions_test/01: MissingCompileTimeError
type_promotion_functions_test/05: MissingCompileTimeError
type_promotion_functions_test/06: MissingCompileTimeError
@@ -1064,6 +1068,7 @@
covariant_subtyping_unsafe_call3_test: RuntimeError
field_override_optimization_test: RuntimeError
field_type_check2_test/01: MissingRuntimeError
+forwarding_semi_stub_test: RuntimeError
forwarding_stub_tearoff_generic_test: RuntimeError
forwarding_stub_tearoff_test: RuntimeError
function_subtype_checked0_test: RuntimeError
@@ -1182,7 +1187,6 @@
field_initialization_order_test: Fail, OK
generalized_void_syntax_test: CompileTimeError # Issue #30176
generic_methods_bounds_test/02: MissingRuntimeError
-generic_methods_type_expression_test: RuntimeError # Issue 25869 / 27460
library_env_test/has_html_support: RuntimeError, OK
library_env_test/has_no_io_support: RuntimeError, OK
main_not_a_function_test: Skip
diff --git a/tests/language_2/mixin_with_named_import_test.dart b/tests/language_2/mixin_with_named_import_test.dart
new file mode 100644
index 0000000..0af06a8
--- /dev/null
+++ b/tests/language_2/mixin_with_named_import_test.dart
@@ -0,0 +1,16 @@
+// 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:collection' as collection;
+
+class Foo extends Object with collection.ListMixin {
+ int get length => 0;
+ operator [](int index) => null;
+ void operator []=(int index, value) => null;
+ set length(int newLength) => null;
+}
+
+main() {
+ new Foo();
+}
diff --git a/tests/language_2/super_in_constructor_test.dart b/tests/language_2/super_in_constructor_test.dart
new file mode 100644
index 0000000..621eee9
--- /dev/null
+++ b/tests/language_2/super_in_constructor_test.dart
@@ -0,0 +1,25 @@
+// 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:expect/expect.dart";
+
+class Foo {
+ bool myBoolean = false;
+
+ void set foo(bool b) {
+ print("Setting foo in Foo");
+ myBoolean = b;
+ }
+}
+
+class Baz extends Foo {
+ Baz() {
+ super.foo = true;
+ Expect.equals(true, super.myBoolean);
+ }
+}
+
+main() {
+ new Baz();
+}
diff --git a/tests/language_2/type_inference_circularity_test.dart b/tests/language_2/type_inference_circularity_test.dart
new file mode 100644
index 0000000..f7d1db2
--- /dev/null
+++ b/tests/language_2/type_inference_circularity_test.dart
@@ -0,0 +1,11 @@
+// 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.
+
+var /*@compile-error=unspecified*/ x = () => y;
+var /*@compile-error=unspecified*/ y = () => x;
+
+void main() {
+ x;
+ y;
+}
diff --git a/tests/language_2/type_inference_inconsistent_inheritance_test.dart b/tests/language_2/type_inference_inconsistent_inheritance_test.dart
new file mode 100644
index 0000000..45f7db9
--- /dev/null
+++ b/tests/language_2/type_inference_inconsistent_inheritance_test.dart
@@ -0,0 +1,19 @@
+// 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.
+
+class A {
+ void f(Object x) {}
+}
+
+class B {
+ void f(String x) {}
+}
+
+class C extends A implements B {
+ // No type can be inferred for x since the two inherited interfaces specify
+ // different types.
+ void f(/*@compile-error=unspecified*/ x) {}
+}
+
+void main() {}
diff --git a/tests/language_2/typedef_class_in_other_file_helper.dart b/tests/language_2/typedef_class_in_other_file_helper.dart
new file mode 100644
index 0000000..3b66850
--- /dev/null
+++ b/tests/language_2/typedef_class_in_other_file_helper.dart
@@ -0,0 +1,5 @@
+// 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.
+
+class Bar {}
diff --git a/tests/language_2/typedef_class_in_other_file_test.dart b/tests/language_2/typedef_class_in_other_file_test.dart
new file mode 100644
index 0000000..5300104
--- /dev/null
+++ b/tests/language_2/typedef_class_in_other_file_test.dart
@@ -0,0 +1,13 @@
+// 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.
+
+// This has crashed DDC with Kernel because of a
+// "Concurrent modification during iteration" exception.
+
+import 'typedef_class_in_other_file_helper.dart';
+
+typedef bool Foo1(bool baz);
+typedef bool Foo2(Bar baz);
+
+main() {}
diff --git a/tests/lib/lib.status b/tests/lib/lib.status
index b7a1b22..2482bda 100644
--- a/tests/lib/lib.status
+++ b/tests/lib/lib.status
@@ -161,7 +161,7 @@
mirrors/generic_bounded_test/02: Fail # Type equality - Issue 26869
[ $strong ]
-*: SkipByDesign # tests/lib_strong has the strong mode versions of these tests.
+*: SkipByDesign # tests/lib_2 has the strong mode versions of these tests.
[ $arch == ia32 && $mode == debug && $system == windows ]
convert/streamed_conversion_json_utf8_decode_test: Skip # Verification OOM.
@@ -276,6 +276,20 @@
math/math2_test: RuntimeError
math/math_test: RuntimeError
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $compiler == dartk && $mode == debug && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
+mirrors/variable_is_const_test/01: Crash # Please triage.
+
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $compiler == dartk && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
+mirrors/invocation_fuzz_test/smi: Crash # Please triage.
+mirrors/library_uri_io_test: RuntimeError # Please triage.
+mirrors/spawn_function_root_library_test: Skip
+
[ $compiler != dartk && $compiler != dartkp && ($runtime == dart_precompiled || $runtime == flutter || $runtime == vm) ]
mirrors/initializing_formals_test/01: Fail # initializing formals are implicitly final as of Dart 1.21
diff --git a/tests/lib_strong/html/Ahem.ttf b/tests/lib_2/html/Ahem.ttf
similarity index 100%
rename from tests/lib_strong/html/Ahem.ttf
rename to tests/lib_2/html/Ahem.ttf
Binary files differ
diff --git a/tests/lib_strong/html/cross_domain_iframe_script.html b/tests/lib_2/html/cross_domain_iframe_script.html
similarity index 100%
rename from tests/lib_strong/html/cross_domain_iframe_script.html
rename to tests/lib_2/html/cross_domain_iframe_script.html
diff --git a/tests/lib_strong/html/cross_domain_iframe_script.js b/tests/lib_2/html/cross_domain_iframe_script.js
similarity index 100%
rename from tests/lib_strong/html/cross_domain_iframe_script.js
rename to tests/lib_2/html/cross_domain_iframe_script.js
diff --git a/tests/lib_strong/html/custom/attribute_changed_callback_test.html b/tests/lib_2/html/custom/attribute_changed_callback_test.html
similarity index 100%
rename from tests/lib_strong/html/custom/attribute_changed_callback_test.html
rename to tests/lib_2/html/custom/attribute_changed_callback_test.html
diff --git a/tests/lib_strong/html/custom/constructor_calls_created_synchronously_test.html b/tests/lib_2/html/custom/constructor_calls_created_synchronously_test.html
similarity index 100%
rename from tests/lib_strong/html/custom/constructor_calls_created_synchronously_test.html
rename to tests/lib_2/html/custom/constructor_calls_created_synchronously_test.html
diff --git a/tests/lib_strong/html/custom/created_callback_test.html b/tests/lib_2/html/custom/created_callback_test.html
similarity index 100%
rename from tests/lib_strong/html/custom/created_callback_test.html
rename to tests/lib_2/html/custom/created_callback_test.html
diff --git a/tests/lib_strong/html/custom/document_register_basic_test.html b/tests/lib_2/html/custom/document_register_basic_test.html
similarity index 100%
rename from tests/lib_strong/html/custom/document_register_basic_test.html
rename to tests/lib_2/html/custom/document_register_basic_test.html
diff --git a/tests/lib_2/html/debugger_test.dart b/tests/lib_2/html/debugger_test.dart
index 587d3b9..8207b59 100644
--- a/tests/lib_2/html/debugger_test.dart
+++ b/tests/lib_2/html/debugger_test.dart
@@ -322,7 +322,7 @@
if (actualStr != golden) {
var helpMessage =
'Debugger output does not match the golden data found in:\n'
- 'tests/lib_strong/html/debugger_test_golden.txt\n'
+ 'tests/lib_2/html/debugger_test_golden.txt\n'
'The new golden data is copied to the clipboard when you click on '
'this window.\n'
'Please update the golden file with the following output and review '
diff --git a/tests/lib_strong/html/events_test.dart b/tests/lib_2/html/events_test.dart
similarity index 86%
rename from tests/lib_strong/html/events_test.dart
rename to tests/lib_2/html/events_test.dart
index fb95033..43a6737 100644
--- a/tests/lib_strong/html/events_test.dart
+++ b/tests/lib_2/html/events_test.dart
@@ -13,9 +13,9 @@
useHtmlConfiguration();
test('TimeStamp', () {
- Event event = new Event('test');
+ var event = new Event('test');
- int timeStamp = event.timeStamp;
+ var timeStamp = event.timeStamp;
expect(timeStamp, greaterThan(0));
});
@@ -33,19 +33,19 @@
// The next test is not asynchronous because [on['test'].dispatch(event)] fires the event
// and event listener synchronously.
test('EventTarget', () {
- Element element = new Element.tag('test');
+ var element = new Element.tag('test');
element.id = 'eventtarget';
- window.document.body.append(element);
+ document.body.append(element);
- int invocationCounter = 0;
+ var invocationCounter = 0;
void handler(Event e) {
expect(e.type, equals('test'));
- Element target = e.target;
+ var target = e.target;
expect(element, equals(target));
invocationCounter++;
}
- Event event = new Event('test');
+ var event = new Event('test');
invocationCounter = 0;
element.dispatchEvent(event);
@@ -84,24 +84,24 @@
});
test('InitMouseEvent', () {
- DivElement div = new Element.tag('div');
- MouseEvent event = new MouseEvent('zebra', relatedTarget: div);
+ var div = new Element.tag('div');
+ var event = new MouseEvent('zebra', relatedTarget: div);
});
test('DOM event callbacks are associated with the correct zone', () {
var callbacks = [];
- final element = new Element.tag('test');
+ var element = new Element.tag('test');
element.id = 'eventtarget';
document.body.append(element);
// runZoned executes the function synchronously, but we don't want to
// rely on this. We therefore wrap it into an expectAsync.
runZoned(expectAsync(() {
- Zone zone = Zone.current;
+ var zone = Zone.current;
expect(zone, isNot(equals(Zone.root)));
- var sub;
+ StreamSubscription<Event> sub;
void handler(Event e) {
expect(Zone.current, equals(zone));
diff --git a/tests/lib_2/html/file_sample_test.dart b/tests/lib_2/html/file_sample_test.dart
new file mode 100644
index 0000000..1e0f355
--- /dev/null
+++ b/tests/lib_2/html/file_sample_test.dart
@@ -0,0 +1,125 @@
+library file_sample;
+
+import 'dart:async';
+import 'dart:html';
+
+import 'package:unittest/unittest.dart';
+import 'package:unittest/html_config.dart';
+import 'package:async_helper/async_helper.dart';
+
+// Expected output from all functions, asynchronous, and event routines.
+const String log_results = 'test-first\n' +
+ 'acquire START\n' +
+ 'acquire CALLBACK START\n' +
+ 'acquire CALLBACK END\n' +
+ 'first START\n' +
+ 'first END\n' +
+ 'test-second\n' +
+ 'second START\n' +
+ 'second END\n' +
+ 'reader onLoadEnd event\n' +
+ 'file content = XYZZY Output\n';
+
+// Simple logger to record all output.
+class Logger {
+ StringBuffer _log = new StringBuffer();
+
+ void log(String message) {
+ _log.writeln(message);
+ }
+
+ String get contents => _log.toString();
+}
+
+Logger testLog = new Logger();
+
+Future<FileSystem> _fileSystem;
+
+Future<FileSystem> get fileSystem async {
+ if (_fileSystem != null) return _fileSystem;
+
+ testLog.log('acquire START');
+ _fileSystem = window.requestFileSystem(100);
+
+ var fs = await _fileSystem;
+ testLog.log('acquire CALLBACK START');
+ expect(fs != null, true);
+ expect(fs.root != null, true);
+ expect(fs.runtimeType, FileSystem);
+ expect(fs.root.runtimeType, DirectoryEntry);
+ testLog.log('acquire CALLBACK END');
+
+ return _fileSystem;
+}
+
+Future<FileEntry> createFile() async {
+ var fs = await fileSystem;
+
+ FileEntry fileEntry = await fs.root.createFile('log.txt');
+
+ expect(fileEntry.isFile, true);
+ expect(fileEntry.name, 'log.txt');
+ expect(fileEntry.fullPath, '/log.txt');
+
+ FileWriter writer = await fileEntry.createWriter();
+
+ Blob blob = new Blob(['XYZZY Output'], 'text/plain');
+
+ writer.write(blob);
+
+ var reader = new FileReader();
+
+ var completer = new Completer<String>();
+
+ reader.onLoadEnd.listen((event) {
+ testLog.log('reader onLoadEnd event');
+ dynamic target = event.currentTarget;
+ testLog.log('file content = ${target.result}');
+ expect(target.result, 'XYZZY Output');
+
+ completer.complete(target.result);
+ });
+
+ Blob readBlob = await fileEntry.file();
+
+ reader.readAsText(readBlob);
+
+ // Wait until onLoadEnd if fired.
+ await completer.future;
+
+ return new Future<FileEntry>.value(fileEntry);
+}
+
+main() {
+ useHtmlConfiguration();
+
+ group('test FileSystem', () {
+ test('FileSystem request #1', () async {
+ testLog.log('test-first');
+ var fs = await fileSystem;
+ testLog.log('first START');
+ expect(fs != null, true);
+ expect(fs.root != null, true);
+ expect(fs.runtimeType, FileSystem);
+ expect(fs.root.runtimeType, DirectoryEntry);
+ testLog.log('first END');
+ });
+
+ test('FileSystem request, create, R/W', () async {
+ testLog.log('test-second');
+ var fs = await fileSystem;
+ testLog.log('second START');
+ expect(fs != null, true);
+ expect(fs.root != null, true);
+ expect(fs.runtimeType, FileSystem);
+ expect(fs.root.runtimeType, DirectoryEntry);
+ testLog.log('second END');
+
+ FileEntry fileEntry = await createFile();
+ expect(fileEntry.name, 'log.txt');
+
+ // Validate every function, async and event mechanism successfully ran.
+ expect(testLog.contents, log_results);
+ });
+ });
+}
diff --git a/tests/lib_2/html/fileapi_supported_test.dart b/tests/lib_2/html/fileapi_supported_test.dart
index 7ab7407..ba93f46 100644
--- a/tests/lib_2/html/fileapi_supported_test.dart
+++ b/tests/lib_2/html/fileapi_supported_test.dart
@@ -1,21 +1,41 @@
library fileapi;
+import 'dart:async';
import 'dart:html';
import 'package:unittest/unittest.dart';
-import 'package:unittest/html_individual_config.dart';
+import 'package:unittest/html_config.dart';
+import 'package:async_helper/async_helper.dart';
+
+
+Future<FileSystem> _fileSystem;
+
+Future<FileSystem> get fileSystem async {
+ if (_fileSystem != null) return _fileSystem;
+
+ _fileSystem = window.requestFileSystem(100);
+
+ var fs = await _fileSystem;
+ expect(fs != null, true);
+ expect(fs.root != null, true);
+ expect(fs.runtimeType, FileSystem);
+ expect(fs.root.runtimeType, DirectoryEntry);
+
+ return _fileSystem;
+}
main() {
- useHtmlIndividualConfiguration();
+ useHtmlConfiguration();
test('supported', () {
expect(FileSystem.supported, true);
});
- test('requestFileSystem', () {
+ test('requestFileSystem', () async {
var expectation = FileSystem.supported ? returnsNormally : throws;
- expect(() {
- window.requestFileSystem(100);
+ expect(() async {
+ var fs = await fileSystem;
+ expect(fs.root != null, true);
}, expectation);
});
}
diff --git a/tests/lib_2/html/notification_permission_test.dart b/tests/lib_2/html/notification_permission_test.dart
new file mode 100644
index 0000000..e403d2f
--- /dev/null
+++ b/tests/lib_2/html/notification_permission_test.dart
@@ -0,0 +1,19 @@
+// 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:async';
+import 'dart:html';
+
+import 'package:unittest/unittest.dart';
+import 'package:unittest/html_config.dart';
+import 'package:async_helper/async_helper.dart';
+
+main() async {
+ useHtmlConfiguration();
+
+ test('Notification.requestPermission', () async {
+ String permission = await Notification.requestPermission();
+ expect(permission, isNotNull);
+ });
+}
diff --git a/tests/lib_strong/html/small.mp4 b/tests/lib_2/html/small.mp4
similarity index 100%
rename from tests/lib_strong/html/small.mp4
rename to tests/lib_2/html/small.mp4
Binary files differ
diff --git a/tests/lib_strong/html/small.webm b/tests/lib_2/html/small.webm
similarity index 100%
rename from tests/lib_strong/html/small.webm
rename to tests/lib_2/html/small.webm
Binary files differ
diff --git a/tests/lib_2/html/websocket_test.dart b/tests/lib_2/html/websocket_test.dart
index a2778ae..ff161ca 100644
--- a/tests/lib_2/html/websocket_test.dart
+++ b/tests/lib_2/html/websocket_test.dart
@@ -2,7 +2,7 @@
import 'dart:html';
-import 'package:expect/minitest.dart';
+import 'package:unittest/unittest.dart';
main() {
group('supported', () {
diff --git a/tests/lib_2/html/websql_test.dart b/tests/lib_2/html/websql_test.dart
index 6c64f58..a066ea5 100644
--- a/tests/lib_2/html/websql_test.dart
+++ b/tests/lib_2/html/websql_test.dart
@@ -4,7 +4,7 @@
import 'dart:html';
import 'dart:web_sql';
-import 'package:expect/minitest.dart';
+import 'package:unittest/unittest.dart';
Future<SqlTransaction> transaction(SqlDatabase db) {
final completer = new Completer<SqlTransaction>.sync();
diff --git a/tests/lib_strong/html/xhr_cross_origin_data.txt b/tests/lib_2/html/xhr_cross_origin_data.txt
similarity index 100%
rename from tests/lib_strong/html/xhr_cross_origin_data.txt
rename to tests/lib_2/html/xhr_cross_origin_data.txt
diff --git a/tests/lib_strong/html/xsltprocessor_test.dart b/tests/lib_2/html/xsltprocessor_test.dart
similarity index 100%
rename from tests/lib_strong/html/xsltprocessor_test.dart
rename to tests/lib_2/html/xsltprocessor_test.dart
diff --git a/tests/lib_2/js/prototype_access_test.dart b/tests/lib_2/js/prototype_access_test.dart
index fe93733..adea05e 100644
--- a/tests/lib_2/js/prototype_access_test.dart
+++ b/tests/lib_2/js/prototype_access_test.dart
@@ -14,7 +14,8 @@
@JS('Function')
class Class {
external dynamic get prototype;
- external dynamic get constructor;
+ external Constructor get constructor;
+ external String get name;
}
class Normal {
@@ -26,6 +27,11 @@
int operator [](int i) => prototype;
}
+@JS()
+class Constructor {
+ external String get name;
+}
+
void main() {
Expect.isTrue(arrayBufferClass.prototype != null);
var normal = new Normal();
@@ -33,6 +39,10 @@
Expect.equals(42, normal[0]);
Expect.isTrue(arrayBufferClass.constructor != null);
Expect.isTrue(arrayBufferClass.constructor is Function);
+ Expect.isTrue(arrayBufferClass.constructor is Constructor);
+ Expect.equals("ArrayBuffer", arrayBufferClass.name);
+ Expect.equals("Function", arrayBufferClass.constructor.name);
+
Expect.isTrue(normal.constructor is Function);
Expect.equals(normal, normal.constructor());
}
diff --git a/tests/lib_2/lib_2_analyzer.status b/tests/lib_2/lib_2_analyzer.status
index 761ea22..a5ead32 100644
--- a/tests/lib_2/lib_2_analyzer.status
+++ b/tests/lib_2/lib_2_analyzer.status
@@ -33,6 +33,7 @@
mirrors/generic_bounded_test/01: MissingCompileTimeError
mirrors/generic_bounded_test/02: MissingCompileTimeError
mirrors/generic_interface_test/01: MissingCompileTimeError
+mirrors/generics_test/01: MissingCompileTimeError
mirrors/redirecting_factory_different_type_test/01: MissingCompileTimeError
mirrors/reflect_class_test/01: MissingCompileTimeError
mirrors/reflect_class_test/02: MissingCompileTimeError
diff --git a/tests/lib_2/lib_2_dart2js.status b/tests/lib_2/lib_2_dart2js.status
index 4c03b62..8b36efd 100644
--- a/tests/lib_2/lib_2_dart2js.status
+++ b/tests/lib_2/lib_2_dart2js.status
@@ -89,8 +89,6 @@
html/fileapi_entry_test: Pass, Fail # TODO(dart2js-team): Please triage this failure.
html/fileapi_file_test: Fail # TODO(dart2js-team): Please triage this failure.
html/media_stream_test: RuntimeError # Please triage.
-html/messageevent_test: RuntimeError # Please triage this error. New in Chrome 62.
-html/serialized_script_value_test: RuntimeError # Please triage this error. New in Chrome 62.
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
@@ -168,13 +166,15 @@
html/dart_object_local_storage_test: Skip # sessionStorage NS_ERROR_DOM_NOT_SUPPORTED_ERR
html/element_animate_test/timing_dict: RuntimeError # Issue 26730
html/element_classes_test: RuntimeError # Issue 27535
-html/element_types_content_test: Pass, RuntimeError # Issue 28983
html/element_types_content_test: RuntimeError # Issue 29922
+html/element_types_content_test: Pass, RuntimeError # Issue 28983
html/element_types_keygen_test: RuntimeError # Issue 29922
html/element_types_keygen_test: Fail
html/element_types_shadow_test: RuntimeError # Issue 29922
html/element_types_shadow_test: Pass, RuntimeError # Issue 28983
-html/fileapi_supported_throws_test: Fail
+html/file_sample_test: Skip # FileSystem not supported on FireFox.
+html/fileapi_supported_test: Skip # FileSystem not supported on FireFox.
+html/fileapi_supported_throws_test: Skip # FileSystem not supported on FireFox.
html/history_test/history: Skip # Issue 22050
html/input_element_datetime_test: Fail
html/input_element_month_test: Fail
@@ -262,13 +262,14 @@
[ $compiler == dart2js && $runtime == safari ]
html/audiobuffersourcenode_test: RuntimeError
-html/custom/attribute_changed_callback_test: Pass, Timeout
+html/custom/attribute_changed_callback_test: RuntimeError, Timeout
html/custom/constructor_calls_created_synchronously_test: Pass, Timeout
html/custom/created_callback_test: Pass, Timeout
html/custom/document_register_basic_test: Pass, Timeout
html/element_types_content_test: RuntimeError # Issue 29922
html/element_types_datalist_test: RuntimeError # Issue 29922
html/element_types_shadow_test: RuntimeError # Issue 29922
+html/file_sample_test: Skip # FileSystem not supported on Safari.
isolate/cross_isolate_message_test: Skip # Issue 12627
isolate/message_test: Skip # Issue 12627
@@ -397,8 +398,8 @@
html/js_array_test: CompileTimeError
html/js_array_test: Crash # FileSystemException(uri=file:///usr/local/google/home/efortuna/dart2/sdk/sdk/lib/_internal/dart2js_platform.dill; message=Error reading 'sdk/lib/_internal/dart2js_platform.dill' (No such file or directory))
html/js_dart_to_string_test: Crash # 'file:*/pkg/compiler/lib/src/common_elements.dart': Failed assertion: line 405 pos 12: 'element.name == '=='': is not true.
-html/js_dispatch_property_test: CompileTimeError
html/js_dispatch_property_test: Crash # FileSystemException(uri=file:///usr/local/google/home/efortuna/dart2/sdk/sdk/lib/_internal/dart2js_platform.dill; message=Error reading 'sdk/lib/_internal/dart2js_platform.dill' (No such file or directory))
+html/js_dispatch_property_test: CompileTimeError
html/js_function_getter_test: CompileTimeError
html/js_function_getter_test/call getter as function: Crash # FileSystemException(uri=file:///usr/local/google/home/efortuna/dart2/sdk/sdk/lib/_internal/dart2js_platform.dill; message=Error reading 'sdk/lib/_internal/dart2js_platform.dill' (No such file or directory))
html/js_function_getter_trust_types_test: Crash # FileSystemException(uri=file:///usr/local/google/home/efortuna/dart2/sdk/sdk/lib/_internal/dart2js_platform.dill; message=Error reading 'sdk/lib/_internal/dart2js_platform.dill' (No such file or directory))
@@ -676,7 +677,6 @@
html/location_test: RuntimeError
html/media_stream_test: RuntimeError, Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
html/mediasource_test: RuntimeError, Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
-html/messageevent_test: RuntimeError
html/mirrors_js_typed_interop_test: RuntimeError
html/mouse_event_test: RuntimeError
html/mutationobserver_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
@@ -694,7 +694,6 @@
html/request_animation_frame_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
html/rtc_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
html/selectelement_test: RuntimeError
-html/serialized_script_value_test: RuntimeError
html/shadow_dom_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
html/shadowroot_test: RuntimeError
html/speechrecognition_test: Crash # NoSuchMethodError: Class 'JMethod' has no instance getter 'implementation'.
diff --git a/tests/lib_2/lib_2_dartdevc.status b/tests/lib_2/lib_2_dartdevc.status
index 6d2a597..9ad5f8f 100644
--- a/tests/lib_2/lib_2_dartdevc.status
+++ b/tests/lib_2/lib_2_dartdevc.status
@@ -3,9 +3,10 @@
# BSD-style license that can be found in the LICENSE file.
[ $compiler == dartdevc ]
-html/custom/attribute_changed_callback_test: RuntimeError # Issue 31577
-html/custom/constructor_calls_created_synchronously_test: RuntimeError # Issue 31577
-html/custom/document_register_basic_test: RuntimeError # Issue 29922
+html/custom/attribute_changed_callback_test: Skip # Issue 31577
+html/custom/constructor_calls_created_synchronously_test: Skip # Issue 31577
+html/custom/created_callback_test: Skip # Issue 31577
+html/custom/document_register_basic_test: Skip # Issue 31577
html/custom/document_register_template_test: Skip # Issue 31577
html/custom/document_register_type_extensions_test/construction: Skip # Issue 31577
html/custom/document_register_type_extensions_test/constructors: Skip # Issue 31577
@@ -24,10 +25,8 @@
html/deferred_multi_app_htmltest: Skip # Issue 29919
html/fontface_loaded_test: RuntimeError
html/gamepad_test: RuntimeError # Issue 31029
-html/messageevent_test: Skip # Issue 31144
html/no_linked_scripts_htmltest: Skip # Issue 29919
html/scripts_htmltest: Skip # Issue 29919
-html/serialized_script_value_test: Skip # Issue 31144
html/transferables_test: CompileTimeError # Issue 30975
html/two_scripts_htmltest: Skip # Issue 29919
html/websql_test: Pass, RuntimeError # Issue 31036
@@ -92,7 +91,6 @@
html/js_typed_interop_type3_test/*: RuntimeError # Issue 30947
html/js_typed_interop_type_test: RuntimeError # Issue 30947
html/js_util_test: RuntimeError # Issue 29922
-html/keyboard_event_test: RuntimeError # Issue 30946
html/media_stream_test: RuntimeError # Issue 29922
html/mediasource_test: RuntimeError # Issue 29922
html/transition_event_test: Pass, RuntimeError, Timeout # Issue 29922, this test seems flaky
@@ -123,3 +121,4 @@
[ $compiler == dartdevc && $system == windows ]
html/xhr_test/xhr: Skip # Times out. Issue 21527
+
diff --git a/tests/lib_2/lib_2_kernel.status b/tests/lib_2/lib_2_kernel.status
index f9de2f7..af19ce3 100644
--- a/tests/lib_2/lib_2_kernel.status
+++ b/tests/lib_2/lib_2_kernel.status
@@ -37,37 +37,16 @@
async/slow_consumer3_test: CompileTimeError # Issue 31402 (Invocation arguments)
async/slow_consumer_test: CompileTimeError # Issue 31402 (Invocation arguments)
async/stream_controller_async_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/stream_first_where_test: CompileTimeError # Issue 31402 (Invocation arguments)
async/stream_from_iterable_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/stream_iterator_test: CompileTimeError # Issue 31402 (Invocation arguments)
async/stream_join_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/stream_last_where_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/stream_periodic2_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/stream_periodic3_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/stream_periodic4_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/stream_periodic5_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/stream_periodic6_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/stream_periodic_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/stream_single_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/stream_single_to_multi_subscriber_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/stream_state_nonzero_timer_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/stream_state_test: CompileTimeError # Issue 31402 (Invocation arguments)
async/stream_subscription_as_future_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/stream_subscription_cancel_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/stream_timeout_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/stream_transform_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/stream_transformation_broadcast_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/timer_cancel1_test: CompileTimeError # Issue 31402 (Invocation arguments)
async/timer_cancel2_test: CompileTimeError # Issue 31402 (Invocation arguments)
async/timer_cancel_test: CompileTimeError # Issue 31402 (Invocation arguments)
async/timer_isActive_test: CompileTimeError # Issue 31402 (Invocation arguments)
async/timer_not_available_test: RuntimeError
async/timer_repeat_test: CompileTimeError # Issue 31402 (Invocation arguments)
-async/timer_test: CompileTimeError # Issue 31402 (Invocation arguments)
async/zone_run_unary_test: CompileTimeError # Issue 31537
-convert/streamed_conversion_json_utf8_decode_test: DartkCompileTimeError
convert/streamed_conversion_json_utf8_decode_test: Pass, Slow # Infrequent timeouts.
-html/*: DartkCompileTimeError
html/*: SkipByDesign # dart:html not supported on VM.
isolate/compile_time_error_test/01: MissingCompileTimeError
isolate/count_test: CompileTimeError # Issue 31402 (Invocation arguments)
@@ -99,19 +78,18 @@
isolate/message_test: CompileTimeError # Issue 31402 (Invocation arguments)
isolate/mint_maker_test: CompileTimeError # Issue 31402 (Invocation arguments)
isolate/nested_spawn2_test: CompileTimeError # Issue 31402 (Invocation arguments)
-isolate/nested_spawn_test: CompileTimeError # Issue 31402 (Invocation arguments)
+isolate/nested_spawn_test: RuntimeError # Issue 31402 (Invocation arguments)
isolate/ping_pause_test: Pass, Timeout
isolate/raw_port_test: CompileTimeError # Issue 31402 (Invocation arguments)
-isolate/request_reply_test: CompileTimeError # Issue 31402 (Invocation arguments)
-isolate/spawn_function_custom_class_test: CompileTimeError # Issue 31402 (Invocation arguments)
-isolate/spawn_function_test: CompileTimeError # Issue 31402 (Invocation arguments)
+isolate/request_reply_test: RuntimeError # Issue 31402 (Invocation arguments)
+isolate/spawn_function_custom_class_test: RuntimeError # Issue 31402 (Invocation arguments)
+isolate/spawn_function_test: RuntimeError # Issue 31402 (Invocation arguments)
isolate/spawn_uri_exported_main_test: RuntimeError # Issue 31402 (Return and yield statements)
isolate/spawn_uri_multi_test/none: CompileTimeError # Issue 31402 (Invocation arguments)
isolate/spawn_uri_nested_vm_test: CompileTimeError # Issue 31402 (Invocation arguments)
isolate/spawn_uri_test: CompileTimeError # Issue 31402 (Invocation arguments)
isolate/spawn_uri_vm_test: CompileTimeError # Issue 31402 (Invocation arguments)
-isolate/static_function_test: CompileTimeError # Issue 31402 (Invocation arguments)
-isolate/timer_isolate_test: CompileTimeError # Issue 31402 (Invocation arguments)
+isolate/static_function_test: RuntimeError # Issue 31402 (Invocation arguments)
isolate/typed_message_test: CompileTimeError # Issue 31402 (Invocation arguments)
isolate/unresolved_ports_test: CompileTimeError # Issue 31402 (Invocation arguments)
js/datetime_roundtrip_test: CompileTimeError
@@ -143,6 +121,7 @@
mirrors/empty_test: RuntimeError
mirrors/enum_test: CompileTimeError # Issue 31402 (Invocation arguments)
mirrors/equality_test: RuntimeError
+mirrors/fake_function_without_call_test: RuntimeError
mirrors/function_type_mirror_test: RuntimeError
mirrors/generic_bounded_by_type_parameter_test/02: MissingCompileTimeError
mirrors/generic_bounded_test/01: MissingCompileTimeError
@@ -155,6 +134,12 @@
mirrors/generic_interface_test/none: RuntimeError
mirrors/generic_mixin_applications_test: RuntimeError
mirrors/generic_mixin_test: RuntimeError
+mirrors/generics_double_substitution_test/01: RuntimeError
+mirrors/generics_double_substitution_test/none: RuntimeError
+mirrors/generics_dynamic_test: RuntimeError
+mirrors/generics_substitution_test: RuntimeError
+mirrors/generics_test/01: MissingCompileTimeError
+mirrors/generics_test/none: RuntimeError
mirrors/hot_get_field_test: RuntimeError
mirrors/hot_set_field_test: RuntimeError
mirrors/inherit_field_test: CompileTimeError # Issue 31402 (Invocation arguments)
@@ -193,8 +178,6 @@
mirrors/library_imports_shown_test: CompileTimeError # Issue 31402 (Invocation arguments)
mirrors/library_imports_shown_test: RuntimeError
mirrors/library_metadata_test: RuntimeError
-mirrors/library_uri_io_test: CompileTimeError # Issue 31402 (Invocation arguments)
-mirrors/library_uri_package_test: CompileTimeError # Issue 31402 (Invocation arguments)
mirrors/list_constructor_test/01: Crash
mirrors/list_constructor_test/01: RuntimeError
mirrors/list_constructor_test/none: Crash
@@ -290,25 +273,9 @@
async/slow_consumer_test: RuntimeError
async/stream_controller_async_test: RuntimeError
async/stream_distinct_test: RuntimeError
-async/stream_first_where_test: RuntimeError
async/stream_from_iterable_test: RuntimeError
-async/stream_iterator_test: RuntimeError
async/stream_join_test: RuntimeError
-async/stream_last_where_test: RuntimeError
-async/stream_periodic2_test: RuntimeError
-async/stream_periodic3_test: RuntimeError
-async/stream_periodic4_test: RuntimeError
-async/stream_periodic5_test: RuntimeError
-async/stream_periodic6_test: RuntimeError
-async/stream_periodic_test: RuntimeError
-async/stream_single_test: RuntimeError
-async/stream_single_to_multi_subscriber_test: RuntimeError
-async/stream_state_test: RuntimeError
async/stream_subscription_as_future_test: RuntimeError
-async/stream_subscription_cancel_test: RuntimeError
-async/stream_timeout_test: RuntimeError
-async/stream_transform_test: RuntimeError
-async/stream_transformation_broadcast_test: RuntimeError
async/timer_cancel2_test: RuntimeError
async/timer_cancel_test: RuntimeError
async/timer_isActive_test: RuntimeError
@@ -355,7 +322,6 @@
isolate/spawn_uri_vm_test: RuntimeError
isolate/stacktrace_message_test: RuntimeError
isolate/static_function_test: Timeout
-isolate/timer_isolate_test: RuntimeError
isolate/typed_message_test: RuntimeError
isolate/unresolved_ports_test: RuntimeError
mirrors/class_mirror_type_variables_test: RuntimeError
@@ -412,6 +378,24 @@
typed_data/int32x4_static_test/01: MissingCompileTimeError
typed_data/int32x4_static_test/02: MissingCompileTimeError
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $compiler == dartk && $strong && ($arch == simarm || $arch == simarm64) ]
+mirrors/invocation_fuzz_test/emptyarray: CompileTimeError # Please triage.
+mirrors/invocation_fuzz_test/false: CompileTimeError # Please triage.
+mirrors/invocation_fuzz_test/none: CompileTimeError # Please triage.
+mirrors/invocation_fuzz_test/smi: CompileTimeError # Please triage.
+mirrors/invocation_fuzz_test/string: CompileTimeError # Please triage.
+mirrors/spawn_function_root_library_test: Skip
+typed_data/int32x4_arithmetic_test/int64: CompileTimeError # Please triage.
+
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $compiler == dartk && $strong && ($arch == simarm || $arch == simarm64 || $arch == simdbc64) ]
+isolate/*: Skip
+
# ===== Skip dartk and darkp in !$strong mode ====
[ $compiler == dartk && !$strong ]
*: SkipByDesign
diff --git a/tests/lib_2/lib_2_vm.status b/tests/lib_2/lib_2_vm.status
index d387ae5..3325cdf 100644
--- a/tests/lib_2/lib_2_vm.status
+++ b/tests/lib_2/lib_2_vm.status
@@ -22,6 +22,7 @@
mirrors/generic_bounded_test/01: MissingCompileTimeError
mirrors/generic_bounded_test/02: MissingCompileTimeError
mirrors/generic_interface_test/01: MissingCompileTimeError
+mirrors/generics_test/01: MissingCompileTimeError
mirrors/initializing_formals_test/01: Fail # initializing formals are implicitly final as of Dart 1.21
mirrors/mirrors_used*: SkipByDesign # Invalid tests. MirrorsUsed does not have a specification, and dart:mirrors is not required to hide declarations that are not covered by any MirrorsUsed annotation.
mirrors/native_class_test: SkipByDesign # Imports dart:html
diff --git a/tests/lib_strong/mirrors/fake_function_without_call_test.dart b/tests/lib_2/mirrors/fake_function_without_call_test.dart
similarity index 91%
rename from tests/lib_strong/mirrors/fake_function_without_call_test.dart
rename to tests/lib_2/mirrors/fake_function_without_call_test.dart
index 3cc42d5..1d341ea 100644
--- a/tests/lib_strong/mirrors/fake_function_without_call_test.dart
+++ b/tests/lib_2/mirrors/fake_function_without_call_test.dart
@@ -14,7 +14,7 @@
}
main() {
- var f = new MultiArityFunction();
+ dynamic f = new MultiArityFunction();
Expect.isTrue(f is Function);
Expect.equals('a', f('a'));
@@ -23,7 +23,7 @@
Expect.equals('a', Function.apply(f, ['a']));
Expect.equals('a,b', Function.apply(f, ['a', 'b']));
Expect.equals('a,b,c', Function.apply(f, ['a', 'b', 'c']));
- Expect.throws(() => f.foo('a', 'b', 'c'), (e) => e is NoSuchMethodError);
+ Expect.throwsNoSuchMethodError(() => f.foo('a', 'b', 'c'));
ClosureMirror cm = reflect(f);
Expect.isTrue(cm is ClosureMirror);
diff --git a/tests/lib_strong/mirrors/generics_double_substitution_test.dart b/tests/lib_2/mirrors/generics_double_substitution_test.dart
similarity index 93%
rename from tests/lib_strong/mirrors/generics_double_substitution_test.dart
rename to tests/lib_2/mirrors/generics_double_substitution_test.dart
index ed058a7..ae0666e 100644
--- a/tests/lib_strong/mirrors/generics_double_substitution_test.dart
+++ b/tests/lib_2/mirrors/generics_double_substitution_test.dart
@@ -5,6 +5,7 @@
library test.generics_double_substitution;
import 'dart:mirrors';
+
import 'package:expect/expect.dart';
class A<R> {}
@@ -31,5 +32,5 @@
Expect.equals(aOfString, parameterType.parameters.single.type);
ClassMirror typeArgOfSuperclass = cOfString.superclass.typeArguments.single;
- Expect.equals(aOfString, typeArgOfSuperclass); // //# 01: ok
+ Expect.equals(aOfString, typeArgOfSuperclass); //# 01: ok
}
diff --git a/tests/lib_strong/mirrors/generics_dynamic_test.dart b/tests/lib_2/mirrors/generics_dynamic_test.dart
similarity index 100%
rename from tests/lib_strong/mirrors/generics_dynamic_test.dart
rename to tests/lib_2/mirrors/generics_dynamic_test.dart
diff --git a/tests/lib_2/mirrors/generics_helper.dart b/tests/lib_2/mirrors/generics_helper.dart
index e63ffb2..da10962 100644
--- a/tests/lib_2/mirrors/generics_helper.dart
+++ b/tests/lib_2/mirrors/generics_helper.dart
@@ -7,7 +7,6 @@
import 'package:expect/expect.dart';
typeParameters(mirror, parameterNames) {
- print(mirror.typeVariables.map((v) => v.simpleName).toList());
Expect.listEquals(
parameterNames, mirror.typeVariables.map((v) => v.simpleName).toList());
}
diff --git a/tests/lib_strong/mirrors/generics_special_types_test.dart b/tests/lib_2/mirrors/generics_special_types_test.dart
similarity index 100%
rename from tests/lib_strong/mirrors/generics_special_types_test.dart
rename to tests/lib_2/mirrors/generics_special_types_test.dart
diff --git a/tests/lib_strong/mirrors/generics_substitution_test.dart b/tests/lib_2/mirrors/generics_substitution_test.dart
similarity index 100%
rename from tests/lib_strong/mirrors/generics_substitution_test.dart
rename to tests/lib_2/mirrors/generics_substitution_test.dart
diff --git a/tests/lib_strong/mirrors/generics_test.dart b/tests/lib_2/mirrors/generics_test.dart
similarity index 97%
rename from tests/lib_strong/mirrors/generics_test.dart
rename to tests/lib_2/mirrors/generics_test.dart
index fb1ff11..fface13 100644
--- a/tests/lib_strong/mirrors/generics_test.dart
+++ b/tests/lib_2/mirrors/generics_test.dart
@@ -16,7 +16,7 @@
class B extends A {}
class C
- extends A<num, int> // //# 01: static type warning
+ extends A<num, int> //# 01: compile-time error
{}
class D extends A<int> {}
@@ -146,7 +146,7 @@
Expect.equals(
reflect(new I()).type, reflect(new I()).type.originalDeclaration);
- // Library members are all uninstantaited generics or non-generics.
+ // Library members are all uninstantiated generics or non-generics.
currentMirrorSystem().libraries.values.forEach((libraryMirror) {
libraryMirror.declarations.values.forEach((declaration) {
if (declaration is ClassMirror) {
diff --git a/tests/lib_strong/typed_data/typed_list_iterable_test.dart b/tests/lib_2/typed_data/typed_list_iterable_test.dart
similarity index 89%
rename from tests/lib_strong/typed_data/typed_list_iterable_test.dart
rename to tests/lib_2/typed_data/typed_list_iterable_test.dart
index 03046bc..844f535 100644
--- a/tests/lib_strong/typed_data/typed_list_iterable_test.dart
+++ b/tests/lib_2/typed_data/typed_list_iterable_test.dart
@@ -3,6 +3,7 @@
// BSD-style license that can be found in the LICENSE file.
import 'dart:typed_data';
+
import 'package:expect/expect.dart';
void testIterableFunctions<T extends num>(
@@ -17,7 +18,7 @@
Expect.equals(first, list.single);
Expect.equals(first, list.singleWhere((x) => x == last));
} else {
- Expect.throws(() => list.single, (e) => e is StateError);
+ Expect.throwsStateError(() => list.single);
bool isFirst = true;
Expect.equals(first, list.singleWhere((x) {
if (isFirst) {
@@ -97,7 +98,7 @@
l2.add(first);
Expect.equals(first, l2.last);
var l3 = list.toList(growable: false);
- Expect.throws(() => l3.add(last), (e) => e is UnsupportedError);
+ Expect.throwsUnsupportedError(() => l3.add(last));
}
void emptyChecks<T extends num>(List<T> list, T zero) {
@@ -105,12 +106,12 @@
Expect.isTrue(list.isEmpty);
- Expect.throws(() => list.first, (e) => e is StateError);
- Expect.throws(() => list.last, (e) => e is StateError);
- Expect.throws(() => list.single, (e) => e is StateError);
- Expect.throws(() => list.firstWhere((x) => true), (e) => e is StateError);
- Expect.throws(() => list.lastWhere((x) => true), (e) => e is StateError);
- Expect.throws(() => list.singleWhere((x) => true), (e) => e is StateError);
+ Expect.throwsStateError(() => list.first);
+ Expect.throwsStateError(() => list.last);
+ Expect.throwsStateError(() => list.single);
+ Expect.throwsStateError(() => list.firstWhere((x) => true));
+ Expect.throwsStateError(() => list.lastWhere((x) => true));
+ Expect.throwsStateError(() => list.singleWhere((x) => true));
Expect.isFalse(list.any((x) => true));
Expect.isFalse(list.contains(null));
@@ -147,7 +148,7 @@
Expect.equals(list.length, whereList.length);
Expect.equals(list.length, whereCount);
- Expect.throws(() => list.reduce((x, y) => x), (e) => e is StateError);
+ Expect.throwsStateError(() => list.reduce((x, y) => x));
Expect.isTrue(list.skip(list.length).isEmpty);
Expect.isTrue(list.skip(0).isEmpty);
@@ -162,7 +163,7 @@
l2.add(zero);
Expect.equals(zero, l2.last);
var l3 = list.toList(growable: false);
- Expect.throws(() => l3.add(zero), (e) => e is UnsupportedError);
+ Expect.throwsUnsupportedError(() => l3.add(zero));
}
main() {
diff --git a/tests/lib_strong/html/util.dart b/tests/lib_strong/html/util.dart
deleted file mode 100644
index 0cf55fb..0000000
--- a/tests/lib_strong/html/util.dart
+++ /dev/null
@@ -1,17 +0,0 @@
-// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library test.html.util;
-
-import 'dart:html';
-import 'package:expect/minitest.dart';
-
-void expectEmptyRect(Rectangle rect) {
- expect(rect.bottom, 0);
- expect(rect.top, 0);
- expect(rect.left, 0);
- expect(rect.right, 0);
- expect(rect.height, 0);
- expect(rect.width, 0);
-}
diff --git a/tests/lib_strong/html/utils.dart b/tests/lib_strong/html/utils.dart
deleted file mode 100644
index 4209f9b..0000000
--- a/tests/lib_strong/html/utils.dart
+++ /dev/null
@@ -1,219 +0,0 @@
-library TestUtils;
-
-import 'dart:async';
-import 'dart:html';
-import 'dart:js' as js;
-import 'dart:typed_data';
-import 'package:unittest/unittest.dart';
-
-/**
- * Verifies that [actual] has the same graph structure as [expected].
- * Detects cycles and DAG structure in Maps and Lists.
- */
-verifyGraph(expected, actual) {
- var eItems = [];
- var aItems = [];
-
- message(path, reason) => path == ''
- ? reason
- : reason == null ? "path: $path" : "path: $path, $reason";
-
- walk(path, expected, actual) {
- if (expected is String || expected is num || expected == null) {
- expect(actual, equals(expected), reason: message(path, 'not equal'));
- return;
- }
-
- // Cycle or DAG?
- for (int i = 0; i < eItems.length; i++) {
- if (identical(expected, eItems[i])) {
- expect(actual, same(aItems[i]),
- reason: message(path, 'missing back or side edge'));
- return;
- }
- }
- for (int i = 0; i < aItems.length; i++) {
- if (identical(actual, aItems[i])) {
- expect(expected, same(eItems[i]),
- reason: message(path, 'extra back or side edge'));
- return;
- }
- }
- eItems.add(expected);
- aItems.add(actual);
-
- if (expected is Blob) {
- expect(actual is Blob, isTrue, reason: '$actual is Blob');
- expect(expected.type, equals(actual.type),
- reason: message(path, '.type'));
- expect(expected.size, equals(actual.size),
- reason: message(path, '.size'));
- return;
- }
-
- if (expected is ByteBuffer) {
- expect(actual is ByteBuffer, isTrue, reason: '$actual is ByteBuffer');
- expect(expected.lengthInBytes, equals(actual.lengthInBytes),
- reason: message(path, '.lengthInBytes'));
- // TODO(antonm): one can create a view on top of those
- // and check if contents identical. Let's do it later.
- return;
- }
-
- if (expected is DateTime) {
- expect(actual is DateTime, isTrue, reason: '$actual is DateTime');
- expect(expected.millisecondsSinceEpoch,
- equals(actual.millisecondsSinceEpoch),
- reason: message(path, '.millisecondsSinceEpoch'));
- return;
- }
-
- if (expected is ImageData) {
- expect(actual is ImageData, isTrue, reason: '$actual is ImageData');
- expect(expected.width, equals(actual.width),
- reason: message(path, '.width'));
- expect(expected.height, equals(actual.height),
- reason: message(path, '.height'));
- walk('$path.data', expected.data, actual.data);
- return;
- }
-
- if (expected is TypedData) {
- expect(actual is TypedData, isTrue, reason: '$actual is TypedData');
- walk('$path/.buffer', expected.buffer, actual.buffer);
- expect(expected.offsetInBytes, equals(actual.offsetInBytes),
- reason: message(path, '.offsetInBytes'));
- expect(expected.lengthInBytes, equals(actual.lengthInBytes),
- reason: message(path, '.lengthInBytes'));
- // And also fallback to elements check below.
- }
-
- if (expected is List) {
- expect(actual, isList, reason: message(path, '$actual is List'));
- expect(actual.length, expected.length,
- reason: message(path, 'different list lengths'));
- for (var i = 0; i < expected.length; i++) {
- walk('$path[$i]', expected[i], actual[i]);
- }
- return;
- }
-
- if (expected is Map) {
- expect(actual, isMap, reason: message(path, '$actual is Map'));
- for (var key in expected.keys) {
- if (!actual.containsKey(key)) {
- expect(false, isTrue, reason: message(path, 'missing key "$key"'));
- }
- walk('$path["$key"]', expected[key], actual[key]);
- }
- for (var key in actual.keys) {
- if (!expected.containsKey(key)) {
- expect(false, isTrue, reason: message(path, 'extra key "$key"'));
- }
- }
- return;
- }
-
- expect(false, isTrue, reason: 'Unhandled type: $expected');
- }
-
- walk('', expected, actual);
-}
-
-/**
- * Sanitizer which does nothing.
- */
-class NullTreeSanitizer implements NodeTreeSanitizer {
- void sanitizeTree(Node node) {}
-}
-
-/**
- * Validate that two DOM trees are equivalent.
- */
-void validateNodeTree(Node a, Node b, [String path = '']) {
- path = '${path}${a.runtimeType}';
- expect(a.nodeType, b.nodeType, reason: '$path nodeTypes differ');
- expect(a.nodeValue, b.nodeValue, reason: '$path nodeValues differ');
- expect(a.text, b.text, reason: '$path texts differ');
- expect(a.nodes.length, b.nodes.length, reason: '$path nodes.lengths differ');
-
- if (a is Element) {
- Element bE = b;
- Element aE = a;
-
- expect(aE.tagName, bE.tagName, reason: '$path tagNames differ');
- expect(aE.attributes.length, bE.attributes.length,
- reason: '$path attributes.lengths differ');
- for (var key in aE.attributes.keys) {
- expect(aE.attributes[key], bE.attributes[key],
- reason: '$path attribute [$key] values differ');
- }
- }
- for (var i = 0; i < a.nodes.length; ++i) {
- validateNodeTree(a.nodes[i], b.nodes[i], '$path[$i].');
- }
-}
-
-/**
- * Upgrade all custom elements in the subtree which have not been upgraded.
- *
- * This is needed to cover timing scenarios which the custom element polyfill
- * does not cover.
- */
-void upgradeCustomElements(Node node) {
- if (js.context.hasProperty('CustomElements') &&
- js.context['CustomElements'].hasProperty('upgradeAll')) {
- js.context['CustomElements'].callMethod('upgradeAll', [node]);
- }
-}
-
-/**
- * A future that completes once all custom elements in the initial HTML page
- * have been upgraded.
- *
- * This is needed because the native implementation can update the elements
- * while parsing the HTML document, but the custom element polyfill cannot,
- * so it completes this future once all elements are upgraded.
- */
-// TODO(jmesserly): rename to webComponentsReady to match the event?
-Future customElementsReady = () {
- if (_isReady) return new Future.value();
-
- // Not upgraded. Wait for the polyfill to fire the WebComponentsReady event.
- // Note: we listen on document (not on document.body) to allow this polyfill
- // to be loaded in the HEAD element.
- return document.on['WebComponentsReady'].first;
-}();
-
-// Return true if we are using the polyfill and upgrade is complete, or if we
-// have native document.register and therefore the browser took care of it.
-// Otherwise return false, including the case where we can't find the polyfill.
-bool get _isReady {
- // If we don't have dart:js, assume things are ready
- if (js.context == null) return true;
-
- var customElements = js.context['CustomElements'];
- if (customElements == null) {
- // Return true if native document.register, otherwise false.
- // (Maybe the polyfill isn't loaded yet. Wait for it.)
- return document.supportsRegisterElement;
- }
-
- return customElements['ready'] == true;
-}
-
-/**
- * *Note* this API is primarily intended for tests. In other code it is better
- * to write it in a style that works with or without the polyfill, rather than
- * using this method.
- *
- * Synchronously trigger evaluation of pending lifecycle events, which otherwise
- * need to wait for a [MutationObserver] to signal the changes in the polyfill.
- * This method can be used to resolve differences in timing between native and
- * polyfilled custom elements.
- */
-void customElementsTakeRecords([Node node]) {
- var customElements = js.context['CustomElements'];
- if (customElements == null) return;
- customElements.callMethod('takeRecords', [node]);
-}
diff --git a/tests/lib_strong/lib_strong.status b/tests/lib_strong/lib_strong.status
deleted file mode 100644
index 7877ef7..0000000
--- a/tests/lib_strong/lib_strong.status
+++ /dev/null
@@ -1,145 +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.
-
-# TODO(29919): HTML tests are not supported on dartdevc in test.dart yet.
-[ $compiler == dartdevc ]
-html/custom/attribute_changed_callback_test: Crash # Issue 29922
-html/custom/constructor_calls_created_synchronously_test: Crash # Issue 29922
-html/custom/created_callback_test: CompileTimeError # Issue 29922
-html/custom/document_register_basic_test: CompileTimeError # Issue 29922
-html/custom/document_register_type_extensions_test/construction: CompileTimeError # Issue 29922
-html/custom/document_register_type_extensions_test/constructors: CompileTimeError # Issue 29922
-html/custom/document_register_type_extensions_test/createElement with type extension: CompileTimeError # Issue 29922
-html/custom/document_register_type_extensions_test/functional: CompileTimeError # Issue 29922
-html/custom/document_register_type_extensions_test/namespaces: CompileTimeError # Issue 29922
-html/custom/document_register_type_extensions_test/parsing: CompileTimeError # Issue 29922
-html/custom/document_register_type_extensions_test/registration: CompileTimeError # Issue 29922
-html/custom/document_register_type_extensions_test/single-parameter createElement: CompileTimeError # Issue 29922
-html/custom/element_upgrade_test: CompileTimeError # Issue 29922
-html/custom/entered_left_view_test: Crash # Issue 29922
-html/custom/js_custom_test: Crash # Issue 29922
-html/custom/mirrors_test: Crash # Issue 29922
-html/custom/regress_194523002_test: Crash # Issue 29922
-html/deferred_multi_app_htmltest: Skip # Issue 29919
-html/no_linked_scripts_htmltest: Skip # Issue 29919
-html/scripts_htmltest: Skip # Issue 29919
-html/two_scripts_htmltest: Skip # Issue 29919
-
-# Skip tests that are not yet strong-mode clean.
-[ $strong ]
-async/print_test/01: Skip # Temporalily disable the following tests until we figure out why they started failing.
-async/print_test/none: Skip # Temporalily disable the following tests until we figure out why they started failing.
-html/cross_frame_test: Skip # Temporalily disable the following tests until we figure out why they started failing.
-html/custom/created_callback_test: CompileTimeError # Issue 28969
-html/custom/document_register_basic_test: CompileTimeError # Issue 28969
-html/custom/document_register_type_extensions_test: CompileTimeError # Issue 28969
-html/custom/element_upgrade_test: CompileTimeError # Issue 28969
-html/element_dimensions_test: Skip
-html/events_test: Skip
-html/fileapi_test: Skip
-html/filereader_test: Skip
-html/fontface_loaded_test: Skip
-html/js_function_getter_trust_types_test: Skip
-html/js_typed_interop_default_arg_test/default_value: MissingCompileTimeError # Issue 28969
-html/keyboard_event_test: Skip
-html/mutationobserver_test: Skip
-html/postmessage_structured_test: Skip
-html/resource_http_test: Skip
-html/transferables_test: Skip
-html/webgl_1_test: Skip
-html/wrapping_collections_test: Skip
-mirrors/circular_factory_redirection_test: Skip
-mirrors/class_declarations_test: Skip
-mirrors/closures_test: Skip
-mirrors/fake_function_without_call_test: Skip
-mirrors/generic_bounded_by_type_parameter_test: Skip
-mirrors/generic_bounded_test: Skip
-mirrors/generic_class_declaration_test: Skip
-mirrors/generic_f_bounded_mixin_application_test: Skip
-mirrors/generic_interface_test: Skip
-mirrors/generics_test: Skip
-mirrors/intercepted_class_test: Skip
-mirrors/intercepted_object_test: Skip
-mirrors/invoke_call_through_getter_previously_accessed_test: Skip
-mirrors/invoke_call_through_getter_test: Skip
-mirrors/invoke_call_through_implicit_getter_previously_accessed_test: Skip
-mirrors/invoke_call_through_implicit_getter_test: Skip
-mirrors/lazy_static_test: Skip
-mirrors/mirrors_test: Skip
-mirrors/mixin_application_test: Skip
-mirrors/mixin_members_test: Skip
-mirrors/model_test: Skip
-mirrors/native_class_test: Skip
-mirrors/no_metadata_test: Skip
-mirrors/operator_test: Skip
-mirrors/parameter_is_const_test: Skip
-mirrors/parameter_of_mixin_app_constructor_test: Skip
-mirrors/parameter_test: Skip
-mirrors/private_symbol_test: Skip
-mirrors/redirecting_factory_different_type_test: Skip
-mirrors/redirecting_factory_test: Skip
-mirrors/reflect_class_test: Skip
-mirrors/reflect_model_test: Skip
-mirrors/reflected_type_classes_test: Skip
-mirrors/reflected_type_test: Skip
-mirrors/regress_16321_test: Skip
-mirrors/regress_19731_test: Skip
-
-# Skip entire suite if not running in strong mode.
-[ !$strong ]
-*: SkipByDesign
-
-[ $compiler == dartdevc && $runtime == chrome ]
-html/element_animate_test/timing_dict: RuntimeError # Issue 29922
-html/element_types_keygen_test: RuntimeError # Issue 29922
-
-[ $compiler == dartdevc && $runtime != none ]
-async/future_or_non_strong_test: RuntimeError # Issue 29922
-html/element_classes_svg_test: RuntimeError # Issue 29922
-html/element_classes_test: RuntimeError # Issue 29922
-html/indexeddb_1_test/functional: RuntimeError # Issue 29922, strong mode cast failure
-html/indexeddb_2_test: RuntimeError, Skip # Times out. Issue 29922, strong mode cast failure
-html/interactive_test: Skip # requests interactive permissions (camera, geolocation)
-html/isolates_test: RuntimeError # Issue 29922
-html/js_util_test: RuntimeError # Issue 29922
-html/media_stream_test: RuntimeError # Issue 29922
-html/mediasource_test: RuntimeError # Issue 29922
-html/transition_event_test: Pass, RuntimeError, Timeout # Issue 29922, this test seems flaky
-html/typing_test: RuntimeError # Issue 29922
-html/websql_test/functional: RuntimeError # Issue 29922
-html/worker_api_test: RuntimeError # Issue 29922
-html/xhr_cross_origin_test/functional: RuntimeError # Issue 29922
-html/xhr_test/xhr: RuntimeError # Issue 29922, strong mode cast failure
-mirrors/basic_types_in_dart_core_test: RuntimeError # Issue 29922
-mirrors/class_mirror_location_test: RuntimeError # Issue 29922
-mirrors/class_mirror_type_variables_test: RuntimeError # Issue 29922
-mirrors/closurization_equivalence_test: RuntimeError # Issue 29922
-mirrors/constructor_kinds_test/01: RuntimeError # Issue 29922
-mirrors/fake_function_with_call_test: RuntimeError # Issue 29922
-mirrors/field_metadata2_test: RuntimeError # Issue 29922
-mirrors/field_type_test: RuntimeError # Issue 29922
-mirrors/function_type_mirror_test: RuntimeError # Issue 29922
-mirrors/generic_f_bounded_test/01: RuntimeError # Issue 29922
-mirrors/generic_f_bounded_test/none: RuntimeError # Issue 29922
-mirrors/generic_function_typedef_test: RuntimeError # Issue 29922
-mirrors/generics_double_substitution_test/01: RuntimeError # Issue 29922
-mirrors/generics_double_substitution_test/none: RuntimeError # Issue 29922
-mirrors/generics_dynamic_test: RuntimeError # Issue 29922
-mirrors/generics_special_types_test: RuntimeError # Issue 29922
-mirrors/generics_substitution_test: RuntimeError # Issue 29922
-mirrors/instantiate_abstract_class_test: RuntimeError # Issue 29922
-mirrors/invocation_fuzz_test/emptyarray: RuntimeError # Issue 29922
-mirrors/invocation_fuzz_test/false: RuntimeError # Issue 29922
-mirrors/invocation_fuzz_test/none: RuntimeError # Issue 29922
-mirrors/invocation_fuzz_test/smi: RuntimeError # Issue 29922
-mirrors/invocation_fuzz_test/string: RuntimeError # Issue 29922
-mirrors/invoke_call_on_closure_test: RuntimeError # Issue 29922
-mirrors/libraries_test: RuntimeError # Issue 29922
-mirrors/library_enumeration_deferred_loading_test: RuntimeError # Issue 29922
-mirrors/library_metadata_test: RuntimeError # Issue 29922
-mirrors/library_uri_io_test: RuntimeError # Issue 29922
-mirrors/library_uri_package_test: RuntimeError # Issue 29922
-mirrors/local_function_is_static_test: RuntimeError # Issue 29922
-mirrors/metadata_test: RuntimeError # Issue 29922
-
diff --git a/tests/lib_strong/lib_strong_kernel.status b/tests/lib_strong/lib_strong_kernel.status
deleted file mode 100644
index 3cee57b..0000000
--- a/tests/lib_strong/lib_strong_kernel.status
+++ /dev/null
@@ -1,134 +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.
-
-[ $compiler == dartk && $runtime == vm ]
-html/canvas_test: DartkCompileTimeError
-html/cdata_test: DartkCompileTimeError
-html/client_rect_test: DartkCompileTimeError
-html/cross_domain_iframe_test: DartkCompileTimeError
-html/crypto_test: DartkCompileTimeError
-html/css_rule_list_test: DartkCompileTimeError
-html/css_test: DartkCompileTimeError
-html/cssstyledeclaration_test: DartkCompileTimeError
-html/custom/attribute_changed_callback_test: DartkCompileTimeError
-html/custom/constructor_calls_created_synchronously_test: DartkCompileTimeError
-html/custom/created_callback_test: DartkCompileTimeError
-html/custom/document_register_basic_test: DartkCompileTimeError
-html/custom/document_register_type_extensions_test: DartkCompileTimeError
-html/custom/element_upgrade_test: DartkCompileTimeError
-html/custom/entered_left_view_test: DartkCompileTimeError
-html/custom/js_custom_test: DartkCompileTimeError
-html/custom/mirrors_test: DartkCompileTimeError
-html/custom/regress_194523002_test: DartkCompileTimeError
-html/custom_element_method_clash_test: DartkCompileTimeError
-html/custom_element_name_clash_test: DartkCompileTimeError
-html/custom_elements_23127_test: DartkCompileTimeError
-html/custom_elements_test: DartkCompileTimeError
-html/dom_constructors_test: DartkCompileTimeError
-html/domparser_test: DartkCompileTimeError
-html/element_add_test: DartkCompileTimeError
-html/element_animate_test: DartkCompileTimeError
-html/element_classes_svg_test: DartkCompileTimeError
-html/element_classes_test: DartkCompileTimeError
-html/element_constructor_1_test: DartkCompileTimeError
-html/element_dimensions_test: DartkCompileTimeError
-html/element_offset_test: DartkCompileTimeError
-html/indexeddb_1_test: DartkCompileTimeError
-html/indexeddb_2_test: DartkCompileTimeError
-html/indexeddb_3_test: DartkCompileTimeError
-html/indexeddb_4_test: DartkCompileTimeError
-html/indexeddb_5_test: DartkCompileTimeError
-html/input_element_test: DartkCompileTimeError
-html/instance_of_test: DartkCompileTimeError
-html/interactive_test: DartkCompileTimeError
-html/isolates_test: DartkCompileTimeError
-html/js_function_getter_test: DartkCompileTimeError
-html/js_interop_1_test: DartkCompileTimeError
-html/js_test: DartkCompileTimeError
-html/js_util_test: DartkCompileTimeError
-html/localstorage_test: DartkCompileTimeError
-html/location_test: DartkCompileTimeError
-html/media_stream_test: DartkCompileTimeError
-html/mediasource_test: DartkCompileTimeError
-html/messageevent_test: DartkCompileTimeError
-html/mirrors_js_typed_interop_test: DartkCompileTimeError
-html/mouse_event_test: DartkCompileTimeError
-html/native_gc_test: DartkCompileTimeError
-html/navigator_test: DartkCompileTimeError
-html/node_test: DartkCompileTimeError
-html/node_validator_important_if_you_suppress_make_the_bug_critical_test: DartkCompileTimeError
-html/non_instantiated_is_test: DartkCompileTimeError
-html/notification_test: DartkCompileTimeError
-html/performance_api_test: DartkCompileTimeError
-html/private_extension_member_test: DartkCompileTimeError
-html/query_test: DartkCompileTimeError
-html/queryall_test: DartkCompileTimeError
-html/range_test: DartkCompileTimeError
-html/request_animation_frame_test: DartkCompileTimeError
-html/rtc_test: DartkCompileTimeError
-html/selectelement_test: DartkCompileTimeError
-html/serialized_script_value_test: DartkCompileTimeError
-html/shadow_dom_test: DartkCompileTimeError
-html/shadowroot_test: DartkCompileTimeError
-html/speechrecognition_test: DartkCompileTimeError
-html/storage_test: DartkCompileTimeError
-html/streams_test: DartkCompileTimeError
-html/svg_test: DartkCompileTimeError
-html/svgelement_test: DartkCompileTimeError
-html/table_test: DartkCompileTimeError
-html/text_event_test: DartkCompileTimeError
-html/touchevent_test: DartkCompileTimeError
-html/track_element_constructor_test: DartkCompileTimeError
-html/transition_event_test: DartkCompileTimeError
-html/trusted_html_tree_sanitizer_test: DartkCompileTimeError
-html/typed_arrays_1_test: DartkCompileTimeError
-html/typed_arrays_2_test: DartkCompileTimeError
-html/typed_arrays_3_test: DartkCompileTimeError
-html/typed_arrays_4_test: DartkCompileTimeError
-html/typed_arrays_5_test: DartkCompileTimeError
-html/typed_arrays_arraybuffer_test: DartkCompileTimeError
-html/typed_arrays_dataview_test: DartkCompileTimeError
-html/typed_arrays_range_checks_test: DartkCompileTimeError
-html/typed_arrays_simd_test: DartkCompileTimeError
-html/typing_test: DartkCompileTimeError
-html/unknownelement_test: DartkCompileTimeError
-html/uri_test: DartkCompileTimeError
-html/url_test: DartkCompileTimeError
-html/websocket_test: DartkCompileTimeError
-html/websql_test: DartkCompileTimeError
-html/wheelevent_test: DartkCompileTimeError
-html/window_eq_test: DartkCompileTimeError
-html/window_mangling_test: DartkCompileTimeError
-html/window_nosuchmethod_test: DartkCompileTimeError
-html/window_test: DartkCompileTimeError
-html/worker_api_test: DartkCompileTimeError
-html/worker_test: DartkCompileTimeError
-html/xhr_cross_origin_test: DartkCompileTimeError
-html/xhr_test: DartkCompileTimeError
-html/xsltprocessor_test: DartkCompileTimeError
-mirrors/basic_types_in_dart_core_test: RuntimeError
-mirrors/class_mirror_location_test: RuntimeError
-mirrors/constructor_kinds_test/01: RuntimeError
-mirrors/constructor_kinds_test/none: RuntimeError
-mirrors/fake_function_with_call_test: Crash
-mirrors/field_type_test: RuntimeError
-mirrors/function_type_mirror_test: RuntimeError
-mirrors/generic_function_typedef_test: RuntimeError
-mirrors/generics_double_substitution_test/01: RuntimeError
-mirrors/generics_double_substitution_test/none: RuntimeError
-mirrors/generics_dynamic_test: Crash
-mirrors/generics_substitution_test: RuntimeError
-mirrors/invocation_fuzz_test/emptyarray: Crash
-mirrors/invocation_fuzz_test/false: Crash
-mirrors/invocation_fuzz_test/none: Crash
-mirrors/invocation_fuzz_test/smi: Crash
-mirrors/invocation_fuzz_test/string: Crash
-mirrors/libraries_test: RuntimeError
-mirrors/library_enumeration_deferred_loading_test: RuntimeError
-mirrors/library_metadata_test: RuntimeError
-mirrors/library_uri_io_test: DartkCompileTimeError
-mirrors/library_uri_package_test: DartkCompileTimeError
-mirrors/list_constructor_test/01: RuntimeError
-mirrors/list_constructor_test/none: RuntimeError
-mirrors/metadata_test: RuntimeError
diff --git a/tests/lib_strong/mirrors/declarations_model.dart b/tests/lib_strong/mirrors/declarations_model.dart
deleted file mode 100644
index f25523f..0000000
--- a/tests/lib_strong/mirrors/declarations_model.dart
+++ /dev/null
@@ -1,166 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library test.declarations_model;
-
-var libraryVariable;
-get libraryGetter => null;
-set librarySetter(x) => x;
-libraryMethod() => null;
-
-var _libraryVariable;
-get _libraryGetter => null;
-set _librarySetter(x) => x;
-_libraryMethod() => null;
-
-typedef bool Predicate(dynamic);
-
-abstract class Interface<I> {
- operator /(x) => null;
-
- var interfaceInstanceVariable;
- get interfaceInstanceGetter;
- set interfaceInstanceSetter(x);
- interfaceInstanceMethod();
-
- var _interfaceInstanceVariable;
- get _interfaceInstanceGetter;
- set _interfaceInstanceSetter(x);
- _interfaceInstanceMethod();
-
- static var interfaceStaticVariable;
- static get interfaceStaticGetter => null;
- static set interfaceStaticSetter(x) => x;
- static interfaceStaticMethod() => null;
-
- static var _interfaceStaticVariable;
- static get _interfaceStaticGetter => null;
- static set _interfaceStaticSetter(x) => x;
- static _interfaceStaticMethod() => null;
-}
-
-class Mixin<M> {
- operator *(x) => null;
-
- var mixinInstanceVariable;
- get mixinInstanceGetter => null;
- set mixinInstanceSetter(x) => x;
- mixinInstanceMethod() => null;
-
- var _mixinInstanceVariable;
- get _mixinInstanceGetter => null;
- set _mixinInstanceSetter(x) => x;
- _mixinInstanceMethod() => null;
-
- static var mixinStaticVariable;
- static get mixinStaticGetter => null;
- static set mixinStaticSetter(x) => x;
- static mixinStaticMethod() => null;
-
- static var _mixinStaticVariable;
- static get _mixinStaticGetter => null;
- static set _mixinStaticSetter(x) => x;
- static _mixinStaticMethod() => null;
-}
-
-class Superclass<S> {
- operator -(x) => null;
-
- var inheritedInstanceVariable;
- get inheritedInstanceGetter => null;
- set inheritedInstanceSetter(x) => x;
- inheritedInstanceMethod() => null;
-
- var _inheritedInstanceVariable;
- get _inheritedInstanceGetter => null;
- set _inheritedInstanceSetter(x) => x;
- _inheritedInstanceMethod() => null;
-
- static var inheritedStaticVariable;
- static get inheritedStaticGetter => null;
- static set inheritedStaticSetter(x) => x;
- static inheritedStaticMethod() => null;
-
- static var _inheritedStaticVariable;
- static get _inheritedStaticGetter => null;
- static set _inheritedStaticSetter(x) => x;
- static _inheritedStaticMethod() => null;
-
- Superclass.inheritedGenerativeConstructor(this.inheritedInstanceVariable);
- Superclass.inheritedRedirectingConstructor(x)
- : this.inheritedGenerativeConstructor(x * 2);
- factory Superclass.inheritedNormalFactory(y) =>
- new Superclass.inheritedRedirectingConstructor(y * 3);
- factory Superclass.inheritedRedirectingFactory(z) =
- Superclass<S>.inheritedNormalFactory;
-
- Superclass._inheritedGenerativeConstructor(this._inheritedInstanceVariable);
- Superclass._inheritedRedirectingConstructor(x)
- : this._inheritedGenerativeConstructor(x * 2);
- factory Superclass._inheritedNormalFactory(y) =>
- new Superclass._inheritedRedirectingConstructor(y * 3);
- factory Superclass._inheritedRedirectingFactory(z) =
- Superclass<S>._inheritedNormalFactory;
-}
-
-abstract class Class<C> extends Superclass<C>
- with Mixin<C>
- implements Interface<C> {
- operator +(x) => null;
-
- abstractMethod();
-
- var instanceVariable;
- get instanceGetter => null;
- set instanceSetter(x) => x;
- instanceMethod() => null;
-
- var _instanceVariable;
- get _instanceGetter => null;
- set _instanceSetter(x) => x;
- _instanceMethod() => null;
-
- static var staticVariable;
- static get staticGetter => null;
- static set staticSetter(x) => x;
- static staticMethod() => null;
-
- static var _staticVariable;
- static get _staticGetter => null;
- static set _staticSetter(x) => x;
- static _staticMethod() => null;
-
- Class.generativeConstructor(this.instanceVariable)
- : super.inheritedGenerativeConstructor(0);
- Class.redirectingConstructor(x) : this.generativeConstructor(x * 2);
- factory Class.normalFactory(y) => new ConcreteClass(y * 3);
- factory Class.redirectingFactory(z) = Class<C>.normalFactory;
-
- Class._generativeConstructor(this._instanceVariable)
- : super._inheritedGenerativeConstructor(0);
- Class._redirectingConstructor(x) : this._generativeConstructor(x * 2);
- factory Class._normalFactory(y) => new ConcreteClass(y * 3);
- factory Class._redirectingFactory(z) = Class<C>._normalFactory;
-}
-
-// This is just here as a target of Class's factories to appease the analyzer.
-class ConcreteClass<CC> extends Class<CC> {
- abstractMethod() {}
-
- operator /(x) => null;
-
- var interfaceInstanceVariable;
- get interfaceInstanceGetter => null;
- set interfaceInstanceSetter(x) => null;
- interfaceInstanceMethod() => null;
-
- var _interfaceInstanceVariable;
- get _interfaceInstanceGetter => null;
- set _interfaceInstanceSetter(x) => null;
- _interfaceInstanceMethod() => null;
-
- ConcreteClass(x) : super.generativeConstructor(x);
-}
-
-class _PrivateClass {}
diff --git a/tests/lib_strong/mirrors/declarations_model_easier.dart b/tests/lib_strong/mirrors/declarations_model_easier.dart
deleted file mode 100644
index 665b691..0000000
--- a/tests/lib_strong/mirrors/declarations_model_easier.dart
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library test.declarations_model;
-
-var libraryVariable;
-get libraryGetter => null;
-set librarySetter(x) => x;
-libraryMethod() => null;
-
-typedef bool Predicate(dynamic);
-
-abstract class Interface<I> {
- operator /(x) => null;
-
- var interfaceInstanceVariable;
- get interfaceInstanceGetter;
- set interfaceInstanceSetter(x);
- interfaceInstanceMethod();
-
- static var interfaceStaticVariable;
- static get interfaceStaticGetter => null;
- static set interfaceStaticSetter(x) => x;
- static interfaceStaticMethod() => null;
-}
-
-class Superclass<S> {
- operator -(x) => null;
-
- var inheritedInstanceVariable;
- get inheritedInstanceGetter => null;
- set inheritedInstanceSetter(x) => x;
- inheritedInstanceMethod() => null;
-
- static var inheritedStaticVariable;
- static get inheritedStaticGetter => null;
- static set inheritedStaticSetter(x) => x;
- static inheritedStaticMethod() => null;
-
- Superclass.inheritedGenerativeConstructor(this.inheritedInstanceVariable);
- Superclass.inheritedRedirectingConstructor(x)
- : this.inheritedGenerativeConstructor(x * 2);
- factory Superclass.inheritedNormalFactory(y) =>
- new Superclass.inheritedRedirectingConstructor(y * 3);
- factory Superclass.inheritedRedirectingFactory(z) =
- Superclass<S>.inheritedNormalFactory;
-}
-
-abstract class Class<C> extends Superclass<C> implements Interface<C> {
- operator +(x) => null;
-
- abstractMethod();
-
- var instanceVariable;
- get instanceGetter => null;
- set instanceSetter(x) => x;
- instanceMethod() => null;
-
- static var staticVariable;
- static get staticGetter => null;
- static set staticSetter(x) => x;
- static staticMethod() => null;
-
- Class.generativeConstructor(this.instanceVariable)
- : super.inheritedGenerativeConstructor(0);
- Class.redirectingConstructor(x) : this.generativeConstructor(x * 2);
- factory Class.normalFactory(y) => new ConcreteClass(y * 3);
- factory Class.redirectingFactory(z) = Class<C>.normalFactory;
-}
-
-// This is just here as a target of Class's factories to appease the analyzer.
-class ConcreteClass<CC> extends Class<CC> {
- abstractMethod() {}
-
- operator /(x) => null;
-
- var interfaceInstanceVariable;
- get interfaceInstanceGetter => null;
- set interfaceInstanceSetter(x) => null;
- interfaceInstanceMethod() => null;
-
- ConcreteClass(x) : super.generativeConstructor(x);
-}
diff --git a/tests/lib_strong/mirrors/fake_function_with_call_test.dart b/tests/lib_strong/mirrors/fake_function_with_call_test.dart
deleted file mode 100644
index b77eb59..0000000
--- a/tests/lib_strong/mirrors/fake_function_with_call_test.dart
+++ /dev/null
@@ -1,50 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import "dart:mirrors";
-
-import "package:expect/expect.dart";
-
-membersOf(ClassMirror cm) {
- var result = new Map();
- cm.declarations.forEach((k, v) {
- if (v is MethodMirror && !v.isConstructor) result[k] = v;
- if (v is VariableMirror) result[k] = v;
- });
- return result;
-}
-
-class WannabeFunction {
- int call(int a, int b) => a + b;
- method(x) => x * x;
-}
-
-main() {
- Expect.isTrue(new WannabeFunction() is Function);
-
- ClosureMirror cm = reflect(new WannabeFunction());
- Expect.equals(7, cm.invoke(#call, [3, 4]).reflectee);
- Expect.throws(() => cm.invoke(#call, [3]), (e) => e is NoSuchMethodError,
- "Wrong arity");
- Expect.equals(49, cm.invoke(#method, [7]).reflectee);
- Expect.throws(() => cm.invoke(#method, [3, 4]), (e) => e is NoSuchMethodError,
- "Wrong arity");
- Expect.equals(7, cm.apply([3, 4]).reflectee);
- Expect.throws(
- () => cm.apply([3]), (e) => e is NoSuchMethodError, "Wrong arity");
-
- MethodMirror mm = cm.function;
- Expect.equals(#call, mm.simpleName);
- Expect.equals(reflectClass(WannabeFunction), mm.owner);
- Expect.isTrue(mm.isRegularMethod);
- Expect.equals(#int, mm.returnType.simpleName);
- Expect.equals(#int, mm.parameters[0].type.simpleName);
- Expect.equals(#int, mm.parameters[1].type.simpleName);
-
- ClassMirror km = cm.type;
- Expect.equals(reflectClass(WannabeFunction), km);
- Expect.equals(#WannabeFunction, km.simpleName);
- Expect.equals(mm, km.declarations[#call]);
- Expect.setEquals([#call, #method], membersOf(km).keys);
-}
diff --git a/tests/lib_strong/mirrors/field_metadata2_test.dart b/tests/lib_strong/mirrors/field_metadata2_test.dart
deleted file mode 100644
index e3dc834..0000000
--- a/tests/lib_strong/mirrors/field_metadata2_test.dart
+++ /dev/null
@@ -1,26 +0,0 @@
-// compile options: --emit-metadata
-// 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.
-
-// Run essentially the same test, but with emit-metadata compile option,
-// which allows us to reflect on the fields.
-import 'dart:mirrors';
-import 'package:expect/expect.dart';
-
-import 'field_metadata_test.dart' as field_metadata_test;
-import 'field_metadata_test.dart' show Foo, Bar;
-
-void main() {
- // Make sure the other test still works.
- field_metadata_test.main();
-
- // Check that we can now reflect on the annotations.
- dynamic f = new Foo();
- var members = reflect(f).type.declarations;
- var bar = members[#x].metadata.first.reflectee as Bar;
- Expect.equals(bar.name, 'bar');
-
- var baz = members[#y].metadata.first.reflectee as Bar;
- Expect.equals(baz.name, 'baz');
-}
diff --git a/tests/lib_strong/mirrors/field_metadata_test.dart b/tests/lib_strong/mirrors/field_metadata_test.dart
deleted file mode 100644
index a8db33d..0000000
--- a/tests/lib_strong/mirrors/field_metadata_test.dart
+++ /dev/null
@@ -1,47 +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:mirrors';
-import 'package:expect/expect.dart';
-
-class Bar {
- final String name;
-
- const Bar(this.name);
-}
-
-class Foo {
- @Bar('bar')
- int x = 40;
-
- @Bar('baz')
- final String y = 'hi';
-
- @Bar('foo')
- void set z(int val) {
- x = val;
- }
-}
-
-void main() {
- dynamic f = new Foo();
- Expect.throws(() {
- f.x = 'hello';
- });
- f.x += 2;
- Expect.equals(f.x, 42);
- Expect.equals(f.y, 'hi');
-
- Expect.throws(() {
- f.z = 'hello';
- });
- f.z = 0;
- Expect.equals(f.x, 0);
-
- var members = reflect(f).type.declarations;
- var x = members[#x] as VariableMirror;
- var y = members[#y] as VariableMirror;
- Expect.equals(x.type.simpleName, #int);
- Expect.equals(y.type.simpleName, #String);
-}
diff --git a/tests/lib_strong/mirrors/field_type_test.dart b/tests/lib_strong/mirrors/field_type_test.dart
deleted file mode 100644
index 9e56745..0000000
--- a/tests/lib_strong/mirrors/field_type_test.dart
+++ /dev/null
@@ -1,79 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library field_test;
-
-import 'dart:mirrors';
-import "package:expect/expect.dart";
-
-String toplevelVariable;
-
-class C {
- final int i;
- const C(this.i);
-}
-
-class A<T> {
- static int staticField;
- @C(42)
- @C(44)
- String field;
- var dynamicTypeField;
- T typeVariableField;
- H<int> parameterizedTypeField;
-}
-
-class H<T> {}
-
-testOriginalDeclaration() {
- ClassMirror a = reflectClass(A);
- VariableMirror staticField = a.declarations[#staticField];
- VariableMirror field = a.declarations[#field];
- VariableMirror dynamicTypeField = a.declarations[#dynamicTypeField];
- VariableMirror typeVariableField = a.declarations[#typeVariableField];
- VariableMirror parameterizedTypeField =
- a.declarations[#parameterizedTypeField];
-
- Expect.equals(reflectType(int), staticField.type);
- Expect.equals(reflectClass(String), field.type);
- Expect.equals(reflectType(dynamic), dynamicTypeField.type);
- Expect.equals(a.typeVariables.single, typeVariableField.type);
- Expect.equals(reflect(new H<int>()).type, parameterizedTypeField.type);
-
- Expect.equals(2, field.metadata.length);
- Expect.equals(reflect(const C(42)), field.metadata.first);
- Expect.equals(reflect(const C(44)), field.metadata.last);
-}
-
-testInstance() {
- ClassMirror aOfString = reflect(new A<String>()).type;
- VariableMirror staticField = aOfString.declarations[#staticField];
- VariableMirror field = aOfString.declarations[#field];
- VariableMirror dynamicTypeField = aOfString.declarations[#dynamicTypeField];
- VariableMirror typeVariableField = aOfString.declarations[#typeVariableField];
- VariableMirror parameterizedTypeField =
- aOfString.declarations[#parameterizedTypeField];
-
- Expect.equals(reflectType(int), staticField.type);
- Expect.equals(reflectClass(String), field.type);
- Expect.equals(reflectType(dynamic), dynamicTypeField.type);
- Expect.equals(reflectClass(String), typeVariableField.type);
- Expect.equals(reflect(new H<int>()).type, parameterizedTypeField.type);
-
- Expect.equals(2, field.metadata.length);
- Expect.equals(reflect(const C(42)), field.metadata.first);
- Expect.equals(reflect(const C(44)), field.metadata.last);
-}
-
-testTopLevel() {
- LibraryMirror currentLibrary = currentMirrorSystem().findLibrary(#field_test);
- VariableMirror topLevel = currentLibrary.declarations[#toplevelVariable];
- Expect.equals(reflectClass(String), topLevel.type);
-}
-
-main() {
- testOriginalDeclaration();
- testInstance();
- testTopLevel();
-}
diff --git a/tests/lib_strong/mirrors/function_apply_mirrors_lib.dart b/tests/lib_strong/mirrors/function_apply_mirrors_lib.dart
deleted file mode 100644
index e94a55a..0000000
--- a/tests/lib_strong/mirrors/function_apply_mirrors_lib.dart
+++ /dev/null
@@ -1,10 +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.
-
-library function_apply_mirrors_lib;
-
-@MirrorsUsed(targets: "function_apply_mirrors_lib")
-import "dart:mirrors";
-
-bar() => reflect(499).reflectee;
diff --git a/tests/lib_strong/mirrors/function_apply_mirrors_test.dart b/tests/lib_strong/mirrors/function_apply_mirrors_test.dart
deleted file mode 100644
index 81d3b9e..0000000
--- a/tests/lib_strong/mirrors/function_apply_mirrors_test.dart
+++ /dev/null
@@ -1,21 +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.
-
-// Only 'lib' imports mirrors.
-// Function.apply is resolved, before it is known that mirrors are used.
-// Dart2js has different implementations of Function.apply for different
-// emitters (like --fast-startup). Dart2js must not switch the resolved
-// Function.apply when it discovers the use of mirrors.
-// In particular it must not switch from the fast-startup emitter to the full
-// emitter without updating the Function.apply reference.
-import 'function_apply_mirrors_lib.dart' as lib;
-
-import "package:expect/expect.dart";
-
-int foo({x: 499, y: 42}) => x + y;
-
-main() {
- Expect.equals(709, Function.apply(foo, [], {#y: 210}));
- Expect.equals(499, lib.bar());
-}
diff --git a/tests/lib_strong/mirrors/function_type_mirror_test.dart b/tests/lib_strong/mirrors/function_type_mirror_test.dart
deleted file mode 100644
index 3b547e3..0000000
--- a/tests/lib_strong/mirrors/function_type_mirror_test.dart
+++ /dev/null
@@ -1,23 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import "dart:mirrors";
-
-import "package:expect/expect.dart";
-
-typedef void FooFunction(int a, double b);
-
-bar(int a) {}
-
-main() {
- TypedefMirror tm = reflectType(FooFunction);
- FunctionTypeMirror ftm = tm.referent;
- Expect.equals(const Symbol('void'), ftm.returnType.simpleName);
- Expect.equals(#int, ftm.parameters[0].type.simpleName);
- Expect.equals(#double, ftm.parameters[1].type.simpleName);
- ClosureMirror cm = reflect(bar);
- ftm = cm.type;
- Expect.equals(#dynamic, ftm.returnType.simpleName);
- Expect.equals(#int, ftm.parameters[0].type.simpleName);
-}
diff --git a/tests/lib_strong/mirrors/generic_bounded_by_type_parameter_test.dart b/tests/lib_strong/mirrors/generic_bounded_by_type_parameter_test.dart
deleted file mode 100644
index f7aa697..0000000
--- a/tests/lib_strong/mirrors/generic_bounded_by_type_parameter_test.dart
+++ /dev/null
@@ -1,85 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library test.generic_bounded_by_type_parameter;
-
-import 'dart:mirrors';
-
-import 'package:expect/expect.dart';
-
-import 'generics_helper.dart';
-
-class Super<T, R extends T> {}
-
-class Fixed extends Super<num, int> {}
-class Generic<X, Y> extends Super<X, Y> {} //# 02: static type warning
-class Malbounded extends Super<num, String> {} //# 01: static type warning
-
-bool inCheckedMode() {
- try {
- var s = 'string';
- int i = s;
- } catch (e) {
- return true;
- }
- return false;
-}
-
-main() {
- ClassMirror superDecl = reflectClass(Super);
- ClassMirror superOfNumAndInt = reflectClass(Fixed).superclass;
- ClassMirror genericDecl = reflectClass(Generic); // //# 02: continued
- ClassMirror superOfXAndY = genericDecl.superclass; // //# 02: continued
- ClassMirror genericOfNumAndDouble = reflect(new Generic<num, double>()).type; // //# 02: continued
- ClassMirror superOfNumAndDouble = genericOfNumAndDouble.superclass; // //# 02: continued
- ClassMirror superOfNumAndString = reflectClass(Malbounded).superclass; // //# 01: continued
-
- try {
- ClassMirror genericOfNumAndBool = reflect(new Generic<num, bool>()).type; // //# 02: static type warning
- ClassMirror superOfNumAndBool = genericOfNumAndBool.superclass; // //# 02: continued
- Expect.isFalse(genericOfNumAndBool.isOriginalDeclaration); // //# 02: continued
- Expect.isFalse(superOfNumAndBool.isOriginalDeclaration); // //# 02: continued
- typeParameters(genericOfNumAndBool, [#X, #Y]); // //# 02: continued
- typeParameters(superOfNumAndBool, [#T, #R]); // //# 02: continued
- typeArguments(genericOfNumAndBool, [reflectClass(num), reflectClass(bool)]); // //# 02: continued
- typeArguments(superOfNumAndBool, [reflectClass(num), reflectClass(bool)]); // //# 02: continued
- Expect.isFalse(inCheckedMode()); //# 02: continued
- } on TypeError catch (e) {
- Expect.isTrue(inCheckedMode());
- }
-
- Expect.isTrue(superDecl.isOriginalDeclaration);
- Expect.isFalse(superOfNumAndInt.isOriginalDeclaration);
- Expect.isTrue(genericDecl.isOriginalDeclaration); // //# 02: continued
- Expect.isFalse(superOfXAndY.isOriginalDeclaration); // //# 02: continued
- Expect.isFalse(genericOfNumAndDouble.isOriginalDeclaration); // //# 02: continued
- Expect.isFalse(superOfNumAndDouble.isOriginalDeclaration); // //# 02: continued
- Expect.isFalse(superOfNumAndString.isOriginalDeclaration); // //# 01: continued
-
- TypeVariableMirror tFromSuper = superDecl.typeVariables[0];
- TypeVariableMirror rFromSuper = superDecl.typeVariables[1];
- TypeVariableMirror xFromGeneric = genericDecl.typeVariables[0]; // //# 02: continued
- TypeVariableMirror yFromGeneric = genericDecl.typeVariables[1]; // //# 02: continued
-
- Expect.equals(reflectClass(Object), tFromSuper.upperBound);
- Expect.equals(tFromSuper, rFromSuper.upperBound);
- Expect.equals(reflectClass(Object), xFromGeneric.upperBound); // //# 02: continued
- Expect.equals(reflectClass(Object), yFromGeneric.upperBound); // //# 02: continued
-
- typeParameters(superDecl, [#T, #R]);
- typeParameters(superOfNumAndInt, [#T, #R]);
- typeParameters(genericDecl, [#X, #Y]); // //# 02: continued
- typeParameters(superOfXAndY, [#T, #R]); // //# 02: continued
- typeParameters(genericOfNumAndDouble, [#X, #Y]); // //# 02: continued
- typeParameters(superOfNumAndDouble, [#T, #R]); // //# 02: continued
- typeParameters(superOfNumAndString, [#T, #R]); // //# 01: continued
-
- typeArguments(superDecl, []);
- typeArguments(superOfNumAndInt, [reflectClass(num), reflectClass(int)]);
- typeArguments(genericDecl, []); // //# 02: continued
- typeArguments(superOfXAndY, [xFromGeneric, yFromGeneric]); // //# 02: continued
- typeArguments(genericOfNumAndDouble, [reflectClass(num), reflectClass(double)]); // //# 02: continued
- typeArguments(superOfNumAndDouble, [reflectClass(num), reflectClass(double)]); // //# 02: continued
- typeArguments(superOfNumAndString, [reflectClass(num), reflectClass(String)]); // //# 01: continued
-}
diff --git a/tests/lib_strong/mirrors/generic_bounded_test.dart b/tests/lib_strong/mirrors/generic_bounded_test.dart
deleted file mode 100644
index d0ea427..0000000
--- a/tests/lib_strong/mirrors/generic_bounded_test.dart
+++ /dev/null
@@ -1,83 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library test.generic_bounded;
-
-import 'dart:mirrors';
-
-import 'package:expect/expect.dart';
-
-import 'generics_helper.dart';
-
-class Super<T extends num> {}
-
-class Fixed extends Super<int> {}
-class Generic<R> extends Super<R> {} // //# 02: static type warning
-class Malbounded extends Super<String> {} //# 01: static type warning
-
-bool inCheckedMode() {
- try {
- var s = 'string';
- int i = s;
- } catch (e) {
- return true;
- }
- return false;
-}
-
-main() {
- ClassMirror superDecl = reflectClass(Super);
- ClassMirror superOfInt = reflectClass(Fixed).superclass;
- ClassMirror genericDecl = reflectClass(Generic); // //# 02: continued
- ClassMirror superOfR = genericDecl.superclass; // //# 02: continued
- ClassMirror genericOfDouble = reflect(new Generic<double>()).type; // //# 02: continued
- ClassMirror superOfDouble = genericOfDouble.superclass; // //# 02: continued
-
- try {
- ClassMirror genericOfBool = reflect(new Generic<bool>()).type; // //# 02: static type warning
- ClassMirror superOfBool = genericOfBool.superclass; // //# 02: continued
- Expect.isFalse(genericOfBool.isOriginalDeclaration); // //# 02: continued
- Expect.isFalse(superOfBool.isOriginalDeclaration); // //# 02: continued
- typeParameters(genericOfBool, [#R]); // //# 02: continued
- typeParameters(superOfBool, [#T]); // //# 02: continued
- typeArguments(genericOfBool, [reflectClass(bool)]); // //# 02: continued
- typeArguments(superOfBool, [reflectClass(bool)]); // //# 02: continued
- Expect.isFalse(inCheckedMode()); //# 02: continued
- } on TypeError catch (e) {
- Expect.isTrue(inCheckedMode());
- }
-
- ClassMirror superOfString = reflectClass(Malbounded).superclass; // //# 01: continued
-
- Expect.isTrue(superDecl.isOriginalDeclaration);
- Expect.isFalse(superOfInt.isOriginalDeclaration);
- Expect.isTrue(genericDecl.isOriginalDeclaration); // //# 02: continued
- Expect.isFalse(superOfR.isOriginalDeclaration); // //# 02: continued
- Expect.isFalse(genericOfDouble.isOriginalDeclaration); // //# 02: continued
- Expect.isFalse(superOfDouble.isOriginalDeclaration); // //# 02: continued
-
- Expect.isFalse(superOfString.isOriginalDeclaration); // //# 01: continued
-
- TypeVariableMirror tFromSuper = superDecl.typeVariables.single;
- TypeVariableMirror rFromGeneric = genericDecl.typeVariables.single; // //# 02: continued
-
- Expect.equals(reflectClass(num), tFromSuper.upperBound);
- Expect.equals(reflectClass(Object), rFromGeneric.upperBound); // //# 02: continued
-
- typeParameters(superDecl, [#T]);
- typeParameters(superOfInt, [#T]);
- typeParameters(genericDecl, [#R]); // //# 02: continued
- typeParameters(superOfR, [#T]); // //# 02: continued
- typeParameters(genericOfDouble, [#R]); // //# 02: continued
- typeParameters(superOfDouble, [#T]); // //# 02: continued
- typeParameters(superOfString, [#T]); // //# 01: continued
-
- typeArguments(superDecl, []);
- typeArguments(superOfInt, [reflectClass(int)]);
- typeArguments(genericDecl, []); // //# 02: continued
- typeArguments(superOfR, [rFromGeneric]); // //# 02: continued
- typeArguments(genericOfDouble, [reflectClass(double)]); // //# 02: continued
- typeArguments(superOfDouble, [reflectClass(double)]); // //# 02: continued
- typeArguments(superOfString, [reflectClass(String)]); // //# 01: continued
-}
diff --git a/tests/lib_strong/mirrors/generic_class_declaration_test.dart b/tests/lib_strong/mirrors/generic_class_declaration_test.dart
deleted file mode 100644
index 79ebee1..0000000
--- a/tests/lib_strong/mirrors/generic_class_declaration_test.dart
+++ /dev/null
@@ -1,94 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-import 'dart:mirrors';
-import 'package:expect/expect.dart';
-
-import 'stringify.dart';
-
-class A<T> {
- var instanceVariable;
- get instanceGetter => null;
- set instanceSetter(x) => x;
- instanceMethod() => null;
-
- var _instanceVariable;
- get _instanceGetter => null;
- set _instanceSetter(x) => x;
- _instanceMethod() => null;
-
- static var staticVariable;
- static get staticGetter => null;
- static set staticSetter(x) => x;
- static staticMethod() => null;
-
- static var _staticVariable;
- static get _staticGetter => null;
- static set _staticSetter(x) => x;
- static _staticMethod() => null;
-}
-
-main() {
- ClassMirror cm = reflect(new A<String>()).type;
- Expect.setEquals([
- 'Variable(s(_instanceVariable) in s(A), private)',
- 'Variable(s(_staticVariable) in s(A), private, static)',
- 'Variable(s(instanceVariable) in s(A))',
- 'Variable(s(staticVariable) in s(A), static)'
- ], cm.declarations.values.where((dm) => dm is VariableMirror).map(stringify),
- 'variables');
-
- Expect.setEquals(
- [
- 'Method(s(_instanceGetter) in s(A), private, getter)',
- 'Method(s(_staticGetter) in s(A), private, static, getter)',
- 'Method(s(instanceGetter) in s(A), getter)',
- 'Method(s(staticGetter) in s(A), static, getter)'
- ],
- cm.declarations.values
- .where((dm) => dm is MethodMirror && dm.isGetter)
- .map(stringify),
- 'getters');
-
- Expect.setEquals(
- [
- 'Method(s(_instanceSetter=) in s(A), private, setter)',
- 'Method(s(_staticSetter=) in s(A), private, static, setter)',
- 'Method(s(instanceSetter=) in s(A), setter)',
- 'Method(s(staticSetter=) in s(A), static, setter)'
- ],
- cm.declarations.values
- .where((dm) => dm is MethodMirror && dm.isSetter)
- .map(stringify),
- 'setters');
-
- Expect.setEquals(
- [
- 'Method(s(_instanceMethod) in s(A), private)',
- 'Method(s(_staticMethod) in s(A), private, static)',
- 'Method(s(instanceMethod) in s(A))',
- 'Method(s(staticMethod) in s(A), static)'
- ],
- cm.declarations.values
- .where((dm) => dm is MethodMirror && dm.isRegularMethod)
- .map(stringify),
- 'methods');
-
- Expect.setEquals(
- ['Method(s(A) in s(A), constructor)'],
- cm.declarations.values
- .where((dm) => dm is MethodMirror && dm.isConstructor)
- .map(stringify),
- 'constructors');
-
- Expect.setEquals(
- [
- 'TypeVariable(s(T) in s(A), upperBound = Class(s(Object) in '
- 's(dart.core), top-level))'
- ],
- cm.declarations.values
- .where((dm) => dm is TypeVariableMirror)
- .map(stringify),
- 'type variables');
-}
diff --git a/tests/lib_strong/mirrors/generic_f_bounded_mixin_application_test.dart b/tests/lib_strong/mirrors/generic_f_bounded_mixin_application_test.dart
deleted file mode 100644
index 2b8d81e..0000000
--- a/tests/lib_strong/mirrors/generic_f_bounded_mixin_application_test.dart
+++ /dev/null
@@ -1,122 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library test.generic_f_bounded;
-
-import 'dart:mirrors';
-
-import 'package:expect/expect.dart';
-
-import 'generics_helper.dart';
-
-class Collection<C> {}
-
-class Serializable<S> {}
-
-class OrderedCollection<V> extends Collection<V>
- with Serializable<OrderedCollection<V>> {}
-
-class AbstractOrderedCollection<W> = Collection<W>
- with Serializable<AbstractOrderedCollection<W>>;
-
-class CustomOrderedCollection<Z> extends AbstractOrderedCollection<Z> {}
-
-class OrderedIntegerCollection extends OrderedCollection<int> {}
-
-class CustomOrderedIntegerCollection extends CustomOrderedCollection<int> {}
-
-class Serializer<R extends Serializable<R>> {}
-
-class CollectionSerializer extends Serializer<Collection> {}
-
-class OrderedCollectionSerializer extends Serializer<OrderedCollection> {}
-
-main() {
- ClassMirror collectionDecl = reflectClass(Collection);
- ClassMirror serializableDecl = reflectClass(Serializable);
- ClassMirror orderedCollectionDecl = reflectClass(OrderedCollection);
- ClassMirror abstractOrderedCollectionDecl =
- reflectClass(AbstractOrderedCollection);
- ClassMirror customOrderedCollectionDecl =
- reflectClass(CustomOrderedCollection);
- ClassMirror orderedIntegerCollection = reflectClass(OrderedIntegerCollection);
- ClassMirror customOrderedIntegerCollection =
- reflectClass(CustomOrderedIntegerCollection);
- ClassMirror serializerDecl = reflectClass(Serializer);
- ClassMirror collectionSerializerDecl = reflectClass(CollectionSerializer);
- ClassMirror orderedCollectionSerializerDecl =
- reflectClass(OrderedCollectionSerializer);
-
- ClassMirror orderedCollectionOfInt = orderedIntegerCollection.superclass;
- ClassMirror customOrderedCollectionOfInt =
- customOrderedIntegerCollection.superclass;
- ClassMirror serializerOfCollection = collectionSerializerDecl.superclass;
- ClassMirror serializerOfOrderedCollection =
- orderedCollectionSerializerDecl.superclass;
- ClassMirror collectionOfDynamic = reflect(new Collection()).type;
- ClassMirror orderedCollectionOfDynamic =
- reflect(new OrderedCollection()).type;
- ClassMirror collectionWithSerializableOfOrderedCollection =
- orderedCollectionDecl.superclass;
-
- Expect.isTrue(collectionDecl.isOriginalDeclaration);
- Expect.isTrue(serializableDecl.isOriginalDeclaration);
- Expect.isTrue(orderedCollectionDecl.isOriginalDeclaration);
- Expect.isTrue(abstractOrderedCollectionDecl.isOriginalDeclaration);
- Expect.isTrue(customOrderedCollectionDecl.isOriginalDeclaration);
- Expect.isTrue(orderedIntegerCollection.isOriginalDeclaration);
- Expect.isTrue(customOrderedIntegerCollection.isOriginalDeclaration);
- Expect.isTrue(serializerDecl.isOriginalDeclaration);
- Expect.isTrue(collectionSerializerDecl.isOriginalDeclaration);
- Expect.isTrue(orderedCollectionSerializerDecl.isOriginalDeclaration);
-
- Expect.isFalse(orderedCollectionOfInt.isOriginalDeclaration);
- Expect.isFalse(customOrderedCollectionOfInt.isOriginalDeclaration);
- Expect.isFalse(serializerOfCollection.isOriginalDeclaration);
- Expect.isFalse(serializerOfOrderedCollection.isOriginalDeclaration);
- Expect.isFalse(collectionOfDynamic.isOriginalDeclaration);
- Expect.isFalse(
- collectionWithSerializableOfOrderedCollection.isOriginalDeclaration);
-
- TypeVariableMirror rFromSerializer = serializerDecl.typeVariables.single;
- ClassMirror serializableOfR = rFromSerializer.upperBound;
- Expect.isFalse(serializableOfR.isOriginalDeclaration);
- Expect.equals(serializableDecl, serializableOfR.originalDeclaration);
- Expect.equals(rFromSerializer, serializableOfR.typeArguments.single);
-
- typeParameters(collectionDecl, [#C]);
- typeParameters(serializableDecl, [#S]);
- typeParameters(orderedCollectionDecl, [#V]);
- typeParameters(abstractOrderedCollectionDecl, [#W]);
- typeParameters(customOrderedCollectionDecl, [#Z]);
- typeParameters(orderedIntegerCollection, []);
- typeParameters(customOrderedIntegerCollection, []);
- typeParameters(serializerDecl, [#R]);
- typeParameters(collectionSerializerDecl, []);
- typeParameters(orderedCollectionSerializerDecl, []);
-
- typeParameters(orderedCollectionOfInt, [#V]);
- typeParameters(customOrderedCollectionOfInt, [#Z]);
- typeParameters(serializerOfCollection, [#R]);
- typeParameters(serializerOfOrderedCollection, [#R]);
- typeParameters(collectionOfDynamic, [#C]);
- typeParameters(collectionWithSerializableOfOrderedCollection, []);
-
- typeArguments(collectionDecl, []);
- typeArguments(serializableDecl, []);
- typeArguments(orderedCollectionDecl, []);
- typeArguments(abstractOrderedCollectionDecl, []);
- typeArguments(customOrderedCollectionDecl, []);
- typeArguments(orderedIntegerCollection, []);
- typeArguments(customOrderedIntegerCollection, []);
- typeArguments(serializerDecl, []);
- typeArguments(collectionSerializerDecl, []);
- typeArguments(orderedCollectionSerializerDecl, []);
-
- typeArguments(orderedCollectionOfInt, [reflectClass(int)]);
- typeArguments(customOrderedCollectionOfInt, [reflectClass(int)]);
- typeArguments(serializerOfCollection, [collectionOfDynamic]);
- typeArguments(serializerOfOrderedCollection, [orderedCollectionOfDynamic]);
- typeArguments(collectionWithSerializableOfOrderedCollection, []);
-}
diff --git a/tests/lib_strong/mirrors/generic_f_bounded_test.dart b/tests/lib_strong/mirrors/generic_f_bounded_test.dart
deleted file mode 100644
index 1ddf7e4..0000000
--- a/tests/lib_strong/mirrors/generic_f_bounded_test.dart
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library test.generic_f_bounded;
-
-import 'dart:mirrors';
-
-import 'package:expect/expect.dart';
-
-import 'generics_helper.dart';
-
-class Magnitude<T> {}
-
-class Real extends Magnitude<Real> {}
-
-class Sorter<R extends Magnitude<R>> {}
-
-class RealSorter extends Sorter<Real> {}
-
-main() {
- ClassMirror magnitudeDecl = reflectClass(Magnitude);
- ClassMirror realDecl = reflectClass(Real);
- ClassMirror sorterDecl = reflectClass(Sorter);
- ClassMirror realSorterDecl = reflectClass(RealSorter);
- ClassMirror magnitudeOfReal = realDecl.superclass;
- ClassMirror sorterOfReal = realSorterDecl.superclass;
-
- Expect.isTrue(magnitudeDecl.isOriginalDeclaration);
- Expect.isTrue(realDecl.isOriginalDeclaration);
- Expect.isTrue(sorterDecl.isOriginalDeclaration);
- Expect.isTrue(realSorterDecl.isOriginalDeclaration);
- Expect.isFalse(magnitudeOfReal.isOriginalDeclaration);
- Expect.isFalse(sorterOfReal.isOriginalDeclaration);
-
- TypeVariableMirror tFromMagnitude = magnitudeDecl.typeVariables.single;
- TypeVariableMirror rFromSorter = sorterDecl.typeVariables.single;
-
- Expect.equals(reflectClass(Object), tFromMagnitude.upperBound);
-
- ClassMirror magnitudeOfR = rFromSorter.upperBound;
- Expect.isFalse(magnitudeOfR.isOriginalDeclaration);
- Expect.equals(magnitudeDecl, magnitudeOfR.originalDeclaration);
- Expect.equals(rFromSorter, magnitudeOfR.typeArguments.single);
-
- typeParameters(magnitudeDecl, [#T]);
- typeParameters(realDecl, []);
- typeParameters(sorterDecl, [#R]);
- typeParameters(realSorterDecl, []);
- typeParameters(magnitudeOfReal, [#T]);
- typeParameters(sorterOfReal, [#R]);
- typeParameters(magnitudeOfR, [#T]);
-
- typeArguments(magnitudeDecl, []);
- typeArguments(realDecl, []);
- typeArguments(sorterDecl, []);
- typeArguments(realSorterDecl, []);
- typeArguments(magnitudeOfReal, [realDecl]); //# 01: ok
- typeArguments(sorterOfReal, [realDecl]); //# 01: ok
- typeArguments(magnitudeOfR, [rFromSorter]);
-}
diff --git a/tests/lib_strong/mirrors/generic_function_typedef_test.dart b/tests/lib_strong/mirrors/generic_function_typedef_test.dart
deleted file mode 100644
index e119d51..0000000
--- a/tests/lib_strong/mirrors/generic_function_typedef_test.dart
+++ /dev/null
@@ -1,125 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library test.generic_function_typedef;
-
-import 'dart:mirrors';
-
-import 'package:expect/expect.dart';
-
-import 'generics_helper.dart';
-
-typedef bool NonGenericPredicate(num n);
-typedef bool GenericPredicate<T>(T t);
-typedef S GenericTransform<S>(S s);
-
-class C<R> {
- GenericPredicate<num> predicateOfNum;
- GenericTransform<String> transformOfString;
- GenericTransform<R> transformOfR;
-}
-
-reflectTypeDeclaration(t) => reflectType(t).originalDeclaration;
-
-main() {
- TypeMirror dynamicMirror = currentMirrorSystem().dynamicType;
-
- TypedefMirror predicateOfNum =
- (reflectClass(C).declarations[#predicateOfNum] as VariableMirror).type;
- TypedefMirror transformOfString =
- (reflectClass(C).declarations[#transformOfString] as VariableMirror).type;
- TypedefMirror transformOfR =
- (reflectClass(C).declarations[#transformOfR] as VariableMirror).type;
- TypedefMirror transformOfDouble = (reflect(new C<double>())
- .type
- .declarations[#transformOfR] as VariableMirror)
- .type;
-
- TypeVariableMirror tFromGenericPredicate =
- reflectTypeDeclaration(GenericPredicate).typeVariables[0];
- TypeVariableMirror sFromGenericTransform =
- reflectTypeDeclaration(GenericTransform).typeVariables[0];
- TypeVariableMirror rFromC = reflectClass(C).typeVariables[0];
-
- // Typedefs.
- typeParameters(reflectTypeDeclaration(NonGenericPredicate), []);
- typeParameters(reflectTypeDeclaration(GenericPredicate), [#T]);
- typeParameters(reflectTypeDeclaration(GenericTransform), [#S]);
- typeParameters(predicateOfNum, [#T]);
- typeParameters(transformOfString, [#S]);
- typeParameters(transformOfR, [#S]);
- typeParameters(transformOfDouble, [#S]);
-
- typeArguments(reflectTypeDeclaration(NonGenericPredicate), []);
- typeArguments(reflectTypeDeclaration(GenericPredicate), []);
- typeArguments(reflectTypeDeclaration(GenericTransform), []);
- typeArguments(predicateOfNum, [reflectClass(num)]);
- typeArguments(transformOfString, [reflectClass(String)]);
- typeArguments(transformOfR, [rFromC]);
- typeArguments(transformOfDouble, [reflectClass(double)]);
-
- Expect.isTrue(
- reflectTypeDeclaration(NonGenericPredicate).isOriginalDeclaration);
- Expect.isTrue(reflectTypeDeclaration(GenericPredicate).isOriginalDeclaration);
- Expect.isTrue(reflectTypeDeclaration(GenericTransform).isOriginalDeclaration);
- Expect.isFalse(predicateOfNum.isOriginalDeclaration);
- Expect.isFalse(transformOfString.isOriginalDeclaration);
- Expect.isFalse(transformOfR.isOriginalDeclaration);
- Expect.isFalse(transformOfDouble.isOriginalDeclaration);
-
- // Function types.
- typeParameters(reflectTypeDeclaration(NonGenericPredicate).referent, []);
- typeParameters(reflectTypeDeclaration(GenericPredicate).referent, []);
- typeParameters(reflectTypeDeclaration(GenericTransform).referent, []);
- typeParameters(predicateOfNum.referent, []);
- typeParameters(transformOfString.referent, []);
- typeParameters(transformOfR.referent, []);
- typeParameters(transformOfDouble.referent, []);
-
- typeArguments(reflectTypeDeclaration(NonGenericPredicate).referent, []);
- typeArguments(reflectTypeDeclaration(GenericPredicate).referent, []);
- typeArguments(reflectTypeDeclaration(GenericTransform).referent, []);
- typeArguments(predicateOfNum.referent, []);
- typeArguments(transformOfString.referent, []);
- typeArguments(transformOfR.referent, []);
- typeArguments(transformOfDouble.referent, []);
-
- // Function types are always non-generic. Only the typedef is generic.
- Expect.isTrue(reflectTypeDeclaration(NonGenericPredicate)
- .referent
- .isOriginalDeclaration);
- Expect.isTrue(
- reflectTypeDeclaration(GenericPredicate).referent.isOriginalDeclaration);
- Expect.isTrue(
- reflectTypeDeclaration(GenericTransform).referent.isOriginalDeclaration);
- Expect.isTrue(predicateOfNum.referent.isOriginalDeclaration);
- Expect.isTrue(transformOfString.referent.isOriginalDeclaration);
- Expect.isTrue(transformOfR.referent.isOriginalDeclaration);
- Expect.isTrue(transformOfDouble.referent.isOriginalDeclaration);
-
- Expect.equals(reflectClass(num),
- reflectTypeDeclaration(NonGenericPredicate).referent.parameters[0].type);
- Expect.equals(tFromGenericPredicate,
- reflectTypeDeclaration(GenericPredicate).referent.parameters[0].type);
- Expect.equals(sFromGenericTransform,
- reflectTypeDeclaration(GenericTransform).referent.parameters[0].type);
-
- Expect.equals(reflectClass(num), predicateOfNum.referent.parameters[0].type);
- Expect.equals(
- reflectClass(String), transformOfString.referent.parameters[0].type);
- Expect.equals(rFromC, transformOfR.referent.parameters[0].type);
- Expect.equals(
- reflectClass(double), transformOfDouble.referent.parameters[0].type);
-
- Expect.equals(reflectClass(bool),
- reflectTypeDeclaration(NonGenericPredicate).referent.returnType);
- Expect.equals(reflectClass(bool),
- reflectTypeDeclaration(GenericPredicate).referent.returnType);
- Expect.equals(sFromGenericTransform,
- reflectTypeDeclaration(GenericTransform).referent.returnType);
- Expect.equals(reflectClass(bool), predicateOfNum.referent.returnType);
- Expect.equals(reflectClass(String), transformOfString.referent.returnType);
- Expect.equals(rFromC, transformOfR.referent.returnType);
- Expect.equals(reflectClass(double), transformOfDouble.referent.returnType);
-}
diff --git a/tests/lib_strong/mirrors/generic_interface_test.dart b/tests/lib_strong/mirrors/generic_interface_test.dart
deleted file mode 100644
index 053569c..0000000
--- a/tests/lib_strong/mirrors/generic_interface_test.dart
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library test.generic_bounded;
-
-import 'dart:mirrors';
-
-import 'package:expect/expect.dart';
-
-import 'generics_helper.dart';
-
-class Interface<T> {}
-
-class Bounded<S extends num> {}
-
-class Fixed implements Interface<int> {}
-
-class Generic<R> implements Interface<R> {}
-
-class Bienbounded implements Bounded<int> {}
-
-class Malbounded implements Bounded<String> {} // //# 01: static type warning
-class FBounded implements Interface<FBounded> {}
-
-class Mixin {}
-
-class FixedMixinApplication = Object with Mixin implements Interface<int>;
-class GenericMixinApplication<X> = Object with Mixin implements Interface<X>;
-
-class FixedClass extends Object with Mixin implements Interface<int> {}
-
-class GenericClass<Y> extends Object with Mixin implements Interface<Y> {}
-
-main() {
- TypeMirror dynamicMirror = currentMirrorSystem().dynamicType;
-
- ClassMirror interfaceDecl = reflectClass(Interface);
- ClassMirror boundedDecl = reflectClass(Bounded);
-
- ClassMirror interfaceOfInt = reflectClass(Fixed).superinterfaces.single;
- ClassMirror interfaceOfR = reflectClass(Generic).superinterfaces.single;
- ClassMirror interfaceOfBool =
- reflect(new Generic<bool>()).type.superinterfaces.single;
-
- ClassMirror boundedOfInt = reflectClass(Bienbounded).superinterfaces.single;
- ClassMirror boundedOfString = reflectClass(Malbounded).superinterfaces.single; // //# 01: continued
- ClassMirror interfaceOfFBounded =
- reflectClass(FBounded).superinterfaces.single;
-
- ClassMirror interfaceOfInt2 =
- reflectClass(FixedMixinApplication).superinterfaces.single;
- ClassMirror interfaceOfX =
- reflectClass(GenericMixinApplication).superinterfaces.single;
- ClassMirror interfaceOfDouble = reflect(new GenericMixinApplication<double>())
- .type
- .superinterfaces
- .single;
- ClassMirror interfaceOfInt3 = reflectClass(FixedClass).superinterfaces.single;
- ClassMirror interfaceOfY = reflectClass(GenericClass).superinterfaces.single;
- ClassMirror interfaceOfDouble2 =
- reflect(new GenericClass<double>()).type.superinterfaces.single;
-
- Expect.isTrue(interfaceDecl.isOriginalDeclaration);
- Expect.isTrue(boundedDecl.isOriginalDeclaration);
-
- Expect.isFalse(interfaceOfInt.isOriginalDeclaration);
- Expect.isFalse(interfaceOfR.isOriginalDeclaration);
- Expect.isFalse(interfaceOfBool.isOriginalDeclaration);
- Expect.isFalse(boundedOfInt.isOriginalDeclaration);
- Expect.isFalse(boundedOfString.isOriginalDeclaration); // //# 01: continued
- Expect.isFalse(interfaceOfFBounded.isOriginalDeclaration);
- Expect.isFalse(interfaceOfInt2.isOriginalDeclaration);
- Expect.isFalse(interfaceOfX.isOriginalDeclaration);
- Expect.isFalse(interfaceOfDouble.isOriginalDeclaration);
- Expect.isFalse(interfaceOfInt3.isOriginalDeclaration);
- Expect.isFalse(interfaceOfY.isOriginalDeclaration);
- Expect.isFalse(interfaceOfDouble2.isOriginalDeclaration);
-
- TypeVariableMirror tFromInterface = interfaceDecl.typeVariables.single;
- TypeVariableMirror sFromBounded = boundedDecl.typeVariables.single;
- TypeVariableMirror rFromGeneric = reflectClass(Generic).typeVariables.single;
- TypeVariableMirror xFromGenericMixinApplication =
- reflectClass(GenericMixinApplication).typeVariables.single;
- TypeVariableMirror yFromGenericClass =
- reflectClass(GenericClass).typeVariables.single;
-
- Expect.equals(reflectClass(Object), tFromInterface.upperBound);
- Expect.equals(reflectClass(num), sFromBounded.upperBound);
- Expect.equals(reflectClass(Object), rFromGeneric.upperBound);
- Expect.equals(reflectClass(Object), xFromGenericMixinApplication.upperBound);
- Expect.equals(reflectClass(Object), yFromGenericClass.upperBound);
-
- typeParameters(interfaceDecl, [#T]);
- typeParameters(boundedDecl, [#S]);
- typeParameters(interfaceOfInt, [#T]);
- typeParameters(interfaceOfR, [#T]);
- typeParameters(interfaceOfBool, [#T]);
- typeParameters(boundedOfInt, [#S]);
- typeParameters(boundedOfString, [#S]); // //# 01: continued
- typeParameters(interfaceOfFBounded, [#T]);
- typeParameters(interfaceOfInt2, [#T]);
- typeParameters(interfaceOfX, [#T]);
- typeParameters(interfaceOfDouble, [#T]);
- typeParameters(interfaceOfInt3, [#T]);
- typeParameters(interfaceOfY, [#T]);
- typeParameters(interfaceOfDouble2, [#T]);
-
- typeArguments(interfaceDecl, []);
- typeArguments(boundedDecl, []);
- typeArguments(interfaceOfInt, [reflectClass(int)]);
- typeArguments(interfaceOfR, [rFromGeneric]);
- typeArguments(interfaceOfBool, [reflectClass(bool)]);
- typeArguments(boundedOfInt, [reflectClass(int)]);
- typeArguments(boundedOfString, [reflectClass(String)]); // //# 01: continued
- typeArguments(interfaceOfFBounded, [reflectClass(FBounded)]);
- typeArguments(interfaceOfInt2, [reflectClass(int)]);
- typeArguments(interfaceOfX, [xFromGenericMixinApplication]);
- typeArguments(interfaceOfDouble, [reflectClass(double)]);
- typeArguments(interfaceOfInt3, [reflectClass(int)]);
- typeArguments(interfaceOfY, [yFromGenericClass]);
- typeArguments(interfaceOfDouble2, [reflectClass(double)]);
-}
diff --git a/tests/lib_strong/mirrors/generics_helper.dart b/tests/lib_strong/mirrors/generics_helper.dart
deleted file mode 100644
index da10962..0000000
--- a/tests/lib_strong/mirrors/generics_helper.dart
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library generics_helper;
-
-import 'package:expect/expect.dart';
-
-typeParameters(mirror, parameterNames) {
- Expect.listEquals(
- parameterNames, mirror.typeVariables.map((v) => v.simpleName).toList());
-}
-
-typeArguments(mirror, argumentMirrors) {
- Expect.listEquals(argumentMirrors, mirror.typeArguments);
-}
diff --git a/tests/lib_strong/mirrors/library_with_annotated_declaration.dart b/tests/lib_strong/mirrors/library_with_annotated_declaration.dart
deleted file mode 100644
index 07a498b..0000000
--- a/tests/lib_strong/mirrors/library_with_annotated_declaration.dart
+++ /dev/null
@@ -1,10 +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.
-
-@metadata
-library library_with_annotated_declaration;
-
-const metadata = 'metadata';
-
-class ClassInLibraryWithAnnotatedDeclaration {}
diff --git a/tests/lib_strong/mirrors/library_without_declaration.dart b/tests/lib_strong/mirrors/library_without_declaration.dart
deleted file mode 100644
index d9e1fe4..0000000
--- a/tests/lib_strong/mirrors/library_without_declaration.dart
+++ /dev/null
@@ -1,7 +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.
-
-// NO LIBRARY DECLARATION
-
-class ClassInLibraryWithoutDeclaration {}
diff --git a/tests/lib_strong/mirrors/metadata_test.dart b/tests/lib_strong/mirrors/metadata_test.dart
deleted file mode 100644
index 2fe04fa..0000000
--- a/tests/lib_strong/mirrors/metadata_test.dart
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library test.metadata_test;
-
-import 'dart:mirrors';
-
-const string = 'a metadata string';
-
-const symbol = const Symbol('symbol');
-
-const hest = 'hest';
-
-@symbol
-@string
-class MyClass {
- @hest
- @hest
- @symbol
- var x;
- var y;
-
- @string
- @symbol
- @string
- myMethod() => 1;
- myOtherMethod() => 2;
-}
-
-checkMetadata(DeclarationMirror mirror, List expectedMetadata) {
- List metadata = mirror.metadata.map((m) => m.reflectee).toList();
- if (metadata == null) {
- throw 'Null metadata on $mirror';
- }
- int expectedLength = expectedMetadata.length;
- int actualLength = metadata.length;
- if (expectedLength != actualLength) {
- throw 'Expected length = $expectedLength, but got length = $actualLength.';
- }
- for (int i = 0; i < expectedLength; i++) {
- if (metadata[i] != expectedMetadata[i]) {
- throw '${metadata[i]} is not "${expectedMetadata[i]}"'
- ' in $mirror at index $i';
- }
- }
- print(metadata);
-}
-
-@symbol
-@string
-@symbol
-main() {
- if (MirrorSystem.getName(symbol) != 'symbol') {
- // This happened in dart2js due to how early library metadata is
- // computed.
- throw 'Bad constant: $symbol';
- }
-
- MirrorSystem mirrors = currentMirrorSystem();
- ClassMirror myClassMirror = reflectClass(MyClass);
- checkMetadata(myClassMirror, [symbol, string]);
- LibraryMirror lib = mirrors.findLibrary(#test.metadata_test);
- MethodMirror function = lib.declarations[#main];
- checkMetadata(function, [symbol, string, symbol]);
- MethodMirror method = myClassMirror.declarations[#myMethod];
- checkMetadata(method, [string, symbol, string]);
- method = myClassMirror.declarations[#myOtherMethod];
- checkMetadata(method, []);
-
- VariableMirror xMirror = myClassMirror.declarations[#x];
- checkMetadata(xMirror, [hest, hest, symbol]);
-
- VariableMirror yMirror = myClassMirror.declarations[#y];
- checkMetadata(yMirror, []);
-
- // TODO(ahe): Test local functions.
-}
diff --git a/tests/lib_strong/mirrors/mirrors_test.dart b/tests/lib_strong/mirrors/mirrors_test.dart
deleted file mode 100644
index ccd6f50..0000000
--- a/tests/lib_strong/mirrors/mirrors_test.dart
+++ /dev/null
@@ -1,247 +0,0 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library MirrorsTest;
-
-import 'dart:mirrors';
-
-import '../../light_unittest.dart';
-
-bool isDart2js = false; // TODO(ahe): Remove this field.
-
-var topLevelField;
-u(a, b, c) => {"a": a, "b": b, "c": c};
-_v(a, b) => a + b;
-
-class Class<T> {
- Class() {
- this.field = "default value";
- }
- Class.withInitialValue(this.field);
- var field;
-
- Class.generative(this.field);
- Class.redirecting(y) : this.generative(y * 2);
- factory Class.faktory(y) => new Class.withInitialValue(y * 3);
- factory Class.redirectingFactory(y) = Class.faktory;
-
- m(a, b, c) => {"a": a, "b": b, "c": c};
- _n(a, b) => a + b;
- noSuchMethod(invocation) => "DNU";
-
- static var staticField;
- static s(a, b, c) => {"a": a, "b": b, "c": c};
- static _t(a, b) => a + b;
-}
-
-typedef Typedef();
-
-testInvoke(mirrors) {
- var instance = new Class();
- var instMirror = reflect(instance);
-
- expect(instMirror.invoke(#m, ['A', 'B', instance]).reflectee,
- equals({"a": 'A', "b": 'B', "c": instance}));
- expect(instMirror.invoke(#notDefined, []).reflectee, equals("DNU"));
- expect(instMirror.invoke(#m, []).reflectee, equals("DNU")); // Wrong arity.
-
- var classMirror = instMirror.type;
- expect(classMirror.invoke(#s, ['A', 'B', instance]).reflectee,
- equals({"a": 'A', "b": 'B', "c": instance}));
- expect(() => classMirror.invoke(#notDefined, []).reflectee, throws);
- expect(() => classMirror.invoke(#s, []).reflectee, throws); // Wrong arity.
-
- var libMirror = classMirror.owner;
- expect(libMirror.invoke(#u, ['A', 'B', instance]).reflectee,
- equals({"a": 'A', "b": 'B', "c": instance}));
- expect(() => libMirror.invoke(#notDefined, []).reflectee, throws);
- expect(() => libMirror.invoke(#u, []).reflectee, throws); // Wrong arity.
-}
-
-/// In dart2js, lists, numbers, and other objects are treated special
-/// and their methods are invoked through a techique called interceptors.
-testIntercepted(mirrors) {
- var instance = 1;
- var instMirror = reflect(instance);
-
- expect(instMirror.invoke(#toString, []).reflectee, equals('1'));
-
- instance = [];
- instMirror = reflect(instance);
- instMirror.setField(#length, 44);
- var resultMirror = instMirror.getField(#length);
- expect(resultMirror.reflectee, equals(44));
- expect(instance.length, equals(44));
-
- expect(
- instMirror.invoke(#toString, []).reflectee,
- equals('[null, null, null, null, null, null, null, null, null, null,'
- ' null, null, null, null, null, null, null, null, null, null,'
- ' null, null, null, null, null, null, null, null, null, null,'
- ' null, null, null, null, null, null, null, null, null, null,'
- ' null, null, null, null]'));
-}
-
-testFieldAccess(mirrors) {
- var instance = new Class();
-
- var libMirror = mirrors.findLibrary(#MirrorsTest);
- var classMirror = libMirror.declarations[#Class];
- var instMirror = reflect(instance);
- var fieldMirror = classMirror.declarations[#field];
- var future;
-
- expect(fieldMirror is VariableMirror, isTrue);
- expect(fieldMirror.type, equals(mirrors.dynamicType));
-
- libMirror.setField(#topLevelField, [91]);
- expect(libMirror.getField(#topLevelField).reflectee, equals([91]));
- expect(topLevelField, equals([91]));
-}
-
-testClosureMirrors(mirrors) {
- // TODO(ahe): Test optional parameters (named or not).
- var closure = (x, y, z) {
- return x + y + z;
- };
-
- var mirror = reflect(closure);
- expect(mirror is ClosureMirror, equals(true));
-
- var funcMirror = mirror.function;
- expect(funcMirror is MethodMirror, equals(true));
- expect(funcMirror.parameters.length, equals(3));
-
- expect(mirror.apply([7, 8, 9]).reflectee, equals(24));
-}
-
-testInvokeConstructor(mirrors) {
- var classMirror = reflectClass(Class);
-
- var instanceMirror = classMirror.newInstance(const Symbol(''), []);
- expect(instanceMirror.reflectee is Class, equals(true));
- expect(instanceMirror.reflectee.field, equals("default value"));
-
- instanceMirror = classMirror.newInstance(#withInitialValue, [45]);
- expect(instanceMirror.reflectee is Class, equals(true));
- expect(instanceMirror.reflectee.field, equals(45));
-
- instanceMirror = classMirror.newInstance(#generative, [7]);
- expect(instanceMirror.reflectee is Class, equals(true));
- expect(instanceMirror.reflectee.field, equals(7));
-
- instanceMirror = classMirror.newInstance(#redirecting, [8]);
- expect(instanceMirror.reflectee is Class, equals(true));
- expect(instanceMirror.reflectee.field, equals(16));
-
- instanceMirror = classMirror.newInstance(#faktory, [9]);
- expect(instanceMirror.reflectee is Class, equals(true));
- expect(instanceMirror.reflectee.field, equals(27));
-
- instanceMirror = classMirror.newInstance(#redirectingFactory, [10]);
- expect(instanceMirror.reflectee is Class, equals(true));
- expect(instanceMirror.reflectee.field, equals(30));
-}
-
-testReflectClass(mirrors) {
- var classMirror = reflectClass(Class);
- expect(classMirror is ClassMirror, equals(true));
- var symbolClassMirror = reflectClass(Symbol);
- var symbolMirror =
- symbolClassMirror.newInstance(const Symbol(''), ['withInitialValue']);
- var objectMirror = classMirror.newInstance(symbolMirror.reflectee, [1234]);
- expect(objectMirror.reflectee is Class, equals(true));
- expect(objectMirror.reflectee.field, equals(1234));
-}
-
-testNames(mirrors) {
- var libMirror = mirrors.findLibrary(#MirrorsTest);
- var classMirror = libMirror.declarations[#Class];
- var typedefMirror = libMirror.declarations[#Typedef];
- var methodMirror = libMirror.declarations[#testNames];
- var variableMirror = classMirror.declarations[#field];
-
- expect(libMirror.simpleName, equals(#MirrorsTest));
- expect(libMirror.qualifiedName, equals(#MirrorsTest));
-
- expect(classMirror.simpleName, equals(#Class));
- expect(classMirror.qualifiedName, equals(#MirrorsTest.Class));
-
- TypeVariableMirror typeVariable = classMirror.typeVariables.single;
- expect(typeVariable.simpleName, equals(#T));
- expect(
- typeVariable.qualifiedName, equals(const Symbol('MirrorsTest.Class.T')));
-
- if (!isDart2js) {
- // TODO(ahe): Implement this in dart2js.
- expect(typedefMirror.simpleName, equals(#Typedef));
- expect(typedefMirror.qualifiedName,
- equals(const Symbol('MirrorsTest.Typedef')));
-
- var typedefMirrorDeNovo = reflectType(Typedef);
- expect(typedefMirrorDeNovo.simpleName, equals(#Typedef));
- expect(typedefMirrorDeNovo.qualifiedName,
- equals(const Symbol('MirrorsTest.Typedef')));
- }
-
- expect(methodMirror.simpleName, equals(#testNames));
- expect(methodMirror.qualifiedName,
- equals(const Symbol('MirrorsTest.testNames')));
-
- expect(variableMirror.simpleName, equals(#field));
- expect(variableMirror.qualifiedName,
- equals(const Symbol('MirrorsTest.Class.field')));
-}
-
-testLibraryUri(var value, bool check(Uri)) {
- var valueMirror = reflect(value);
- ClassMirror valueClass = valueMirror.type;
- LibraryMirror valueLibrary = valueClass.owner;
- Uri uri = valueLibrary.uri;
- if (uri.scheme != "https" ||
- uri.host != "dartlang.org" ||
- uri.path != "/dart2js-stripped-uri") {
- expect(check(uri), isTrue);
- }
-}
-
-main() {
- var mirrors = currentMirrorSystem();
- test("Test reflective method invocation", () {
- testInvoke(mirrors);
- });
- test('Test intercepted objects', () {
- testIntercepted(mirrors);
- });
- test("Test field access", () {
- testFieldAccess(mirrors);
- });
- test("Test closure mirrors", () {
- testClosureMirrors(mirrors);
- });
- test("Test invoke constructor", () {
- testInvokeConstructor(mirrors);
- });
- test("Test current library uri", () {
- testLibraryUri(
- new Class(),
- // TODO(floitsch): change this to "/mirrors_test.dart" when
- // dart2js_mirrors_test.dart has been removed.
- (Uri uri) => uri.path.endsWith('mirrors_test.dart'));
- });
- test("Test dart library uri", () {
- testLibraryUri("test", (Uri uri) {
- if (uri == Uri.parse('dart:core')) return true;
- // TODO(floitsch): do we want to fake the interceptors to
- // be in dart:core?
- return (uri == Uri.parse('dart:_interceptors'));
- });
- });
- test("Test simple and qualifiedName", () {
- testNames(mirrors);
- });
- test("Test reflect type", () {
- testReflectClass(mirrors);
- });
-}
diff --git a/tests/lib_strong/mirrors/stringify.dart b/tests/lib_strong/mirrors/stringify.dart
deleted file mode 100644
index 9047c9a..0000000
--- a/tests/lib_strong/mirrors/stringify.dart
+++ /dev/null
@@ -1,187 +0,0 @@
-// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-/// Helper methods for converting a [Mirror] to a [String].
-library test.stringify;
-
-import 'dart:mirrors';
-
-import 'package:expect/expect.dart';
-
-name(DeclarationMirror mirror) {
- return (mirror == null) ? '<null>' : stringify(mirror.simpleName);
-}
-
-stringifyMap(Map map) {
- var buffer = new StringBuffer();
- bool first = true;
- for (String key in map.keys.map(MirrorSystem.getName).toList()..sort()) {
- if (!first) buffer.write(', ');
- first = false;
- buffer.write(key);
- buffer.write(': ');
- buffer.write(stringify(map[new Symbol(key)]));
- }
- return '{$buffer}';
-}
-
-stringifyIterable(Iterable list) {
- var buffer = new StringBuffer();
- bool first = true;
- for (String value in list.map(stringify)) {
- if (!first) buffer.write(', ');
- first = false;
- buffer.write(value);
- }
- return '[$buffer]';
-}
-
-stringifyInstance(InstanceMirror instance) {
- var buffer = new StringBuffer();
- if (instance.hasReflectee) {
- buffer.write('value = ${stringify(instance.reflectee)}');
- }
- return 'Instance(${buffer})';
-}
-
-stringifySymbol(Symbol symbol) => 's(${MirrorSystem.getName(symbol)})';
-
-writeDeclarationOn(DeclarationMirror mirror, StringBuffer buffer) {
- buffer.write(stringify(mirror.simpleName));
- if (mirror.owner != null) {
- buffer.write(' in ');
- buffer.write(name(mirror.owner));
- }
- if (mirror.isPrivate) buffer.write(', private');
- if (mirror.isTopLevel) buffer.write(', top-level');
-}
-
-writeVariableOn(VariableMirror variable, StringBuffer buffer) {
- writeDeclarationOn(variable, buffer);
- if (variable.isStatic) buffer.write(', static');
- if (variable.isFinal) buffer.write(', final');
-}
-
-stringifyVariable(VariableMirror variable) {
- var buffer = new StringBuffer();
- writeVariableOn(variable, buffer);
- return 'Variable($buffer)';
-}
-
-stringifyParameter(ParameterMirror parameter) {
- var buffer = new StringBuffer();
- writeVariableOn(parameter, buffer);
- if (parameter.isOptional) buffer.write(', optional');
- if (parameter.isNamed) buffer.write(', named');
- // TODO(6490): dart2js always returns false for hasDefaultValue.
- if (parameter.hasDefaultValue) {
- buffer.write(', value = ${stringify(parameter.defaultValue)}');
- }
- // TODO(ahe): Move to writeVariableOn.
- buffer.write(', type = ${stringify(parameter.type)}');
- return 'Parameter($buffer)';
-}
-
-stringifyTypeVariable(TypeVariableMirror typeVariable) {
- var buffer = new StringBuffer();
- writeDeclarationOn(typeVariable, buffer);
- buffer.write(', upperBound = ${stringify(typeVariable.upperBound)}');
- return 'TypeVariable($buffer)';
-}
-
-stringifyType(TypeMirror type) {
- var buffer = new StringBuffer();
- writeDeclarationOn(type, buffer);
- return 'Type($buffer)';
-}
-
-stringifyClass(ClassMirror cls) {
- var buffer = new StringBuffer();
- writeDeclarationOn(cls, buffer);
- return 'Class($buffer)';
-}
-
-stringifyMethod(MethodMirror method) {
- var buffer = new StringBuffer();
- writeDeclarationOn(method, buffer);
- if (method.isAbstract) buffer.write(', abstract');
- if (method.isSynthetic) buffer.write(', synthetic');
- if (method.isStatic) buffer.write(', static');
- if (method.isGetter) buffer.write(', getter');
- if (method.isSetter) buffer.write(', setter');
- if (method.isConstructor) buffer.write(', constructor');
- return 'Method($buffer)';
-}
-
-stringifyDependencies(LibraryMirror l) {
- n(s) => s is Symbol ? MirrorSystem.getName(s) : s;
- compareDep(a, b) {
- if (a.targetLibrary == b.targetLibrary) {
- if ((a.prefix != null) && (b.prefix != null)) {
- return n(a.prefix).compareTo(n(b.prefix));
- }
- return a.prefix == null ? 1 : -1;
- }
- return n(a.targetLibrary.simpleName)
- .compareTo(n(b.targetLibrary.simpleName));
- }
-
- compareCom(a, b) => n(a.identifier).compareTo(n(b.identifier));
- compareFirst(a, b) => a[0].compareTo(b[0]);
- sortBy(c, p) => new List.from(c)..sort(p);
-
- var buffer = new StringBuffer();
- sortBy(l.libraryDependencies, compareDep).forEach((dep) {
- if (dep.isImport) buffer.write('import ');
- if (dep.isExport) buffer.write('export ');
- buffer.write(n(dep.targetLibrary.simpleName));
- if (dep.isDeferred) buffer.write(' deferred');
- if (dep.prefix != null) buffer.write(' as ${n(dep.prefix)}');
- buffer.write('\n');
-
- List flattenedCombinators = new List();
- dep.combinators.forEach((com) {
- com.identifiers.forEach((ident) {
- flattenedCombinators.add([n(ident), com.isShow, com.isHide]);
- });
- });
- sortBy(flattenedCombinators, compareFirst).forEach((triple) {
- buffer.write(' ');
- if (triple[1]) buffer.write('show ');
- if (triple[2]) buffer.write('hide ');
- buffer.write(triple[0]);
- buffer.write('\n');
- });
- });
- return buffer.toString();
-}
-
-stringify(value) {
- if (value is Map) return stringifyMap(value);
- if (value is Iterable) return stringifyIterable(value);
- if (value is InstanceMirror) return stringifyInstance(value);
- if (value is ParameterMirror) return stringifyParameter(value);
- if (value is VariableMirror) return stringifyVariable(value);
- if (value is MethodMirror) return stringifyMethod(value);
- if (value is num) return value.toString();
- if (value is String) return value;
- if (value is Symbol) return stringifySymbol(value);
- if (value is ClassMirror) return stringifyClass(value);
- if (value is TypeVariableMirror) return stringifyTypeVariable(value);
- if (value is TypeMirror) return stringifyType(value);
- if (value == null) return '<null>';
- throw 'Unexpected value: $value';
-}
-
-expect(expected, actual, [String reason]) {
- Expect.stringEquals(expected, stringify(actual), reason);
-}
-
-compareSymbols(Symbol a, Symbol b) {
- return MirrorSystem.getName(a).compareTo(MirrorSystem.getName(b));
-}
-
-simpleNames(Iterable<Mirror> i) => i.map((e) => e.simpleName);
-
-sort(Iterable<Symbol> symbols) => symbols.toList()..sort(compareSymbols);
diff --git a/tests/standalone/standalone.status b/tests/standalone/standalone.status
index b863bd1..44429ad 100644
--- a/tests/standalone/standalone.status
+++ b/tests/standalone/standalone.status
@@ -16,11 +16,6 @@
io/raw_secure_server_socket_argument_test: StaticWarning
io/stdout_bad_argument_test: StaticWarning
-[ $compiler == dartkp ]
-dwarf_stack_trace_test: RuntimeError
-io/https_bad_certificate_test: Skip # Flaky.
-io/raw_datagram_socket_test: Skip # Flaky.
-
# Overriding these flags are not supported in product mode.
[ $mode == product ]
verbose_gc_to_bmu_test: SkipByDesign # No verbose_gc in product mode
@@ -74,8 +69,10 @@
[ $compiler == dart2js || $compiler == dartdevc ]
*: SkipByDesign
+# We skip all the Dart 1.0 tests in dartk and dartkp mode as these
+# modes are intended only for Dart 2.0 with strong mode enabled.
[ $compiler == dartk || $compiler == dartkp ]
-io/raw_datagram_socket_test: Skip # Flaky.
+*: Skip
[ $compiler != none || $runtime != vm ]
script_snapshot_depfile_test: SkipByDesign # Only makes sense running from source.
diff --git a/tests/standalone_2/standalone_2_kernel.status b/tests/standalone_2/standalone_2_kernel.status
index c65cb4b..1b4afc1 100644
--- a/tests/standalone_2/standalone_2_kernel.status
+++ b/tests/standalone_2/standalone_2_kernel.status
@@ -65,6 +65,25 @@
regress_29350_test: MissingCompileTimeError
regress_29350_test/none: Pass # Issue 31537
+# Enabling of dartk for sim{arm,arm64,dbc64} revelaed these test failures, which
+# are to be triaged. Isolate tests are skipped on purpose due to the usage of
+# batch mode.
+[ $compiler == dartk && $strong && ($arch == simarm || $arch == simarm64) ]
+bytedata_test: CompileTimeError # Please triage.
+map_insert_remove_oom_test: Pass # Please triage.
+package/scenarios/invalid/invalid_utf8_test: Pass # Please triage.
+package/scenarios/invalid/non_existent_packages_file_test: Pass # Please triage.
+package/scenarios/packages_file_strange_formatting/empty_lines_test: CompileTimeError # Please triage.
+package/scenarios/packages_file_strange_formatting/mixed_line_ends_test: CompileTimeError # Please triage.
+package/scenarios/packages_option_only/packages_option_only_test: CompileTimeError # Please triage.
+regress_26031_test: RuntimeError # Please triage.
+regress_28854_1_test: RuntimeError # Please triage.
+regress_28854_2_test: RuntimeError # Please triage.
+typed_array_int64_uint64_test: CompileTimeError # Please triage.
+typed_array_test: RuntimeError # Please triage.
+typed_data_isolate_test: RuntimeError # Please triage.
+typed_data_view_test: CompileTimeError # Please triage.
+
# ===== Skip dartk and darkp in !$strong mode ====
[ $compiler == dartk && !$strong ]
*: SkipByDesign
diff --git a/tools/VERSION b/tools/VERSION
index 17092b6..508d185 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 0
PATCH 0
-PRERELEASE 12
+PRERELEASE 13
PRERELEASE_PATCH 0
diff --git a/tools/bots/dart2js_d8_hostchecked_tests.isolate b/tools/bots/dart2js_d8_hostchecked_tests.isolate
index 9be6fb1..5b5db4d 100644
--- a/tools/bots/dart2js_d8_hostchecked_tests.isolate
+++ b/tools/bots/dart2js_d8_hostchecked_tests.isolate
@@ -14,6 +14,7 @@
'tests/',
'pkg/async_helper/',
'pkg/compiler/',
+ 'pkg/dart_internal/',
'pkg/expect/',
'pkg/front_end/',
'pkg/js/',
diff --git a/tools/bots/dart_tests.isolate b/tools/bots/dart_tests.isolate
index bd529b6..5f635b6 100644
--- a/tools/bots/dart_tests.isolate
+++ b/tools/bots/dart_tests.isolate
@@ -15,6 +15,7 @@
'tests/',
'pkg/async_helper/',
'pkg/browser/',
+ 'pkg/dart_internal/',
'pkg/expect/',
'pkg/js/',
'pkg/meta/',
diff --git a/tools/bots/ddc_tests.py b/tools/bots/ddc_tests.py
index 94ea237..e00602b 100644
--- a/tools/bots/ddc_tests.py
+++ b/tools/bots/ddc_tests.py
@@ -16,9 +16,7 @@
TARGETS = [
'language_2',
'corelib_2',
- 'lib_2',
- # TODO(rnystrom): Remove this when all tests have been migrated out.
- 'lib_strong'
+ 'lib_2'
]
FLAGS = [
diff --git a/tools/bots/test_matrix.json b/tools/bots/test_matrix.json
index c8b4c40..6e5f830 100644
--- a/tools/bots/test_matrix.json
+++ b/tools/bots/test_matrix.json
@@ -254,6 +254,77 @@
},
{
"builders": [
+ "vm-kernel-linux-debug-simdbc64",
+ "vm-kernel-linux-release-simarm",
+ "vm-kernel-linux-release-simarm64",
+ "vm-kernel-linux-release-simdbc64"
+ ],
+ "meta": {
+ "description": "This configuration is used by the simarm/simdbc vm kernel builders."
+ },
+ "steps": [
+ {
+ "name": "build dart",
+ "script": "tools/build.py",
+ "arguments": ["runtime_kernel"]
+ },
+ {
+ "name": "dartk tests",
+ "arguments": ["-cdartk"]
+ },
+ {
+ "name": "dartk strong tests",
+ "arguments": [
+ "-cdartk",
+ "--strong",
+ "language_2",
+ "corelib_2",
+ "lib_2",
+ "standalone_2"
+ ]
+ }
+ ]
+ },
+ {
+ "builders": [
+ "vm-kernel-precomp-linux-release-simarm",
+ "vm-kernel-precomp-linux-release-simarm64"
+ ],
+ "meta": {
+ "description": "This configuration is used by the simarm vm kernel precomp release builders."
+ },
+ "steps": [
+ {
+ "name": "build dart",
+ "script": "tools/build.py",
+ "arguments": [
+ "runtime_kernel",
+ "dart_precompiled_runtime"
+ ]
+ },
+ {
+ "name": "dartk tests",
+ "arguments": [
+ "-cdartk",
+ "-rdart_precompiled"
+ ]
+ },
+ {
+ "name": "dartk strong tests",
+ "arguments": [
+ "-cdartk",
+ "-rdart_precompiled",
+ "--strong",
+ "language_2",
+ "corelib_2",
+ "lib_2",
+ "standalone_2"
+ ]
+ }
+ ]
+ },
+ {
+ "builders": [
"vm-kernel-linux-debug-x64",
"vm-kernel-linux-release-x64",
"vm-kernel-mac-debug-x64",
@@ -310,8 +381,8 @@
},
{
"builders": [
- "ddc-linux-release",
- "ddc-win-release"
+ "ddc-linux-release-chrome",
+ "ddc-win-release-chrome"
],
"meta": {
"description": "This configuration is used by the ddc builder group."
@@ -326,21 +397,18 @@
"name": "ddc tests",
"arguments": [
"-cdartdevc",
- "-rchrome",
"--checked",
"--strong",
"--use-sdk",
"language_2",
"corelib_2",
- "lib_2",
- "lib_strong"
+ "lib_2"
]
},
{
"name": "ddc kernel tests",
"arguments": [
"-cdartdevk",
- "-rchrome",
"--checked",
"--strong",
"--use-sdk",
@@ -351,35 +419,39 @@
"name": "ddc sourcemap tests",
"script": "out/ReleaseX64/dart",
"arguments": [
- "pkg/dev_compiler/test/sourcemap/sourcemaps_ddc_suite.dart"
+ "pkg/dev_compiler/test/sourcemap/sourcemaps_ddc_suite.dart",
+ "-rnone"
]
},
{
"name": "ddk sourcemap tests",
"script": "out/ReleaseX64/dart",
"arguments": [
- "pkg/dev_compiler/test/sourcemap/sourcemaps_ddk_suite.dart"
+ "pkg/dev_compiler/test/sourcemap/sourcemaps_ddk_suite.dart",
+ "-rnone"
]
},
{
"name": "ddc sourcemap stacktrace tests",
"script": "out/ReleaseX64/dart",
"arguments": [
- "pkg/dev_compiler/test/sourcemap/stacktrace_ddc_suite.dart"
+ "pkg/dev_compiler/test/sourcemap/stacktrace_ddc_suite.dart",
+ "-rnone"
]
},
{
"name": "ddk sourcemap stacktrace tests",
"script": "out/ReleaseX64/dart",
"arguments": [
- "pkg/dev_compiler/test/sourcemap/stacktrace_ddk_suite.dart"
+ "pkg/dev_compiler/test/sourcemap/stacktrace_ddk_suite.dart",
+ "-rnone"
]
}
]
},
{
"builders": [
- "ddc-mac-release"
+ "ddc-mac-release-chrome"
],
"meta": {
"description": "This configuration is used by the ddc builder group."
@@ -394,7 +466,6 @@
"name": "ddc tests",
"arguments": [
"-cdartdevc",
- "-rchrome",
"--checked",
"--strong",
"--use-sdk",
@@ -408,7 +479,6 @@
"name": "ddc kernel tests",
"arguments": [
"-cdartdevk",
- "-rchrome",
"--checked",
"--strong",
"--use-sdk",
@@ -419,28 +489,32 @@
"name": "ddc sourcemap tests",
"script": "out/xcodebuild/dart",
"arguments": [
- "pkg/dev_compiler/test/sourcemap/sourcemaps_ddc_suite.dart"
+ "pkg/dev_compiler/test/sourcemap/sourcemaps_ddc_suite.dart",
+ "-rnone"
]
},
{
"name": "ddk sourcemap tests",
"script": "out/xcodebuild/dart",
"arguments": [
- "pkg/dev_compiler/test/sourcemap/sourcemaps_ddk_suite.dart"
+ "pkg/dev_compiler/test/sourcemap/sourcemaps_ddk_suite.dart",
+ "-rnone"
]
},
{
"name": "ddc sourcemap stacktrace tests",
"script": "out/xcodebuild/dart",
"arguments": [
- "pkg/dev_compiler/test/sourcemap/stacktrace_ddc_suite.dart"
+ "pkg/dev_compiler/test/sourcemap/stacktrace_ddc_suite.dart",
+ "-rnone"
]
},
{
"name": "ddk sourcemap stacktrace tests",
"script": "out/xcodebuild/dart",
"arguments": [
- "pkg/dev_compiler/test/sourcemap/stacktrace_ddk_suite.dart"
+ "pkg/dev_compiler/test/sourcemap/stacktrace_ddk_suite.dart",
+ "-rnone"
]
}
]
diff --git a/tools/dom/scripts/htmldartgenerator.py b/tools/dom/scripts/htmldartgenerator.py
index 53be964..10647b0 100644
--- a/tools/dom/scripts/htmldartgenerator.py
+++ b/tools/dom/scripts/htmldartgenerator.py
@@ -12,8 +12,9 @@
TypeOrNothing, ConvertToFuture, GetCallbackInfo
from copy import deepcopy
from htmlrenamer import convert_to_future_members, custom_html_constructors, \
- keep_overloaded_members, overloaded_and_renamed, private_html_members, \
- renamed_html_members, renamed_overloads, removed_html_members
+ GetDDC_Extension, keep_overloaded_members, overloaded_and_renamed,\
+ private_html_members, renamed_html_members, renamed_overloads, \
+ removed_html_members
from generator import TypeOrVar
import logging
import monitored
@@ -671,6 +672,12 @@
callback_info = GetCallbackInfo(
self._database.GetInterface(info.callback_args[0].type_id))
+ extensions = GetDDC_Extension(self._interface, info.declared_name)
+ if extensions:
+ ddc_extensions = "\n".join(extensions);
+ else:
+ ddc_extensions = ''
+
param_list = info.ParametersAsArgumentList()
metadata = ''
if '_RenamingAnnotation' in dir(self):
@@ -682,6 +689,7 @@
' var completer = new Completer$(FUTURE_GENERIC)();\n'
' $ORIGINAL_FUNCTION($PARAMS_LIST\n'
' $NAMED_PARAM($VARIABLE_NAME) { '
+ '$DDC_EXTENSION\n'
'completer.complete($VARIABLE_NAME); }'
'$ERROR_CALLBACK);\n'
' return completer.future;\n'
@@ -697,6 +705,7 @@
if info.requires_named_arguments and
info.callback_args[0].is_optional else ''),
VARIABLE_NAME= '' if len(callback_info.param_infos) == 0 else 'value',
+ DDC_EXTENSION=ddc_extensions,
ERROR_CALLBACK=('' if len(info.callback_args) == 1 else
(',\n %s(error) { completer.completeError(error); }' %
('%s : ' % info.callback_args[1].name
diff --git a/tools/dom/scripts/htmlrenamer.py b/tools/dom/scripts/htmlrenamer.py
index c3f7a9d..ad6b9b2 100644
--- a/tools/dom/scripts/htmlrenamer.py
+++ b/tools/dom/scripts/htmlrenamer.py
@@ -198,6 +198,38 @@
'WorkerGlobalScope.webkitResolveLocalFileSystemURL',
])
+# DDC Exposed Classes
+ddc_extensions = monitored.Dict('ddcextensions.ddc_extensions', {
+ 'DirectoryEntry': {
+ 'getFile': [
+ 'applyExtension(\'FileEntry\', value);',
+ ]
+ },
+ 'FileEntry': {
+ 'createWriter': [
+ 'applyExtension(\'FileWriter\', value);'
+ ],
+ 'file': [
+ 'applyExtension(\'Blob\', value);'
+ ]
+ },
+ 'Window': {
+ 'webkitRequestFileSystem':[
+ 'applyExtension(\'DOMFileSystem\', value);',
+ 'applyExtension(\'DirectoryEntry\', value.root);',
+ ]
+ },
+})
+
+# DDC Extension for this interface operation?
+def GetDDC_Extension(interface, operationName):
+ if interface.id in ddc_extensions:
+ entry = ddc_extensions[interface.id]
+ if operationName in entry:
+ return entry[operationName]
+ return None
+
+
# Classes where we have customized constructors, but we need to keep the old
# constructor for dispatch purposes.
custom_html_constructors = monitored.Set(
diff --git a/tools/dom/src/dart2js_KeyEvent.dart b/tools/dom/src/dart2js_KeyEvent.dart
index b9c627b..92534a1a 100644
--- a/tools/dom/src/dart2js_KeyEvent.dart
+++ b/tools/dom/src/dart2js_KeyEvent.dart
@@ -104,61 +104,41 @@
}
var eventObj;
- // In these two branches we create an underlying native KeyboardEvent, but
- // we set it with our specified values. Because we are doing custom setting
- // of certain values (charCode/keyCode, etc) only in this class (as opposed
- // to KeyboardEvent) and the way we set these custom values depends on the
- // type of underlying JS object, we do all the construction for the
- // underlying KeyboardEvent here.
- if (canUseDispatchEvent) {
- // Currently works in everything but Internet Explorer.
- eventObj = new Event.eventType('Event', type,
- canBubble: canBubble, cancelable: cancelable);
- JS('void', '#.keyCode = #', eventObj, keyCode);
- JS('void', '#.which = #', eventObj, keyCode);
- JS('void', '#.charCode = #', eventObj, charCode);
+ // Currently this works on everything but Safari. Safari throws an
+ // "Attempting to change access mechanism for an unconfigurable property"
+ // TypeError when trying to do the Object.defineProperty hack, so we avoid
+ // this branch if possible.
+ // Also, if we want this branch to work in FF, we also need to modify
+ // _initKeyboardEvent to also take charCode and keyCode values to
+ // initialize initKeyEvent.
- JS('void', '#.location = #', eventObj, location);
- JS('void', '#.ctrlKey = #', eventObj, ctrlKey);
- JS('void', '#.altKey = #', eventObj, altKey);
- JS('void', '#.shiftKey = #', eventObj, shiftKey);
- JS('void', '#.metaKey = #', eventObj, metaKey);
- } else {
- // Currently this works on everything but Safari. Safari throws an
- // "Attempting to change access mechanism for an unconfigurable property"
- // TypeError when trying to do the Object.defineProperty hack, so we avoid
- // this branch if possible.
- // Also, if we want this branch to work in FF, we also need to modify
- // _initKeyboardEvent to also take charCode and keyCode values to
- // initialize initKeyEvent.
+ eventObj = new Event.eventType('KeyboardEvent', type,
+ canBubble: canBubble, cancelable: cancelable);
- eventObj = new Event.eventType('KeyboardEvent', type,
- canBubble: canBubble, cancelable: cancelable);
+ // Chromium Hack
+ JS(
+ 'void',
+ "Object.defineProperty(#, 'keyCode', {"
+ " get : function() { return this.keyCodeVal; } })",
+ eventObj);
+ JS(
+ 'void',
+ "Object.defineProperty(#, 'which', {"
+ " get : function() { return this.keyCodeVal; } })",
+ eventObj);
+ JS(
+ 'void',
+ "Object.defineProperty(#, 'charCode', {"
+ " get : function() { return this.charCodeVal; } })",
+ eventObj);
- // Chromium Hack
- JS(
- 'void',
- "Object.defineProperty(#, 'keyCode', {"
- " get : function() { return this.keyCodeVal; } })",
- eventObj);
- JS(
- 'void',
- "Object.defineProperty(#, 'which', {"
- " get : function() { return this.keyCodeVal; } })",
- eventObj);
- JS(
- 'void',
- "Object.defineProperty(#, 'charCode', {"
- " get : function() { return this.charCodeVal; } })",
- eventObj);
+ var keyIdentifier = _convertToHexString(charCode, keyCode);
+ eventObj._initKeyboardEvent(type, canBubble, cancelable, view,
+ keyIdentifier, location, ctrlKey, altKey, shiftKey, metaKey);
+ JS('void', '#.keyCodeVal = #', eventObj, keyCode);
+ JS('void', '#.charCodeVal = #', eventObj, charCode);
- var keyIdentifier = _convertToHexString(charCode, keyCode);
- eventObj._initKeyboardEvent(type, canBubble, cancelable, view,
- keyIdentifier, location, ctrlKey, altKey, shiftKey, metaKey);
- JS('void', '#.keyCodeVal = #', eventObj, keyCode);
- JS('void', '#.charCodeVal = #', eventObj, charCode);
- }
// Tell dart2js that it smells like a KeyboardEvent!
setDispatchProperty(eventObj, _keyboardEventDispatchRecord);
diff --git a/tools/dom/templates/html/dart2js/html_dart2js.darttemplate b/tools/dom/templates/html/dart2js/html_dart2js.darttemplate
index 830921c..380bece 100644
--- a/tools/dom/templates/html/dart2js/html_dart2js.darttemplate
+++ b/tools/dom/templates/html/dart2js/html_dart2js.darttemplate
@@ -54,7 +54,7 @@
convertDartClosureToJS, Creates, JavaScriptIndexingBehavior,
JSName, Native, Returns, ForceInline,
findDispatchTagForInterceptorClass, setNativeSubclassDispatchRecord,
- makeLeafDispatchRecord, registerGlobalObject;
+ makeLeafDispatchRecord, registerGlobalObject, applyExtension;
import 'dart:_interceptors' show
Interceptor, JSExtendableArray, JSUInt31,
findInterceptorConstructorForType,
diff --git a/tools/dom/templates/html/impl/impl_MessageEvent.darttemplate b/tools/dom/templates/html/impl/impl_MessageEvent.darttemplate
index aa1616b..826f607 100644
--- a/tools/dom/templates/html/impl/impl_MessageEvent.darttemplate
+++ b/tools/dom/templates/html/impl/impl_MessageEvent.darttemplate
@@ -10,7 +10,7 @@
factory $CLASSNAME(String type,
{bool canBubble: false, bool cancelable: false, Object data,
String origin, String lastEventId,
- Window source, List<MessagePort> messagePorts}) {
+ Window source, List<MessagePort> messagePorts: const []}) {
if (source == null) {
source = window;
}
diff --git a/tools/infra/config/cq.cfg b/tools/infra/config/cq.cfg
index b68a277..da718ee 100644
--- a/tools/infra/config/cq.cfg
+++ b/tools/infra/config/cq.cfg
@@ -26,7 +26,7 @@
builders { name: "dart2js-linux-none-only-unittest-try"}
builders { name: "pkg-linux-release-try"}
builders { name: "dart2js-linux-chrome-try"}
- builders { name: "ddc-linux-release-try"}
+ builders { name: "ddc-linux-release-chrome-try"}
builders { name: "vm-linux-product-x64-try"}
builders { name: "dart-sdk-windows-try"}
builders { name: "vm-kernel-mac-release-x64-try"}
diff --git a/tools/status_clean.dart b/tools/status_clean.dart
index e5c11e2..1c47633 100644
--- a/tools/status_clean.dart
+++ b/tools/status_clean.dart
@@ -310,7 +310,7 @@
var tests = new Map<String, String>();
var outcomes = new Map<String, Set<String>>();
if (multiTestRegExp.hasMatch(new File(file).readAsStringSync())) {
- ExtractTestsFromMultitest(new Path(file), tests, outcomes);
+ extractTestsFromMultitest(new Path(file), tests, outcomes);
}
return tests.keys.toList();
} catch (error) {
diff --git a/tools/testing/dart/command_output.dart b/tools/testing/dart/command_output.dart
index e5593be..8a885ac 100644
--- a/tools/testing/dart/command_output.dart
+++ b/tools/testing/dart/command_output.dart
@@ -876,15 +876,44 @@
}
Expectation result(TestCase testCase) {
- Expectation result = super.result(testCase);
- if (result.canBeOutcomeOf(Expectation.crash)) {
+ // TODO(kustermann): Currently the batch mode runner (which can be found
+ // in `test_runner.dart:BatchRunnerProcess`) does not really distinguish
+ // between different kinds of failures and will mark a failed
+ // compilation to just an exit code of "1". So we treat all `exitCode ==
+ // 1`s as compile-time errors as well.
+ const int kBatchModeCompileTimeErrorExit = 1;
+
+ // Handle crashes and timeouts first.
+ if (hasCrashed) return Expectation.dartkCrash;
+ if (hasTimedOut) return Expectation.timeout;
+ if (hasNonUtf8) return Expectation.nonUtf8Error;
+
+ // If the frontend had an uncaught exception, then we'll consider this a
+ // crash.
+ if (exitCode == VMCommandOutput._uncaughtExceptionExitCode) {
return Expectation.dartkCrash;
- } else if (result.canBeOutcomeOf(Expectation.timeout)) {
- return Expectation.dartkTimeout;
- } else if (result.canBeOutcomeOf(Expectation.compileTimeError)) {
- return Expectation.dartkCompileTimeError;
}
- return result;
+
+ // Multitests are handled specially.
+ if (testCase.expectCompileError) {
+ if (exitCode == VMCommandOutput._compileErrorExitCode ||
+ exitCode == kBatchModeCompileTimeErrorExit) {
+ return Expectation.pass;
+ }
+ return Expectation.missingCompileTimeError;
+ }
+
+ // The actual outcome depends on the exitCode.
+ var outcome = Expectation.pass;
+ if (exitCode == VMCommandOutput._compileErrorExitCode ||
+ exitCode == kBatchModeCompileTimeErrorExit) {
+ outcome = Expectation.compileTimeError;
+ } else if (exitCode != 0) {
+ // This is a general fail, in case we get an unknown nonzero exitcode.
+ outcome = Expectation.fail;
+ }
+
+ return _negateOutcomeIfNegativeTest(outcome, testCase.isNegative);
}
/// If the compiler was able to produce a Kernel IR file we want to run the
diff --git a/tools/testing/dart/compiler_configuration.dart b/tools/testing/dart/compiler_configuration.dart
index f5bb536..268d96e 100644
--- a/tools/testing/dart/compiler_configuration.dart
+++ b/tools/testing/dart/compiler_configuration.dart
@@ -46,6 +46,10 @@
throw new UnsupportedError("This compiler does not support DFE.");
}
+ /// Whether to run the runtime on the compilation result of a test which
+ /// expects a compile-time error and the compiler did not emit one.
+ bool get runRuntimeDespiteMissingCompileTimeError => false;
+
factory CompilerConfiguration(Configuration configuration) {
switch (configuration.compiler) {
case Compiler.dart2analyzer:
@@ -67,6 +71,11 @@
return new PrecompilerCompilerConfiguration(configuration);
case Compiler.dartk:
+ if (configuration.architecture == Architecture.simdbc64 ||
+ configuration.architecture == Architecture.simarm ||
+ configuration.architecture == Architecture.simarm64) {
+ return new VMKernelCompilerConfiguration(configuration);
+ }
return new NoneCompilerConfiguration(configuration, useDfe: true);
case Compiler.dartkp:
@@ -101,8 +110,8 @@
List<Uri> bootstrapDependencies() => const <Uri>[];
/// Creates a [Command] to compile [inputFile] to [outputFile].
- Command createCommand(
- String inputFile, String outputFile, List<String> sharedOptions) {
+ Command createCommand(String inputFile, String outputFile,
+ List<String> sharedOptions, Map<String, String> environment) {
// TODO(rnystrom): See if this method can be unified with
// computeCompilationArtifact() and/or computeCompilerArguments() for the
// other compilers.
@@ -132,6 +141,8 @@
/// The "none" compiler.
class NoneCompilerConfiguration extends CompilerConfiguration {
+ // This boolean is used by the [VMTestSuite] for running cc tests via
+ // run_vm_tests.
final bool useDfe;
NoneCompilerConfiguration(Configuration configuration, {this.useDfe: false})
@@ -186,6 +197,71 @@
}
}
+class VMKernelCompilerConfiguration extends CompilerConfiguration
+ with VMKernelCompilerMixin {
+ VMKernelCompilerConfiguration(Configuration configuration)
+ : super._subclass(configuration);
+
+ // This boolean is used by the [VMTestSuite] for running cc tests via
+ // run_vm_tests. We enable it here, so the cc tests continue to use the
+ // kernel-isolate. All the remaining tests will use a separate compilation
+ // command (which this class represents).
+ bool get useDfe => true;
+
+ bool get _isAot => false;
+
+ // Issue(http://dartbug.com/29840): Currently fasta sometimes does not emit a
+ // compile-time error (even though it should). The VM will emit some of these
+ // compile-time errors (e.g. in constant evaluator, class finalizer, ...).
+ //
+ // => Since this distinction between fasta and vm reported compile-time
+ // errors do not exist when running dart with the kernel-service, we will
+ // also not make this distinction when compiling to .dill and then run.
+ //
+ // The corresponding http://dartbug.com/29840 tracks to get the frontend to
+ // emit all necessary compile-time errors (and *additionally* encode them
+ // in the AST in certain cases).
+ bool get runRuntimeDespiteMissingCompileTimeError => true;
+
+ CommandArtifact computeCompilationArtifact(String tempDir,
+ List<String> arguments, Map<String, String> environmentOverrides) {
+ final commands = <Command>[
+ computeCompileToKernelCommand(tempDir, arguments, environmentOverrides),
+ ];
+ return new CommandArtifact(commands, tempKernelFile(tempDir),
+ 'application/kernel-ir-fully-linked');
+ }
+
+ List<String> computeRuntimeArguments(
+ RuntimeConfiguration runtimeConfiguration,
+ TestInformation info,
+ List<String> vmOptions,
+ List<String> sharedOptions,
+ List<String> originalArguments,
+ CommandArtifact artifact) {
+ var args = <String>[];
+ if (_isStrong) {
+ args.add('--strong');
+ args.add('--reify-generic-functions');
+ args.add('--limit-ints-to-64-bits');
+ }
+ if (_isChecked) {
+ args.add('--enable_asserts');
+ args.add('--enable_type_checks');
+ }
+ if (_configuration.hotReload) {
+ args.add('--hot-reload-test-mode');
+ } else if (_configuration.hotReloadRollback) {
+ args.add('--hot-reload-rollback-test-mode');
+ }
+
+ return args
+ ..addAll(vmOptions)
+ ..addAll(sharedOptions)
+ ..addAll(_replaceDartFiles(originalArguments, artifact.filename));
+ }
+}
+
typedef List<String> CompilerArgumentsFunction(
List<String> globalArguments, String previousCompilerOutput);
@@ -403,9 +479,8 @@
return result;
}
- Command createCommand(
- String inputFile, String outputFile, List<String> sharedOptions,
- [Map<String, String> environment = const {}]) {
+ Command createCommand(String inputFile, String outputFile,
+ List<String> sharedOptions, Map<String, String> environment) {
var moduleRoot =
new Path(outputFile).directoryPath.directoryPath.toNativePath();
@@ -487,9 +562,8 @@
return result;
}
- Command createCommand(
- String inputFile, String outputFile, List<String> sharedOptions,
- [Map<String, String> environment = const {}]) {
+ Command createCommand(String inputFile, String outputFile,
+ List<String> sharedOptions, Map<String, String> environment) {
var args = sharedOptions.toList();
var sdkSummary = new Path(_configuration.buildDirectory)
@@ -548,13 +622,18 @@
}
}
-class PrecompilerCompilerConfiguration extends CompilerConfiguration {
+class PrecompilerCompilerConfiguration extends CompilerConfiguration
+ with VMKernelCompilerMixin {
+ // This boolean is used by the [VMTestSuite] for running cc tests via
+ // run_vm_tests.
final bool useDfe;
bool get _isAndroid => _configuration.system == System.android;
bool get _isArm => _configuration.architecture == Architecture.arm;
bool get _isArm64 => _configuration.architecture == Architecture.arm64;
+ bool get _isAot => true;
+
PrecompilerCompilerConfiguration(Configuration configuration,
{this.useDfe: false})
: super._subclass(configuration);
@@ -574,15 +653,15 @@
List<String> arguments, Map<String, String> environmentOverrides) {
var commands = <Command>[];
- if (_isStrong) {
+ if (useDfe) {
commands.add(computeCompileToKernelCommand(
tempDir, arguments, environmentOverrides));
}
commands.add(
- computeCompilationCommand(tempDir, arguments, environmentOverrides));
+ computeDartBootstrapCommand(tempDir, arguments, environmentOverrides));
- if (_isStrong) {
+ if (useDfe) {
commands.add(computeRemoveKernelFileCommand(
tempDir, arguments, environmentOverrides));
}
@@ -598,25 +677,6 @@
commands, '$tempDir', 'application/dart-precompiled');
}
- String tempKernelFile(String tempDir) => '$tempDir/out.dill';
-
- Command computeCompileToKernelCommand(String tempDir, List<String> arguments,
- Map<String, String> environmentOverrides) {
- final genKernel =
- Platform.script.resolve('../../../pkg/vm/tool/gen_kernel').toFilePath();
- final dillFile = tempKernelFile(tempDir);
- var args = [
- '--packages=.packages',
- '--aot',
- '--platform=${_configuration.buildDirectory}/vm_platform_strong.dill',
- '-o',
- dillFile,
- ];
- args.add(arguments.where((name) => name.endsWith('.dart')).single);
- return Command.vmKernelCompilation(dillFile, true, bootstrapDependencies(),
- genKernel, args, environmentOverrides);
- }
-
/// Creates a command to clean up large temporary kernel files.
///
/// Warning: this command removes temporary file and violates tracking of
@@ -632,7 +692,7 @@
alwaysCompile: !_useSdk);
}
- Command computeCompilationCommand(String tempDir, List<String> arguments,
+ Command computeDartBootstrapCommand(String tempDir, List<String> arguments,
Map<String, String> environmentOverrides) {
var buildDir = _configuration.buildDirectory;
String exec;
@@ -646,18 +706,7 @@
exec = "$buildDir/dart_bootstrap";
}
- var args = <String>[];
- if (useDfe) {
- if (!_isStrong) {
- args.add('--dfe=pkg/vm/bin/kernel_service.dart');
- }
- // TODO(dartbug.com/30480): avoid using additional kernel binaries
- args.add('--kernel-binaries=' +
- (_useSdk
- ? '${_configuration.buildDirectory}/dart-sdk/lib/_internal'
- : '${buildDir}'));
- }
-
+ final args = <String>[];
args.add("--snapshot-kind=app-aot");
if (_configuration.useBlobs) {
args.add("--snapshot=$tempDir/out.aotsnapshot");
@@ -680,8 +729,9 @@
if (_isStrong) {
args.add('--strong');
- args.addAll(arguments.where((name) => !name.endsWith('.dart')));
- args.add(tempKernelFile(tempDir));
+ }
+ if (useDfe) {
+ args.addAll(_replaceDartFiles(arguments, tempKernelFile(tempDir)));
} else {
args.addAll(arguments);
}
@@ -880,12 +930,10 @@
args.add('--enable_asserts');
args.add('--enable_type_checks');
}
- args..addAll(vmOptions)..addAll(sharedOptions)..addAll(originalArguments);
- for (var i = 0; i < args.length; i++) {
- if (args[i].endsWith(".dart")) {
- args[i] = artifact.filename;
- }
- }
+ args
+ ..addAll(vmOptions)
+ ..addAll(sharedOptions)
+ ..addAll(_replaceDartFiles(originalArguments, artifact.filename));
return args;
}
}
@@ -969,3 +1017,42 @@
return <String>[];
}
}
+
+abstract class VMKernelCompilerMixin {
+ Configuration get _configuration;
+ bool get _useSdk;
+ bool get _isStrong;
+ bool get _isAot;
+
+ List<Uri> bootstrapDependencies();
+
+ String tempKernelFile(String tempDir) => '$tempDir/out.dill';
+
+ Command computeCompileToKernelCommand(String tempDir, List<String> arguments,
+ Map<String, String> environmentOverrides) {
+ final genKernel =
+ Platform.script.resolve('../../../pkg/vm/tool/gen_kernel').toFilePath();
+
+ final kernelBinariesFolder = _useSdk
+ ? '${_configuration.buildDirectory}/dart-sdk/lib/_internal'
+ : '${_configuration.buildDirectory}';
+
+ final vmPlatform = _isStrong
+ ? '$kernelBinariesFolder/vm_platform_strong.dill'
+ : '$kernelBinariesFolder/vm_platform.dill';
+
+ final dillFile = tempKernelFile(tempDir);
+
+ final args = [
+ _isAot ? '--aot' : '--no-aot',
+ _isStrong ? '--strong-mode' : '--no-strong-mode',
+ '--platform=$vmPlatform',
+ '-o',
+ dillFile,
+ ];
+ args.add(arguments.where((name) => name.endsWith('.dart')).single);
+
+ return Command.vmKernelCompilation(dillFile, true, bootstrapDependencies(),
+ genKernel, args, environmentOverrides);
+ }
+}
diff --git a/tools/testing/dart/multitest.dart b/tools/testing/dart/multitest.dart
index 5e5e170..ed10d09 100644
--- a/tools/testing/dart/multitest.dart
+++ b/tools/testing/dart/multitest.dart
@@ -2,8 +2,77 @@
// 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 multitest;
-
+/// Multitests are Dart test scripts containing lines of the form
+/// " [some dart code] //# [key]: [error type]"
+///
+/// To support legacy multi tests we also handle lines of the form
+/// " [some dart code] /// [key]: [error type]"
+///
+/// For each key in the file, a new test file is made containing all the normal
+/// lines of the file, and all of the multitest lines containing that key, in
+/// the same order as in the source file. The new test is expected to pass if
+/// the error type listed is 'ok', and to fail if the error type is 'syntax
+/// error', 'compile-time error', 'runtime error', 'static type warning',
+/// 'dynamic type error', or 'checked mode compile-time error'. The type error
+/// tests fail only in checked mode. There is also a test created from only the
+/// untagged lines of the file, with key "none", which is expected to pass. This
+/// library extracts these tests, writes them into a temporary directory, and
+/// passes them to the test runner. These tests may be referred to in the status
+/// files with the pattern [test name]/[key].
+///
+/// For example, file i_am_a_multitest.dart:
+///
+/// ```dart
+/// aaa
+/// bbb //# 02: runtime error
+/// ccc //# 02: continued
+/// ddd //# 07: static type warning
+/// eee //# 10: ok
+/// fff
+/// ```
+///
+/// Create four test files:
+///
+/// i_am_a_multitest_none.dart:
+///
+/// ```dart
+/// aaa
+/// fff
+/// ```
+///
+/// i_am_a_multitest_02.dart:
+///
+/// ```dart
+/// aaa
+/// bbb //# 02: runtime error
+/// ccc //# 02: continued
+/// fff
+/// ```
+///
+/// i_am_a_multitest_07.dart:
+///
+/// ```dart
+/// aaa
+/// ddd //# 07: static type warning
+/// fff
+/// ```
+///
+/// i_am_a_multitest_10.dart:
+///
+/// ```dart
+/// aaa
+/// eee //# 10: ok
+/// fff
+/// ```
+///
+/// Note that it is possible to indicate more than one acceptable outcome in
+/// the case of dynamic and static type warnings
+///
+/// ```dart
+/// aaa
+/// ddd //# 07: static type warning, dynamic type error
+/// fff
+/// ```
import "dart:async";
import "dart:io";
@@ -11,85 +80,33 @@
import "test_suite.dart";
import "utils.dart";
-// Multitests are Dart test scripts containing lines of the form
-// " [some dart code] //# [key]: [error type]"
-//
-// To support legacy multi tests we also handle lines of the form
-// " [some dart code] /// [key]: [error type]"
-//
-// For each key in the file, a new test file is made containing all
-// the normal lines of the file, and all of the multitest lines containing
-// that key, in the same order as in the source file. The new test is expected
-// to pass if the error type listed is 'ok', and to fail if the error type is
-// 'syntax error', 'compile-time error', 'runtime error', 'static type warning',
-// 'dynamic type error', or 'checked mode compile-time error'. The type error
-// tests fail only in checked mode. There is also a test created from only the
-// untagged lines of the file, with key "none", which is expected to pass. This
-// library extracts these tests, writes them into a temporary directory, and
-// passes them to the test runner. These tests may be referred to in the status
-// files with the pattern [test name]/[key].
-//
-// For example: file I_am_a_multitest.dart
-// aaa
-// bbb //# 02: runtime error
-// ccc //# 02: continued
-// ddd //# 07: static type warning
-// eee //# 10: ok
-// fff
-//
-// should create four tests:
-// I_am_a_multitest_none.dart
-// aaa
-// fff
-//
-// I_am_a_multitest_02.dart
-// aaa
-// bbb //# 02: runtime error
-// ccc //# 02: continued
-// fff
-//
-// I_am_a_multitest_07.dart
-// aaa
-// ddd //# 07: static type warning
-// fff
-//
-// and I_am_a_multitest_10.dart
-// aaa
-// eee //# 10: ok
-// fff
-//
-// Note that it is possible to indicate more than one acceptable outcome
-// in the case of dynamic and static type warnings
-// aaa
-// ddd //# 07: static type warning, dynamic type error
-// fff
-
/// Until legacy multitests are ported we need to support both /// and //#
final _multitestMarker = new RegExp(r"//[/#]");
-void ExtractTestsFromMultitest(Path filePath, Map<String, String> tests,
+final _multitestOutcomes = [
+ 'ok',
+ 'syntax error',
+ 'compile-time error',
+ 'runtime error',
+ // TODO(rnystrom): Remove these after Dart 1.0 tests are removed.
+ 'static type warning',
+ 'dynamic type error',
+ 'checked mode compile-time error'
+].toSet();
+
+// Note: This function is called directly by:
+//
+// tests/compiler/dart2js/frontend_checker.dart
+// tools/status_clean.dart
+void extractTestsFromMultitest(Path filePath, Map<String, String> tests,
Map<String, Set<String>> outcomes) {
- // Read the entire file into a byte buffer and transform it to a
- // String. This will treat the file as ascii but the only parts
- // we are interested in will be ascii in any case.
- var bytes = new File(filePath.toNativePath()).readAsBytesSync();
- var contents = decodeUtf8(bytes);
+ var contents = new File(filePath.toNativePath()).readAsStringSync();
+
var firstNewline = contents.indexOf('\n');
var lineSeparator =
(firstNewline == 0 || contents[firstNewline - 1] != '\r') ? '\n' : '\r\n';
var lines = contents.split(lineSeparator);
if (lines.last == '') lines.removeLast();
- bytes = null;
- contents = null;
- var validMultitestOutcomes = [
- 'ok',
- 'syntax error',
- 'compile-time error',
- 'runtime error',
- 'static type warning',
- 'dynamic type error',
- 'checked mode compile-time error'
- ].toSet();
// Create the set of multitests, which will have a new test added each
// time we see a multitest line with a new key.
@@ -102,7 +119,7 @@
var lineCount = 0;
for (var line in lines) {
lineCount++;
- var annotation = new _Annotation.from(line);
+ var annotation = _Annotation.tryParse(line);
if (annotation != null) {
testsAsLines.putIfAbsent(
annotation.key, () => new List<String>.from(testsAsLines["none"]));
@@ -112,13 +129,13 @@
}
outcomes.putIfAbsent(annotation.key, () => new Set<String>());
if (annotation.rest != 'continued') {
- for (String nextOutcome in annotation.outcomesList) {
- if (validMultitestOutcomes.contains(nextOutcome)) {
+ for (var nextOutcome in annotation.outcomes) {
+ if (_multitestOutcomes.contains(nextOutcome)) {
outcomes[annotation.key].add(nextOutcome);
} else {
- DebugLogger.warning(
- "Warning: Invalid test directive '$nextOutcome' on line "
- "${lineCount}:\n${annotation.rest} ");
+ DebugLogger
+ .warning("Warning: Invalid expectation '$nextOutcome' on line "
+ "$lineCount:\n${annotation.rest} ");
}
}
}
@@ -126,6 +143,7 @@
for (var test in testsAsLines.values) test.add(line);
}
}
+
// End marker, has a final line separator so we don't need to add it after
// joining the lines.
var marker =
@@ -133,21 +151,17 @@
'$lineSeparator';
for (var test in testsAsLines.values) test.add(marker);
- var keysToDelete = <String>[];
- // Check that every key (other than the none case) has at least one outcome
- for (var outcomeKey in outcomes.keys) {
- if (outcomeKey != 'none' && outcomes[outcomeKey].isEmpty) {
- DebugLogger.warning(
- "Warning: Test ${outcomeKey} has no valid annotated outcomes.\n"
- "Expected one of: ${validMultitestOutcomes.toString()}");
- // If this multitest doesn't have an outcome, mark the multitest for
- // deletion.
- keysToDelete.add(outcomeKey);
- }
+ // Check that every test (other than the none case) has at least one outcome.
+ var invalidTests = outcomes.keys
+ .where((test) => test != 'none' && outcomes[test].isEmpty)
+ .toList();
+ for (var test in invalidTests) {
+ DebugLogger.warning("Warning: Test $test has no valid expectation.\n"
+ "Expected one of: ${_multitestOutcomes.toString()}");
+
+ outcomes.remove(test);
+ testsAsLines.remove(test);
}
- // If a key/multitest was marked for deletion, do the necessary cleanup.
- keysToDelete.forEach(outcomes.remove);
- keysToDelete.forEach(testsAsLines.remove);
// Copy all the tests into the output map tests, as multiline strings.
for (var key in testsAsLines.keys) {
@@ -155,34 +169,115 @@
}
}
-// Represents a mutlitest annotation in the special //# comment.
+Future doMultitest(Path filePath, String outputDir, Path suiteDir,
+ CreateTest doTest, bool hotReload) {
+ void writeFile(String filepath, String content) {
+ final File file = new File(filepath);
+
+ if (file.existsSync()) {
+ var oldContent = file.readAsStringSync();
+ if (oldContent == content) {
+ // Don't write to the file if the content is the same
+ return;
+ }
+ }
+ file.writeAsStringSync(content);
+ }
+
+ // Each new test is a single String value in the Map tests.
+ var tests = <String, String>{};
+ var outcomes = <String, Set<String>>{};
+ extractTestsFromMultitest(filePath, tests, outcomes);
+
+ var sourceDir = filePath.directoryPath;
+ var targetDir = _createMultitestDirectory(outputDir, suiteDir, sourceDir);
+ assert(targetDir != null);
+
+ // Copy all the relative imports of the multitest.
+ var importsToCopy = _findAllRelativeImports(filePath);
+ var futureCopies = <Future>[];
+ for (var relativeImport in importsToCopy) {
+ var importPath = new Path(relativeImport);
+ // Make sure the target directory exists.
+ var importDir = importPath.directoryPath;
+ if (!importDir.isEmpty) {
+ TestUtils.mkdirRecursive(targetDir, importDir);
+ }
+
+ // Copy file.
+ futureCopies.add(TestUtils.copyFile(
+ sourceDir.join(importPath), targetDir.join(importPath)));
+ }
+
+ // Wait until all imports are copied before scheduling test cases.
+ return Future.wait(futureCopies).then((_) {
+ var baseFilename = filePath.filenameWithoutExtension;
+ for (var key in tests.keys) {
+ var multitestFilename = targetDir.append('${baseFilename}_$key.dart');
+ writeFile(multitestFilename.toNativePath(), tests[key]);
+
+ var outcome = outcomes[key];
+ var hasStaticWarning = outcome.contains('static type warning');
+ var hasRuntimeError = outcome.contains('runtime error');
+ var hasSyntaxError = outcome.contains('syntax error');
+ var hasCompileError =
+ hasSyntaxError || outcome.contains('compile-time error');
+ var isNegativeIfChecked = outcome.contains('dynamic type error');
+ var hasCompileErrorIfChecked =
+ outcome.contains('checked mode compile-time error');
+
+ if (hotReload) {
+ if (hasCompileError || hasCompileErrorIfChecked) {
+ // Running a test that expects a compilation error with hot reloading
+ // is redundant with a regular run of the test.
+ continue;
+ }
+ }
+
+ doTest(multitestFilename, filePath,
+ hasSyntaxError: hasSyntaxError,
+ hasCompileError: hasCompileError,
+ hasRuntimeError: hasRuntimeError,
+ isNegativeIfChecked: isNegativeIfChecked,
+ hasCompileErrorIfChecked: hasCompileErrorIfChecked,
+ hasStaticWarning: hasStaticWarning,
+ multitestKey: key);
+ }
+
+ return null;
+ });
+}
+
+/// A multitest annotation in the special `//#` comment.
class _Annotation {
- String key;
- String rest;
- List<String> outcomesList;
- _Annotation() {}
- factory _Annotation.from(String line) {
+ /// Parses the annotation in [line] or returns `null` if the line isn't a
+ /// multitest annotation.
+ static _Annotation tryParse(String line) {
// Do an early return with "null" if this is not a valid multitest
// annotation.
- if (!line.contains(_multitestMarker)) {
- return null;
- }
+ if (!line.contains(_multitestMarker)) return null;
+
var parts = line
.split(_multitestMarker)[1]
.split(':')
.map((s) => s.trim())
.where((s) => s.length > 0)
.toList();
- if (parts.length <= 1) {
- return null;
- }
- var annotation = new _Annotation();
- annotation.key = parts[0];
- annotation.rest = parts[1];
- annotation.outcomesList =
- annotation.rest.split(',').map((s) => s.trim()).toList();
- return annotation;
+ if (parts.length <= 1) return null;
+
+ return new _Annotation._(parts[0], parts[1]);
+ }
+
+ final String key;
+ final String rest;
+
+ // TODO(rnystrom): After Dart 1.0 is no longer supported, I don't think we
+ // need to support more than a single outcome for each test.
+ final List<String> outcomes = [];
+
+ _Annotation._(this.key, this.rest) {
+ outcomes.addAll(rest.split(',').map((s) => s.trim()));
}
}
@@ -202,121 +297,50 @@
while (!toSearch.isEmpty) {
var thisPass = toSearch;
toSearch = new Set<Path>();
- for (Path filename in thisPass) {
- File f = new File(filename.toNativePath());
- for (String line in f.readAsLinesSync()) {
- Match match = relativeImportRegExp.firstMatch(line);
+ for (var filename in thisPass) {
+ var f = new File(filename.toNativePath());
+ for (var line in f.readAsLinesSync()) {
+ var match = relativeImportRegExp.firstMatch(line);
+
if (match != null) {
- Path relativePath = new Path(match.group(3));
+ var relativePath = new Path(match.group(3));
if (foundImports.contains(relativePath.toString())) {
continue;
}
+
if (relativePath.toString().contains('..')) {
// This is just for safety reasons, we don't want
// to unintentionally clobber files relative to the destination
- // dir when copying them ove.
- print("relative paths containing .. are not allowed.");
+ // dir when copying them over.
+ print("relative paths containing '..' are not allowed.");
exit(1);
}
+
foundImports.add(relativePath.toString());
toSearch.add(libraryDir.join(relativePath));
}
}
}
}
+
return foundImports;
}
-Future doMultitest(Path filePath, String outputDir, Path suiteDir,
- CreateTest doTest, bool hotReload) {
- void writeFile(String filepath, String content) {
- final File file = new File(filepath);
-
- if (file.existsSync()) {
- var oldContent = file.readAsStringSync();
- if (oldContent == content) {
- // Don't write to the file if the content is the same
- return;
- }
- }
- file.writeAsStringSync(content);
- }
-
- // Each new test is a single String value in the Map tests.
- Map<String, String> tests = new Map<String, String>();
- Map<String, Set<String>> outcomes = new Map<String, Set<String>>();
- ExtractTestsFromMultitest(filePath, tests, outcomes);
-
- Path sourceDir = filePath.directoryPath;
- Path targetDir = createMultitestDirectory(outputDir, suiteDir, sourceDir);
- assert(targetDir != null);
-
- // Copy all the relative imports of the multitest.
- Set<String> importsToCopy = _findAllRelativeImports(filePath);
- List<Future> futureCopies = [];
- for (String relativeImport in importsToCopy) {
- Path importPath = new Path(relativeImport);
- // Make sure the target directory exists.
- Path importDir = importPath.directoryPath;
- if (!importDir.isEmpty) {
- TestUtils.mkdirRecursive(targetDir, importDir);
- }
- // Copy file.
- futureCopies.add(TestUtils.copyFile(
- sourceDir.join(importPath), targetDir.join(importPath)));
- }
-
- // Wait until all imports are copied before scheduling test cases.
- return Future.wait(futureCopies).then((_) {
- String baseFilename = filePath.filenameWithoutExtension;
- for (String key in tests.keys) {
- final Path multitestFilename =
- targetDir.append('${baseFilename}_$key.dart');
- writeFile(multitestFilename.toNativePath(), tests[key]);
- Set<String> outcome = outcomes[key];
- bool hasStaticWarning = outcome.contains('static type warning');
- bool hasRuntimeError = outcome.contains('runtime error');
- bool hasSyntaxError = outcome.contains('syntax error');
- bool hasCompileError =
- hasSyntaxError || outcome.contains('compile-time error');
- bool isNegativeIfChecked = outcome.contains('dynamic type error');
- bool hasCompileErrorIfChecked =
- outcome.contains('checked mode compile-time error');
- if (hotReload) {
- if (hasCompileError || hasCompileErrorIfChecked) {
- // Running a test that expects a compilation error with hot reloading
- // is redundant with a regular run of the test.
- continue;
- }
- }
- doTest(multitestFilename, filePath,
- hasSyntaxError: hasSyntaxError,
- hasCompileError: hasCompileError,
- hasRuntimeError: hasRuntimeError,
- isNegativeIfChecked: isNegativeIfChecked,
- hasCompileErrorIfChecked: hasCompileErrorIfChecked,
- hasStaticWarning: hasStaticWarning,
- multitestKey: key);
- }
-
- return null;
- });
-}
-
-String suiteNameFromPath(Path suiteDir) {
+String _suiteNameFromPath(Path suiteDir) {
var split = suiteDir.segments();
+
// co19 test suite is at tests/co19/src.
- if (split.last == 'src') {
- split.removeLast();
- }
+ if (split.last == 'src') split.removeLast();
+
return split.last;
}
-Path createMultitestDirectory(String outputDir, Path suiteDir, Path sourceDir) {
- Path relative = sourceDir.relativeTo(suiteDir);
- Path path = new Path(outputDir)
+Path _createMultitestDirectory(
+ String outputDir, Path suiteDir, Path sourceDir) {
+ var relative = sourceDir.relativeTo(suiteDir);
+ var path = new Path(outputDir)
.append('generated_tests')
- .append(suiteNameFromPath(suiteDir))
+ .append(_suiteNameFromPath(suiteDir))
.join(relative);
TestUtils.mkdirRecursive(Path.workingDirectory, path);
return new Path(new File(path.toNativePath()).absolute.path);
diff --git a/tools/testing/dart/runtime_configuration.dart b/tools/testing/dart/runtime_configuration.dart
index bffb352..9f43481 100644
--- a/tools/testing/dart/runtime_configuration.dart
+++ b/tools/testing/dart/runtime_configuration.dart
@@ -225,10 +225,20 @@
String type = artifact.mimeType;
if (script != null &&
type != 'application/dart' &&
- type != 'application/dart-snapshot') {
+ type != 'application/dart-snapshot' &&
+ type != 'application/kernel-ir' &&
+ type != 'application/kernel-ir-fully-linked') {
throw "Dart VM cannot run files of type '$type'.";
}
+
String executable = suite.dartVmBinaryFileName;
+ if (type == 'application/kernel-ir-fully-linked') {
+ // We don't use the pkg/vm/tool/dart2 wrapper script for fully linked
+ // kernel files, since we don't want to pass the --dfe/--kernel-binaries
+ // flags to the VM (the vm cannot distinguish fully-linked vs
+ // not-fully-linked, see http://dartbug.com/31545)
+ executable = suite.dartVmExecutableFileName;
+ }
return [Command.vm(executable, arguments, environmentOverrides)];
}
}
diff --git a/tools/testing/dart/test_configurations.dart b/tools/testing/dart/test_configurations.dart
index 34c9527..77ac9f5 100644
--- a/tools/testing/dart/test_configurations.dart
+++ b/tools/testing/dart/test_configurations.dart
@@ -43,7 +43,6 @@
new Path('tests/language'),
new Path('tests/language_2'),
new Path('tests/lib'),
- new Path('tests/lib_strong'),
new Path('tests/lib_2'),
new Path('tests/standalone'),
new Path('tests/standalone_2'),
diff --git a/tools/testing/dart/test_runner.dart b/tools/testing/dart/test_runner.dart
index ac8b5df..2cb2950 100644
--- a/tools/testing/dart/test_runner.dart
+++ b/tools/testing/dart/test_runner.dart
@@ -790,6 +790,7 @@
bool _dictEquals(Map a, Map b) {
if (a == null) return b == null;
if (b == null) return false;
+ if (a.length != b.length) return false;
for (var key in a.keys) {
if (a[key] != b[key]) return false;
}
diff --git a/tools/testing/dart/test_suite.dart b/tools/testing/dart/test_suite.dart
index 0b9cb56..6d71dc0 100644
--- a/tools/testing/dart/test_suite.dart
+++ b/tools/testing/dart/test_suite.dart
@@ -128,8 +128,12 @@
TestSuite(this.configuration, this.suiteName, this.statusFilePaths) {
_environmentOverrides = {
- 'DART_CONFIGURATION': configuration.configurationDirectory
+ 'DART_CONFIGURATION': configuration.configurationDirectory,
};
+
+ if (useSdk && configuration.usingDart2VMWrapper) {
+ _environmentOverrides['DART_USE_SDK'] = '1';
+ }
}
Map<String, String> get environmentOverrides => _environmentOverrides;
@@ -173,16 +177,19 @@
}
if (dartExecutable == null) {
- var suffix = executableBinarySuffix;
- dartExecutable = useSdk
- ? '$buildDir/dart-sdk/bin/dart$suffix'
- : '$buildDir/dart$suffix';
+ dartExecutable = dartVmExecutableFileName;
}
TestUtils.ensureExists(dartExecutable, configuration);
return dartExecutable;
}
+ String get dartVmExecutableFileName {
+ return useSdk
+ ? '$buildDir/dart-sdk/bin/dart$executableBinarySuffix'
+ : '$buildDir/dart$executableBinarySuffix';
+ }
+
/// Returns the name of the flutter engine executable.
String get flutterEngineBinaryFileName {
// Controlled by user with the option "--flutter".
@@ -269,12 +276,14 @@
[TestInformation info]) {
var displayName = '$suiteName/$testName';
- // If the test is not going to be run at all, then a RuntimeError will
- // never occur. Instead, treat that as Pass.
- if (configuration.runtime == Runtime.none &&
- expectations.contains(Expectation.runtimeError)) {
+ // If the test is not going to be run at all, then a RuntimeError,
+ // MissingRuntimeError or Timeout will never occur.
+ // Instead, treat that as Pass.
+ if (configuration.runtime == Runtime.none) {
expectations = expectations.toSet();
expectations.remove(Expectation.runtimeError);
+ expectations.remove(Expectation.missingRuntimeError);
+ expectations.remove(Expectation.timeout);
if (expectations.isEmpty) expectations.add(Expectation.pass);
}
@@ -873,7 +882,9 @@
commands.addAll(compilationArtifact.commands);
}
- if (expectCompileError(info) && compilerConfiguration.hasCompiler) {
+ if (expectCompileError(info) &&
+ compilerConfiguration.hasCompiler &&
+ !compilerConfiguration.runRuntimeDespiteMissingCompileTimeError) {
// Do not attempt to run the compiled result. A compilation
// error should be reported by the compilation command.
return commands;
@@ -1037,8 +1048,11 @@
case Compiler.dartdevk:
var toPath =
new Path('$compilationTempDir/$nameNoExt.js').toNativePath();
- commands.add(configuration.compilerConfiguration.createCommand(fileName,
- toPath, optionsFromFile["sharedOptions"] as List<String>));
+ commands.add(configuration.compilerConfiguration.createCommand(
+ fileName,
+ toPath,
+ optionsFromFile["sharedOptions"] as List<String>,
+ environmentOverrides));
break;
default:
@@ -1062,7 +1076,8 @@
commands.add(configuration.compilerConfiguration.createCommand(
fromPath.toNativePath(),
toPath,
- optionsFromFile["sharedOptions"] as List<String>));
+ optionsFromFile["sharedOptions"] as List<String>,
+ environmentOverrides));
break;
}
}
diff --git a/utils/dartdevc/BUILD.gn b/utils/dartdevc/BUILD.gn
index 6a91fb1..7a9cf2f 100644
--- a/utils/dartdevc/BUILD.gn
+++ b/utils/dartdevc/BUILD.gn
@@ -47,7 +47,9 @@
training_args = [
"--dart-sdk-summary",
rebase_path(sdk_dill),
- "--help",
+ "-o",
+ "dartdevk.js",
+ rebase_path("../../pkg/dev_compiler/test/codegen/sunflower/sunflower.dart"),
]
deps = [
@@ -217,7 +219,7 @@
]
}
- args = [
+ args += [
"--quiet",
rebase_path("../../pkg/dev_compiler/tool/build_sdk.dart"),
"--dart-sdk",
diff --git a/utils/dartdevk/BUILD.gn b/utils/dartdevk/BUILD.gn
deleted file mode 100644
index 43d904c..0000000
--- a/utils/dartdevk/BUILD.gn
+++ /dev/null
@@ -1,318 +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("../../build/prebuilt_dart_sdk.gni")
-import("../application_snapshot.gni")
-import("../create_timestamp.gni")
-
-patched_sdk_dir = "$target_gen_dir/patched_sdk"
-sdk_summary = "$target_gen_dir/ddc_sdk.sum"
-dart_root = rebase_path("../..")
-
-sdk_lib_files = exec_script("../../tools/list_dart_files.py",
- [
- "absolute",
- rebase_path("../../sdk/lib"),
- ],
- "list lines")
-
-compiler_files = exec_script("../../tools/list_dart_files.py",
- [
- "absolute",
- rebase_path("../../pkg/compiler"),
- ],
- "list lines")
-
-dev_compiler_files = exec_script("../../tools/list_dart_files.py",
- [
- "absolute",
- rebase_path("../../pkg/dev_compiler"),
- ],
- "list lines")
-
-template("dart2js_compile") {
- assert(defined(invoker.main), "Must specify the main file")
- main = invoker.main
- assert(defined(invoker.out), "Must specify the out file")
- out = invoker.out
- abs_main = rebase_path(main)
- abs_output = rebase_path(out)
-
- compiled_action(target_name) {
- tool = "../../runtime/bin:dart"
- inputs = sdk_lib_files + compiler_files + dev_compiler_files
- outputs = [
- out,
- ]
-
- dot_packages = rebase_path("../../.packages")
- compiler = rebase_path("../../pkg/compiler/lib/src/dart2js.dart")
-
- args = [
- "--packages=$dot_packages",
- compiler,
- "--packages=$dot_packages",
- "$abs_main",
- "-m",
- "-o$abs_output",
- ]
- }
-}
-
-dart2js_compile("dartdevk_web") {
- main = rebase_path("../../pkg/dev_compiler/web/main.dart")
- out = "$root_out_dir/dev_compiler/build/web/ddk_web_compiler.js"
-}
-
-#dart2js_compile("stack_trace_mapper") {
-# main = rebase_path("../../pkg/dev_compiler/web/stack_trace_mapper.dart")
-# out = "$root_out_dir/dev_compiler/build/web/dart_stack_trace_mapper.js"
-#}
-
-# Apply dev_compiler's patch files to create the Dart version of the dartdevk
-# SDK.
-action("dartdevk_patch_sdk") {
- # TODO(rnystrom): Unfork DDC's patch_sdk.dart script with the
- # tools/patch_sdk.dart and then change this to use generate_patch_sdk().
- deps = [
- ":dartdevk_files_stamp",
-
- # The patch script uses several packages, including analyzer, so consider
- # it dirty if any of those change.
- "../../pkg:pkg_files_stamp",
- ]
-
- if (!prebuilt_dart_exe_works) {
- deps += [ "$dart_root/runtime/bin:dart_bootstrap($dart_host_toolchain)" ]
- }
-
- script = "../../tools/patch_sdk.py"
-
- # We list the `patch_sdk.dart` tool here because the [script] (which is
- # implicitly an input) will call it.
- inputs = [
- "../../pkg/dev_compiler/tool/patch_sdk.dart",
- ]
-
- # The main SDK library sources.
- inputs += sdk_lib_files
-
- # dev_compiler's additional sources and patch files.
- inputs += exec_script("../../tools/list_dart_files.py",
- [
- "absolute",
- rebase_path("../../pkg/dev_compiler/tool/input_sdk"),
- ],
- "list lines")
-
- # Arbitrarily use the version file as a token file to check against to see if
- # the sources have changed.
- # TODO(rnystrom): List the outputs more precisely?
- outputs = [
- "$patched_sdk_dir/version",
- ]
-
- args = []
- if (!prebuilt_dart_exe_works) {
- dart_out_dir = get_label_info(
- "$dart_root/runtime/bin:dart_bootstrap($dart_host_toolchain)",
- "root_out_dir")
- dart_bootstrap =
- rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix")
- args += [
- "--dart-executable",
- dart_bootstrap,
- ]
- }
-
- args += [
- "--script",
- rebase_path("../../pkg/dev_compiler/tool/patch_sdk.dart"),
- rebase_path("../../"),
- rebase_path("../../pkg/dev_compiler/tool/input_sdk"),
- rebase_path(patched_sdk_dir),
- ]
-}
-
-# Compiles the Dart core libraries and DDC runtime to an analyzer summary and
-# JS.
-action("dartdevk_sdk") {
- deps = [
- ":dartdevk_files_stamp",
- ":dartdevk_patch_sdk",
- "../../pkg:pkg_files_stamp",
- ]
-
- if (!prebuilt_dart_exe_works) {
- deps += [ "$dart_root/runtime/bin:dart_bootstrap($dart_host_toolchain)" ]
- }
-
- script = "../../tools/run_dart.py"
-
- args = []
- if (!prebuilt_dart_exe_works) {
- dart_out_dir = get_label_info(
- "$dart_root/runtime/bin:dart_bootstrap($dart_host_toolchain)",
- "root_out_dir")
- dart_bootstrap =
- rebase_path("$dart_out_dir/dart_bootstrap$executable_suffix")
- args += [
- "--dart",
- dart_bootstrap,
- ]
- }
-
- args = [
- "--quiet",
- rebase_path("../../pkg/dev_compiler/tool/build_sdk.dart"),
- "--dart-sdk-summary=build",
- "--summary-out",
- rebase_path(sdk_summary),
- "--source-map",
- "--source-map-comment",
- "--inline-source-map",
- "--modules=amd",
- "-o",
- rebase_path("$target_gen_dir/js/amd/dart_sdk.js"),
- "--modules=es6",
- "-o",
- rebase_path("$target_gen_dir/js/es6/dart_sdk.js"),
- "--modules=common",
- "-o",
- rebase_path("$target_gen_dir/js/common/dart_sdk.js"),
- "--modules=legacy",
- "-o",
- rebase_path("$target_gen_dir/js/legacy/dart_sdk.js"),
- ]
-
- inputs = [
- "../../pkg/dev_compiler/tool/build_sdk.dart",
-
- # Since the entire patched SDK is built in one step, if any file changes,
- # they all will. Instead of listing them all as outputs of
- # dartdevk_patch_sdk (which would require something like a depfile), just
- # use version as the token file whose timestamp we track.
- # TODO(rnystrom): Do something better?
- "$patched_sdk_dir/version",
-
- # If dev_compiler itself changes, it can affect the generated SDK.
- "$target_gen_dir/dartdevk_files.stamp",
-
- # Likewise, the packages dev_compiler depends on may affect its output.
- "$root_gen_dir/pkg_files.stamp",
- ]
-
- outputs = [
- sdk_summary,
- "$target_gen_dir/js/amd/dart_sdk.js",
- "$target_gen_dir/js/amd/dart_sdk.js.map",
- "$target_gen_dir/js/common/dart_sdk.js",
- "$target_gen_dir/js/common/dart_sdk.js.map",
- "$target_gen_dir/js/es6/dart_sdk.js",
- "$target_gen_dir/js/es6/dart_sdk.js.map",
- "$target_gen_dir/js/legacy/dart_sdk.js",
- "$target_gen_dir/js/legacy/dart_sdk.js.map",
- ]
-}
-
-# Builds everything needed to run dartdevk and dartdevk tests using test.dart.
-group("dartdevk_test") {
- deps = [
- ":dartdevk",
- ":dartdevk_sdk",
- ":dartdevk_sdk_kernel_summary",
- ":dartdevk_test_pkg",
- "../../sdk:create_sdk",
- ]
-}
-
-create_timestamp_file("dartdevk_files_stamp") {
- path = rebase_path("../../pkg/dev_compiler/lib")
- output = "$target_gen_dir/dartdevk_files.stamp"
-}
-
-# Compiles the packages used by the tests to JS with dartdevk so that they are
-# available for loading by the tests.
-compiled_action("dartdevk_test_pkg") {
- tool = "../../runtime/bin:dart"
-
- deps = [
- ":dartdevk_files_stamp",
- ":dartdevk_sdk",
- ":dartdevk_sdk_kernel_summary",
- "../../pkg:pkg_files_stamp",
- ]
-
- inputs = [
- "$target_gen_dir/ddc_sdk.dill",
- sdk_summary,
- "$target_gen_dir/dartdevk_files.stamp",
- "$root_gen_dir/pkg_files.stamp",
- ]
-
- outputs = [
- "$target_gen_dir/pkg/async_helper.dill",
- "$target_gen_dir/pkg/async_helper.js",
- "$target_gen_dir/pkg/async_helper.sum",
- "$target_gen_dir/pkg/collection.dill",
- "$target_gen_dir/pkg/collection.js",
- "$target_gen_dir/pkg/collection.sum",
- "$target_gen_dir/pkg/expect.dill",
- "$target_gen_dir/pkg/expect.js",
- "$target_gen_dir/pkg/expect.sum",
- "$target_gen_dir/pkg/js.dill",
- "$target_gen_dir/pkg/js.js",
- "$target_gen_dir/pkg/js.sum",
- "$target_gen_dir/pkg/matcher.dill",
- "$target_gen_dir/pkg/matcher.js",
- "$target_gen_dir/pkg/matcher.sum",
- "$target_gen_dir/pkg/meta.dill",
- "$target_gen_dir/pkg/meta.js",
- "$target_gen_dir/pkg/meta.sum",
- "$target_gen_dir/pkg/path.dill",
- "$target_gen_dir/pkg/path.js",
- "$target_gen_dir/pkg/path.sum",
- "$target_gen_dir/pkg/stack_trace.dill",
- "$target_gen_dir/pkg/stack_trace.js",
- "$target_gen_dir/pkg/stack_trace.sum",
-
- # TODO(rnystrom): Remove this when unittest is no longer used. Also remove
- # any of the above packages that are only here because unittest uses them.
- "$target_gen_dir/pkg/unittest.dill",
- "$target_gen_dir/pkg/unittest.js",
- "$target_gen_dir/pkg/unittest.sum",
- ]
-
- args = [
- rebase_path("../../pkg/dev_compiler/tool/build_pkgs.dart"),
- "--analyzer-sdk",
- rebase_path(sdk_summary),
- "--kernel-sdk",
- rebase_path("$target_gen_dir/ddc_sdk.dill"),
- "--output",
- rebase_path("$target_gen_dir"),
- ]
-}
-
-# Compiles the DDC SDK's kernel summary.
-compiled_action("dartdevk_sdk_kernel_summary") {
- tool = "../../runtime/bin:dart"
-
- deps = [
- ":dartdevk_files_stamp",
- ]
-
- inputs = [
- "$target_gen_dir/dartdevk_files.stamp",
- ]
-
- outputs = [
- "$target_gen_dir/ddc_sdk.dill",
- ]
-
- args = [
- rebase_path("../../pkg/dev_compiler/tool/kernel_sdk.dart"),
- rebase_path("$target_gen_dir/ddc_sdk.dill"),
- ]
-}